Privileged issue
Issue Content
Hey folks! We're excited to share that we're rolling support for the new MCP spec with a primitive in langchain.mcp! We used to support MCP in langchain via a package called langchain-mcp-adapters. Given how popular MCP has become, we figured it was time to support this in core langchain!
The new primitive we're introducing is called MCPAdapter. It can wrap server specs or a custom-rolled FastMCP client (including a ClientGroup for a fleet of servers). You can use this to build langchain-style tools from MCP tools!
Also particularly exciting, with the new spec, we can now support "elicitation" via LangChain's interrupt primitive. Full release notes can be found here: https://github.com/langchain-ai/langchain/releases/tag/langchain%3D%3D1.4.0a3
We've released an alpha version langchain==1.4.0a3 where you can test this out:
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())
result = await agent.ainvoke({"messages": [{"role": "user", "content": "..."}]})
Install with the mcp extra (it's a pre-release, so --pre):
pip install --pre "langchain[mcp]==1.4.0a3"
A few things landed since the first alphas, worth calling out:
MCPAdapter.list_tools() replaces the earlier get_tools(), matching the MCP client APIs. It takes cache_mode for client-side response caching (SEP-2549).
- Single-tool conversion is
as_langchain_tool(tool, client) (was convert_mcp_tool_to_langchain_tool).
- Tool metadata is grouped under an
mcp namespace: the tool's annotations and _meta under metadata["mcp"]["tool"], and the serving server's identity under metadata["mcp"]["server"].
We're planning on releasing this new primitive in beta soon. We'd love to get feedback in the meantime. Take MCPAdapter for a spin and let us know — do you like the devx? Wdyt about the new elicitation support? Are the auth flows you use working well w/ FastMCP?
Privileged issue
Issue Content
Hey folks! We're excited to share that we're rolling support for the new MCP spec with a primitive in
langchain.mcp! We used to support MCP in langchain via a package calledlangchain-mcp-adapters. Given how popular MCP has become, we figured it was time to support this in core langchain!The new primitive we're introducing is called
MCPAdapter. It can wrap server specs or a custom-rolledFastMCPclient (including aClientGroupfor a fleet of servers). You can use this to build langchain-style tools from MCP tools!Also particularly exciting, with the new spec, we can now support "elicitation" via LangChain's
interruptprimitive. Full release notes can be found here: https://github.com/langchain-ai/langchain/releases/tag/langchain%3D%3D1.4.0a3We've released an alpha version
langchain==1.4.0a3where you can test this out:Install with the
mcpextra (it's a pre-release, so--pre):pip install --pre "langchain[mcp]==1.4.0a3"A few things landed since the first alphas, worth calling out:
MCPAdapter.list_tools()replaces the earlierget_tools(), matching the MCP client APIs. It takescache_modefor client-side response caching (SEP-2549).as_langchain_tool(tool, client)(wasconvert_mcp_tool_to_langchain_tool).mcpnamespace: the tool'sannotationsand_metaundermetadata["mcp"]["tool"], and the serving server's identity undermetadata["mcp"]["server"].We're planning on releasing this new primitive in beta soon. We'd love to get feedback in the meantime. Take
MCPAdapterfor a spin and let us know — do you like the devx? Wdyt about the new elicitation support? Are the auth flows you use working well w/FastMCP?