代理框架
LangChain 1.4 Brings MCP into the Core Package with Support for Stateless Protocols, Tool List Caching, and Mid-Execution Elicitation
The new `langchain.mcp` uses FastMCP to unify connections, authentication, and protocol negotiation, replacing the standalone adapter package. Servers can request additional information or approval during tool execution, while LangChain maps the pause point to a resumable LangGraph interrupt.

Following the release of the LangChain 1.4 series, MCP clients no longer primarily rely on the standalone `langchain-mcp-adapters` package. Instead, they are provided through the beta `langchain.mcp` namespace in the core package. `MCPAdapter` can accept an HTTP URL, a local stdio process, an in-memory server, a multi-server configuration, or a FastMCP `ClientGroup`, then convert discovered tools into standard LangChain tools for use with `create_agent`, Deep Agents, or custom graphs.
The key architectural change is the move to FastMCP 4 underneath. It handles streamable HTTP, stdio, OAuth 2.1, bearer tokens, connection pooling, and protocol negotiation, allowing legacy handshake/session servers to coexist with servers that adopt the stateless core of MCP `2026-07-28`. When using `ClientGroup`, each backend can negotiate its supported protocol version and credentials independently. If new and legacy servers are mixed in a single legacy configuration, however, the oldest backend may still prevent the entire connection group from using capabilities available only in newer versions.
The new release also adds two features with practical implications for agent execution. First, servers can provide a TTL for their tool lists, while clients can use `cache_mode` to use, refresh, or bypass the cache, reducing the latency caused by fetching the catalog again before every agent run. Second, MCP elicitation can pause execution when a tool is missing parameters or requires confirmation for an action such as deletion. LangChain converts this into a LangGraph interrupt, writes the state to a checkpointer, and retries the call after receiving a human response, without needing to keep the same connection open for an extended period.
Migration involves more than changing an import: `MultiServerMCPClient` has been consolidated into `MCPAdapter`, while the tool-listing API, metadata structure, and elicitation flow have all changed. Installation also requires `langchain[mcp]>=1.4.0` and FastMCP 4. At present, only the Python version is available, and the interface is marked beta. Engineering teams should pay particular attention to testing negotiation with legacy servers, cache invalidation, process restarts after a pause, and whether server prefixes added to identically named tools break existing prompts or policies.