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 "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-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 |
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 installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.