gmail-mcp
Search, read, and create draft emails in Gmail with whitelisted query filters and optional recipient restrictions.
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 inbox for unread emails"
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 reading Gmail and creating drafts via AI assistants (Claude, OpenClaw, etc.).
Security model:
π Read-only by default β no send capability, ever
π Drafts only β human must open Gmail and send manually
π Query whitelist β only configured filter queries are allowed
π€ Optional recipient whitelist for drafts
π API key authentication for HTTP/SSE mode
Tools
Tool | Description |
| Show configured allowed search queries |
| Search Gmail (query must match a whitelisted filter) |
| Fetch full content of an email by ID |
| Create a draft β NOT sent, human reviews in Gmail |
Related MCP server: Gmail MCP Server
Setup
1. Google Cloud credentials
Go to Google Cloud Console
Create a project β Enable Gmail API
Create OAuth2 credentials (Desktop app type)
Download as
credentials.jsonand place in the project folder
2. Install
git clone https://github.com/mortenv/gmail-mcp
cd gmail-mcp
pip install -e .
# or with uv:
uv sync3. Configure
cp config.example.yaml config.yamlEdit config.yaml:
Add your filter queries (Gmail search syntax)
Optionally restrict draft recipients
4. Authenticate
First run opens a browser for OAuth2 login:
gmail-mcp config.yamlToken is cached in token.json β subsequent runs don't need the browser.
5. Connect to Claude / OpenClaw
stdio mode (local):
{
"mcpServers": {
"gmail": {
"command": "gmail-mcp",
"args": ["/path/to/config.yaml"]
}
}
}HTTP/SSE mode (remote server):
export GMAIL_MCP_API_KEY=$(python -c "import secrets; print(secrets.token_hex(32))")
gmail-mcp --http config.yaml{
"mcpServers": {
"gmail": {
"url": "https://your-server:8001/sse",
"headers": { "X-API-Key": "your-key" }
}
}
}Filter syntax
Uses standard Gmail search syntax:
filters:
- query: "label:inbox"
label: "Inbox"
- query: "from:boss@company.com"
label: "From boss"
- query: "label:invoices newer_than:30d"
label: "Recent invoices"The AI can narrow results by appending terms to a base query:
"label:inbox subject:urgent" β allowed if label:inbox is whitelisted.
Security notes
credentials.jsonandtoken.jsonare gitignored β never commit themOAuth scopes:
gmail.readonly+gmail.compose(nogmail.send)Drafts require human review β the server has no way to send email
License
MIT
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 Servers
- Alicense-quality-maintenanceEnables 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.Last updated
- Alicense-qualityDmaintenanceEnables AI assistants to manage Gmail by reading unread emails with automatic classification, creating AI-generated draft replies, and saving drafts directly to Gmail through the Gmail API.Last updated202MIT
- Alicense-qualityDmaintenanceEnables AI assistants to interact with Gmail through OAuth2 authentication, allowing users to list, search, read emails, and create drafts with a safety-first design that prevents accidental sends by default.Last updated202MIT
- Alicense-qualityFmaintenanceEnables AI assistants to search, read, and download attachments from Gmail using natural language, with read-only access.Last updatedMIT
Related MCP Connectors
Manage Gmail end-to-end: search, read, send, draft, label, and organize threads. Automate workflowβ¦
Governed email for AI agents (Mailbuttons / mbag.ai): sandbox inboxes, policy gate, audit log.
Authenticated email gateway for AI agents β per-agent inboxes, HITL approval, SPF/DKIM verified.
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/mortenv/gmail-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server