Chaining Remote and Local MCP Servers into a Single Agent Workflow
MCP’s transport abstraction means an Agent can mix local tools, remote APIs, and npm-published servers without glue code. A developer who understands the `url` vs `command + args` split can assemble multi-tool workflows in a single configuration file, turning the LLM into an orchestrator rather than a chatbot.
MCP’s protocol stays identical whether the transport is stdio or HTTP; only the connection method changes. A `MultiServerMCPClient` can manage a remote Amap maps server via a URL alongside locally spawned filesystem and Chrome DevTools servers, all configured in one object. `getTools()` fetches every tool at once, and a standard ReAct loop lets the LLM decide which to call.
The Agent chains `maps_geo`, `maps_around_search`, and `maps_search_detail` to find nearby hotels, then uses the Chrome DevTools server to open each image in a browser tab and rewrite the page titles. The filesystem server writes any results to disk, constrained to a single allowed directory for security.
Common failure modes include API rate limiting on free map keys, LLM-generated parameter formats that violate API schemas, and hallucinated Linux paths that trip the filesystem server’s directory allowlist. A `SystemMessage` that declares the working directory and parameter constraints prevents most of these.
Transport independence is MCP’s quiet superpower: the same ReAct loop drives a local script, a cloud API, and a browser controller without any adapter layer.
Security in the filesystem server is path-based and enforced server-side, which means the Agent cannot escalate its own privileges even if the LLM is tricked.
The four-case return-value normalizer is a microcosm of MCP’s current maturity — the protocol standard exists, but real-world server implementations still diverge enough to require defensive parsing.
Rate limiting becomes a first-class Agent design concern when a single user prompt can trigger eight parallel API calls; prompt-level batching instructions are a cheap fix but fragile.