Next-Generation Agentic AI System with 17+ MCP Tools
A production-ready ChatGPT-style system integrating LangChain, LangGraph, FastMCP, and Google Gemini 2.0 Flash with 17+ powerful MCP tools, intelligent routing, persistent memory, and a beautiful reactive UI.
Features • Architecture • Installation • Usage • API Docs
- Overview
- Key Features
- System Architecture
- MCP Tools
- Technology Stack
- Installation
- Configuration
- Usage Guide
- API Documentation
- Project Structure
- Development
- Troubleshooting
- Contributing
- License
AI-MCP Orchestrator is a sophisticated agentic AI system that combines the power of Google's Gemini 2.0 Flash model with an extensive suite of Model Context Protocol (MCP) tools. Built on LangChain and LangGraph, it provides intelligent tool routing, multi-step reasoning, and seamless integration with external services.
- 🎯 17+ MCP Tools - From web search to system monitoring, weather to translation
- 🧠 Intelligent Routing - Automatically selects the right tools for each query
- 🔄 LangGraph Pipeline - Multi-agent orchestration with state management
- 💾 Persistent Memory - Conversation history and context retention
- 🎨 Beautiful UI - Modern, responsive interface with real-time updates
- ⚡ Real-time WebSocket - Streaming responses and live tool execution
- 🔧 Toggleable Tools - Enable/disable tools on-the-fly
- 📊 Analytics Dashboard - Monitor system performance and tool usage
- Multi-turn Conversations with context awareness
- Tool Chaining - Combine multiple tools in a single query
- Intelligent Fallbacks - Graceful degradation when tools fail
- Streaming Responses - Real-time token-by-token output
- Memory Management - Short-term and long-term context
- Web Search - DuckDuckGo integration
- File Management - Read, write, organize files
- Database Operations - MongoDB CRUD operations
- Email Automation - Send and manage emails
- Google Drive - Cloud storage integration
- Workflow Automation - Schedule and execute tasks
- Knowledge Base - Store and retrieve information
- Analytics - Data analysis and visualization
- API Integration - Connect to external APIs
- Weather/Climate - Real-time weather data
- Wikipedia - Encyclopedia search and retrieval
- Python Execution - Safe code execution sandbox
- Screen Monitoring - Screenshots and display info
- System Monitoring - CPU, memory, disk metrics
- Calculator - Math operations and unit conversion
- Translator - Multi-language translation
- ChatGPT-style Interface - Familiar and intuitive
- Tool Status Cards - Visual tool management
- Animated Particles - Dynamic background effects
- Dark Theme - Eye-friendly design
- Responsive Layout - Works on all devices
- Message History - Scroll through past conversations
- Typing Indicators - Real-time feedback
┌─────────────────────────────────────────────────────────────────┐
│ FRONTEND (React) │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ Chat UI │ │ Tool Panel │ │ Analytics │ │
│ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ │
│ │ │ │ │
│ └──────────────────┴──────────────────┘ │
│ │ │
│ WebSocket / REST API │
└────────────────────────────┼────────────────────────────────────┘
│
┌────────────────────────────┼────────────────────────────────────┐
│ BACKEND (FastAPI) │
│ ┌──────────────────────────┴──────────────────────────┐ │
│ │ API Layer (Routes) │ │
│ │ • Chat Routes • MCP Routes • Memory Routes │ │
│ └──────────────────────┬──────────────────────────────┘ │
│ │ │
│ ┌──────────────────────┴──────────────────────────────┐ │
│ │ LangGraph Orchestration Pipeline │ │
│ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ │
│ │ │ Router │→ │ Executor │→ │ Aggregator│ │ │
│ │ └──────────┘ └──────────┘ └──────────┘ │ │
│ └──────────────────────┬──────────────────────────────┘ │
│ │ │
│ ┌──────────────────────┴──────────────────────────────┐ │
│ │ Tool Registry (17 Tools) │ │
│ │ ┌────────┐ ┌────────┐ ┌────────┐ ┌────────┐ │ │
│ │ │Web Srch│ │File Mgr│ │Database│ │ Email │ ... │ │
│ │ └────────┘ └────────┘ └────────┘ └────────┘ │ │
│ └──────────────────────┬──────────────────────────────┘ │
│ │ │
│ ┌──────────────────────┴──────────────────────────────┐ │
│ │ Services & Integrations │ │
│ │ • Database Service (MongoDB) │ │
│ │ • Gemini AI Service (Google) │ │
│ │ • Memory Service (Context Management) │ │
│ └──────────────────────────────────────────────────────┘ │
└──────────────────────────────────────────────────────────────────┘
│
┌────────────────────────────┼────────────────────────────────────┐
│ EXTERNAL SERVICES │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ Gemini │ │ MongoDB │ │ Google │ │ APIs │ │
│ │ 2.0 Flash│ │ │ │ Drive │ │ │ │
│ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │
└──────────────────────────────────────────────────────────────────┘
User Query
↓
┌───────────────┐
│ Query Router │ ← Analyzes query and selects appropriate tools
└───────┬───────┘
↓
┌───────────────┐
│ Tool Executor │ ← Executes selected MCP tools in parallel/sequence
└───────┬───────┘
↓
┌───────────────┐
│ Aggregator │ ← Combines results from multiple tools
└───────┬───────┘
↓
┌───────────────┐
│ Response Gen │ ← Generates natural language response
└───────┬───────┘
↓
User Response
┌──────────────┐
│ User Input │
└──────┬───────┘
↓
┌──────────────────────────────────────┐
│ 1. WebSocket Connection Established │
└──────┬───────────────────────────────┘
↓
┌──────────────────────────────────────┐
│ 2. Query Preprocessing │
│ • Tokenization │
│ • Context Injection │
│ • Memory Retrieval │
└──────┬───────────────────────────────┘
↓
┌──────────────────────────────────────┐
│ 3. Tool Selection (Router) │
│ • Keyword Matching │
│ • Semantic Analysis │
│ • Multi-tool Detection │
└──────┬───────────────────────────────┘
↓
┌──────────────────────────────────────┐
│ 4. Tool Execution │
│ • Parallel Execution │
│ • Error Handling │
│ • Result Caching │
└──────┬───────────────────────────────┘
↓
┌──────────────────────────────────────┐
│ 5. Response Generation │
│ • Result Aggregation │
│ • Gemini 2.0 Processing │
│ • Streaming Output │
└──────┬───────────────────────────────┘
↓
┌──────────────────────────────────────┐
│ 6. Memory Update │
│ • Conversation Storage │
│ • Context Update │
└──────┬───────────────────────────────┘
↓
┌──────────────┐
│ User Response│
└──────────────┘
- Provider: DuckDuckGo
- Actions: Search web, get snippets, extract URLs
- Use Cases: Research, fact-checking, current events
- Actions: Read, write, delete, list files
- Supported: Text, JSON, CSV, Markdown
- Use Cases: Document management, data processing
- Provider: MongoDB
- Actions: CRUD operations, queries, aggregations
- Use Cases: Data storage, retrieval, analytics
- Protocol: SMTP
- Actions: Send emails, attachments, templates
- Use Cases: Notifications, reports, communication
- Actions: Upload, download, share, organize
- Use Cases: Cloud storage, collaboration
- Actions: Schedule tasks, workflows, triggers
- Use Cases: Recurring tasks, batch processing
- Actions: Store, recall, search context
- Use Cases: Conversation history, user preferences
- Actions: Data analysis, visualization, trends
- Use Cases: Business intelligence, reporting
- Actions: Store articles, search, categorize
- Use Cases: Documentation, wiki, FAQs
- Actions: REST calls, webhooks, OAuth
- Use Cases: Third-party integrations
- Provider: Python Weather API
- Actions: Current weather, forecasts, climate data
- Use Cases: Travel planning, weather alerts
- Actions: Search, summaries, full articles
- Use Cases: Research, definitions, learning
- Actions: Execute code, validate syntax, analyze
- Use Cases: Calculations, data processing, automation
- Actions: Screenshots, display info, resolution
- Use Cases: Documentation, troubleshooting
- Actions: CPU, memory, disk, network stats
- Use Cases: Performance monitoring, diagnostics
- Actions: Math operations, unit conversions
- Use Cases: Calculations, conversions, equations
- Actions: Translate text, detect language
- Supported: 12+ languages
- Use Cases: Multilingual communication
- Framework: FastAPI 0.120.0
- AI/ML:
- Google Gemini 2.0 Flash
- LangChain (latest)
- LangGraph (latest)
- Database: MongoDB (Motor async driver)
- WebSocket: FastAPI WebSockets
- Validation: Pydantic v2
- Framework: React 18
- Build Tool: Vite
- Styling: TailwindCSS
- Animations: Framer Motion
- Icons: Lucide React
- HTTP Client: Axios
- Environment: Python 3.13+
- Package Manager: pip, npm
- Process Manager: Uvicorn
- Logging: Python logging with colors
- Python 3.13+
- Node.js 18+
- MongoDB (local or cloud)
- Git
git clone https://github.com/yourusername/ai-mcp-orchestrator.git
cd ai-mcp-orchestratorcd backend
# Create virtual environment
python -m venv venv
# Activate virtual environment
# Windows:
venv\Scripts\activate
# Linux/Mac:
source venv/bin/activate
# Install dependencies
pip install -r requirements.txtcd frontend
# Install dependencies
npm installCreate .env file in backend/ directory:
# API Keys
GEMINI_API_KEY=your_gemini_api_key_here
OPENAI_API_KEY=
# Model Configuration
GEMINI_MODEL=gemini-2.0-flash-exp
TEMPERATURE=0.7
MAX_TOKENS=8192
# Database
MONGODB_URL=mongodb://localhost:27017
DATABASE_NAME=ai_mcp_orchestrator
# Server
HOST=0.0.0.0
PORT=8000
DEBUG=True
# CORS (comma-separated)
CORS_ORIGINS=http://localhost:3000,http://localhost:5173
# MCP Configuration
MCP_TIMEOUT=30
MAX_CONCURRENT_TOOLS=5# Windows (if installed as service)
net start MongoDB
# Linux/Mac
sudo systemctl start mongod
# Or use MongoDB Atlas (cloud)Terminal 1 - Backend:
cd backend
python main.pyTerminal 2 - Frontend:
cd frontend
npm run devWindows:
start.batLinux/Mac:
chmod +x start.sh
./start.sh- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Docs: http://localhost:8000/docs
- Health Check: http://localhost:8000/health
- Open http://localhost:3000
- Enable Tools - Click "MCP Tools" button and toggle desired tools
- Start Chatting - Type your query in the input box
- View Results - See AI responses with tool execution details
🔍 Web Search:
"Search for latest AI news"
🌤️ Weather:
"What's the weather in Tokyo?"
📖 Wikipedia:
"Tell me about quantum computing"
💻 Python Code:
"Run this code: print('Hello World')"
📊 System Monitor:
"Show me my CPU usage"
🔢 Calculator:
"Calculate 25 * 4 + 10"
🌐 Translator:
"Translate 'Good morning' to Spanish"
🔗 Multi-Tool:
"Search for Python tutorials and save the results to a file"
POST /api/chat/message
{
"message": "Your query here",
"session_id": "optional-session-id",
"active_tools": ["web_search", "calculator"]
}Response:
{
"response": "AI generated response",
"tools_used": ["web_search"],
"execution_time": 1.23,
"session_id": "session-123"
}GET /api/mcp/tools
{
"tools": [
{
"name": "web_search",
"description": "Search the web",
"enabled": true
}
]
}POST /api/mcp/tools/{tool_name}/toggle
{
"enabled": true
}GET /api/memory/history?session_id=123&limit=10
DELETE /api/memory/clear?session_id=123
Connect: ws://localhost:8000/api/ws/chat
Send Message:
{
"type": "message",
"content": "Your query",
"session_id": "session-123"
}Receive Response:
{
"type": "response",
"content": "AI response",
"tools_used": ["web_search"],
"done": true
}ai-mcp-orchestrator/
├── backend/
│ ├── config.py # Configuration settings
│ ├── main.py # FastAPI application entry
│ ├── requirements.txt # Python dependencies
│ │
│ ├── routes/ # API route handlers
│ │ ├── chat_routes.py
│ │ ├── mcp_routes.py
│ │ ├── memory_routes.py
│ │ └── websocket_routes.py
│ │
│ ├── services/ # Business logic services
│ │ ├── db_service.py
│ │ ├── gemini_service.py
│ │ └── memory_service.py
│ │
│ ├── mcp_tools/ # 17 MCP tool implementations
│ │ ├── web_search_mcp.py
│ │ ├── file_manager_mcp.py
│ │ ├── climate_mcp.py
│ │ ├── wikipedia_mcp.py
│ │ └── ... (13 more)
│ │
│ ├── langgraph_pipeline/ # LangGraph orchestration
│ │ ├── graph_builder.py
│ │ ├── router.py
│ │ ├── executor.py
│ │ └── aggregator.py
│ │
│ └── utils/ # Utility functions
│ ├── tool_registry.py
│ └── helpers.py
│
├── frontend/
│ ├── package.json
│ ├── vite.config.js
│ ├── tailwind.config.js
│ │
│ ├── src/
│ │ ├── App.jsx # Main application
│ │ ├── main.jsx # Entry point
│ │ │
│ │ ├── components/ # React components
│ │ │ ├── ChatInterface.jsx
│ │ │ ├── MCPToolPanel.jsx
│ │ │ ├── MCPCard.jsx
│ │ │ └── ParticleBackground.jsx
│ │ │
│ │ ├── context/ # React context
│ │ │ └── MCPContext.jsx
│ │ │
│ │ ├── services/ # API services
│ │ │ └── api.js
│ │ │
│ │ └── styles/ # CSS styles
│ │ └── index.css
│ │
│ └── public/ # Static assets
│
├── README.md # This file
├── UPDATE_SUMMARY.md # Recent updates
└── .gitignore
- Create tool file:
backend/mcp_tools/your_tool_mcp.py
class YourTool:
def __init__(self):
self.name = "your_tool"
self.description = "Tool description"
self.enabled = True
async def execute(self, action: str, **kwargs):
# Implementation
return {"success": True, "data": "result"}
def get_schema(self):
return {
"name": self.name,
"description": self.description,
"parameters": {...}
}- Register in
__init__.py:
from .your_tool_mcp import YourTool
__all__ = [..., "YourTool"]-
Add to tool registry:
utils/tool_registry.py -
Add keywords:
langgraph_pipeline/router.py -
Add frontend icon:
frontend/src/components/MCPCard.jsx
# Backend tests
cd backend
pytest
# Frontend tests
cd frontend
npm test# Backend
black backend/
flake8 backend/
# Frontend
npm run lint
npm run formatError: CORS policy blocked
Solution: Check CORS_ORIGINS in .env matches your frontend URL
Error: Could not connect to MongoDB
Solution:
- Ensure MongoDB is running
- Check
MONGODB_URLin.env - Try:
mongodb://localhost:27017or MongoDB Atlas URL
Error: Invalid API key
Solution:
- Get API key from https://ai.google.dev
- Update
GEMINI_API_KEYin.env
ModuleNotFoundError: No module named 'fastapi'
Solution:
cd backend
pip install -r requirements.txtError: Address already in use
Solution:
- Change
PORTin.env - Or kill process:
lsof -ti:8000 | xargs kill -9(Mac/Linux)
- Backend: Console output with colored logging
- Frontend: Browser console (F12)
- MongoDB: Check MongoDB logs
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow existing code style
- Add tests for new features
- Update documentation
- Keep commits atomic and well-described
This project is licensed under the MIT License - see the LICENSE file for details.
- Google - Gemini 2.0 Flash API
- LangChain - AI orchestration framework
- FastAPI - Modern Python web framework
- React - UI library
- MongoDB - Database solution
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: your.email@example.com
- Add more MCP tools (20+ target)
- Voice input/output support
- Multi-user authentication
- Tool marketplace
- Mobile app (React Native)
- Docker containerization
- Kubernetes deployment
- Advanced analytics dashboard
- Plugin system for custom tools
- RAG (Retrieval Augmented Generation)
Built with ❤️ by the AI-MCP Team
⭐ Star us on GitHub if you find this useful!