claude-gmail-connector
Provides tools for working with a private Gmail account: searching and reading messages and threads, listing labels and drafts, organizing mail (read/unread, star, archive, labels), creating and updating drafts, and preparing send or trash actions that require out-of-band confirmation.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
claude-gmail-connector
A remote MCP server that lets Claude work with one private Gmail account: search and read mail, organise it, prepare drafts, and send or trash messages only after you confirm in your browser. It runs on Cloudflare Workers (Free plan is enough) and is a personal, single-user tool.
Built and used by its author to manage a personal inbox from Claude. It is published as a reference implementation and a starting point. Read the security notes before connecting your own mailbox.
Why this design
Giving an AI assistant access to email is risky: an email can contain text that tries to give the model orders (prompt injection). This connector is built around that threat:
Single account. Login is rejected unless the verified Google account equals
GOOGLE_ALLOWED_EMAIL.Out-of-band confirmation. Sending, trashing and bulk changes (> 10 messages) are never executed on the model's word. The server returns a link; you open it, review a server-generated preview and type a separate passphrase. The model never has that passphrase, so nothing written in a chat or inside an email can replace it.
Drafts first. There is no "send directly" tool. Mail is sent only from a draft you can see in Gmail. The draft is fingerprinted (message id + SHA-256) at confirmation time and refused if it changed afterwards.
No deletion, no settings. No permanent delete, no filters, no forwarding rules, no
gmail.sendor full-mail scope.Email is untrusted data. The server instructs the model to treat message content as data, never as instructions.
Minimal data. No request or content logging; email bodies are never stored; pending confirmations keep a short preview for at most one hour; tokens are encrypted by the OAuth provider.
Strong consistency for confirmations. Pending actions live in a Durable Object (single-instance, serialised), not in KV, so a confirmation cannot be replayed or executed twice.
Details and the full capability and scope matrices: docs/architecture.md.
Related MCP server: Gmail MCP Server
Tools exposed to Claude
Area | Tools | Needs confirmation |
Diagnostics |
| no |
Read |
| no |
Organise |
| only above 10 messages |
Drafts |
| no |
Trash |
| always |
Send |
| always |
Quick start
You need: a Cloudflare account, a Google Cloud project, Node.js ≥ 24.
npm installGoogle Cloud: enable the Gmail API, create an OAuth client (type Web application) and add the redirect URI
https://private-google-mcp.<your-subdomain>.workers.dev/callback. Declared scopes:openid email,gmail.readonly,gmail.modify.cp wrangler.example.jsonc wrangler.jsoncand fill in your URL, client ID and a KV namespace (npx wrangler kv namespace create OAUTH_KV).Set the secrets, each typed by you in a terminal (never paste them in a chat):
npx wrangler secret put GATE1_PASSPHRASE # protects the OAuth consent page npx wrangler secret put CONFIRM_PASSPHRASE # protects confirmations; must differ from the one above npx wrangler secret put GOOGLE_CLIENT_SECRET npx wrangler secret put GOOGLE_ALLOWED_EMAIL # the only account allowed to log innpm run typecheck && npm test, thennpm run deploy.In Claude, add a custom connector with the URL
https://private-google-mcp.<your-subdomain>.workers.dev/mcpand sign in. Check with thewhoamitool.
After a deploy: /mcp without a token must answer 401, and /debug must answer 404.
Development
Command | What it does |
| unit and in-memory MCP integration tests (dummy data only) |
| TypeScript check |
| local Worker on |
| local end-to-end check of discovery, client registration, consent, passphrase and negative cases. Start the Worker first in another terminal: |
Known limitations
The Google OAuth app stays "unverified" unless you go through Google's review: Google shows a warning at consent.
Google can revoke the refresh token (manual revoke, six months of inactivity, password change); reconnect the connector.
The MCP connection expires after 30 days without a token refresh.
Trashing whole conversations: the rollback after an error un-trashes every message in that conversation.
The confirmation preview for a send shows the draft's text part. If a draft also carries an HTML part, the two could in theory differ in meaning; always read the draft in Gmail before confirming. Hardening idea: show the HTML-derived text too.
The limit of 5 wrong passphrases applies per pending action. Guessing needs the secret confirmation link (256-bit id) and the passphrase; a global lockout counter would be a sensible hardening.
The source code, comments, test names and the confirmation page are written in Italian (the author's language); documentation is in English. Translations of the code are welcome as pull requests.
Security
Report vulnerabilities privately, see SECURITY.md.
License
MIT.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Connect any IMAP/SMTP mailbox to Claude & ChatGPT: search, read, sort, draft. Sends only with OK.
Connect any mailbox to Claude, ChatGPT & AI: read, send, reply, schedule & search emails.
Manage Gmail end-to-end: search, read, send, draft, label, and organize threads. Automate workflow…
Read and search FranklyMail email and prepare drafts, replies, and forwards for human approval.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables reading, sending, searching, and managing Gmail through Claude using the official Google Gmail API.98 npm3MIT
- AlicenseNot gradedqualityCmaintenanceEnables Claude to read, search, send, label, and trash emails in any Gmail account via Google's Gmail API, using OAuth2 authentication with automatic token refresh.67 npmMIT
- FlicenseNot gradedqualityDmaintenanceProvides Claude with Gmail capabilities including sending emails, managing drafts, and searching messages.-
- AlicenseNot gradedqualityDmaintenanceEnables Claude to read, search, send, and manage Gmail messages and threads through natural language.283 npmMIT