langchain-mcp
rectalogic/langchain-mcp · 205 stars · Python · MIT
MCP server Model Context Protocol tool support for LangChain
Install
The repo has no one-line install. Follow its README.
Files
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.BaseTools.
Example:
Lines 34 to 43 in 8fa8445
| server_params = StdioServerParameters( | |
| command="npx", | |
| args=["-y", "@modelcontextprotocol/server-filesystem", str(pathlib.Path(__file__).parent.parent)], | |
| ) | |
| async with stdio_client(server_params) as (read, write): | |
| async with ClientSession(read, write) as session: | |
| toolkit = MCPToolkit(session=session) | |
| await toolkit.initialize() | |
| response = await run(toolkit.get_tools(), prompt) | |
| print(response) |
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.
Facts
- Kind
- MCP server
- Group
- Uncategorized
- Stars
- 205
- License
- MIT
- Language
- Python
- Last push
- 2025-04-02
- Forks
- 24
- 1REAio.github.morluto/reaReverse engineer anything from your terminal or agent with one CLI and MCP server.125.3k
- 2com.browser-use/browser-usecom.browser-use/browser-useControl a real Chrome browser to complete any task: fill forms, extract data, book flights.117.7k
- 3World Monitorapp.worldmonitor/mcpLive markets, conflicts, country risk, chokepoints, energy, and China decision signals. 93 tools.88.3k
- 4Scrapling MCP Serverd4vinci/scrapling🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scraplingdev86.9k
- 5Everythingmodelcontextprotocol/serversThis MCP server attempts to exercise all the features of the MCP protocol. It is not intended to be a useful server, but rather a test server for builders of MCP clients. It implements prompts, tools, resources, sampling, and more to showcase MCP capabilities.85.8k
- 6Fetchmodelcontextprotocol/serversA Model Context Protocol server that provides web content fetching capabilities. This server enables LLMs to retrieve and process content from web pages, converting HTML to markdown for easier consumption.85.8k