gmail-mcp-server
Provides tools for managing Gmail inboxes, including sending, reading, replying, forwarding, trashing, deleting, archiving, starring emails; creating and managing drafts; listing, creating, updating, deleting labels; searching with full Gmail syntax; handling attachments; configuring vacation responders; creating and deleting filters; and performing batch operations on multiple messages.
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-mcp-serverlist my 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-server
A production-ready MCP (Model Context Protocol) server that connects Claude AI to your Gmail account, enabling full email management through natural language.
No Google Cloud setup knowledge required — just add it to Claude Desktop and follow the on-screen instructions.
Features
Email Management — list, read, send, reply, forward, trash, delete, archive, star emails
Drafts — create, list, read, update, delete, and send drafts
Labels — create, list, update, delete labels; add/remove labels from messages
Search — full Gmail search syntax, thread retrieval, pagination
Attachments — list and download attachments, optionally save to disk
Settings — vacation responder management, email filter creation and deletion
Batch Operations — apply label changes to multiple emails at once
Multi-Account — connect multiple Gmail accounts; switch with one env var
Auto Token Refresh — OAuth tokens refreshed and persisted automatically
Guided Browser Setup — first-time setup opens a UI in your browser automatically
Account Dashboard — manage connected accounts, view token status, and get your Claude Desktop config in one place
Related MCP server: mcp-gmail
Setup
1. Add to Claude Desktop
Open your Claude Desktop config file:
macOS/Linux:
~/.config/claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
Add this entry and restart Claude Desktop:
{
"mcpServers": {
"gmail": {
"command": "npx",
"args": ["-y", "gmail-mcp-server"]
}
}
}2. Connect Your Gmail
Ask Claude anything Gmail-related:
"Check my Gmail"
A browser setup page opens automatically. Follow the on-screen steps to connect your Gmail account — takes about 2 minutes. You only do this once.
After signing in, you'll be taken to the account dashboard where you can:
See all connected accounts and their token status
Remove accounts with one click
Copy a ready-made Claude Desktop config snippet
Multiple Accounts
From the dashboard, click Add Another Account, or run:
npx gmail-mcp-server authThen add each account as a separate entry in Claude Desktop config using the GMAIL_ACCOUNT env var:
{
"mcpServers": {
"gmail-personal": {
"command": "npx",
"args": ["-y", "gmail-mcp-server"],
"env": { "GMAIL_ACCOUNT": "personal@gmail.com" }
},
"gmail-work": {
"command": "npx",
"args": ["-y", "gmail-mcp-server"],
"env": { "GMAIL_ACCOUNT": "work@company.com" }
}
}
}If only one account is connected, GMAIL_ACCOUNT is optional — the server uses it automatically.
CLI Commands
Command | Description |
| Open the browser dashboard (add or manage accounts) |
| List all connected accounts |
| Remove an account and delete its token |
Tools Reference
Email Messages
Tool | Description |
| List emails with optional query/label filtering and pagination |
| Get full email content including body, HTML, and attachment metadata |
| Send a new email (supports HTML, CC, BCC) |
| Reply to an email with proper threading headers |
| Forward an email with optional message prefix |
| Move an email to trash |
| Permanently delete an email (requires |
| Remove the UNREAD label from a message |
| Add the UNREAD label to a message |
| Remove from inbox (remove INBOX label) |
| Add STARRED label to a message |
| Add/remove labels from multiple messages at once |
Drafts
Tool | Description |
| Create a new draft email |
| List all drafts with subject and snippet |
| Get full draft content |
| Update an existing draft |
| Delete a draft |
| Send an existing draft |
Labels
Tool | Description |
| List all labels with counts |
| Create a label with optional color |
| Update label name, visibility, or color |
| Delete a label |
| Apply a label to a message |
| Remove a label from a message |
Search & Threads
Tool | Description |
| Search emails using full Gmail search syntax |
| Get all messages in a thread in order |
| List threads with optional query filtering |
Attachments
Tool | Description |
| List all attachments in an email |
| Download attachment as base64 or save to disk |
Settings
Tool | Description |
| Get vacation/out-of-office settings |
| Configure vacation auto-reply |
| Turn off auto-reply |
| List all email filters |
| Create a new email filter with actions |
| Delete an email filter |
Gmail Search Syntax Examples
Ask Claude using Gmail's full search syntax:
# Unread emails from a specific sender
from:boss@example.com is:unread
# Emails with attachments in the last week
has:attachment newer_than:7d
# Large emails over 10MB
larger:10m
# Emails in specific labels
label:work label:urgent
# Starred unread emails
is:starred is:unreadEnvironment Variables
Variable | Required | Description |
| Only with multiple accounts | Email address of the account to use |
Token Storage
Credentials and tokens are stored locally at ~/.gmail-mcp/:
~/.gmail-mcp/
├── config.json ← Google OAuth client credentials
├── accounts.json ← Registered Gmail accounts
└── tokens/
├── personal@gmail.com.json
└── work@company.com.jsonThese files never leave your machine. To revoke access, run remove-account or revoke the app at myaccount.google.com/permissions.
Troubleshooting
Setup page opens but credentials form fails
Make sure you created a Desktop App OAuth client in Google Cloud Console, not a Web App. Web App clients reject localhost redirect URIs unless explicitly allowlisted.
"Multiple accounts found. Set GMAIL_ACCOUNT env var"
Add "GMAIL_ACCOUNT": "your@email.com" to the env section of the relevant Claude Desktop config entry.
Auth expired / 401 error
Re-run auth for that account:
npx gmail-mcp-server remove-account your@email.com
npx gmail-mcp-server auth"Insufficient permissions" / 403 error
The token was created without all required scopes. Remove and re-authenticate:
npx gmail-mcp-server remove-account your@email.com
npx gmail-mcp-server authGmail rate limit hit / 429 error
Gmail API rate limit reached. Wait 1-2 minutes and retry.
Contributing
See CONTRIBUTING.md for development setup and PR guidelines.
License
MIT — see LICENSE
This server cannot be deployed
Maintenance
Related MCP Connectors
Email infrastructure for AI agents — send, receive, search, and reply to email over MCP.
A MCP server for Gmail that lets you search, read, and draft emails and replies.
MCP server connecting AI agents to 100+ apps (Gmail, Slack, Notion, GitHub) via one-click OAuth.
Connect any mailbox to Claude, ChatGPT & AI: read, send, reply, schedule & search emails.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables Claude AI to interact with Gmail, supporting email sending, reading, searching, labeling, draft management, and batch operations through natural language commands.2MIT
- AlicenseBqualityFmaintenanceMCP server that connects Claude with Gmail to read, send, delete, and manage messages and labels via the Google Gmail API.3MIT
- AlicenseAqualityDmaintenanceA Gmail MCP server that enables Claude to send, search, and read emails using either Gmail API or SMTP/IMAP backend.3MIT
- AlicenseNot gradedqualityDmaintenanceA secure MCP server that enables Claude to read, search, send, reply, forward, and manage Gmail messages and labels through natural language commands.811MIT