This repository provides a lightweight wrapper for using Anthropic Model Context Protocol (MCP) tools with LangChain and LangGraph, enabling the creation of agents that can access and utilize MCP-defined functionalities.
This library provides a lightweight wrapper to integrate Anthropic Model Context Protocol (MCP) tools with LangChain and LangGraph.

pip install langchain-mcp-adaptersThe library facilitates the creation of MCP servers with tools (e.g., add, multiply in math_server.py) and their integration into LangGraph agents. The client connects to these servers using stdio_client and ClientSession, loads the tools using load_mcp_tools, and then uses them within a LangGraph agent created with create_react_agent.
The library supports connecting to multiple MCP servers, demonstrated with math_server.py and weather_server.py. The MultiServerMCPClient manages connections to different servers (e.g., via stdio and SSE), retrieves tools, and integrates them into a LangGraph agent.
To run a LangGraph agent with MCP tools in a LangGraph API server, define a make_graph function that initializes the MultiServerMCPClient and creates the agent. Configure the langgraph.json file to specify make_graph as the graph entrypoint.
langchain-ai/langchain-mcp-adapters
February 7, 2025
March 28, 2025
Python