A production-style Model Context Protocol (MCP) system that demonstrates how to build a modular AI agent capable of orchestrating multiple specialized servers through a single intelligent client.
The system integrates tool-based reasoning, RAG, web search, financial data, weather APIs, and mathematical computation under a unified agent powered by LangGraph and Gemini.
- 🧠 Multi-Server MCP Architecture
- 🤖 LangGraph ReAct Agent with Tool Calling
- 💬 Persistent Conversation Memory (Checkpointer)
- 🔄 Multi-step Tool Chaining
- ⚡ Streaming Responses
- 🎨 Rich CLI Interface with Tool Tracing
- Local document-based knowledge system
- Built using LangChain + ChromaDB
- Embeddings powered by Ollama (embeddinggemma)
- Semantic retrieval over multiple knowledge collections
- Hybrid ingestion pipeline with crawling + PDF parsing
- Real-time web search using Tavily API
- Used for up-to-date information retrieval
- Integrated as MCP tool for dynamic reasoning
-
Powered by Yahoo Finance (yfinance)
-
Tools:
search_symbolget_market_dataget_historical_data
Supports stock analysis, historical comparisons, and ticker resolution.
-
Built with Open-Meteo API
-
Provides:
- Current weather
- Forecast data
- Historical weather analysis
A full-featured mathematical computation server supporting:
addsubtractmultiplydividepowersqrtfactorial
Used as a deterministic reasoning tool for arithmetic and symbolic operations.
+----------------------+
| AI Client (CLI) |
| LangGraph + Gemini |
+----------+-----------+
|
MCP Protocol
|
-----------------------------------------------------
| | | | | |
▼ ▼ ▼ ▼ ▼ ▼
Math Market Weather Search RAG (Tools)
Server Server Server Server Server
Each server is fully independent and communicates via the MCP protocol.
The retrieval system is built using:
-
🧬 Ollama Embeddings
- Model:
embeddinggemma
- Model:
-
🗂 Vector Database:
- ChromaDB (persistent storage)
-
📄 Document Sources:
- PDF files
- Crawled web documents
-
🔍 Retrieval:
- Semantic similarity search over chunks
- Multi-collection support
- Python 3.11+
- MCP (Model Context Protocol)
- LangGraph
- LangChain
- Google Gemini
- Ollama (EmbeddingGemma)
- ChromaDB
- Tavily Search API
- Yahoo Finance
- Open-Meteo API
- Rich (CLI UI)
multi-server-mcp-agent/
├── client.py
├── ingest.py
├── crawl.py
├── .env
│
├── knowledge_base/
├── vector_db/
│
├── servers/
│ ├── math_server.py
│ ├── market_server.py
│ ├── weather_server.py
│ ├── search_server.py
│ └── rag_server.py
│
└── utils/
└── cli.py
git clone https://github.com/Hosein541/multi-server-mcp-agent.git
cd multi-server-mcp-agent
poetry installGOOGLE_API_KEY=...
TAVILY_API_KEY=...
poetry run python client.pyCompare Tesla and Apple stock over the last month.
What is the weather in Tokyo tomorrow?
Solve factorial of 10.
Search latest AI news.
Explain Model Context Protocol.
Summarize retrieved documents about LangChain.
- Multi-agent orchestration layer
- Tool ranking / reranking (Router model)
- Distributed MCP servers
- Dockerized deployment
- LangSmith observability
- Web UI (Streamlit / React)
- Authentication layer for MCP servers
This project demonstrates a real-world implementation of:
- Modular AI systems using MCP
- Tool-augmented LLM reasoning
- Retrieval-augmented generation with local embeddings
- Multi-step agent execution
- Real-time tool orchestration
- Production-style AI system design
It is not just a demo — it is a blueprint for building scalable AI agent systems.