MCP Server Suite: Calculator + Gmail Integration

April 20, 2025 ยท View on GitHub

A powerful Model Context Protocol (MCP) server suite that combines an advanced calculator with Gmail integration, allowing you to perform complex mathematical calculations and send results via email through Claude Desktop MCP Client.

๐ŸŒŸ Features

Advanced Calculator

  • ๐Ÿ“ฑ Complex BODMAS (Bracket, Order, Division, Multiplication, Addition, Subtraction) operations
  • ๐Ÿงฎ Advanced mathematical functions:
    • Trigonometric functions (sin, cos, tan)
    • Exponential and logarithmic operations
    • Square and cube roots
    • Factorial calculations
    • Fibonacci sequence generation
  • โœ… Step-by-step reasoning verification
  • ๐Ÿ“Š Calculation consistency checks

Gmail Integration

  • ๐Ÿ“ง Send calculation results via email
  • ๐Ÿ“ฅ Retrieve and read unread emails
  • ๐Ÿ—‘๏ธ Manage emails (mark as read, move to trash)
  • ๐ŸŒ Open emails in browser

๐Ÿ—๏ธ Project Structure

MCP-Server-V4-Gmail/
โ”œโ”€โ”€ calculator-mcp-server/       # Calculator MCP Server
โ”‚   โ”œโ”€โ”€ math-mcp-server/
โ”‚   โ”‚   โ”œโ”€โ”€ mcp_server.py       # Calculator implementation
โ”‚   โ”‚   โ””โ”€โ”€ models.py           # Data models
โ”‚   โ”œโ”€โ”€ pyproject.toml
โ”‚   โ””โ”€โ”€ README.md
โ””โ”€โ”€ gmail-mcp-server/           # Gmail MCP Server
    โ”œโ”€โ”€ src/
    โ”‚   โ””โ”€โ”€ gmail/
    โ”‚       โ”œโ”€โ”€ server.py       # Gmail integration
    โ”‚       โ””โ”€โ”€ __init__.py
    โ”œโ”€โ”€ pyproject.toml
    โ””โ”€โ”€ README.md

๐Ÿš€ Setup & Installation

Prerequisites

  • Python 3.12 or higher
  • Claude Desktop MCP Client
  • Google Cloud Platform account (for Gmail API)

1. Gmail API Setup

  1. Create a new Google Cloud project
  2. Enable the Gmail API
  3. Configure OAuth consent screen:
    • Select "external" (no publishing required)
    • Add your email as a "Test user"
  4. Add OAuth scope: https://www.googleapis.com/auth/gmail/modify
  5. Create OAuth Client ID for "Desktop App"
  6. Download and save OAuth credentials JSON file

2. Server Installation

# Clone the repository
cd MCP-Server-V4-Gmail

# Set up Calculator Server
cd calculator-mcp-server
uv venv
uv pip install -r requirements.txt

# Set up Gmail Server
cd ../gmail-mcp-server
uv venv
uv pip install -r requirements.txt

3. Claude Desktop Configuration

Add both servers to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "calculator": {
      "command": "uv",
      "args": [
        "--directory",
        "[path-to-repo]/calculator-mcp-server",
        "run",
        "mcp-server"
      ]
    },
    "gmail": {
      "command": "uv",
      "args": [
        "--directory",
        "[path-to-repo]/gmail-mcp-server",
        "run",
        "gmail",
        "--creds-file-path",
        "[path-to-credentials]/client_creds.json",
        "--token-path",
        "[path-to-tokens]/app_tokens.json"
      ]
    }
  }
}

๐Ÿ’ป Usage

  1. Start Calculator Server:

    cd calculator-mcp-server
    python math-mcp-server/mcp_server.py
    
  2. Start Gmail Server:

    cd gmail-mcp-server
    python src/gmail/server.py --creds-file-path [path]/client_creds.json --token-path [path]/app_tokens.json
    
  3. Use in Claude Desktop:

    • Perform calculations: "Calculate 5 * (3 + 2) - 4 / 2"
    • Send results: "Send these calculation results to example@email.com"

๐Ÿ“‹ Example Workflow

  1. Calculate complex expression:

    User: Calculate (sin(45) + cos(30)) * sqrt(16)
    Claude: Let me break this down...
    [Shows step-by-step calculation]
    Result: 3.2834...
    
  2. Send results via email:

    User: Send this result to john@example.com
    Claude: I'll draft an email with the calculation results...
    [Shows email draft]
    Shall I send it?
    

๐Ÿ”’ Security

  • Gmail API uses OAuth 2.0 for authentication
  • Tokens are stored securely in specified location
  • Email operations require explicit user confirmation

๐Ÿ“ License

MIT License

๐Ÿ‘ฅ Authors

  • Calculator Server by Saish Shetty
  • Gmail Integration by Original Authors