LangChain MCP Adapters

v1.0.0โ€ขDeveloper Toolsโ€ขstable

LangChain ๐Ÿ”Œ MCP

langchainlanggraphmcppythontools
Share:
3,535
Stars
0
Downloads
0
Weekly
0/5

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

Integrate MCP tools with LangChain and LangGraph workflows.
Use MCPs as Python-based tools within LangChain agents.
langchain-ai

Maintainer

LicenseMIT
Languagepython
Versionv1.0.0
UpdatedMay 22, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx langchain-mcp-adapters

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

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
1

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]"
2

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-key
3

Connect 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 objects
4

Create 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?"}]})
5

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.

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.

Quick Config Preview

{ "mcpServers": { "langchain-mcp-adapters": { "command": "npx", "args": ["-y", "langchain-mcp-adapters"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide โ†’

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.

33,000+ ServersFree & Open SourceStep-by-Step Guides