gmail-mcp
Provides full read/write access to Gmail, including search, send, reply, drafts, labels, filters, vacation responder, auto-forwarding, signature, and attachment handling (download and render to PDF).
Click on "Install 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., "@gmail-mcpsend a reply to the last email from Jane"
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.
gmail-mcp
MCP server for Gmail with full read/write coverage: search, send, reply, drafts, labels, filters, vacation responder, auto-forwarding, signature, and attachment handling (download + render to PDF).
Built because the commonly available Gmail MCP integrations are read/label-only (no sending, no attachment export, no settings management). This one closes that gap using the standard Gmail API with your own OAuth client.
Why it's safe by design
The OAuth scope used is gmail.modify, not the full https://mail.google.com/
scope. This means the Gmail API itself rejects permanent delete
(messages.delete, batchDelete, threads.delete) — the only "removal" tool
is trash/untrash, which is reversible.
Related MCP server: Gmail MCP Server
Tools (41)
Read / search
Tool | What it does |
| Account email and message/thread totals |
| Search with Gmail query syntax ( |
| Parsed message: from/to/cc/subject/date/body/labels/attachments |
| Full thread with all messages parsed |
| Real attachment metadata for a message (with |
| Download an attachment to disk |
| Render a message (HTML + inline images resolved) to PDF via WeasyPrint |
| Same, for a full thread (one message per page) |
Send / reply (require confirmed=True)
Tool | What it does |
| Send a new email (text/HTML, attachments) |
| Reply within a thread, auto-generating |
Drafts
Tool | What it does |
| List and read drafts |
| Manage drafts |
| Send an existing draft ( |
Labels
Tool | What it does |
| Label management |
| Delete a label ( |
| Add/remove labels on a message or full thread |
Organization (trash only, reversible)
Tool | What it does |
| Move to trash / restore |
| Change labels on several messages at once |
Incremental sync
Tool | What it does |
| Delta of changes since a |
Mailbox delegation
Tool | What it does |
| Accounts with delegated access to this mailbox |
| Grants full delegated access (read/send/manage) to another Google account. |
| Revokes delegated access ( |
⚠️ Requires domain-wide delegation. Verified live: on a regular Gmail/Workspace account without
that admin-level setup, these 3 tools return 403: Access restricted to service accounts that have been delegated domain-wide authority. Left implemented for accounts where it does apply.
Authorized forwarding addresses
Different from get_auto_forwarding/update_auto_forwarding below (which toggle forwarding to an
already-authorized address): these manage which addresses are allowed as a target in the first
place.
Tool | What it does |
| Authorized addresses (verified or pending) |
| Authorizes a new address — Google sends it a verification email. |
| Revokes an address's authorization ( |
Settings
Tool | What it does |
| Vacation auto-responder |
| Auto-forwarding ( |
| Filters ( |
| Send-as aliases and HTML signature ( |
Confirmation pattern
Tools that send mail, delete something, or change externally-visible settings
take confirmed: bool = False. Called without it, they return
{"requires_confirmation": true, ...} with a preview of what would happen —
the calling agent must show that preview to the user and only repeat the call
with confirmed=True after explicit approval. confirmed=True is a technical
flag, not a substitute for actually asking.
Security
Every tool ships with MCP Tool Annotations (
readOnlyHint,destructiveHint,idempotentHint,openWorldHint), so MCP clients can use them to decide whether to prompt for confirmation before running a tool.Execution errors propagate as real MCP protocol errors (
isError: true), not as a JSON payload that looks like a success with an"error"key buried inside — so the calling model actually sees the failure and can self-correct instead of silently treating it as a success.
Setup
Create a Google Cloud project (or reuse one) and enable the Gmail API.
Create an OAuth 2.0 Client ID of type "Desktop app" and download it as
client_secret.json.On the OAuth consent screen, add these scopes:
gmail.modify,gmail.settings.basic,gmail.settings.sharing.If the app is in "Testing" mode, add your own Google account as a test user.
Install dependencies:
python3 -m venv .venv source .venv/bin/activate pip install -r requirements.txt # weasyprint also needs a system package for PDF rendering: # macOS: brew install pango # Debian/Ubuntu: apt install libpango-1.0-0 libpangocairo-1.0-0Run the OAuth flow once per account:
CLIENT_SECRET_PATH=~/.config/gmail-mcp/client_secret.json \ TOKEN_OUT=~/.config/gmail-mcp/token.json \ python3 setup_auth.pyThis opens a browser — log in and grant access. Run it again with a different
TOKEN_OUTfor each additional Gmail account you want to expose as a separate MCP server instance.
MCP client configuration
{
"mcpServers": {
"gmail": {
"command": "/path/to/.venv/bin/python3",
"args": ["/path/to/gmail-mcp/server.py"],
"env": {
"GMAIL_TOKEN_PATH": "~/.config/gmail-mcp/token.json"
}
}
}
}To expose a second account, add another entry (e.g. gmail-work) pointing at
the same server.py with a different GMAIL_TOKEN_PATH.
Env var | Default | Purpose |
|
| Path to the OAuth token for this account |
Notes on usage (for the calling agent)
API quota: 6,000 units/user/minute.
messages.getcosts 20 units,messages.listcosts 5. Filter with Gmail'squerysyntax instead of fetching everything and filtering client-side.Use
get_threadinstead of Nget_messagecalls when you need a whole conversation.attachment_idis not stable across calls — always use the one from the same response you're about to calldownload_attachmentwith.Prefer
body_htmloverbody_textfor anything with lists, bold text or links — Gmail does not reflow plain text, so\nbecomes a hard line break.No automatic retry on 429 — back off manually if you hit a rate limit.
License
MIT — see LICENSE.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
No tool schema history has been recorded yet.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
A MCP server for Gmail that lets you search, read, and draft emails and replies.
Read, search, send, organize, draft and schedule email across your inboxes from any MCP client.
Email infrastructure for AI agents — send, receive, search, and reply to email over MCP.
MCP server for Nylas — read email, calendars, events and contacts, and send email or create events.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables interaction with Gmail through MCP-compatible clients to list, read, search, and send emails. It supports advanced features such as managing labels, handling threaded replies, and utilizing Gmail's native search syntax.492MIT
- AlicenseNot gradedqualityDmaintenanceEnables interaction with Gmail through the MCP protocol, supporting sending, reading, searching, replying, forwarding, managing drafts and labels, and saving attachments.153MIT
- AlicenseAqualityDmaintenanceGmail MCP server for searching, reading, and sending mail over MCP.159152MIT
- FlicenseNot gradedqualityCmaintenanceMCP server for email management that enables reading, searching, drafting, replying to, and sending emails with thread-aware replies and draft-first safety, supporting Gmail API and IMAP/SMTP backends.22-
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/YerayRodri/gmail-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server