advanced-gmail-mcp
Provides full email management across multiple Gmail accounts, including listing, searching, reading, sending, drafting, replying, archiving, labeling, trashing, and batch modifying 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., "@advanced-gmail-mcpshow me my unread emails from yesterday"
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 Server

A Gmail MCP server for Claude Code that provides full email management across multiple Gmail accounts.
Features
12 tools: list, search, read, thread, labels, send, draft, reply, archive, label, trash, batch modify
Multi-account support with simple aliases
OAuth2 authentication with interactive CLI flow
Token auto-refresh — re-authenticates transparently
Rate limit retry with exponential backoff
Claude Code commands included (
/emailand/checkemail) for structured inbox triage
Quick Start
1. Clone & Install
git clone https://github.com/coreyepstein/advanced-gmail-mcp.git
cd advanced-gmail-mcp
npm install2. Google Cloud Setup
Go to Google Cloud Console
Create a new project (or select an existing one)
Enable the Gmail API:
APIs & Services → Enable APIs → search "Gmail API" → Enable
Configure the OAuth consent screen:
APIs & Services → OAuth consent screen
User type: External (or Internal if using Google Workspace)
Add your email address(es) as test users
Add scopes:
gmail.readonly,gmail.modify,gmail.send,gmail.compose
Create OAuth credentials:
APIs & Services → Credentials → Create Credentials → OAuth client ID
Application type: Desktop app
Download the JSON file
Save the downloaded file as
credentials.jsonin the project root
3. Configure Accounts
cp accounts.example.json accounts.jsonEdit accounts.json with your Gmail accounts:
{
"accounts": [
{ "email": "you@gmail.com", "alias": "personal" },
{ "email": "you@company.com", "alias": "work" }
],
"default": "personal"
}You can add as many accounts as you want. Each needs a unique alias.
4. Authenticate
# Authenticate all accounts (opens browser for each)
npm run auth
# Or authenticate a single account
npm run auth -- work
# Check auth status
npm run auth:checkThe auth flow opens a browser window for each account. Tokens are saved to ./tokens/.
5. Add to Claude Code
Add to your MCP config (project .mcp.json or ~/.claude.json):
{
"mcpServers": {
"gmail": {
"type": "stdio",
"command": "npx",
"args": ["tsx", "/absolute/path/to/gmail-mcp/src/server.ts"]
}
}
}Important: Use the absolute path to
src/server.ts.
6. (Optional) Add Commands
Copy the included Claude Code commands for structured email workflows:
# From your project root (where .claude/ lives)
mkdir -p .claude/commands
cp /path/to/gmail-mcp/.claude/commands/email.md .claude/commands/
cp /path/to/gmail-mcp/.claude/commands/checkemail.md .claude/commands/Then use /email or /checkemail in Claude Code.
Tools
Tool | Description |
| List inbox or label emails |
| Search with Gmail query syntax |
| Read full email by ID |
| Get full thread with all messages |
| List all labels |
| Send a new email |
| Create a draft |
| Reply with proper threading |
| Archive (remove INBOX label) |
| Add/remove labels |
| Move to trash |
| Batch archive/trash/label |
All tools accept an optional account parameter (alias or email). Defaults to the account set in accounts.json.
Commands
/email [action] [account]
Full email management command with actions:
triage — Summarize inbox, batch archive/trash
cleanup — 4-phase daily email workflow
search {query} — Cross-account search
send / draft / reply — Compose with confirmation
/checkemail [account]
Quick 3-phase inbox sweep:
Fetch & classify all inbox emails (auto-archive junk)
Batch archive on approval
Walk through remaining emails one at a time
Troubleshooting
Error | Fix |
| Copy |
| Download OAuth credentials from GCP Console |
| Run |
| Re-authenticate: |
| Add your email as test user in GCP OAuth consent screen |
| Re-authenticate to get updated scopes |
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.
Latest Blog Posts
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/coreyepstein/advanced-gmail-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server