Gmail MCP Server
Enables interaction with Gmail through 11 tools for email management, including reading, sending, replying, searching, and labeling, with OAuth 2.1 authentication and support for various MCP clients.
README
Gmail MCP Server
Public Gmail MCP server — Streamable HTTP + OAuth 2.1, same architecture as the Salesforce and Outlook MCP Servers. One deployed URL works with:
- Archon AI portal (Managed MCP via Anthropic / OpenAI)
- Claude.ai custom connectors
- ChatGPT custom MCP
- Any standalone MCP client (n8n, Cursor, custom apps) via the PATH B flow
Tools (11)
| Tool | Kind | Description |
|---|---|---|
getProfile |
read | Connected Gmail account (email, message counts) |
listEmails |
read | List messages by label, filters: unread, sender |
readEmail |
read | Full body (text + HTML) of one message |
searchEmails |
read | Gmail-syntax search across all mail |
listLabels |
read | All labels (Gmail's folders) |
getAttachments |
read | Attachment names/types/sizes |
sendEmail |
write | Send a new email |
replyEmail |
write | In-thread reply / reply-all (proper threading headers) |
createDraft |
write | Draft without sending |
moveEmail |
write | Archive / trash / apply label |
markEmail |
write | Read/unread + star |
Setup
1. Google Cloud OAuth client (one-time)
- https://console.cloud.google.com → create/select a project
- APIs & Services → Library → enable Gmail API
- OAuth consent screen → External → add scope
https://www.googleapis.com/auth/gmail.modify(+ openid, email, profile). While the app is in Testing status, add your Gmail address under Test users — otherwise login fails withaccess_denied. - Credentials → Create credentials → OAuth client ID → Web application
Authorized redirect URIs:
https://claude.ai/api/mcp/auth_callback(Claude connector)<BASE_URL>/auth/callback(PATH B standalone)
2. Run
cp .env.example .env # fill in GOOGLE_CLIENT_ID / GOOGLE_CLIENT_SECRET / BASE_URL
npm install
npm run dev # http://localhost:3200
3. Deploy (Render)
- Build command:
npm install - Start command:
npm start - Env vars:
BASE_URL(the Render URL),GOOGLE_CLIENT_ID,GOOGLE_CLIENT_SECRET,GOOGLE_REDIRECT_URI=<BASE_URL>/auth/callback - After deploy, add
<BASE_URL>/auth/callbackto the Google OAuth client's redirect URIs.
Auth paths
PATH A — Bearer header (portals, Claude connector). The client sends
Authorization: Bearer <google access token> on /mcp. Tokens acquired
through this server's /token proxy get vaulted, enabling server-side
refresh when Google returns 401 (Google access tokens live ~1 hour).
PATH B — session flow (standalone clients). Visit
<BASE_URL>/auth?session=<id> → Google login → tokens stored server-side
keyed by the stable Google account id.
The /authorize proxy forces access_type=offline&prompt=consent so Google
actually issues a refresh token, and both proxies force the real Google
client credentials so Dynamic Client Registration (Claude invents a random
client id) still works — the only requirement is the client's redirect URI
being whitelisted on the Google OAuth client.
Gmail-specific notes
- Gmail message ids are opaque hex strings; always source them from
listEmails/searchEmailsin the same session. - Gmail has labels, not folders.
moveEmailmaps the familiar folder actions: archive = removeINBOX, trash = the dedicated trash endpoint. replyEmailfetches the original'sMessage-ID/Referencesheaders and sends withthreadId, so replies thread correctly in both Gmail and the recipient's client.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.