
# 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](https://badge.fury.io/py/rickjang-gmail-mcp-server.svg)](https://badge.fury.io/py/rickjang-gmail-mcp-server)
[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/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.


## CLAUDE CONFIG EXAMPLE 
```
{
  "mcpServers": {
    "terminal_server": {
      "command": "/Users/maitreyamishra/.local/bin/uv",
      "args": [
        "--directory", "Path to your mcp server file",
        "run",
        "terminal_server.py"
      ]
    },
    "web3_server": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "http://localhost:3000/mcp"
      ]
    },
    "gmail_mcp": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "http://localhost:8989/mcp"
      ]
    }
  }
}
```


### Port

The server runs on port 5000 and binds to all interfaces (0.0.0.0) for container deployment.

## Installation

Install the package from PyPI:

```bash
pip install rickjang-gmail-mcp-server
```

## Quick Start

1. Set up your Gmail credentials as environment variables:
   ```bash
   export SMTP_USERNAME="your-email@gmail.com"
   export SMTP_PASSWORD="your-app-password"
   ```

2. Run the server:
   ```bash
   rickjang-gmail-mcp-server
   ```

## Local Development

1. Clone the repository:
   ```bash
   git clone https://github.com/rickjang/Gmail-mcp-server.git
   cd Gmail-mcp-server
   ```

2. Install in development mode:
   ```bash
   pip install -e .
   ```

3. Set environment variables and run:
   ```bash
   export SMTP_USERNAME="your-email@gmail.com"
   export SMTP_PASSWORD="your-app-password"
   rickjang-gmail-mcp-server
   ```

## Docker

Build and run with Docker:
```bash
docker build -t gmail-mcp .
docker run -p 5000:5000 -e SMTP_USERNAME=your-email -e SMTP_PASSWORD=your-password gmail-mcp
```
