About langchain-mcp
langchain-mcp is a Python library that adds Model Context Protocol tool calling to LangChain. Developers wrap an MCP ClientSession in a toolkit and obtain LangChain BaseTool objects. The README notes that LangChain now offers the more official langchain-mcp-adapters implementation.
Key features
- 01Wraps an MCP ClientSession in MCPToolkit
- 02Initializes the toolkit and returns tools via get_tools
- 03Produces langchain_core BaseTool objects
- 04Includes a runnable demo script
Use cases
- 01Calling MCP server tools from a LangChain application
- 02Letting an LLM summarize files through a filesystem MCP server
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMElangchain-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.BaseTools.
Example:
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.
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.