MCP Directory

Gmail MCP Server (GongRzhe)

Gmail MCP with auto OAuth: send, search, label and manage email

Verified
stdio (local)
OAuth
TypeScript

Add to your client

Copy the config for your MCP client and paste it into its config file.

Install / run
npx -y @gongrzhe/server-gmail-autoauth-mcp

Paste into ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "gmail-mcp-server-gongrzhe": {
      "command": "npx",
      "args": [
        "-y",
        "@gongrzhe/server-gmail-autoauth-mcp"
      ]
    }
  }
}

Before you start

  • Node.js installed (run via npx, no global install required)
  • A Google Cloud project with the Gmail API enabled
  • OAuth 2.0 client credentials (Desktop app type recommended) downloaded as gcp-oauth.keys.json from Google Cloud Console > APIs & Services > Credentials
  • For Web-app credential type: add the redirect URI http://localhost:3000/oauth2callback
  • The OAuth keys file placed in the working directory or in ~/.gmail-mcp/

About Gmail MCP Server (GongRzhe)

Gmail MCP Server is a community-built Node.js server that gives MCP clients (Claude Desktop, Cursor, and others) full programmatic control over a Gmail account through the official Gmail API. Its headline feature is automatic OAuth2 handling: on first run it opens a browser, walks you through Google sign-in, and caches the resulting token, so you don't have to wire up auth flows yourself.

Beyond sending and reading, it covers the operational surface of Gmail: searching with native Gmail query syntax (e.g. from:alice has:attachment newer_than:7d), creating and editing drafts, downloading attachments, full label management, batch operations across many messages at once, and Gmail filter creation including reusable filter templates.

It supports HTML and multipart messages and international (non-ASCII) characters, making it suitable for real outbound email rather than just plain-text notes. It's installable in one line via npx or Smithery and runs locally over stdio.

Tools & capabilities (12)

send_email

Send an email, with HTML/multipart and attachment support

draft_email

Create a draft message without sending it

read_email

Read the full content of a specific message by ID

search_emails

Search the mailbox using native Gmail query syntax

modify_email

Add or remove labels / change the state of a message

delete_email

Permanently delete a message

download_attachment

Download an attachment from a message

batch_modify_emails

Apply label/state changes to many messages at once

batch_delete_emails

Delete many messages in a single operation

list_email_labels / create_label / update_label / delete_label / get_or_create_label

Full label CRUD and idempotent get-or-create

create_filter / list_filters / get_filter / delete_filter

Manage Gmail filters programmatically

create_filter_from_template

Create a filter from a reusable template

When to use it

  • Use it when you want an AI assistant to triage your inbox — search, label, archive, and batch-clean messages by query
  • Use it to draft and send real emails (HTML, attachments, international characters) from inside Claude or Cursor
  • Use it to automate label and filter setup so incoming mail is sorted without manual rules
  • Use it when you need to pull attachments out of specific threads programmatically
  • Use it for bulk inbox cleanup via batch modify/delete across hundreds of messages

Quick setup

  1. 1Enable the Gmail API in a Google Cloud project and download OAuth credentials as gcp-oauth.keys.json
  2. 2Place gcp-oauth.keys.json in your working directory or ~/.gmail-mcp/
  3. 3Run `npx @gongrzhe/server-gmail-autoauth-mcp auth` and complete the browser sign-in to cache your token
  4. 4Add the server to your MCP client config (command: npx, args: ['@gongrzhe/server-gmail-autoauth-mcp'])
  5. 5Restart Claude Desktop / Cursor and verify with a search_emails or send_email call

Security notes

Requires Google OAuth client credentials and stores access/refresh tokens in plaintext under ~/.gmail-mcp/ — protect that directory. The upstream repo is archived (read-only since March 2026), so evaluate a maintained fork if you need security updates.

Gmail MCP Server (GongRzhe) FAQ

Do I have to set up OAuth manually?

You provide the Google OAuth client credentials file, but the server handles the token exchange automatically — running the `auth` command opens a browser, you sign in once, and the token is cached for reuse.

Does it work outside Claude Desktop?

Yes. It speaks MCP over stdio, so any MCP-compatible client (Cursor, etc.) works; the README also documents a Smithery one-line install for Claude.

Where do I get the credentials and is it free?

Create OAuth 2.0 credentials in Google Cloud Console with the Gmail API enabled. Google Cloud and the Gmail API are free within normal personal usage quotas; this server itself is free and MIT-licensed.

Why does sending fail with an auth/scope error?

Re-run the `auth` command to refresh the token and confirm the OAuth consent screen granted Gmail send/modify scopes; for Web-type credentials make sure http://localhost:3000/oauth2callback is an authorized redirect URI.

Can it search like the Gmail web UI?

Yes — search_emails accepts native Gmail query operators such as from:, subject:, has:attachment, and newer_than:.

Alternatives to Gmail MCP Server (GongRzhe)

Connect your personal WhatsApp: search, read and send messages and media locally

Verified
stdio (local)
No auth
Python
12 tools
Updated 26 days agoRepo

Powerful Slack MCP with stdio/SSE/HTTP, DMs, group DMs and no-admin token auth

Verified
stdio (local)
API key
Go
12 tools
Updated 1 month agoRepo

Full Telegram user-account MCP via MTProto: read chats, manage groups, send messages

Verified
stdio (local)
API key
Python
11 tools
Updated 7 days agoRepo