Feature1.4.0a3
langchain 1.4.0a3 — MCP server integration
Third alpha of 1.4.0 introduces the langchain.mcp namespace for adapting Model Context Protocol servers into LangChain tools. MCPAdapter accepts URLs, local scripts, in-process servers, or pre-built clients and includes tool discovery with optional response caching and human-in-the-loop support via LangGraph interrupts.
Third alpha of the 1.4.0 line. This release focuses on the new langchain.mcp namespace for adapting MCP servers into LangChain tools.
langchain.mcp highlights
MCPAdapteradapts any targetfastmcp.Clientaccepts — a URL, a local script, an in-process server, anMCPConfignaming several servers, or a pre-built client — as well as a FastMCPClientGroupfor a fleet of servers behind one client.MCPAdapter.list_tools(*, cache_mode="use")discovers and adapts tools, with optional client-side response caching (SEP-2549):useserves a cached list within the server's TTL hint,refreshrepopulates it,bypassskips it.as_langchain_tool(tool, client, *, elicitation=None)converts a single MCP tool for callers managing their own client.- Tool metadata is grouped under an
mcpnamespace on each tool: the tool'sannotations(snake_case) and_metaundermetadata["mcp"]["tool"], and the serving server's identity undermetadata["mcp"]["server"]. elicitation="interrupt"surfaces a server's mid-call questions as LangGraph interrupts, so a human answers and the run resumes.
from langchain.agents import create_agent from langchain.mcp import MCPAdapter async with MCPAdapter("https://example.com/mcp") as adapter: agent = create_agent("anthropic:claude-sonnet-5", await adapter.list_tools())
Requires the mcp extra: pip install "langchain[mcp]" (and fastmcp>=4.0.0).
Install
pip install --pre "langchain==1.4.0a3"
This is a pre-release; install with --pre.
Release notes curated with the assistance of an AI agent.
mcptoolsintegrationagentscaching
Source: original entry ↗