LangChain Tools
MCP to LangChain Tools Conversion Utility / Python
What is LangChain Tools?
LangChain Tools is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to mcp to langchain tools conversion utility / python
MCP to LangChain Tools Conversion Utility / Python
This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- MCP to LangChain Tools Conversion Utility / Python
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx langchain-mcp-tools-pyConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use LangChain Tools
langchain-mcp-tools is a Python utility library that converts MCP (Model Context Protocol) server tools into native LangChain BaseTool objects, letting you plug any MCP-compatible tool server directly into LangChain agents and chains without writing adapter code. It supports local stdio servers, remote HTTP/SSE endpoints, and WebSocket transports, and handles connection lifecycle management through a returned async cleanup callback. Python developers building LangChain agents can use this library to tap into the growing ecosystem of MCP tool servers — file systems, web search, databases — with a single function call.
Prerequisites
- Python 3.9 or later
- pip or a compatible package manager
- LangChain (langchain or langchain-core) installed in your environment
- At least one MCP server to connect to (e.g. npx @modelcontextprotocol/server-filesystem)
- An LLM API key (e.g. ANTHROPIC_API_KEY or OPENAI_API_KEY) for your LangChain agent
Install the library
Install langchain-mcp-tools from PyPI using pip. It will pull in the MCP client SDK as a dependency.
pip install langchain-mcp-toolsDefine your MCP server configurations
Create a dictionary mapping server names to their connection parameters. Local servers use command and args; remote servers use url; add env for any API keys required by those servers.
mcp_servers = {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "."]
},
"brave-search": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-brave-search"],
"env": {"BRAVE_API_KEY": os.environ["BRAVE_API_KEY"]}
}
}Convert MCP tools to LangChain tools
Call convert_mcp_to_langchain_tools with your server config inside an async function. It returns a list of BaseTool objects and a cleanup coroutine you must call when finished.
from langchain_mcp_tools import convert_mcp_to_langchain_tools
async def main():
tools, cleanup = await convert_mcp_to_langchain_tools(mcp_servers)
try:
# use tools here
pass
finally:
await cleanup()Build a LangChain agent with the tools
Pass the converted tools to any LangChain agent constructor. The tools behave like any other BaseTool and are callable by the agent's reasoning loop.
from langchain import hub
from langchain.agents import create_tool_calling_agent, AgentExecutor
from langchain_anthropic import ChatAnthropic
llm = ChatAnthropic(model="claude-3-5-sonnet-20241022")
prompt = hub.pull("hwchase17/openai-tools-agent")
agent = create_tool_calling_agent(llm, tools, prompt)
executor = AgentExecutor(agent=agent, tools=tools)
result = await executor.ainvoke({"input": "List files in the current directory"})Run cleanup after the agent finishes
Always call the cleanup function to gracefully shut down MCP server connections and free resources. Wrapping your code in try/finally ensures cleanup runs even if an exception occurs.
LangChain Tools Examples
Client configuration
Complete async script showing MCP tool conversion and agent execution with LangChain.
{
"mcp_servers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "."]
},
"brave-search": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-brave-search"],
"env": {"BRAVE_API_KEY": "your_brave_api_key"}
}
}
}Prompts to try
Example agent inputs once your LangChain agent is running with MCP tools loaded.
- "List all Python files in the current directory"
- "Read the contents of README.md and summarise it"
- "Search the web for the latest LangChain release notes"
- "Write a haiku to a new file called haiku.txt"
- "What MCP tools are currently available to you?"Troubleshooting LangChain Tools
MCP server subprocess fails to start
Ensure npx and Node.js are installed and accessible. The library automatically injects PATH into the subprocess environment, but if a custom env dict is provided, PATH must be included explicitly.
Tool calls return errors about unsupported result types
The library only supports text results from MCP tool calls. MCP servers that return binary data, images, or resources will not work. MCP Resources, Prompts, and Sampling features are not implemented.
Connection timeout when using remote HTTP servers
Set the timeout key in the server config dictionary (e.g. {"url": "https://...", "timeout": 60}) to extend the connection timeout beyond the default.
Frequently Asked Questions about LangChain Tools
What is LangChain Tools?
LangChain Tools is a Model Context Protocol (MCP) server that mcp to langchain tools conversion utility / python It connects AI assistants to external tools and data sources through a standardized interface.
How do I install LangChain Tools?
Follow the installation instructions on the LangChain Tools GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with LangChain Tools?
LangChain Tools works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is LangChain Tools free to use?
Yes, LangChain Tools is open source and available under the MIT license. You can use it freely in both personal and commercial projects.
LangChain Tools Alternatives — Similar Developer Tools Servers
Looking for alternatives to LangChain Tools? Here are other popular developer tools servers you can use with Claude, Cursor, and VS Code.
Ecc
★ 188.2kThe agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Javaguide
★ 155.8kJava 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发
Gemini CLI
★ 104.5kA secure MCP server that wraps the Google Gemini CLI, allowing clients to query Gemini models using local OAuth sessions without requiring an API key. It provides tools for model interaction and diagnostics with built-in protection against command in
Awesome MCP Servers
★ 87.3k⭐ Curated list of Model Context Protocol (MCP) servers - tools that extend Claude Desktop, Cursor, Windsurf, and other MCP clients with custom capabilities.
MCP Servers
★ 86.0kModel Context Protocol Servers
CC Switch
★ 77.5kA cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Gemini CLI & Hermes Agent. Only official website: ccswitch.io
Browse More Developer Tools MCP Servers
Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up LangChain Tools in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use LangChain Tools?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.