Skip to main content

Gmail MCP Server — search, read, send, threads, labels, drafts, filters

Project description

Gmail Blade MCP

Production Gmail MCP server for AI agents. Token-efficient, write-safe, thread-intelligent.

Features

Category Tools Description
Read gmail_search, gmail_read, gmail_snippets, gmail_thread, gmail_mailboxes Search, read messages and threads, list labels
Meta gmail_info, gmail_state, gmail_changes, gmail_identities, gmail_filters Account info, incremental sync, send-as aliases, filter rules
Write gmail_send, gmail_reply, gmail_draft, gmail_flag, gmail_move, gmail_bulk, gmail_delete Send, reply, draft, label, move, batch ops, delete
Filter gmail_filter_create, gmail_filter_delete Create and delete Gmail filters
AI gmail_classify, gmail_summarise Gemini-powered classification and summarisation (requires GOOGLE_API_KEY)

What makes this different

  • Token-efficient by default — HTML→plaintext stripping, body truncation, quoted-reply deduplication, concise list format
  • Write-safeGMAIL_WRITE_ENABLED=true env gate + confirm=true on destructive operations
  • Thread-intelligentthread_mode=deduped strips quoted replies; latest shows only newest message
  • Incremental syncgmail_state + gmail_changes via Gmail history.list API
  • Rate-limit aware — automatic exponential backoff on 429 errors
  • Gemini AI — classify and summarise emails using Google Gemini (optional, requires GOOGLE_API_KEY)
  • Credential-safe — OAuth tokens scrubbed from error messages

Quick Start

1. Install

uv sync

2. Set up Gmail API credentials

  1. Go to Google Cloud Console
  2. Create a project (or select existing)
  3. Enable the Gmail API
  4. Create OAuth 2.0 credentials (Desktop application)
  5. Download the JSON file
  6. Save as ~/.gmail-blade/credentials.json

3. First run (authenticate)

uv run gmail-blade-mcp

A browser window opens for OAuth consent. After authorising, the refresh token is saved to ~/.gmail-blade/token.json.

4. Configure MCP client

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "gmail-blade": {
      "command": "uv",
      "args": ["--directory", "/path/to/gmail-blade-mcp", "run", "gmail-blade-mcp"],
      "env": {
        "GMAIL_WRITE_ENABLED": "false"
      }
    }
  }
}

Environment Variables

Variable Default Description
GMAIL_WRITE_ENABLED false Enable write operations (send, reply, delete, etc.)
GMAIL_MCP_TRANSPORT stdio Transport: stdio or http
GMAIL_MCP_HOST 127.0.0.1 HTTP host (when transport=http)
GMAIL_MCP_PORT 8768 HTTP port (when transport=http)
GMAIL_MCP_API_TOKEN (none) Bearer token for HTTP transport auth
GOOGLE_API_KEY (none) Google AI Studio API key for Gemini classify/summarise tools

Security

  • Write operations disabled by default — set GMAIL_WRITE_ENABLED=true to enable
  • Permanent delete requires confirm=true — use gmail_move to TRASH for soft delete
  • OAuth tokens never appear in error messages — regex scrubbing on all error paths
  • Bearer auth uses constant-time comparisonsecrets.compare_digest()
  • Credentials stored locally~/.gmail-blade/, never transmitted

Development

make install-dev    # Install with dev + test deps
make test           # Unit tests (no Gmail needed)
make check          # Lint + format + type check
make test-cov       # Tests with coverage

email-v1 Contract

This server implements the Sidereal email-v1 domain contract — the same tool semantics as fastmail-blade-mcp. Skills targeting email-v1 work with either provider.

License

MIT

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

gmail_blade_mcp-0.3.0.tar.gz (119.4 kB view details)

Uploaded Source

Built Distribution

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

gmail_blade_mcp-0.3.0-py3-none-any.whl (24.7 kB view details)

Uploaded Python 3

File details

Details for the file gmail_blade_mcp-0.3.0.tar.gz.

File metadata

  • Download URL: gmail_blade_mcp-0.3.0.tar.gz
  • Upload date:
  • Size: 119.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gmail_blade_mcp-0.3.0.tar.gz
Algorithm Hash digest
SHA256 02b6eefbb686fa79431f8897e201160edfdb115f83370439ff733bf8d29f2ae0
MD5 7c208373777720fd0eb5dfb15535aa74
BLAKE2b-256 e93224248bf43097f4937886444b7386268587d29aa9d5c847d4872155158e1e

See more details on using hashes here.

Provenance

The following attestation bundles were made for gmail_blade_mcp-0.3.0.tar.gz:

Publisher: publish.yml on Groupthink-dev/gmail-blade-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gmail_blade_mcp-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: gmail_blade_mcp-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 24.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gmail_blade_mcp-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 52f695bdd28d581022384f4be4f9c5fc784a97e3d86cbf9ce7527b6553624967
MD5 e2830cd2c9640d9d75ad87be6e025ae4
BLAKE2b-256 2cf8bb0f4c3ac3036358c92b5758cba96cf3b6b9849b5ceb725e24fdbb795da0

See more details on using hashes here.

Provenance

The following attestation bundles were made for gmail_blade_mcp-0.3.0-py3-none-any.whl:

Publisher: publish.yml on Groupthink-dev/gmail-blade-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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