mcpField
L
langchain-mcp

langchain-mcp

Local
github.com/rectalogicAI & Agents205Updated 82w ago

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

  1. 01Wraps an MCP ClientSession in MCPToolkit
  2. 02Initializes the toolkit and returns tools via get_tools
  3. 03Produces langchain_core BaseTool objects
  4. 04Includes a runnable demo script

Use cases

  1. 01Calling MCP server tools from a LangChain application
  2. 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.

No install method listed yet

We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.

Repository

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

langchain-mcp

Note: langchain now has a more official implementation langchain-mcp-adapters

PyPI - Version

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:

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.

Comments

Markdown supported

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.