Toolkit Multi Server AI Agent With LangChain
π Multi-server MCP agent using LangChain β connects to math & weather tools via stdio and HTTP transports
Ask AI about Toolkit Multi Server AI Agent With LangChain
Powered by Claude Β· Grounded in docs
I know everything about Toolkit Multi Server AI Agent With LangChain. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
π MCP Toolkit: Multi-Server AI Agent with LangChain
Build intelligent agents that seamlessly connect to multiple MCP servers for math operations and real-time data retrieval.
Overview
This project sets up two MCP servers:
- Math Server - Provides arithmetic tools (add, multiply, divide) via stdio transport
- Weather Server - Provides weather lookup via streamable HTTP transport
A LangChain agent connects to both servers and can use their tools to answer questions.
Setup
Prerequisites
- Python 3.13+
- uv package manager
Installation
uv sync
Environment Variables
Create a .env file with your Groq API key:
GROQ_API_KEY=gsk_your_api_key_here
Get your API key from console.groq.com
Usage
1. Start the Weather Server
In one terminal:
uv run python weather.py
This starts an HTTP server on http://127.0.0.1:8000
2. Run the Client
In another terminal:
uv run python client.py
The client will:
- Connect to both MCP servers (math via stdio, weather via HTTP)
- Create a ReAct agent with access to all tools
- Execute sample queries for math and weather
Project Structure
βββ client.py # LangChain agent that connects to MCP servers
βββ mathserver.py # MCP server with arithmetic tools (stdio)
βββ weather.py # MCP server with weather tool (HTTP)
βββ requirements.txt # Python dependencies
βββ pyproject.toml # Project configuration
βββ .env # Environment variables (not committed)
Available Tools
Math Server (stdio)
add(a, b)- Add two numbersmultiply(a, b)- Multiply two numbersdivide(a, b)- Divide two numbers
Weather Server (HTTP)
get_weather(location)- Get weather for a location
Dependencies
langchain-groq- Groq LLM integrationlangchain-mcp-adapters- MCP client adapters for LangChainmcp- Model Context Protocol SDKlanggraph- LangGraph for agent orchestration
