LangChain MCP Adapters
LangChain ๐ MCP
What is LangChain MCP Adapters?
LangChain MCP Adapters is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to langchain ๐ mcp
LangChain ๐ MCP
This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- LangChain ๐ MCP
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx langchain-mcp-adaptersConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use LangChain MCP Adapters
LangChain MCP Adapters is a Python library that makes MCP tool servers consumable as native LangChain tools, enabling LangGraph agents and LangChain chains to call any MCP server's tools without custom integration code. It supports connecting to MCP servers over stdio, HTTP, SSE, and streamable_http transports, and can aggregate tools from multiple MCP servers into a single tool list via the MultiServerMCPClient. Python developers building LangGraph agents use it to instantly access the entire ecosystem of MCP servers as structured tools compatible with any LangChain-supported model.
Prerequisites
- Python 3.10 or later installed
- pip or uv for package installation
- An OpenAI, Anthropic, or other LangChain-supported model API key
- At least one MCP server to connect to (stdio-based or HTTP-based)
- LangGraph installed alongside the adapters for agent workflows
Install langchain-mcp-adapters and dependencies
Install the core adapter library along with LangGraph and your model provider's LangChain integration package.
pip install langchain-mcp-adapters langgraph "langchain[openai]"Set your model provider API key
Export your API key as an environment variable. The example below uses OpenAI; substitute ANTHROPIC_API_KEY and the appropriate LangChain package for Anthropic.
export OPENAI_API_KEY=your-openai-api-keyConnect to a single MCP server and load tools
Use the stdio client to connect to a local MCP server process, then load its tools as LangChain-compatible tool objects.
from langchain_mcp_adapters.client import MCPClient
from mcp import StdioServerParameters
async with MCPClient(StdioServerParameters(
command="uvx",
args=["mcp-server-math"]
)) as session:
tools = await session.get_tools()
# tools is a list of LangChain BaseTool objectsCreate a LangGraph agent with MCP tools
Pass the loaded tools to create_react_agent from LangGraph to build a fully functional agent that can call MCP server tools.
from langgraph.prebuilt import create_react_agent
from langchain_openai import ChatOpenAI
model = ChatOpenAI(model="gpt-4.1")
agent = create_react_agent(model, tools)
result = await agent.ainvoke({"messages": [{"role": "user", "content": "what's (3 + 5) x 12?"}]})Connect to multiple MCP servers simultaneously
Use MultiServerMCPClient to aggregate tools from several MCP servers at once. Each entry in the dict defines a server's transport configuration.
from langchain_mcp_adapters.client import MultiServerMCPClient
client = MultiServerMCPClient({
"math": {
"command": "uvx",
"args": ["mcp-server-math"],
"transport": "stdio"
},
"weather": {
"url": "http://localhost:8000/mcp",
"transport": "streamable_http",
"headers": {"Authorization": "Bearer YOUR_TOKEN"}
}
})
tools = await client.get_tools()LangChain MCP Adapters Examples
Full LangGraph agent with multiple MCP servers
Complete example showing MultiServerMCPClient connecting to both a stdio MCP server and an HTTP MCP server, with tools passed to a LangGraph ReAct agent.
{
"note": "langchain-mcp-adapters is a Python library, not an MCP server itself.",
"usage": "import in Python; no mcpServers config entry needed",
"example_code": "from langchain_mcp_adapters.client import MultiServerMCPClient\nfrom langgraph.prebuilt import create_react_agent\nfrom langchain_openai import ChatOpenAI\n\nclient = MultiServerMCPClient({\n 'math': {'command': 'uvx', 'args': ['mcp-server-math'], 'transport': 'stdio'}\n})\ntools = await client.get_tools()\nagent = create_react_agent(ChatOpenAI(model='gpt-4.1'), tools)"
}Prompts to try with a LangGraph agent
Once you have a LangGraph agent built with MCP tools via the adapters, invoke it with queries that exercise the connected server's capabilities.
- "what's (3 + 5) x 12?" (math MCP server tool)
- "what is the weather in NYC?" (weather MCP server tool)
- "Add 847 and 293, then multiply the result by 7" (chained math tool calls)
- "Search for files matching *.py in the current directory" (filesystem MCP server)
- "Read the contents of README.md and summarize it" (filesystem MCP server)Troubleshooting LangChain MCP Adapters
ImportError when importing from langchain_mcp_adapters
Ensure you installed the correct package: pip install langchain-mcp-adapters (with hyphens). The import uses underscores: from langchain_mcp_adapters.client import MCPClient. Also verify langchain and langgraph are installed.
MCP server subprocess fails to start in stdio transport
Verify the command and args in your server config are correct and that the MCP server package is installed. Test the command directly in your terminal: uvx mcp-server-math. Ensure the executable is on the PATH that Python resolves.
HTTP transport returns connection refused or 401 errors
For streamable_http or sse transport, ensure the MCP server is running and accessible at the specified URL. For authenticated servers, pass credentials in the headers field: {'Authorization': 'Bearer YOUR_TOKEN'}. Check that handle_tool_errors is set to True to get readable error messages instead of exceptions.
Frequently Asked Questions about LangChain MCP Adapters
What is LangChain MCP Adapters?
LangChain MCP Adapters is a Model Context Protocol (MCP) server that langchain ๐ mcp It connects AI assistants to external tools and data sources through a standardized interface.
How do I install LangChain MCP Adapters?
Follow the installation instructions on the LangChain MCP Adapters GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with LangChain MCP Adapters?
LangChain MCP Adapters works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is LangChain MCP Adapters free to use?
Yes, LangChain MCP Adapters is open source and available under the MIT license. You can use it freely in both personal and commercial projects.
LangChain MCP Adapters Alternatives โ Similar Developer Tools Servers
Looking for alternatives to LangChain MCP Adapters? Here are other popular developer tools servers you can use with Claude, Cursor, and VS Code.
Ecc
โ 188.2kThe agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Javaguide
โ 155.8kJava ้ข่ฏ & ๅ็ซฏ้็จ้ข่ฏๆๅ๏ผ่ฆ็่ฎก็ฎๆบๅบ็กใๆฐๆฎๅบใๅๅธๅผใ้ซๅนถๅใ็ณป็ป่ฎพ่ฎกไธ AI ๅบ็จๅผๅ
Gemini CLI
โ 104.5kA secure MCP server that wraps the Google Gemini CLI, allowing clients to query Gemini models using local OAuth sessions without requiring an API key. It provides tools for model interaction and diagnostics with built-in protection against command in
Awesome MCP Servers
โ 87.3kโญ Curated list of Model Context Protocol (MCP) servers - tools that extend Claude Desktop, Cursor, Windsurf, and other MCP clients with custom capabilities.
MCP Servers
โ 86.0kModel Context Protocol Servers
CC Switch
โ 77.5kA cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Gemini CLI & Hermes Agent. Only official website: ccswitch.io
Browse More Developer Tools MCP Servers
Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up LangChain MCP Adapters in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use LangChain MCP Adapters?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.