Skip to main content

A resilient MCP server built with fastMCP for sending emails through Gmail's SMTP server using AI agents

Project description

Gmail MCP Server

A resilient MCP (Model Context Protocol) server built with fastMCP for sending emails through Gmail's SMTP server using AI agents.

PyPI version Python 3.8+ License: MIT

Features

  • Send emails via Gmail SMTP
  • Fetch recent emails from Gmail folders
  • Handle email attachments
  • Health check endpoint for deployment monitoring

Deployment on Smithery.ai

This server is configured for deployment on Smithery.ai using Streamable HTTP transport.

Configuration

The server requires the following configuration parameters:

  • smtp_username: Your Gmail email address
  • smtp_password: Your Gmail app password (not your regular password)

Health Check

The server provides a health check endpoint at /health for Smithery deployment monitoring.

Gmail App Password Setup

To use this MCP server, you'll need to create a Gmail App Password:

  1. Go to your Google Account settings
  2. Select Security from the navigation panel
  3. Under "How you sign in to Google," select 2-Step Verification
  4. At the bottom, select App passwords
  5. Select the app and device you want to generate the app password for
  6. Select Generate
  7. Follow the instructions to enter the app password on your device
  8. Select Done

Use this app password as your SMTP_PASSWORD in the configuration.

Configuration Options

Environment Variables

  • SMTP_USERNAME: Your Gmail email address
  • SMTP_PASSWORD: Your Gmail app password (not your regular password)

Server Configuration

  • Default Port: 8989
  • Default Host: 0.0.0.0 (binds to all interfaces)
  • Transport: Streamable HTTP for MCP compatibility

Installation

Option 1: Direct Installation with pip

Install the package from PyPI:

pip install rickjang-gmail-mcp-server

Then set up your Gmail credentials as environment variables:

export SMTP_USERNAME="your-email@gmail.com"
export SMTP_PASSWORD="your-app-password"

Run the server:

rickjang-gmail-mcp-server

Option 2: MCP Server Configuration with uv (Recommended)

Add the following to your MCP client configuration (e.g., Claude Desktop):

{
  "mcpServers": {
    "gmail-mcp": {
      "command": "uv",
      "args": [
        "tool", 
        "run", 
        "rickjang-gmail-mcp-server"
      ],
      "env": {
        "SMTP_USERNAME": "your-email@gmail.com",
        "SMTP_PASSWORD": "your-gmail-app-password"
      }
    }
  }
}

This method automatically installs the package using uv and sets the environment variables directly in the configuration.

Claude Desktop Configuration

For Claude Desktop, add this to your claude_desktop_config.json file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "gmail-mcp": {
      "command": "uv",
      "args": [
        "tool", 
        "run", 
        "rickjang-gmail-mcp-server"
      ],
      "env": {
        "SMTP_USERNAME": "your-email@gmail.com",
        "SMTP_PASSWORD": "your-gmail-app-password"
      }
    }
  }
}

After adding this configuration, restart Claude Desktop to load the MCP server.

Local Development

  1. Clone the repository:

    git clone https://github.com/rickjang/Gmail-mcp-server.git
    cd Gmail-mcp-server
    
  2. Install in development mode:

    pip install -e .
    
  3. Set environment variables and run:

    export SMTP_USERNAME="your-email@gmail.com"
    export SMTP_PASSWORD="your-app-password"
    rickjang-gmail-mcp-server
    

Docker

Build and run with Docker:

docker build -t gmail-mcp .
docker run -p 5000:5000 -e SMTP_USERNAME=your-email -e SMTP_PASSWORD=your-password gmail-mcp

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rickjang_gmail_mcp_server-1.0.2.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rickjang_gmail_mcp_server-1.0.2-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file rickjang_gmail_mcp_server-1.0.2.tar.gz.

File metadata

File hashes

Hashes for rickjang_gmail_mcp_server-1.0.2.tar.gz
Algorithm Hash digest
SHA256 139f0013a7eb9c53c6d4333788e2a87aa7634a4923cfcb514879ce08381d082f
MD5 f9c2b8e5c9c0f657835680c113fd574a
BLAKE2b-256 0273bfe87d5a785c6aaf4122d6f2de627071ad39601223f4d1884347aaac96ed

See more details on using hashes here.

File details

Details for the file rickjang_gmail_mcp_server-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for rickjang_gmail_mcp_server-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2c36bdbc206dc2400fdfe4d04ecb210f91deaddf75dee31b3b998702224f62f7
MD5 c91687efd99d853c11a12ae6b27fb60c
BLAKE2b-256 d51def11a1022f61ba818c483e66bc0d0b10d3e2217af2d0b8042a314ac4837a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page