SuperAPIAI Directory

mcp-google-gmail

github.com · AI developer platforms

Gmail API: search, read and send email, and manage drafts, labels and the trash.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsmacOS · Linux

About this tool

A1 Gmail MCP is an MCP (Model Context Protocol) server used to connect to the Gmail API, allowing AI applications to operate Gmail mailboxes using natural language. It is aimed at MCP-capable AI clients such as Claude, Cursor, and Codex.

Purpose

The server lets AI assistants search and read emails, prepare reply drafts, send when ready, organize labels, and use trash instead of permanent deletion. It works with your Google account through the Gmail API and clearly distinguishes editable drafts from irreversible sent emails, while clearly stating the limitations of the Gmail API rather than implying that all email tasks are reversible.

Main capabilities

  • Provides 24 tools, covering searching and reading emails and conversations, sending emails directly or via drafts, managing the draft lifecycle, labels, and trash.
  • Connect from the conversation: say "connect Gmail", and the server will guide you through OAuth client setup, capture the Google redirect on 127.0.0.1 via PKCE, and save the token itself—no configuration file, no restart.
  • Careful sending: the draft → review → send path is a first-class citizen; sending is marked as destructive, and the server will not resend after an uncertain failure—emails cannot be recalled.
  • Trash as a safety net: deleting emails goes through reversible trash (about 30 days); there is deliberately no tool for permanently deleting emails.
  • Bounded reading: decoded bodies are truncated at explicit limits, and attachments are returned as metadata, so long emails do not silently flood the conversation.
  • Minimal Google scopes: only gmail.modify is used—no permanent deletion, and no access to Gmail settings.

Usage

Requires Node.js 20+ and a Google account. No credentials are needed at install time—the server connects from the conversation.

Add the server to your AI application:

  • In the application: open Settings → MCP servers, choose Add server, choose STDIO, enter the command npx -y mcp-google-gmail@latest and the environment variables GOOGLE_GMAIL_CLIENT_ID, GOOGLE_GMAIL_CLIENT_SECRET, GOOGLE_GMAIL_REFRESH_TOKEN, then choose Save and Restart.
  • From the command line: refer to the Codex MCP documentation and the Claude Code MCP documentation.
  • Claude Desktop: the current official path is Settings → Extensions. For custom desktop extensions, open Advanced settings → Extension Developer → Install Extension…, choose the .mcpb file, and follow the prompts. This repository currently publishes an npm stdio package and does not include a .mcpb bundle. For Claude Desktop builds that still support local configuration, you can use a JSON stdio configuration as a fallback, saved to ~/Library/Application Support/Claude/claude_desktop_config.json on macOS or %APPDATA%\Claude\claude_desktop_config.json on Windows.
  • Cursor: add to ~/.cursor/mcp.json on macOS/Linux or %USERPROFILE%.cursor\mcp.json on Windows.
  • VS Code: run MCP: Open User Configuration and add the configuration, and check with MCP: List Servers.

Connection method:

  • Connect from chat (recommended): say "connect Gmail", and the assistant will run the flow: setup_instructions prints a checklist; download the OAuth client JSON and give the assistant the path, and set_client stores it with owner-only permissions; start_login returns a Google consent link, open it on the local machine and approve, and the code returns to a one-time listener on 127.0.0.1 (PKCE); finish_login exchanges the code and saves the token to ~/.config/mcp-google-gmail/credentials.json (mode 0600), and verifies it with a real Gmail API call. The token is re-read on every call, so the connection takes effect immediately without restarting the AI app. auth_status shows the connection status, and logout revokes and deletes it.
  • Environment variables (CI, unattended installation): create or select a Google Cloud project and enable the Gmail API; configure the OAuth consent screen and create a desktop app OAuth client; authorize the Google account to connect; request scopes https://www.googleapis.com/auth/gmail.modify。测试模式 OAuth refresh tokens may expire after seven days; for long-term access, publish the OAuth app or use an internal app in a Workspace domain. Every variable is optional—without them, the server connects from chat.

Use cases

  • Triage inbox: show unread emails from the past seven days grouped by sender; find and summarize the conversation with Acme about the contract; view emails with attachments.
  • Compose and send email: draft replies in the session; show drafts, polish the wording, then send; send a brief status email and cc the manager.
  • Organize the mailbox: create and apply labels; mark this week's newsletters as read and archive them; move a conversation to trash and restore it if you change your mind.

Limitations

  • Sent email is externally irreversible. After a timeout or 5xx error, the server does not resend; search in:sent before retrying, because replaying a send causes duplicate sends.
  • Deleting an email or conversation means moving it to trash. manage_trash is reversible for about 30 days; there is deliberately no permanent delete tool.
  • Drafts are the exception: update_draft replaces the entire draft (the API has no partial editing), and delete_draft is permanent because drafts skip the trash.
  • Each call acts on only one mailbox—the account that granted the token. Decoded bodies are truncated at a configurable limit with an explicit flag, and attachments return metadata only; attachment content must be deliberately fetched via raw_request.
  • The AI client controls confirmation prompts. The server marks read, write, and destructive tools so the client can distinguish inspection from actual changes.
  • Google Gmail requires OAuth 2.0; an API key is not enough.
  • Quota: Gmail allows about 250 quota units per user per second; sending consumes 100 units, and a typical read consumes 5 units. Consumer accounts can send about 500 emails per day, and Workspace accounts about 2,000. On 429, the server uses backoff; reads also retry after network and 5xx errors, while sends and other writes are never replayed after an uncertain failure.
  • There is no background polling. The server runs only when called. If the AI app supports scheduled tasks, it can check the inbox periodically; raw_request can also access history.list for incremental sync.
  • Anonymous telemetry includes installation ID, package version, AI client and platform version, and tool names—never OAuth tokens, email content, tool parameters, orprompts. Set ASKADS_TELEMETRY=0 to opt out.
Up/Down to navigate · Enter to open · ESC to closeBrowse all tools