Featured

Deploy OpenClaw in 60 seconds — 20% off logoDeploy OpenClaw in 60 seconds — 20% off

Launch OpenClaw on Hostinger in about 60 seconds and keep your agent live 24/7. Our referral link gives you 20% off, no coupon code needed.

Launch on Hostinger
Run your Hermes agent on Hostinger, fully managed logoRun your Hermes agent on Hostinger, fully managed

Launch Hermes on Hostinger in one click, fully managed, no VPS knowledge needed. Use code ZACAARON10 for 10% off.

Launch on Hostinger
Crawl and scrape any site into clean data, 10% off logoCrawl and scrape any site into clean data, 10% off

Firecrawl crawls and scrapes any site into clean markdown for your agent. Get 1,000 free credits, and new users get 10% off their first purchase.

Try Firecrawl free
Your own AI agent, running 24/7 with QwikClaw logoYour own AI agent, running 24/7 with QwikClaw

QwikClaw sets up and runs an always-on OpenClaw agent for you. One click, no config files, no server setup.

Deploy now
One API to scrape, enrich, and extract the internet. logoOne API to scrape, enrich, and extract the internet.

Context.dev gives your agents a single API to scrape, enrich, and extract live web data — no proxies, no parsers, no maintenance.

Start building free
SetupClaw: done-for-you OpenClaw for founders & exec teams logoSetupClaw: done-for-you OpenClaw for founders & exec teams

White-glove OpenClaw for founders and exec teams (4–50+ employees): we install, harden, integrate your tools, and maintain it — secured from day one.

Get it set up for you
SEO data APIs for your agent, $1 free credit logoSEO data APIs for your agent, $1 free credit

DataForSEO gives your agent live access to SERP results, keyword data, backlinks, and on-page SEO data through one API. New accounts get a $1 credit, good for up to 20,000 keyword or backlink lookups.

Try DataForSEO free
Reach 47,000+ AI builders

A flat monthly placement in front of developers actively installing AI tools. No lock-in, cancel anytime.

Advertise here

Works with

Claude CodeClaude DesktopCursorVS CodeClineCodex CLIOpenClaw+ any MCP client

Install to Claude Code

This server doesn't publish a one-line install command. Follow the setup in the source repository.

Summary

Enables AI assistants to read Gmail and create drafts securely with read-only access and query whitelisting.

README.md

gmail-mcp

MCP server for reading Gmail and creating drafts via AI assistants (Claude, OpenClaw, etc.).

Security model:

  • 🔒 Read-only by default — no send capability, ever
  • 📋 Drafts only — human must open Gmail and send manually
  • 🔍 Query whitelist — only configured filter queries are allowed
  • 👤 Optional recipient whitelist for drafts
  • 🔑 API key authentication for HTTP/SSE mode

Tools

| Tool | Description | |------|-------------| | list_filters | Show configured allowed search queries | | search_email | Search Gmail (query must match a whitelisted filter) | | get_email | Fetch full content of an email by ID | | create_draft | Create a draft — NOT sent, human reviews in Gmail |

Setup

1. Google Cloud credentials

  1. Go to Google Cloud Console
  2. Create a project → Enable Gmail API
  3. Create OAuth2 credentials (Desktop app type)
  4. Download as credentials.json and place in the project folder

2. Install

git clone https://github.com/mortenv/gmail-mcp
cd gmail-mcp
pip install -e .
# or with uv:
uv sync

3. Configure

cp config.example.yaml config.yaml

Edit config.yaml:

  • Add your filter queries (Gmail search syntax)
  • Optionally restrict draft recipients

4. Authenticate

First run opens a browser for OAuth2 login:

gmail-mcp config.yaml

Token is cached in token.json — subsequent runs don't need the browser.

5. Connect to Claude / OpenClaw

stdio mode (local): ``json { "mcpServers": { "gmail": { "command": "gmail-mcp", "args": ["/path/to/config.yaml"] } } } ``

HTTP/SSE mode (remote server): ``bash export GMAIL_MCP_API_KEY=$(python -c "import secrets; print(secrets.token_hex(32))") gmail-mcp --http config.yaml ``

{
  "mcpServers": {
    "gmail": {
      "url": "https://your-server:8001/sse",
      "headers": { "X-API-Key": "your-key" }
    }
  }
}

Filter syntax

Uses standard Gmail search syntax:

filters:
  - query: "label:inbox"
    label: "Inbox"
  - query: "from:boss@company.com"
    label: "From boss"
  - query: "label:invoices newer_than:30d"
    label: "Recent invoices"

The AI can narrow results by appending terms to a base query: "label:inbox subject:urgent" — allowed if label:inbox is whitelisted.

Security notes

  • credentials.json and token.json are gitignored — never commit them
  • OAuth scopes: gmail.readonly + gmail.compose (no gmail.send)
  • Drafts require human review — the server has no way to send email

License

MIT

See related servers & alternatives →

Related MCP servers

Browse all →

Related guides

Hand-picked reading to help you choose and use Communication servers.