https://github.com/rectalogic/langchain-mcp
Model Context Protocol tool support for LangChain
https://github.com/rectalogic/langchain-mcp
Last synced: 4 months ago
JSON representation
Model Context Protocol tool support for LangChain
- Host: GitHub
- URL: https://github.com/rectalogic/langchain-mcp
- Owner: rectalogic
- License: mit
- Created: 2024-11-26T15:05:28.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-02T15:18:46.000Z (over 1 year ago)
- Last Synced: 2025-09-02T15:26:34.150Z (10 months ago)
- Language: Python
- Size: 185 KB
- Stars: 197
- Watchers: 3
- Forks: 25
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- win4r_Awesome-Claude-MCP-Servers - @modelcontextprotocol/server-langchain - LangChain integration for MCP tools (Development Tools / Frameworks 🛠️)
- awesome-mcp-devtools - langchain-mcp - Provides MCP tool calling support in LangChain (SDKs / Python)
- awesome-mcp-servers - rectalogic/langchain-mcp - Provides MCP tool calling support in LangChain, allowing for the integration of MCP tools into LangChain workflows. (Frameworks / 🛠️ <a name="other-tools-and-integrations"></a>Other Tools and Integrations)
- awesome-mcp-servers - **langchain-mcp** - Model Context Protocol tool support for LangChain `python` `ai` `pip install git+https://github.com/rectalogic/langchain-mcp` (🤖 AI/ML)
- awesome-mcp-servers - @modelcontextprotocol/server-langchain - LangChainでのMCPツール呼び出しサポートを提供し、LangChainワークフローにMCPツールを統合できるようにします。 (フレームワーク / 🎧 <a name="text-to-speech"></a>テキスト読み上げ)
- toolsdk-mcp-registry - ❌ langchain-mcp - powered applications. (python) (Other Tools and Integrations / How to Submit)
- awesome-mcp - LangChain MCP - LangChain integration (AI & Machine Learning / Monitoring & Analytics)
- awesome-mcp-servers - LangChain MCP Toolkit - Model Context Protocol tool support for LangChain (Table of Contents / Developer Tools)
- awesome-mcp-servers - @modelcontextprotocol/server-langchain - LangChainでのMCPツール呼び出しサポートを提供し、LangChainワークフローにMCPツールを統合できるようにします。 (フレームワーク / 🎧 <a name="text-to-speech"></a>テキスト読み上げ)
- awesome-mcp-devtools - langchain-mcp - Provides MCP tool calling support in LangChain (SDKs / Python)
- awesome-mcp - Langchain - Support for LangChain. (Tools / Community)
- awesome-claude-mcp-servers - @modelcontextprotocol/server-langchain - LangChain integration for MCP tools (Development Tools / Frameworks 🛠️)
- awesome-mcp - rectalogic/langchain-mcp - 提供 LangChain 中 MCP 工具调用支持,允许将 MCP 工具集成到 LangChain 工作流中。 (框架)
README
# langchain-mcp
*Note: langchain now has a more official implementation [langchain-mcp-adapters](https://github.com/langchain-ai/langchain-mcp-adapters)*

[Model Context Protocol](https://modelcontextprotocol.io) tool calling support in LangChain.
Create a `langchain_mcp.MCPToolkit` with an `mcp.ClientSession`,
then `await toolkit.initialize()` and `toolkit.get_tools()` to get the list of `langchain_core.tools.BaseTool`s.
Example:
https://github.com/rectalogic/langchain-mcp/blob/8fa8445a24755bf91789f52718c32361ed916f46/tests/demo.py#L34-L43
## Demo
You can run the demo against [Groq](https://groq.com/) `llama-3.1-8b-instant`:
```sh-session
$ export GROQ_API_KEY=xxx
$ uv run tests/demo.py "Read and summarize the file ./LICENSE"
Secure MCP Filesystem Server running on stdio
Allowed directories: [ '/users/aw/projects/rectalogic/langchain-mcp' ]
The file ./LICENSE is a MIT License agreement. It states that the software is provided "as is" without warranty and that the authors and copyright holders are not liable for any claims, damages, or other liability arising from the software or its use.
```