Sponsored by Deepsite.site

MCP AI Agent

Created By
Shilpaj19948 months ago
AI Agent interacting with multiple MCP servers
Content

MCP AI Agent

This project demonstrates an intelligent agent that can perform complex mathematical operations, create visual presentations, and communicate results via email using Google's services. It showcases the integration of multiple MCP (Model Context Protocol) servers working together to solve a compound task.

Project Goal

The main goal is to solve the following task:

Calculate the sum of exponential of first five fibonacci numbers, write the answer in a slide, download it as a PNG file, and send it via email.

This involves:

  1. Mathematical computation (Fibonacci + exponential)
  2. Visual presentation (Google Slides)
  3. Communication (Gmail)

System Architecture

The system consists of three main MCP servers:

  1. Math Server (mcp_servers/math_server.py)

    • Calculates Fibonacci sequences
    • Performs exponential operations
    • Handles mathematical computations
  2. Slides Server (mcp_servers/slides_server.py)

    • Creates Google Slides presentations
    • Adds text to slides
    • Downloads slides as PNG images
  3. Gmail Server (mcp_servers/gmail_server.py)

    • Sends emails with attachments
    • Manages email operations (read, trash, mark as read)
    • Handles Gmail API authentication

Setup Instructions

Prerequisites

  • Python 3.8+
  • Linux/Unix environment (tested on Linux 5.15.0-136-generic)
  • X11 display server (for slides functionality)
  • Google account with Gmail and Google Slides access

Installation

  1. Clone the repository
  2. Install dependencies:
pip install -r requirements.txt

Google API Setup

  1. Gmail Setup:

    • Create project in Google Cloud Console
    • Enable Gmail API
    • Create OAuth 2.0 credentials
    • Save credentials as mcp_servers/credentials.json
  2. Environment Variables (optional):

    • GMAIL_CREDS_FILE: Path to credentials.json
    • GMAIL_TOKEN_FILE: Path to token.json

Usage

  1. Start the agent:
python agent.py
  1. The system will:
    • Calculate the Fibonacci sequence and exponentials
    • Create a slide with the result
    • Save the slide as PNG in content/slide.png
    • Send the PNG via email

Project Structure

.
├── agent.py              # Main agent implementation
├── ai.py                 # Gemini Interactions
├── prompt.py             # Prompt used for the project
├── mcp_servers/
│   ├── slides_server.py  # Google Slides operations
│   ├── gmail_server.py   # Gmail operations
│   └── math_server.py    # Mathematical computations
├── content/              # Generated content (slides, images)
└── requirements.txt      # Project dependencies

Troubleshooting

  • Display Issues: Ensure X11 display server is running
  • Gmail Authorization:
    • First run will prompt for Google account access
    • If auth fails, delete token.json and retry
  • File Paths:
    • Images are saved to content/slide.png
    • Use absolute paths when specifying file locations

Example Output

After running the agent, you should:

  1. See mathematical calculations in the console
  2. Find a PNG file in the content directory
  3. Receive an email with the PNG attachment Received Email

Execution Logs

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
ChatWiseThe second fastest AI chatbot™
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Amap Maps高德地图官方 MCP Server
WindsurfThe new purpose-built IDE to harness magic
Serper MCP ServerA Serper MCP Server
DeepChatYour AI Partner on Desktop
Playwright McpPlaywright MCP server
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
CursorThe AI Code Editor
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Tavily Mcp
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.