Gmail MCP
Provides tools to manage Gmail, including sending mail, managing drafts, labels, archiving, marking read/unread, starring, and trashing 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 MCPCan you draft an email to Jessica about the meeting tomorrow?"
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
Private multi-account Gmail MCP server for Codex.
Development
Open this repository through Remote SSH and choose Dev Containers: Reopen in
Container. The container exposes only this repository, runs as the unprivileged
vscode user, and uses a repository-specific Codex home on the VM.
Its sole Docker security override relaxes seccomp because the real Codex
workspace sandbox was verified to require nested user namespaces on this VM.
No capabilities, privileged mode, AppArmor override, or Docker socket are used.
The central development image provides Python, uv, Codex, and generic build
tools. Project dependencies are installed from the checked-in uv.lock into
this repository's ignored .venv. The devcontainer creates that environment
automatically and keeps it isolated from every other repository and worktree.
The project commands are:
uv lock --check
uv sync --frozen --group dev
uv run --frozen pytest
uv run --frozen flake8 src tests
uv buildThe first time this repository is opened, authenticate its isolated Codex state
with the primary development ChatGPT account by running codex login in the
container. Do not put API keys in the devcontainer configuration.
Related MCP server: Gmail MCP Server
Quick Start
Create a Google Cloud project, enable the Gmail API, and create a Web Application OAuth client.
Register
http://localhost:8080/admin/oauth/callbackor your LAN hostname equivalent as an authorized redirect URI.Generate secrets:
uv run --frozen python - <<'PY'
from cryptography.fernet import Fernet
import secrets
print("GMAIL_MCP_ENCRYPTION_KEY=" + Fernet.generate_key().decode())
print("ADMIN_TOKEN=" + secrets.token_urlsafe(32))
print("MCP_BEARER_TOKEN=" + secrets.token_urlsafe(32))
PYSave the generated values and Google credentials in
~/.config/dev-secrets/gmail_mcp.envon the VM, then set mode0600.Start the server with command-scoped secret injection:
./scripts/dev-compose up --buildAdd accounts through the admin OAuth flow:
http://localhost:8080/admin/oauth/start?alias=personal&token=<ADMIN_TOKEN>Connect Codex:
export MCP_BEARER_TOKEN="<same token>"
codex mcp add gmail --url http://localhost:8080/mcp --bearer-token-env-var MCP_BEARER_TOKENRequired Environment
GOOGLE_CLIENT_IDGOOGLE_CLIENT_SECRETGOOGLE_REDIRECT_URIGMAIL_MCP_ENCRYPTION_KEYADMIN_TOKENMCP_BEARER_TOKEN
Optional:
DATABASE_URL, defaultsqlite:////data/gmail_mcp.sqlite3MCP_ALLOWED_HOSTS, comma-separated, defaultlocalhost,localhost:*,127.0.0.1,127.0.0.1:*MCP_ALLOWED_ORIGINS, comma-separated, default emptyLOG_LEVEL, defaultINFO
Safety Model
Draft creation happens immediately. Sending mail, sending drafts, label changes, archive, mark read/unread, star/unstar, and trash create pending actions first. A caller must execute gmail_pending_action_confirm with the returned pending_action_id before Gmail state changes.
The committed .env.example is a variable-name contract only. Real values stay
outside Git and are passed to Docker Compose only for the command being run.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityCmaintenanceEnables interaction with Gmail and Google Calendar using the MCP protocol, supporting multiple Google accounts, email management, and calendar operations through natural language.Last updated3332MIT
- Alicense-qualityDmaintenanceEnables interaction with Gmail through the MCP protocol, supporting sending, reading, searching, replying, forwarding, managing drafts and labels, and saving attachments.Last updated93MIT
- Flicense-qualityCmaintenanceEnables interacting with multiple Gmail accounts through a single MCP server, supporting search, labels, drafts, and thread management with per-account OAuth.Last updated
- Alicense-qualityDmaintenanceEnables Gmail operations such as reading, sending, searching, and managing emails, threads, labels, and drafts via MCP tools.Last updated1MIT
Related MCP Connectors
Read, search, send, organize, draft and schedule email across your inboxes from any MCP client.
Manage Gmail end-to-end: search, read, send, draft, label, and organize threads. Automate workflow…
Manage Gmail messages, threads, labels, drafts, and settings from your workflows. Send and organiz…
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/pyrodie18/gmail_mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server