MCP: Connect Any Tool
When MCP earns its overhead over inline tools, how to connect local and remote servers in LangChain, how to build your own server with FastMCP, and the four failure modes that trip up production deployments.
Quick Reference
- →MCP is an open protocol that standardizes how agents connect to tools, resources, and prompts via a single interface
- →Use MCP when a tool is shared across multiple agents or clients; use @tool for single-agent in-process logic
- →Connect servers via MultiServerMCPClient — tools from all servers merge into a single BaseTool list
- →Set tool_name_prefix=True when connecting multiple servers to prevent silent tool name overwrites
- →HTTP+SSE transport is deprecated (MCP spec 2025-03-26) — use Streamable HTTP for all new remote servers
- →FastMCP exposes any Python function as an MCP tool with a single @mcp.tool() decorator
- →Build the server once; use it from LangChain, Claude Desktop, Cursor, and VS Code Copilot without modification
When to Use MCP (and When Not To)
MCP adds a transport layer between your agent and its tools. That layer enables sharing, isolation, and cross-cutting logic — but it has a real cost. Before building an MCP server, verify that cost is worth paying.
MCP adds ~10–50ms per call — only justified when sharing, isolation, or interceptors are needed
| Criterion | MCP server | @tool decorator |
|---|---|---|
| Clients | Any MCP-compatible client (LangChain, Claude Desktop, Cursor, cron jobs) | One LangChain/LangGraph agent only |
| Call overhead | stdio: subprocess IPC per call; Streamable HTTP: full HTTP round trip | None — in-process function call |
| Process isolation | Yes — subprocess or remote service | No — runs in-process with the agent |
| Interceptors | Auth, retry, rate-limiting via tool_interceptors | Manual wrapper per tool |
| State/Store access | Cannot read LangGraph State or Store directly | Direct access |
| Best for | Shared internal APIs, third-party services, multi-client tools | Agent-specific logic, State-aware tools |
If only one agent uses a tool and it doesn't need process isolation, @tool is faster and simpler. If the same tool will serve two or more agents, clients, or teams — build the MCP server. The setup cost pays off quickly when the tool has more than one consumer.