LangChain Agent with MCP Servers
@esakrissa
关于 LangChain Agent with MCP Servers
LangChain Agent with MCP Servers: Using LangChain MCP Adapters for tool integration.
基本信息
配置
使用下面的配置,将此服务器添加到你的 MCP 客户端。
{
"mcpServers": {
"langchain-mcp-esakrissa": {
"command": "python",
"args": [
"-m",
"venv",
".venv"
]
}
}
}工具
未检测到工具
工具是从 README 中自动提取的。维护者可以在 ## Tools 标题下列出工具,即可填充这部分内容。
概览
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.
AI 与智能体 分类下的更多 MCP 服务器
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.
MCP-LLM Bridge
patruffBridge between Ollama and MCP servers, enabling local LLMs to use Model Context Protocol tools
欢迎来到 智言平台
Shy2593666979AgentChat 是一个基于 LLM 的智能体交流平台,内置默认 Agent 并支持用户自定义 Agent。通过多轮对话和任务协作,Agent 可以理解并协助完成复杂任务。项目集成 LangChain、Function Call、MCP 协议、RAG、Memory、HITL、Skill、Milvus 和 ElasticSearch 等技术,实现高效的知识检索与工具调用,使用 FastAPI 构建高性能后端服务。
Hass-MCP
voskaControl and query Home Assistant from Claude and other LLMs — a Model Context Protocol (MCP) server.
Unreal Engine Generative AI Support Plugin
prajwalshettydevUnreal Engine plugin for LLM/GenAI models & MCP UE5 server. OpenAI GPT-5, Deepseek R1, Claude Opus/Sonnet, Gemini 3, Grok 4, Alibaba Qwen, Kimi, ElevenLabs TTS, Inworld, OpenRouter, Groq, GLM, Ollama, Local, Meshy, Tripo, Hunyuan3D, Rodin, fal, Dashscope, Seedream. NPC AI, agenti
评论