gmail-mcp
Provides a comprehensive set of tools for managing Gmail accounts, including searching emails with Gmail query syntax, reading messages and threads, managing labels, and creating, sending, or replying to emails.
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., "@gmail-mcpsummarize my unread emails from the last 24 hours"
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
Minimal Gmail MCP server for Claude Code. Zero third-party code — only official Google and Anthropic libraries.
Tools
Tool | Description |
| Search with Gmail query syntax ( |
| Read full email by ID (headers + plain text body, HTML fallback) |
| Read all messages in a thread |
| Mark one or more emails as read |
| Mark one or more emails as unread |
| Send email (to, cc, bcc, subject, body) |
| Create draft without sending |
| Reply to a thread (supports reply-all) |
| List all labels with unread counts |
Related MCP server: gmail-mcp
Architecture
gmail-mcp/
├── server.py # FastMCP server — 9 tools, stdio transport
├── auth.py # OAuth2 flow + credential management
├── gmail_tools.py # Gmail API wrapper functions
├── requirements.txt # 3 dependencies (all official)
├── setup.sh # Create venv + install + first-time OAuth
├── .env.example # Template for OAuth credentials
└── .gitignoreTransport: stdio (standard for Claude Code MCPs)
Auth: OAuth2 with
gmail.modifyscope (covers read + modify + send)Multi-account: Two instances in
~/.claude.jsonwith different env varsToken storage:
~/.gmail-mcp/{email}.jsonper account,0600permissions
Setup
1. Google Cloud Console
Enable the Gmail API in your GCP project
Create an OAuth 2.0 Client ID (Desktop application)
Add
https://www.googleapis.com/auth/gmail.modifyto allowed scopes
2. Install
git clone https://github.com/fernandezdiegoh/gmail-mcp.git
cd gmail-mcp
cp .env.example .env
# Edit .env with your OAuth credentials
bash setup.shsetup.sh creates the venv, installs deps, and runs the browser OAuth flow.
3. Register in Claude Code
Add to ~/.claude.json under "mcpServers":
"gmail": {
"type": "stdio",
"command": "/path/to/gmail-mcp/.venv/bin/python3",
"args": ["/path/to/gmail-mcp/server.py"],
"env": {
"GOOGLE_OAUTH_CLIENT_ID": "your-client-id",
"GOOGLE_OAUTH_CLIENT_SECRET": "your-client-secret",
"USER_EMAIL": "you@example.com",
"CREDENTIALS_DIR": "~/.gmail-mcp"
}
}Multi-account
Register multiple instances with different keys (e.g., gmail and gmail-personal) pointing to the same server.py but different env vars. Each account gets its own token file in CREDENTIALS_DIR.
Dependencies
Package | Purpose | Source |
| MCP SDK (FastMCP) | Anthropic (official) |
| OAuth2 flow | Google (official) |
| Gmail API client | Google (official) |
Requirements
Python 3.10+
License
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
A MCP server for Gmail that lets you search, read, and draft emails and replies.
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.
MCP server connecting AI agents to 100+ apps (Gmail, Slack, Notion, GitHub) via one-click OAuth.
Related MCP Servers
- AlicenseBqualityFmaintenanceMCP server that connects Claude with Gmail to read, send, delete, and manage messages and labels via the Google Gmail API.3MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that lets Claude read, search, send, label, and manage your Gmail through OAuth2.MIT
- AlicenseNot gradedqualityCmaintenanceA local MCP server that provides tool-level access to Gmail, allowing Claude to search, read, send, and manage emails using the Gmail API.1MIT
- AlicenseNot gradedqualityDmaintenanceA Gmail MCP server for Claude Code that enables full email management across multiple Gmail accounts, including tools for listing, searching, reading, sending, and organizing emails with OAuth2 authentication.89 npm7MIT