Gmail MCP Server
Provides tools to search, read, label, archive, move, mark read/unread, draft threaded replies, and send emails via the Gmail API.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Gmail MCP Server
Let your AI assistant manage your Gmail — search, read, send, label, archive, and more through natural conversation.
Works with Claude Code, Claude Desktop, Cursor, Windsurf, and any MCP-compatible app.
Setup
1. Clone & Install
git clone https://github.com/saidulalam01/gmail-mcp-server.git
cd gmail-mcp-server
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txtNo git? Click the green Code button on GitHub → Download ZIP.
2. Get Google Credentials
Go to console.cloud.google.com and create a project
Go to APIs & Services → Library → search Gmail API → Enable
Go to APIs & Services → OAuth consent screen → choose External → fill in app name and your email → Save and Continue
On the Scopes page, add these three then save:
https://www.googleapis.com/auth/gmail.modify https://www.googleapis.com/auth/gmail.compose https://www.googleapis.com/auth/gmail.labelsOn the Test users page, add your Gmail address → save
Go to APIs & Services → Credentials → + Create Credentials → OAuth client ID → type: Desktop app → Create
Download the JSON file and move it into the project folder
3. Authenticate
python gmail_mcp_server.py --authYour browser opens for Google sign-in. If you see "This app isn't verified", click Advanced → Go to Gmail MCP Server (unsafe) — this is normal for personal projects.
4. Connect to Your AI App
Get your paths first:
echo "$(pwd)/.venv/bin/python $(pwd)/gmail_mcp_server.py"Then add to your app's config:
{
"mcpServers": {
"gmail": {
"command": "/Users/yourname/gmail-mcp-server/.venv/bin/python",
"args": ["/Users/yourname/gmail-mcp-server/gmail_mcp_server.py"]
}
}
}{
"mcpServers": {
"gmail": {
"command": "/Users/yourname/gmail-mcp-server/.venv/bin/python",
"args": ["/Users/yourname/gmail-mcp-server/gmail_mcp_server.py"]
}
}
}Windows config path: %APPDATA%\Claude\claude_desktop_config.json
Point your MCP client to the server as a stdio process using the two paths from above.
Use full absolute paths — relative paths won't work because the AI app launches the server from its own directory.
5. Try It
"Show me my unread emails"
"Read the latest email from Sarah"
"Draft a reply saying I'll be there at 3pm"
"Archive all emails from noreply"
Related MCP server: Gmail AutoAuth MCP Server
Available Tools
Tool | What It Does |
| Search with Gmail syntax ( |
| Read full email content |
| List all labels |
| Create a new label |
| Add a label to an email |
| Remove a label |
| Archive an email |
| Move between folders |
| Mark as read |
| Mark as unread |
| Draft a threaded reply |
| Send a new email (CC/BCC supported) |
| Send an existing draft |
You don't call these directly — just describe what you want and the AI picks the right tool.
Troubleshooting
Token expires every 7 days — Your Google app is in "Testing" mode. Just re-run python gmail_mcp_server.py --auth. To fix permanently: switch to "Internal" in Google Cloud (requires Workspace), or publish the app.
"Access blocked" during auth — Add your email as a test user: Google Cloud → OAuth consent screen → Test users.
"invalid_grant" or "token revoked" — Delete token.json and re-run python gmail_mcp_server.py --auth.
AI app can't find the server — Make sure you're using full absolute paths in the config, not relative.
Security
token.jsonand credentials are git-ignored — never committedThe server runs locally over stdio — no ports opened, no network exposure
The server cannot permanently delete emails — only archive, label, and send
To revoke access: Google Account Permissions → remove the app
Contributing
See CONTRIBUTING.md. Run tests with pip install -e ".[dev]" && pytest.
License
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Email for AI agents: read, search and send from your Gmail, Outlook, Yahoo, iCloud or IMAP inbox.
Manage Gmail end-to-end: search, read, send, draft, label, and organize threads. Automate workflow…
Give AI agents their own email inboxes: list, read and send mail via scoped, revocable OAuth grants.
Manage Gmail messages, threads, labels, drafts, and settings from your workflows. Send and organiz…
Related MCP Servers
- AlicenseNot gradedqualityNot gradedmaintenanceEnables 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.-
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to manage Gmail through natural language interactions, including sending, reading, searching emails, and managing labels with auto authentication support.1MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to manage Gmail through natural language, including sending, reading, searching, labeling emails, managing attachments, and performing thread operations.3MIT
- AlicenseAqualityCmaintenanceEnables AI assistants to review unread emails and perform email management operations like delete, archive, and label through Gmail integration.7Apache 2.0