What alexneamtu/gmail-mcp does
alexneamtu/gmail-mcp exposes Gmail operations over MCP for one configured owner with multiple enrolled mailboxes. It supports Gmail search queries, message and thread retrieval, attachment access, label lookup, plain-text draft creation, and optional draft sending or label changes.
Every operation includes an account alias. Aliases identify separately enrolled Gmail accounts, so an agent can target personal or work without relying on an implicit mailbox. Forwarded addresses are read from their destination mailbox and do not automatically grant permission to send as those addresses.
How it works
The service uses Streamable HTTP at the /mcp endpoint. A typical deployment places it behind an HTTPS hostname and Cloudflare Tunnel, forwarding to a loopback HTTP service managed by systemd under a dedicated non-root user.
Google OAuth enrolls each mailbox independently. A separate owner authentication flow lets Claude or Codex access the enrolled accounts. OAuth uses PKCE and checks the configured owner identity, verified email, state, nonce, and authorization details. Credentials and authorization state are encrypted in SQLite; the master key is kept in the local configuration area.
The repository also includes an inspection entrypoint for catalog tools. It exposes the nine tool definitions without reading private configuration, using Google credentials, or making Gmail requests. Calls in that mode return an inspection-only error.
Setup and configuration
Run the service with Node.js 24 on Linux with systemd, an HTTPS hostname, and a Google Cloud project with the Gmail API enabled. Create separate Google OAuth clients for desktop mailbox enrollment and web-based owner sign-in. The web client requires the deployment's /login/google/callback URL.
Build and test the project with:
npm ci --ignore-scripts
npm test
npm run check
npm run build
Initialize the installation with the built CLI, then enroll the owner and each mailbox alias. The CLI also provides a status command. Configuration is stored under ~/.config/gmail-mcp, while encrypted state is stored under ~/.local/share/gmail-mcp/state.db. Keep Google client JSON files, configuration, and the master key outside Git with restrictive permissions.
The public information pages should be available before Google OAuth configuration. Enrollment requires a browser on the server or a computer using SSH port forwarding; phone-only enrollment is unsupported.
Tools and capabilities
The tool set includes:
list_accounts for connected aliases and local enrollment state
search_messages for Gmail query searches
get_message for reading messages and listing or downloading attachments
get_thread for reading complete threads
get_attachment for retrieving attachments
list_labels for finding existing labels
create_draft for creating plain-text drafts
send_draft for sending an existing draft in full mode
modify_message_labels for applying or removing existing labels in full mode
Drafts mode exposes the read, account, label-listing, and draft tools while omitting sending and label modification. Full mode adds the latter two operations.
Limitations and notes
One deployment supports one owner, although that owner can enroll multiple Gmail accounts. Drafts mode does not expose a separate send operation, but the Google compose scope itself includes sending permission. In full mode, the connected client must approve a specific send; the server does not display a separate human approval screen.
Message bodies are limited to 60,000 characters and threads to 200,000 characters, with truncation indicators. Attachments are limited to 5 MB. Images are returned as image content, while other files are provided as embedded resources. Plain text is preferred; HTML-only messages are returned as labelled HTML text.
Forwarding does not enable sending from a forwarded address. The project is intended for technically experienced self-hosters and requires the operator to manage the HTTPS service, Google OAuth project, encrypted local state, and backups.