Multi-Gmail MCP Server
Enables searching, reading, and drafting emails across multiple Gmail accounts through a single MCP server.
README
Multi-Gmail MCP Server
Gives Claude one connector that can search, read, and draft email across your
3 Gmail accounts, each addressed by a short name (personal, business,
client by default — rename them to whatever you like in .env).
I've written and tested this server (it correctly speaks the MCP protocol — initialize, tool listing, and tool calls all verified locally). What's left is entirely account-and-credential setup that only you can do: authorizing your own Google accounts and creating your own free hosting account.
Total setup time: 30-45 minutes, done once. Cost: $0 (free tiers throughout).
Overview of what you're building
Claude ---> your MCP server (hosted for free on Render.com) ---> Gmail API
(this repo) (x3 accounts)
You'll do 5 things, in order:
- Create one Google OAuth client (covers all 3 accounts)
- Put this code on GitHub (so Render can deploy it)
- Deploy it to Render's free tier
- Authorize each of your 3 Gmail accounts (one click each)
- Add it to Claude as a custom connector
Step 1: Create a Google OAuth client
- Go to console.cloud.google.com and sign in with any of your 3 Gmail accounts (doesn't matter which — this is just where the app "lives").
- Create a new project (top-left project dropdown → New Project). Name it anything, e.g. "Gmail MCP".
- Go to APIs & Services > Library, search for Gmail API, and click Enable.
- Go to APIs & Services > OAuth consent screen.
- User type: External.
- Fill in app name (e.g. "My Gmail MCP"), your email for support/developer contact.
- Scopes: skip for now (you'll authorize via URL directly).
- Test users: add all 3 of your Gmail addresses here. While the app is in "Testing" mode, only these addresses can authorize it — that's fine and actually a good safety feature.
- Go to APIs & Services > Credentials > Create Credentials > OAuth client ID.
- Application type: Web application.
- Name: anything.
- Authorized redirect URIs: leave this section open for now — you'll add the real value in Step 3 after you know your Render URL. Add a placeholder like
https://example.com/auth/callbackfor now so you can save.
- Save. Copy the Client ID and Client Secret — you'll need them in Step 3.
Step 2: Put this code on GitHub
- If you don't have a GitHub account, create one free at github.com (no card required).
- Create a new empty repository (e.g.
gmail-mcp-server). - Upload the contents of this folder to that repository (drag-and-drop the files on GitHub's web UI works fine, or use
git pushif you're comfortable with git).
Step 3: Deploy to Render (free)
- Create a free account at render.com (no card required for the free web service tier).
- Click New > Web Service, connect your GitHub account, and select the repo from Step 2.
- Settings:
- Runtime: Node
- Build command:
npm install - Start command:
npm start - Instance type: Free
- Under Environment, add these variables:
GMAIL_ACCOUNTS=personal,business,client(or your own names)GOOGLE_CLIENT_ID= (from Step 1)GOOGLE_CLIENT_SECRET= (from Step 1)MCP_SHARED_SECRET= a long random string — this locks your server down so only Claude (with the right URL) can use it. Generate one by runningnode -e "console.log(require('crypto').randomUUID())"on your own computer, or just mash the keyboard for 30 characters.
- Click Create Web Service. Wait for it to build and deploy — Render will give you a URL like
https://gmail-mcp-server-xxxx.onrender.com. - Go back to Google Cloud Console (Step 1, Credentials) and edit your OAuth client's Authorized redirect URIs, replacing the placeholder with:
https://gmail-mcp-server-xxxx.onrender.com/auth/callback(use your actual Render URL).
Note on the free tier: Render's free web services go to sleep after 15 minutes of no traffic and take ~30-60 seconds to wake up on the next request. That means the first thing you ask Claude to do with Gmail in a while might feel slow the first time, then fast after. This is normal and not a bug.
Step 4: Authorize each Gmail account
For each of your 3 accounts, visit this URL in your browser (replace <account> with personal, business, or client, and use your real Render URL):
https://gmail-mcp-server-xxxx.onrender.com/auth/start?account=<account>
Log in with that specific Gmail account when Google prompts you, and approve access. You'll land on a page showing something like:
Success! "personal" is now authorized.
Copy the value below and set it as an environment variable named:
GMAIL_PERSONAL_REFRESH_TOKEN
Value:
1//0abc...
Go back to Render's Environment tab, add that variable with that exact value, and repeat for the other 2 accounts. Render will automatically redeploy after you save environment changes.
If a page tells you no refresh token was returned, it means that Google account already approved this app before. Go to myaccount.google.com/permissions, remove the app, and try the /auth/start link again.
Step 5: Add the connector to Claude
- In Claude (or Cowork), go to Customize > Connectors > Add > Add custom connector.
- Name: "Gmail (3 accounts)" or similar.
- URL:
(thehttps://gmail-mcp-server-xxxx.onrender.com/mcp?key=YOUR_MCP_SHARED_SECRETkeymust match theMCP_SHARED_SECRETyou set in Render — this is what keeps the connector private to you.) - Click Add, then connect/enable it for your conversation.
Step 6: Try it
Ask Claude something like:
"Search my business Gmail for anything from our supplier this month"
or
"Draft a reply in my personal account to the email about the invoice"
Claude will call search_emails, read_email, or create_draft with account set to whichever inbox you named.
Tools this server exposes
list_connected_accounts— lists your configured account names and whether each has completed authorizationsearch_emails({account, query, maxResults})— Gmail search syntax (from:,subject:,after:, etc.)read_email({account, messageId})— full headers + plain-text bodycreate_draft({account, to, subject, body, threadId?})— creates a draft only, never sendslist_labels({account})
Sending email is intentionally not included — Claude can prepare drafts, but you send them yourself from Gmail, same as Anthropic's own native Gmail connector.
Security notes
- Treat your connector URL (with the
?key=in it) like a password — anyone who has it can read and draft in all 3 inboxes. - Refresh tokens are stored only as environment variables on your own Render service, never anywhere else.
- If you ever want to revoke access, remove the app at myaccount.google.com/permissions for the account in question, or just delete the Render service.
If something breaks
- Visit your server's root URL (
https://gmail-mcp-server-xxxx.onrender.com/) — it shows configured accounts and whether they're authorized. - Check Render's Logs tab for error details.
- Common issue: forgetting to update the OAuth redirect URI in Google Cloud Console after Render gives you its real URL (Step 3.6).
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。