MCP Gmail Server
@jeremyjordan
A Model Context Protocol (MCP) server that provides Gmail access for LLMs, powered by the MCP Python SDK.
概览
What is MCP Gmail Server?
An MCP server that provides Gmail access for LLMs, powered by the MCP Python SDK. It exposes Gmail messages and threads as MCP resources and offers tools for composing, sending, and managing emails, using OAuth 2.0 authentication with Google’s Gmail API.
How to use MCP Gmail Server?
Requires Python 3.10+, a Gmail account, and recommended use of uv. Configure OAuth credentials via Google Cloud Console, then run uv run mcp dev mcp_gmail/server.py for development or install for Claude Desktop with uv run mcp install ... with environment variables MCP_GMAIL_CREDENTIALS_PATH and MCP_GMAIL_TOKEN_PATH.
Key features of MCP Gmail Server
- Exposes Gmail messages and threads as MCP resources
- Tools to compose, send, and manage emails
- OAuth 2.0 authentication with the Gmail API
- Search emails with filters (from, to, subject, dates)
- Raw Gmail query syntax support
- Manage labels: add, remove, list labels
- Mark messages as read
- Retrieve multiple emails by IDs
Use cases of MCP Gmail Server
- Let an LLM read and respond to emails via a client
- Automate email searching and labeling tasks
- Integrate email management into AI workflows
- Allow an AI assistant to compose and send drafts
FAQ from MCP Gmail Server
What are the prerequisites for MCP Gmail Server?
Python 3.10+, a Gmail account with API access, and uv for package management (recommended).
How do I set up OAuth credentials?
Follow the README steps: create a Google Cloud project, enable the Gmail API, configure the OAuth consent screen, create a Desktop app OAuth client ID, download credentials.json, and add the gmail.modify scope.
What environment variables can I configure?
MCP_GMAIL_CREDENTIALS_PATH (default credentials.json), MCP_GMAIL_TOKEN_PATH (default token.json), and MCP_GMAIL_MAX_RESULTS (default 10).
How do I fix the “Error: spawn uv ENOENT” when using Claude Desktop?
Update your claude_desktop_config.json to provide the absolute path to uv, e.g., "~/.local/bin/uv".
What tools does MCP Gmail Server provide?
It provides nine tools: compose_email, send_email, search_emails, query_emails, get_emails, list_available_labels, mark_message_read, add_label_to_message, and remove_label_from_message.