LangChain Agent with MCP Servers
@esakrissa
About LangChain Agent with MCP Servers
LangChain Agent with MCP Servers: Using LangChain MCP Adapters for tool integration.
Basic information
Config
Add this server to your MCP-compatible client using the configuration below.
{
"mcpServers": {
"langchain-mcp-esakrissa": {
"command": "python",
"args": [
"-m",
"venv",
".venv"
]
}
}
}Tools
No tools detected
We auto-extract tools from the README. The maintainer can list them under a ## Tools heading to populate this section.
Overview
What is LangChain Agent with MCP Servers?
A LangChain agent that uses the Model Context Protocol (MCP) to integrate with external services such as Tavily Search, a mock weather service, and a math expression evaluator. It is built for developers who want a modular, LangGraph-powered agent with graceful shutdown and easy extensibility.
How to use LangChain Agent with MCP Servers?
Install dependencies, create a virtual environment, and add API keys for OpenAI and Tavily to a .env file. Run python src/agent.py from the command line and enter a query when prompted. The agent automatically selects and invokes the appropriate MCP‑server tool.
Key features of LangChain Agent with MCP Servers
- Integrates with Tavily Search, weather, and math MCP servers
- Uses LangGraph’s ReAct agent pattern for dynamic tool selection
- Graceful shutdown via signal handling and subprocess tracking
- Robust error handling throughout the application
- Modular design makes adding new MCP servers straightforward
Use cases of LangChain Agent with MCP Servers
- Perform web searches and retrieve news via Tavily
- Get mock weather information for any location
- Evaluate mathematical expressions
- Demonstrate a LangChain agent that dynamically calls external MCP tools
FAQ from LangChain Agent with MCP Servers
What runtime dependencies are required?
Python 3.8+, a virtual environment, and the dependencies listed in setup.py. API keys for OpenAI and Tavily must be stored in a .env file.
How can I add a new MCP server?
Create a new file in src/mcpserver/ with proper signal handling, expose it in src/mcpserver/__init__.py, and add its configuration in src/agent.py.
What transport or authentication does the agent use?
MCP servers run as subprocesses and communicate via stdin/stdout. Authentication is handled via API keys passed in the .env file.
Does the agent support graceful shutdown?
Yes. It captures SIGINT and SIGTERM, tracks all child processes, and ensures they terminate cleanly. A shutdown flag prevents new operations during teardown, and asyncio allows in‑progress tasks to finish when possible.
What services are available out‑of‑the-box?
Tavily Search (web and news), a mock weather server, and a math expression evaluator.
More AI & Agents MCP servers
Solon Ai
opensolonJava AI application development framework (supports LLM-tool,skill; RAG; MCP; Agent-ReAct,Team-Agent). Compatible with java8 ~ java25. It can also be embedded in SpringBoot, jFinal, Vert.x, Quarkus, and other frameworks.
Model Context Protocol for Unreal Engine
chongdashuEnable AI assistant clients like Cursor, Windsurf and Claude Desktop to control Unreal Engine through natural language using the Model Context Protocol (MCP).
Open Multi-Agent Canvas
CopilotKitThe open-source multi-agent chat interface that lets you manage multiple agents in one dynamic conversation and add MCP servers for deep research
Model Context Protocol Server for Home Assistant
tevonsbA MCP server for Home Assistant
MCP Claude Code
SDGLBLMCP implementation of Claude Code capabilities and more
Comments