gmail-mcp
This server provides Gmail and Google Drive integration through three tools:
send_email: Send emails from your configured Gmail account to recipients viato,cc, andbccfields (comma-separated), with plain text or HTML body support. Returns the Gmail message ID and thread ID on success.search_emails: Search your Gmail using standard query syntax (e.g.,has:attachment from:bob newer_than:7d), returning message summaries (ID, sender, recipient, subject, date, snippet) and attachment metadata (attachment ID, filename, MIME type, size). Configurable result limit (default: 10).download_attachment: Download a specific email attachment (identified bymessage_idplus optionalfilenameorattachment_id) and upload it directly to a Google Drive folder (default:Gmail Attachments, auto-created if absent). Returns the Drive file ID, name, and shareable web view link.
Allows sending emails from Gmail/Workspace address with support for HTML, cc/bcc, searching Gmail with advanced queries, and downloading attachments.
Uploads downloaded email attachments to a Google Drive folder, returning the Drive link.
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-mcpSearch my Gmail for unread emails from last week."
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
A local stdio MCP server that gives your local Claude clients these Gmail tools:
Tool | What it does |
| Send mail from your Gmail/Workspace address (plain or HTML, cc/bcc). Every send is logged. |
| Search Gmail ( |
| Pull an attachment from a message and upload it to your Google Drive, returning the Drive link. |
| Pull an attachment from a message and save it to a local directory ( |
Design
Local stdio — no public endpoint, no OAuth-for-callers, no server to host. Runs as a subprocess of your Claude client.
Single Google account for both Gmail and Drive.
Least-privilege scopes —
gmail.send,gmail.readonly,drive.file(the app only ever sees Drive files it created).Credentials in AWS SSM — the refresh token lives in an SSM SecureString and is fetched at launch; nothing is written to disk. Requires AWS credentials at runtime (e.g. an
AWS_PROFILE).Attachments upload into a Drive folder named
Gmail Attachmentsby default (created on first use; override per call with thedrive_folderargument).
Related MCP server: Gmail Local MCP
Prerequisites
uv(manages Python 3.12 + deps).AWS credentials with read/write access to the SSM parameter (any standard method —
AWS_PROFILE, env vars, instance role). A region from your AWS config, envAWS_REGION, orGMAIL_MCP_AWS_REGION.A Google Cloud project with the Gmail API and Google Drive API enabled (Console → APIs & Services → Library).
A Google OAuth client of type "Desktop app" — download its
client_secret.json(Console → APIs & Services → Credentials).
One-time setup: mint the token
Runs a browser consent for the three scopes and stores the credentials in SSM
(default param /gmail-mcp/authorized-user-json).
cd /path/to/gmail-mcp
# Using a downloaded Desktop client_secret.json:
AWS_PROFILE=<your-aws-profile> \
uv run python scripts/mint_token.py --client-secrets-file /path/to/client_secret.json
# ...or reuse an existing Google token already in SSM (its client_id/secret):
AWS_PROFILE=<your-aws-profile> \
uv run python scripts/mint_token.py --client-secrets-ssm-param /path/to/existing-tokenA browser window opens — approve access for the intended account. On success the token is written to SSM and the server can run.
Register with your Claude client(s)
Replace /path/to/gmail-mcp and <your-aws-profile> with your values.
Claude Code
claude mcp add gmail-mcp -s user \
-e AWS_PROFILE=<your-aws-profile> \
-- uv run --directory /path/to/gmail-mcp gmail-mcpClaude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):
{
"mcpServers": {
"gmail-mcp": {
"command": "uv",
"args": ["run", "--directory", "/path/to/gmail-mcp", "gmail-mcp"],
"env": { "AWS_PROFILE": "<your-aws-profile>" }
}
}
}Restart Claude Desktop after editing. The three tools appear under the gmail-mcp server.
Usage examples (things to ask Claude)
"Email alice@example.com with the subject 'Lunch?' and body 'Free tomorrow at 1?'"
"Search my Gmail for emails with attachments from the last week."
"Download the PDF attached to that invoice email into my Drive."
Configuration
Variable | Default | Purpose |
| — | AWS credentials used to read the token from SSM |
| standard AWS config | Region of the SSM parameter |
|
| SSM param holding the credentials JSON |
|
| Destination Drive folder for downloads |
Security
The server can send mail as you. Every send is logged (recipients, subject, timestamp). There is no recipient allowlist by default; treat the tool as injection-sensitive.
The refresh token never touches disk — only an SSM SecureString, fetched in-memory at launch.
Scopes are least-privilege: read Gmail, send Gmail, and Drive access limited to app-created files.
Development
uv sync
uv run pytest # unit tests (all mocked; no live Google/AWS calls)
uv run ruff check . # lintLayout: src/gmail_mcp/ — auth.py (SSM→credentials), gmail_client.py (send/search/attachments),
drive_client.py (folder + upload), attachments.py (orchestration), server.py (FastMCP wiring),
bootstrap.py (token mint).
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- 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/Warrenn/gmail-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server