Gmail
MCP server for Gmail with OAuth2 (personal) and service account (Workspace) support.
- Pricing
- Open source
- Runs
- Locally
- Version
- 0.4.12
- Listing updated
- 4 days ago
About Gmail
Gmail is an open-source MCP server for communication. It runs locally on your machine and is started by your AI client.
Install
Run in a terminal
claude mcp add gmail --env GMAIL_OAUTH_CLIENT_ID='<GMAIL_OAUTH_CLIENT_ID>' --env GMAIL_OAUTH_CLIENT_SECRET='<GMAIL_OAUTH_CLIENT_SECRET>' --env GMAIL_OAUTH_REFRESH_TOKEN='<GMAIL_OAUTH_REFRESH_TOKEN>' --env GMAIL_SERVICE_ACCOUNT_PRIVATE_KEY='<GMAIL_SERVICE_ACCOUNT_PRIVATE_KEY>' -- npx -y gmail-workspace-mcp-serverAdd to claude_desktop_config.json
{
"mcpServers": {
"gmail": {
"command": "npx",
"args": [
"-y",
"gmail-workspace-mcp-server"
],
"env": {
"GMAIL_OAUTH_CLIENT_ID": "<GMAIL_OAUTH_CLIENT_ID>",
"GMAIL_OAUTH_CLIENT_SECRET": "<GMAIL_OAUTH_CLIENT_SECRET>",
"GMAIL_OAUTH_REFRESH_TOKEN": "<GMAIL_OAUTH_REFRESH_TOKEN>",
"GMAIL_SERVICE_ACCOUNT_PRIVATE_KEY": "<GMAIL_SERVICE_ACCOUNT_PRIVATE_KEY>"
}
}
}
}Add to ~/.cursor/mcp.json
{
"mcpServers": {
"gmail": {
"command": "npx",
"args": [
"-y",
"gmail-workspace-mcp-server"
],
"env": {
"GMAIL_OAUTH_CLIENT_ID": "<GMAIL_OAUTH_CLIENT_ID>",
"GMAIL_OAUTH_CLIENT_SECRET": "<GMAIL_OAUTH_CLIENT_SECRET>",
"GMAIL_OAUTH_REFRESH_TOKEN": "<GMAIL_OAUTH_REFRESH_TOKEN>",
"GMAIL_SERVICE_ACCOUNT_PRIVATE_KEY": "<GMAIL_SERVICE_ACCOUNT_PRIVATE_KEY>"
}
}
}
}Add to .vscode/mcp.json
{
"servers": {
"gmail": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"gmail-workspace-mcp-server"
],
"env": {
"GMAIL_OAUTH_CLIENT_ID": "<GMAIL_OAUTH_CLIENT_ID>",
"GMAIL_OAUTH_CLIENT_SECRET": "<GMAIL_OAUTH_CLIENT_SECRET>",
"GMAIL_OAUTH_REFRESH_TOKEN": "<GMAIL_OAUTH_REFRESH_TOKEN>",
"GMAIL_SERVICE_ACCOUNT_PRIVATE_KEY": "<GMAIL_SERVICE_ACCOUNT_PRIVATE_KEY>"
}
}
}
}Add to ~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"gmail": {
"command": "npx",
"args": [
"-y",
"gmail-workspace-mcp-server"
],
"env": {
"GMAIL_OAUTH_CLIENT_ID": "<GMAIL_OAUTH_CLIENT_ID>",
"GMAIL_OAUTH_CLIENT_SECRET": "<GMAIL_OAUTH_CLIENT_SECRET>",
"GMAIL_OAUTH_REFRESH_TOKEN": "<GMAIL_OAUTH_REFRESH_TOKEN>",
"GMAIL_SERVICE_ACCOUNT_PRIVATE_KEY": "<GMAIL_SERVICE_ACCOUNT_PRIVATE_KEY>"
}
}
}
}Add to your client's MCP settings (most use this shape)
{
"mcpServers": {
"gmail": {
"command": "npx",
"args": [
"-y",
"gmail-workspace-mcp-server"
],
"env": {
"GMAIL_OAUTH_CLIENT_ID": "<GMAIL_OAUTH_CLIENT_ID>",
"GMAIL_OAUTH_CLIENT_SECRET": "<GMAIL_OAUTH_CLIENT_SECRET>",
"GMAIL_OAUTH_REFRESH_TOKEN": "<GMAIL_OAUTH_REFRESH_TOKEN>",
"GMAIL_SERVICE_ACCOUNT_PRIVATE_KEY": "<GMAIL_SERVICE_ACCOUNT_PRIVATE_KEY>"
}
}
}
}Configuration
GMAIL_OAUTH_CLIENT_IDOAuth2 client ID from Google Cloud Console (for personal Gmail accounts).GMAIL_OAUTH_CLIENT_SECRETOAuth2 client secret from Google Cloud Console.GMAIL_OAUTH_REFRESH_TOKENRefresh token from the OAuth2 setup script.GMAIL_SERVICE_ACCOUNT_CLIENT_EMAILService account email address (for Google Workspace).GMAIL_SERVICE_ACCOUNT_PRIVATE_KEYService account private key in PEM format (for Google Workspace).GMAIL_IMPERSONATE_EMAILEmail address to impersonate (required for service account mode).GMAIL_ENABLED_TOOLGROUPSComma-separated list of tool groups to enable (readonly, readwrite, readwrite_external).
Pricing
Open source
Gmail FAQ
Is Gmail free?
Yes. Gmail is open source, so you can use and self-host it for free.
How do I add Gmail to Claude Code?
Run this command in your terminal: claude mcp add gmail --env GMAIL_OAUTH_CLIENT_ID='<GMAIL_OAUTH_CLIENT_ID>' --env GMAIL_OAUTH_CLIENT_SECRET='<GMAIL_OAUTH_CLIENT_SECRET>' --env GMAIL_OAUTH_REFRESH_TOKEN='<GMAIL_OAUTH_REFRESH_TOKEN>' --env GMAIL_SERVICE_ACCOUNT_PRIVATE_KEY='<GMAIL_SERVICE_ACCOUNT_PRIVATE_KEY>' -- npx -y gmail-workspace-mcp-server
What are the best alternatives to Gmail?
The closest alternatives to Gmail are BoardAgent, Callout, nicemails, SOMMON Office and PostBaton.
Alternatives to Gmail

BoardAgent
MCP serverRemote MCP server for a message board where only AI agents post, reply and vote
- 27 tools
- Remote
- Free
- Community directories

Callout
MCP serverLet an AI agent place real phone calls in Japanese or English and read the transcript
- 5 tools
- Remote
- Freemium
- Communication

nicemails
MCP serverGive each AI agent its own real mailbox to read, search and send email with your approval
- 8 tools
- Remote
- Freemium
- Communication

SOMMON Office
MCP serverSend real paper letters via Deutsche Post from an AI assistant, to 218 countries
Not checked yet- 14 tools
- Remote
- Paid
- Communication

PostBaton
MCP serverSchedule, edit and cancel social posts across networks from an AI assistant or REST API
Not checked yet- Remote
- Freemium
- Marketing and SEO

MeetBetr
MCP serverFind when friends are free and send them a plan after you confirm it
- Remote
- Free
- Productivity