google-mail-mcp
Provides tools for reading and managing Gmail messages, threads, drafts, labels, filters, settings, and attachments, as well as sending drafts and performing trash or permanent deletion operations when enabled.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@google-mail-mcpFind the latest email from my manager about the project."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
google-mail-mcp
Gmail as MCP tools. Read your mail without letting it read your assistant.
A single Go binary that speaks MCP over stdio. It runs as a subprocess of your client, on your own machine, against your own Google account. There is no server to host and no service account: you create a Google OAuth client, log in once, and the refresh token stays in your OS keyring.
It works inside a mailbox. A calendar invitation's event, a linked Drive file and a Chat space belong to servers built on those APIs.
Why google-mail-mcp
Every message was written by somebody other than you, and some of it is written to steer an AI assistant. So mail comes back inside blocks marked with a per-call boundary token; text a reader of the mail would not have seen — hidden styles, zero-width characters, text colored like its background — is removed and counted; nothing a message links to or embeds is fetched; and a link whose text names a different site from its target is flagged.
The writes that would make a persuaded assistant dangerous are not there. Forwarding, filters that forward and delegation are not implemented. Sending is not registered unless you turn it on, and then only a draft can be sent. Removal is trash; permanent deletion is not registered unless you turn it on, and is the only thing that asks Google for full mail access.
Reads are bounded. A thread comes back newest first within a character budget, with quoted replies and signatures collapsed to a line saying how much was hidden, and every omission says how to continue. Non-ASCII subjects, names and filenames decode in any charset.
Related MCP server: Gmail MCP Server
Install
go install github.com/mmedum/google-mail-mcp/cmd/google-mail-mcp@latestOr take an archive from the latest release — Linux, macOS and Windows, on amd64 and arm64 — and verify it before you run it:
sha256sum -c checksums.txt --ignore-missing
# The checksum file is signed with a keyless Sigstore certificate tied to
# the release workflow's identity.
cosign verify-blob checksums.txt \
--bundle checksums.txt.bundle \
--certificate-identity-regexp 'https://github\.com/mmedum/google-mail-mcp/' \
--certificate-oidc-issuer https://token.actions.githubusercontent.com
# And the archive itself carries build provenance.
gh attestation verify google-mail-mcp_*.tar.gz --repo mmedum/google-mail-mcpEvery archive ships an SBOM. Builds are reproducible: rebuilding a tag gives the same bytes.
Claude Desktop
Every release also carries a .mcpb bundle. Open it and Claude Desktop
installs the server and asks for your OAuth client JSON. It covers macOS,
Windows and Linux on both architectures. Its SHA-256 is in the same signed
checksums.txt.
The bundle does not log you in. Install the binary as well, run
google-mail-mcp login --client-secret <your client JSON> once, and the
bundle uses the same credentials.
Set up Google
docs/gcp-setup.md has the whole of it: a Cloud
project with the Gmail API enabled, a consent screen, the scopes for how
you will run the server, and a Desktop app OAuth client. Then:
google-mail-mcp login --client-secret ~/path/to/client_secret.json
google-mail-mcp doctorEvery Gmail scope that reads mail is one Google calls restricted. For your
own use that costs nothing, but an External client in Testing gets refresh
tokens that expire after seven days; docs/runbook.md says what that
looks like.
Logging in over SSH
The callback goes to the remote host's loopback address while your
browser is local, so forward the port. Run
google-mail-mcp login --no-browser: it prints the authorization URL and
the exact ssh -L line for the port it picked. Run that line in a second
local terminal, then open the URL locally.
Connect a client
Claude Code:
claude mcp add google-mail -- google-mail-mcpOr, in a client config file:
{
"mcpServers": {
"google-mail": {
"command": "google-mail-mcp"
}
}
}Every setting is a GMAIL_* environment variable, listed in
docs/configuration.md. The ones worth knowing
now: GMAIL_READ_ONLY=true registers only the read tools and asks for
read-only access; GMAIL_LOCAL_DIR is the one directory attachments may
be saved to; GMAIL_PROFILE lets one machine hold several accounts.
Tools
Tool | What it does |
| The signed-in account, its totals and the current history id |
| Find conversations with a Gmail search |
| Find single messages with a Gmail search |
| Read a conversation, newest first, within a budget |
| Read one message, by id or by its |
| Every label, optionally with counts |
| Unsent drafts |
| Read one draft |
| What changed since a history id, and when that cursor has expired |
| Forwarding, vacation reply, send-as addresses, IMAP and POP, read-only |
| The account's filters, with any that forward mail flagged |
| Save an attachment into |
| Save a new draft or a reply, threaded by the server; nothing is sent |
| Change only the fields given, refusing a draft that changed since it was read |
| Delete a draft for good, with |
| Add and remove labels on up to 100 messages or threads, reported per item |
| Move up to 100 messages or threads to the trash, kept 30 days |
| Take messages or threads out of the trash |
| Create a user label |
| Rename a user label or change how it shows |
| Send a draft, naming every recipient not already in the thread; only with |
| Delete up to 100 messages or threads for good, with |
| Delete a user label, with |
Searches take Gmail's own search language in q, plus after and
before as real instants — Gmail reads a date written inside q as
midnight Pacific time. Every result states the quota it spent. Every
write takes dry_run, names what it touches by id, and says what it
changed, read from Gmail's answer. GMAIL_READ_ONLY=true leaves the
writes out. The last three tools are not registered at all unless their
setting is on.
For clients that attach rather than call, gmail://threads/{id},
gmail://messages/{id} and gmail://labels carry the same text as
get_thread, get_message and list_labels.
Safety
Mail is data. It arrives marked, with what was hidden removed and counted, and no tool description tells a model to act on it.
Nothing reaches another person by default. Drafts wait in Gmail to be sent, and none of the tools changes a setting. Forwarding and filters are shown, never set.
Sending is opt-in and goes through a draft. With
GMAIL_ENABLE_SEND=true,send_draftsends a draft exactly as it is stored. Every recipient not already in the thread must be written out inconfirm_recipients, and a send Gmail does not confirm is never repeated.Removal is trash. Gmail keeps trashed mail for 30 days, and
restorebrings it back. By default the only permanent removal isdelete_draft, which needsconfirm: true.delete_permanentlyanddelete_labelexist only withGMAIL_ENABLE_DESTRUCTIVE=true, which also asks for the one scope that can delete; each call needsconfirm: true.Files go to one directory.
download_attachmentwrites only intoGMAIL_LOCAL_DIR, under a name made safe, and never over an existing file.Logs never carry mail. No address, subject, body, label name or query; ids are cut to six characters. A test drives every tool with marker values and fails if one reaches a log, which is what makes a debug log safe to paste.
Everything above is enforced in the server. Tool annotations are set, but they are hints a client may ignore.
docs/security.md has the whole of it.
Getting help
Run google-mail-mcp doctor first: it checks the client JSON, the token,
the granted scopes and whether the Gmail API is enabled, and names what
is missing. docs/runbook.md covers the common
surprises. Then open an issue with doctor's output and the version.
Do not paste a tool result: it is mail, and carries other people's
words and addresses.
Versioning
Semantic versioning. The tool names and their output fields are the
public contract; CHANGELOG.md marks anything you have
to act on as Breaking.
Development
make checkThat is what CI runs. docs/development.md says
what each gate holds and how the live driver works.
Documentation
docs/README.md is the index. The design, the platform
facts behind it and a verdict on every Gmail API method are in
docs/architecture.md.
Contributing
See CONTRIBUTING.md.
Security
Report a vulnerability through a private advisory; see
SECURITY.md.
Code of conduct
License
This server cannot be deployed
Maintenance
Related MCP Connectors
Manage Gmail end-to-end: search, read, send, draft, label, and organize threads. Automate workflow…
Manage Gmail messages, threads, labels, drafts, and settings from your workflows. Send and organiz…
Email inboxes and calendars for AI agents: send, receive, search, draft and schedule.
Email inboxes and calendars for AI agents: send, receive, search, draft and schedule.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables interaction with Gmail through the Gmail API with OAuth2 authentication. Supports reading, sending, searching emails, and managing read status through natural language.-
- AlicenseNot gradedqualityNot gradedmaintenanceEnables AI assistants to interact with Gmail through natural language, supporting email sending/reading, searching, draft management, label organization, and batch operations with secure OAuth authentication.-
- FlicenseNot gradedqualityNot gradedmaintenanceEnables interaction with Gmail through the Gmail API, allowing users to list, read, search emails, create and send drafts, and get email summaries through natural language commands with OAuth2 authentication.-
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to manage Gmail accounts through natural language for tasks like sending, reading, searching, and organizing emails. It supports advanced features including draft management, label operations, and batch actions via secure OAuth 2.0 authentication.MIT