Overview
langchain-mcp is a tool that provides support for the Model Context Protocol (MCP) within the LangChain framework, enabling seamless interactions with various tools defined under the MCP.
To use langchain-mcp, create an instance of langchain_mcp.MCPToolkit with an mcp.ClientSession. After that, run await toolkit.initialize() to set it up and toolkit.get_tools() to retrieve a list of available tools.
- Integration with the Model Context Protocol for enhanced tool support - Initialization and retrieval of tools through a simple API - Ability to run demos against external services like Groq
- Facilitating tool interactions in data processing workflows.
- Using the MCP for model training and real-time data summarization.
- Running specialized demos for understanding file content.
Add to your AI client
Use these steps to connect langchain-mcp in Cursor, Claude, VS Code, and other MCP-compatible apps. The same JSON appears in the Use with menu above for one-click copy.
Cursor
Add this to your .cursor/mcp.json file in your project root, then restart Cursor.
.cursor/mcp.json
{
"mcpServers": {
"langchain-mcp-rectalogic": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-langchain-mcp-rectalogic"
]
}
}
}Claude Desktop
Add this server entry to the mcpServers object in your Claude Desktop config, then restart the app.
~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
{
"mcpServers": {
"langchain-mcp-rectalogic": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-langchain-mcp-rectalogic"
]
}
}
}Claude Code
Add this to your project's .mcp.json file. Claude Code will detect it automatically.
.mcp.json (project root)
{
"mcpServers": {
"langchain-mcp-rectalogic": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-langchain-mcp-rectalogic"
]
}
}
}VS Code (Copilot)
Add this to your .vscode/mcp.json file. Requires the GitHub Copilot extension with MCP support enabled.
.vscode/mcp.json
{
"servers": {
"langchain-mcp-rectalogic": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-langchain-mcp-rectalogic"
]
}
}
}Windsurf
Add this to your Windsurf MCP config file, then restart Windsurf.
~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"langchain-mcp-rectalogic": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-langchain-mcp-rectalogic"
]
}
}
}Cline
Open Cline settings, navigate to MCP Servers, and add this server configuration.
Cline MCP Settings (via UI)
{
"mcpServers": {
"langchain-mcp-rectalogic": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-langchain-mcp-rectalogic"
]
}
}
}FAQ
What is the Model Context Protocol?
The Model Context Protocol is a specification that allows models to interact with various tools through defined interfaces for improved functionality.
Can I use langchain-mcp with any programming language?
langchain-mcp is designed to be used with Python and specifically integrates into the LangChain framework.
Is there a demo available?
Yes! A demo can be run using `tests/demo.py`, which showcases how to read and summarize files using the MCP.7:["$","div",null,{"className":"container mx-auto flex flex-col gap-4","children":["$L26","$L27",["$","$L28",null,{"currentProject":{"id":188,"uuid":"84d4665f-33c7-4fa1-a31d-c6292da31e72","name":"langchain-mcp","title":"langchain-mcp","description":"Model Context Protocol tool support for LangChain","avatar_url":"https://avatars.githubusercontent.com/u/11581?v=4","created_at":"2024-12-13T09:12:30.709Z","updated_at":"2024-12-13T12:28:11.026Z","status":"created","author_name":"rectalogic","author_avatar_url":"https://avatars.githubusercontent.com/u/11581?v=4","tags":"[]","category":"developer-tools","is_featured":false,"sort":1,"url":"https://github.com/rectalogic/langchain-mcp","target":"_self","content":"$29","summary":"$2a","img_url":"https://camo.githubusercontent.com/109ca1bd95b9d57b14e6a129cb8309160292b5bc420c27bf812541ca6731e8e3/68747470733a2f2f696d672e736869656c64732e696f2f707970692f762f6c616e67636861696e2d6d6370","type":null,"metadata":"{\"star\":\"178\",\"license\":\"MIT license\",\"language\":\"Python\",\"is_official\":false,\"latest_commit_time\":\"2025-04-02 11:18:35\"}","user_uuid":null,"tools":null,"sse_url":null,"sse_provider":null,"sse_params":null,"is_official":false,"server_command":null,"server_params":null,"server_config":null,"allow_call":false,"is_innovation":false,"is_dxt":false,"dxt_manifest":null,"dxt_file_url":null,"is_audit":false},"randomProjects":[],"currentServerKey":"$undefined"}]]}]