google-multi-mcp
Allows searching Gmail with Gmail query syntax, retrieving full threads with plain-text bodies, and creating draft emails without sending them, across configured Google accounts.
Allows listing events on the primary Google Calendar and creating calendar events with summaries, start/end times, and optional attendees across configured Google accounts.
Allows searching Google Drive by name or full text, reading files with Google Docs/Sheets/Slides exported to text, and listing recently modified files across configured Google accounts.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
google-multi-mcp
A local MCP server (TypeScript / Node.js)
that fronts multiple Google accounts through one connection. Every tool
takes an account (email) as its first argument; the server looks up that
account's OAuth credentials, refreshes the access token as needed, and calls the
relevant Google API (Gmail, Drive, Calendar) on its behalf.
Tokens are stored encrypted at rest (AES-256-GCM) in tokens.enc. Nothing
secret is committed to the repository.
Built with the official @modelcontextprotocol/sdk
and googleapis.
Accounts (default registry)
Defined in config.json:
Edit config.json to change the list, or create config.local.json (gitignored)
with the same shape to override it without touching the committed file.
Related MCP server: mcp-gsuite
Tools
Tool | Description |
| Configured accounts and whether each is authorized. |
| Search Gmail (Gmail query syntax). |
| Full thread with plain-text bodies. |
| Create a draft (does not send). |
| Search Drive by name / full text. |
| Read a file (Docs/Sheets/Slides exported to text). |
| Most recently modified files. |
| List primary-calendar events. |
| Create an event. |
If an account has no token yet, the tool returns a clear error:
No token for <account> — run: npm run auth -- <account>.
File layout
google-multi-mcp/
├── src/
│ ├── server.ts # MCP server + tool definitions
│ ├── auth.ts # OAuth CLI: authorize accounts, store refresh tokens
│ ├── accounts.ts # registry (config.json) + encrypted token store
│ └── googleClients.ts # builds authenticated Google API clients per account
├── config.json # account registry + OAuth scopes
├── .env.example # template for secrets (copy to .env)
├── package.json
├── tsconfig.json
├── .gitignore # ignores .env, tokens.enc, config.local.json, dist, node_modules
└── README.mdSetup
1. Create a Google Cloud project & enable APIs
Go to the Google Cloud Console and create a project (or pick an existing one).
Enable these APIs (APIs & Services → Library):
Gmail API
Google Drive API
Google Calendar API
2. Configure the OAuth consent screen
APIs & Services → OAuth consent screen.
User type: External (unless all accounts are in one Google Workspace org, in which case Internal is simpler — no verification needed).
Fill in app name, support email, developer email.
Scopes: you can leave the scope list empty here; the server requests scopes at runtime. The scopes used are:
gmail.readonly,gmail.composedrive.readonly,drive.filecalendar
Test users: while the app is in "Testing" status, add every account from the registry as a test user. Otherwise OAuth will refuse them. (Testing-mode refresh tokens expire after 7 days — publish the app to make them long-lived.)
3. Create an OAuth client (Desktop app)
APIs & Services → Credentials → Create Credentials → OAuth client ID.
Application type: Desktop app.
Copy the Client ID and Client secret.
Note:
authruns a local redirect server onhttp://localhost:<port>(default8765). A Desktop-app client allows loopback redirects, so no extra redirect-URI configuration is normally required.
4. Install & build
cd google-multi-mcp
npm install
npm run build5. Configure secrets
cp .env.example .envEdit .env:
GOOGLE_CLIENT_ID/GOOGLE_CLIENT_SECRET— from step 3.TOKEN_ENC_KEY— generate one:node -e "console.log(require('crypto').randomBytes(32).toString('base64'))"Paste the output as
TOKEN_ENC_KEY. Keep it safe; if you lose it, deletetokens.encand re-runauth.
6. Authorize the accounts
# Authorize every account in the registry (a browser opens for each):
npm run auth
# Or one at a time:
npm run auth -- you@gmail.com
# Check status:
npm run auth -- --status
# Revoke a stored token locally:
npm run auth -- --revoke you@gmail.comFor each account, sign in with that specific Google account and grant the
requested permissions. auth verifies the signed-in email matches the account
you asked for and warns if it doesn't.
During development you can run the TypeScript directly without building:
npm run auth:dev -- <account>andnpm run dev.
7. Connect the server to Claude
Claude Code — register the server (adjust the path):
claude mcp add google-multi-mcp -- \
node /absolute/path/to/google-multi-mcp/dist/server.jsClaude Desktop — add to claude_desktop_config.json
(~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"google-multi-mcp": {
"command": "node",
"args": ["/absolute/path/to/google-multi-mcp/dist/server.js"]
}
}
}Restart the client. Then try: "List my connected Google accounts" or "Search Gmail in you@gmail.com for unread invoices from this week."
How it works
accounts.tsloads the registry/scopes fromconfig.json, reads the OAuth client andTOKEN_ENC_KEYfrom.env, and providesTokenStore— an AES-256-GCM-encrypted JSON blob (tokens.enc) mapping each account to its token. File format is base64 ofiv(12) || authTag(16) || ciphertext.auth.tsruns Google's installed-app OAuth flow per account (access_type=offline,prompt=consentto force a refresh token) using a one-shot loopback HTTP server to capture the redirect, then saves the result.googleClients.tsrebuilds an OAuth2 client from the stored token. google-auth-library refreshes the access token automatically when it expires; atokensevent listener persists the refreshed credentials back to the store.server.tsexposes the tools. Each call resolves the account, runs the API request with exponential-backoff retry on rate limits (HTTP 429/500/503), and returns structured JSON. Known failures are returned as{ "error": ... }rather than crashing the tool.
Security notes
.envandtokens.encare gitignored — do not commit them.tokens.encis written with0600permissions.Scopes are minimal for the feature set: Gmail is read + compose (drafts only, no send); Drive is readonly + file; Calendar is full (needed to create events).
Troubleshooting
No token for <account>— runnpm run auth -- <account>.Auth failed (HTTP 401)/ refresh errors — re-runauthfor that account. In Testing mode, tokens expire after 7 days; publish the consent screen to avoid this.Could not decrypt tokens.enc—TOKEN_ENC_KEYchanged or the file is corrupt. Deletetokens.encand re-authorize.access_deniedduring OAuth — the account isn't added as a test user on the consent screen (or the app isn't published).No refresh_token returned — revoke prior access at myaccount.google.com/permissions and re-run;
authalready passesprompt=consentto avoid this.
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server connecting AI agents to 100+ apps (Gmail, Slack, Notion, GitHub) via one-click OAuth.
Your Gmail, Calendar, Drive, GitHub, Oura, wallet and confirmed profile facts in any MCP client.
Hosted MCP server with managed OAuth for 15+ toolkits: Google Workspace, Fitbit, Oura, Kalshi, etc.
Streamable HTTP MCP server for Google Calendar and Sheets with OAuth login.
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceA multi-account, token-efficient MCP server for Google Workspace services including Gmail, Calendar, Drive, Docs, and Sheets. It enables secure management of multiple accounts with compact data retrieval and keychain-backed authentication for efficient workflow automation.3MIT
- AlicenseNot gradedqualityDmaintenanceMCP server to interact with Google Gmail and Calendar APIs. Supports multiple accounts, email search and drafting, and calendar event management.MIT
- AlicenseBqualityCmaintenanceA local MCP server that acts as a secure credential-holding gateway to Google APIs (Gmail, Calendar, Drive), with deny-by-default policy enforcement so agents never see OAuth tokens.13MIT
- FlicenseNot gradedqualityCmaintenanceA local MCP server that connects multiple Google accounts to Claude Desktop, enabling unified email search and send, calendar events, and full CRUD on Google Docs, Sheets, and Forms.-