langchain-mcp
Model Context Protocol tool support for LangChain Python-based implementation.
Documentation
langchain-mcp
*Note: langchain now has a more official implementation langchain-mcp-adapters*
Model Context Protocol 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 `llama-3.1-8b-instant`:
$ 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.Frequently asked questions
What is langchain-mcp?
langchain-mcp is Model Context Protocol tool support for LangChain Python-based implementation.
How do I install langchain-mcp?
Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.
Is langchain-mcp open source?
Yes — it is hosted on GitHub at https://github.com/rectalogic/langchain-mcp and has 202 stars.
Related MCP tools
A MCP (Model Context Protocol) server for interacting with dbt. Python-based implementation.
MCP server for DuckDB and MotherDuck Python-based implementation.
FreeCAD MCP(Model Context Protocol) server Python-based implementation.
A text-based user interface (TUI) client for interacting with MCP servers using Ollama. Features include multi-server, dynamic model switching, streaming res...
MCP implementation that enables communication between MCP servers and OpenAI-compatible LLMs Python-based implementation.
这是一个为大模型提供 A 股数据的的 MCP(Model Content Protocol) 服务。 Python-based implementation.
Run your own MCP server? See who uses it and what to fix.
Measure it with TrackMCP