Integrating Agents with MCP: MCP For LangChain Agents
91%
Connecting MCP to LangChain
LangChain does not understand MCP natively, but the official langchain-mcp-adapters package bridges the gap. It converts MCP tools into LangChain BaseTool instances so they can be passed directly to create_agent or any other LangChain component.
The adapter's main class is MultiServerMCPClient. You give it a dictionary of server connections and it takes care of establishing sessions, converting schemas, and routing tool calls.
from langchain_mcp_adapters.client import MultiServerMCPClient
client = MultiServerMCPClient(
{
# STDIO server: started as a subprocess
"netflix": {
"command": "python",
"args": ["server/main.py"],
"transport": "stdio",
},
# HTTP server: already running, connect by URL
"netflix_http": {Practical MCP with FastMCP & LangChain
Engineering the Agentic ExperienceEnroll now to unlock all content and receive all future updates for free.
