Multi-MCP AI Agent logo

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

  1. Clone the repository:
git clone <repository-url>
cd <repository-name>
  1. Create and activate a virtual environment:
uv venv
venv\Scripts\activate  # On Mac: source venv/bin/activate
  1. Install dependencies using UV:
uv sync
  1. Set up environment variables:
    • Create .env with Gemini API key and Telegram Bot token.
    • Generate credentials.json using Google OAuth client.

Configuration

  1. Configure MCP servers in config/profiles.yaml
  2. Set up model configurations in config/models.json
  3. Configure Google Cloud credentials:
    • Place credentials.json in the root directory
    • Run the application once to generate token.json

šŸŽ® 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