Multi-MCP AI Agent
by aviban15
The Multi-MCP AI Agent is an agentic AI system that utilizes multiple MCP servers to provide a wide range of capabilities, including external service integrations and real-time communication. It includes a Telegram bot interface and Server-Sent Events (SSE) for live updates.
View on GitHub
Last updated: N/A
Multi-MCP AI Agent
An Agentic AI agent system that leverages multiple MCP (Model Control Protocol) servers to provide a wide range of capabilities, from basic mathematical operations to advanced external service integrations like Google Workspace and web scraping. The agent includes a Telegram bot interface and Server-Sent Events (SSE) for real-time communication.
š Features
- Multi-MCP Architecture: Utilizes multiple MCP servers for distributed processing and diverse capabilities
- Cognitive Modules: Implements perception, decision-making, memory, and action modules
- External Service Integration:
- Google Workspace (Gmail, Google Drive, Google Sheets)
- Web scraping and content extraction
- DuckDuckGo search integration
- Real-time Communication:
- Telegram Bot interface
- Server-Sent Events (SSE) for live updates
- Core Components:
- Agent loop management
- Session handling
- Context management
- Strategic decision making
šļø Project Structure
āāā agent.py # Main agent entry point
āāā core/ # Core agent components
ā āāā context.py # Context management
ā āāā loop.py # Main agent loop
ā āāā session.py # Session handling
ā āāā strategy.py # Strategic decision making
āāā modules/ # Cognitive modules
ā āāā action.py # Action execution
ā āāā decision.py # Decision making
ā āāā memory.py # Memory management
ā āāā model_manager.py # Model management
ā āāā perception.py # Input processing
ā āāā tools.py # Tool definitions
āāā config/ # Configuration files
ā āāā models.json # Model configurations
ā āāā profiles.yaml # MCP server profiles
āāā mcp_server_*.py # MCP server implementations
š Getting Started
Prerequisites
- Python 3.11+
- UV package manager
- Telegram Bot Token (for bot functionality)
- Google Cloud credentials (for Google Workspace integration)
Installation
- Clone the repository:
git clone <repository-url>
cd <repository-name>
- Create and activate a virtual environment:
uv venv
venv\Scripts\activate # On Mac: source venv/bin/activate
- Install dependencies using UV:
uv sync
- Set up environment variables:
- Create
.env
with Gemini API key and Telegram Bot token. - Generate
credentials.json
using Google OAuth client.
- Create
Configuration
- Configure MCP servers in
config/profiles.yaml
- Set up model configurations in
config/models.json
- Configure Google Cloud credentials:
- Place
credentials.json
in the root directory - Run the application once to generate
token.json
- Place
š® Usage
Starting the Agent
uv run agent.py
Starting the Telegram Bot Server
uv run telegram_sse_server.py
š ļø MCP Servers
MCP Server 1: Basic Operations
- Mathematical operations
- Image processing
- File operations
MCP Server 2: Document Processing
- Document indexing
- Semantic search
- Content extraction
- Image captioning
MCP Server 3: Web Integration
- DuckDuckGo search
- Web content fetching
- Rate-limited requests
MCP Server 4: Google Workspace
- Gmail integration
- Google Sheets operations
- Google Drive management
- F1 standings fetcher (URL scraper)
š” Communication
Telegram Bot
- Command handling
- Message processing
- Real-time responses
SSE Server
- Real-time event streaming
- Client connection management
- Event broadcasting
š§ Cognitive Architecture
The agent implements a cognitive architecture with the following modules:
- Perception: Processes input and extracts relevant information
- Memory: Manages state and historical data
- Decision: Makes strategic decisions based on input and context
- Action: Executes decided actions through appropriate tools
š License
MIT License