Google Multi-Account MCP Server
Provides tools for reading, searching, sending, drafting, marking as read, trashing, and untrashing Gmail messages across multiple Google accounts.
Provides multi-account management for Google accounts, including listing connected accounts and revoking account access.
Provides access to the Google Analytics Data API for analytics reporting.
Provides tools for listing, getting, creating, updating, and deleting Google Calendar events and calendars, including creating events with Google Meet.
Provides tools for listing, searching, reading, creating folders, uploading text files, renaming, trashing, and deleting files in Google Drive.
Enables creating Google Meet video conferencing links as part of Google Calendar events.
Provides tools for reading and writing ranges, listing, creating, adding, and deleting sheets, appending rows, and clearing ranges in Google Sheets.
Provides access to YouTube Data, Analytics, and Reporting APIs for supported Google accounts.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Google Multi-Account MCP Servershow today's calendar events across all my Google accounts"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
๐ Google Multi-Account MCP Server
Author: ลukasz Zychal | LinkedIn A custom MCP (Model Context Protocol) server in Python that gives Claude and Gemini access to multiple Google accounts simultaneously โ without external intermediaries, 100% privately.
Supported services: Gmail ยท Google Drive ยท Calendar ยท YouTube ยท Sheets ยท Analytics ยท AdSense ยท Fitness
๐ ๏ธ Full CRUD Support (Create, Read, Update, Delete):
Service | ๐๏ธ Read | โ Create | โ๏ธ Update | ๐๏ธ Delete |
Calendar |
|
|
|
|
Google Drive |
|
|
|
|
Gmail |
|
|
|
|
Google Sheets |
|
|
|
|
Google Accounts |
|
| โ |
|
๐ Table of Contents
Related MCP server: mcp-google
1. Prerequisites
Requirement | Minimum Version | Verification |
Python | 3.10+ |
|
pip | 23+ |
|
Claude Desktop | latest | |
Google Account | any | โ |
2. Google Cloud Console Configuration
โฑ Time: approx. 15 minutes | You do this once.
Step 2.1 โ Create a project
Go to console.cloud.google.com
Click the project selector (top bar) โ "NEW PROJECT"
Project name:
google-mcp-server(any name)Click "CREATE" and wait for initialization (~10 seconds)
Ensure the new project is selected in the selector
Step 2.2 โ Enable necessary APIs
In the side menu, go to "APIs & Services" โ "Library"
Search for and enable each of the following APIs (click โ "ENABLE"):
API to enable | Where to search |
Gmail API | search: |
Google Drive API | search: |
Google Calendar API | search: |
YouTube Data API v3 | search: |
YouTube Analytics API | search: |
YouTube Reporting API | search: |
Google Sheets API | search: |
Google Analytics Data API | search: |
AdSense Management API | search: |
Fitness API | search: |
๐ก Tip: You can enable only those APIs that you will actually use. The rest will be inactive even if they are in the SCOPES.
Step 2.3 โ OAuth Consent Screen Configuration
In the side menu: "APIs & Services" โ "OAuth consent screen"
Select User Type: "External" โ click "CREATE"
Fill out the form:
Field | Value |
App name |
|
User support email | Your email address |
App logo | (optional, skip) |
App domain | (empty โ skip the entire section) |
Developer contact | Your email address |
Click "SAVE AND CONTINUE"
"Scopes" Tab:
Click "ADD OR REMOVE SCOPES"
In the search box, sequentially enter and check:
gmail.readonly,gmail.send,gmail.modifydrive.readonlycalendar.readonly,calendaryoutube.readonly,yt-analytics.readonlyspreadsheetsanalytics.readonlyadsense.readonlyfitness.activity.read
Click "UPDATE" โ "SAVE AND CONTINUE"
โ ๏ธ You do not have to select all of them. Choose only the ones you plan to use.
"Test users" Tab:
Click "ADD USERS"
Enter your email addresses โ every Google account you want to use, e.g.:
john.doe@gmail.com john.doe@company.comClick "ADD" โ "SAVE AND CONTINUE"
๐ Why? Your app is in "Testing" mode. Google only lets addresses from this list through it. This is not necessary after moving to "In production" status (required for a commercial version).
Step 2.4 โ Create Credentials (credentials.json)
In the side menu: "APIs & Services" โ "Credentials"
Click "+ CREATE CREDENTIALS" โ "OAuth client ID"
Application type: "Desktop app"
Name:
MCP Local ClientClick "CREATE"
In the popup window, click "DOWNLOAD JSON"
Save the downloaded file as:
GoogleMCP/credentials/credentials.json
๐จ NEVER upload this file to GitHub or share it! It contains your private app key.
3. Project Installation
# 1. Clone or download the project
cd /path/to/GoogleMCP
# 2. Create a virtual environment
python -m venv venv
# 3. Activate the environment
source venv/bin/activate # macOS / Linux
# or: venv\Scripts\activate # Windows
# 4. Install dependencies
pip install -r requirements.txt
# 5. Check if everything works
python -c "import mcp; import googleapiclient; print('OK')"Ensure the credentials file is in place:
credentials/credentials.json โ downloaded in step 2.4Docker Option ๐ณ
If you prefer not to set up a local Python environment, you can build a Docker image and run the server inside a container. Make sure to mount the credentials directory as a volume to persist your tokens across restarts.
# Build the image (from the project directory)
docker build -t google-mcp-server .
# Test the server (it should wait for stdio input)
docker run -i -v $(pwd)/credentials:/app/credentials google-mcp-server4. Claude Desktop Integration
Step 4.1 โ Find the configuration file
System | Path |
macOS |
|
Windows |
|
Linux |
|
# macOS โ open the file in an editor
open ~/Library/Application\ Support/Claude/Step 4.2 โ Add server configuration
Open the claude_desktop_config.json file and add (or complete an existing one):
{
"mcpServers": {
"google-multi-account": {
"command": "/Users/YOUR_NAME/PhpstormProjects/GoogleMCP/venv/bin/python",
"args": [
"/Users/YOUR_NAME/PhpstormProjects/GoogleMCP/server.py"
]
}
}
}โ ๏ธ Important: Use the full path to Python from the virtual environment (
venv/bin/python), not the systempython.
Quick path check:
source venv/bin/activate
which python
# Copy this output to the "command" field in the JSON aboveStep 4.3 โ Verification
Restart Claude Desktop (close completely and reopen)
Open a new chat
Look for the ๐จ (hammer/tools) icon in the interface
Click it โ a list of tools with
google-multi-accountshould appearTest it by typing to Claude:
"List available Google accounts"
5. Gemini and Antigravity IDE Integration
Path 0 โ Antigravity IDE (Gemini in IDE) โ โ CONFIGURED
In Antigravity IDE, MCP servers are configured in the file:
~/.gemini/config/mcp_config.json
The server has already been added to your configuration:
"google-multi-account": {
"command": "/Users/lukaszzychal/PhpstormProjects/GoogleMCP/venv/bin/python",
"args": [
"/Users/lukaszzychal/PhpstormProjects/GoogleMCP/server.py"
],
"env": {}
}NOTE โ Do you need a Gemini API key in Antigravity IDE? NO. In Antigravity IDE, the agent uses the built-in subscription / session of the IDE environment. The MCP server runs locally as a child process via stdio.
Then what is the
GEMINI_API_KEYkey for? The Gemini API key (GEMINI_API_KEY) from Google AI Studio is only needed if you run external developer Python scripts (e.g.,gemini_client.py) outside the Antigravity environment that connect directly to the Gemini API via thegoogle-genaiSDK.
Path A โ Gemini CLI (local, via terminal)
Google provides the gemini CLI tool that supports the MCP protocol.
Install Gemini CLI
# Requires Node.js 18+
npm install -g @google/gemini-cli
# Login
gemini auth loginMCP configuration in Gemini CLI
Create or edit the config file:
nano ~/.gemini/settings.jsonAdd the MCP server configuration similarly to Claude Desktop.
6. First Login โ OAuth2
Upon the first use of any new account (account_id), the server automatically opens the browser.
What happens step by step:
Claude/Gemini โ calls gmail_list_emails(account_id='work')
โ
server.py โ looks for the file credentials/token_work.json
โ
File does not exist โ opens browser with Google login screen
โ
You log in to your account (e.g., john@gmail.com)
โ
Google asks: "Allow Google MCP Server to access...?"
โ
You click "Allow"
โ
Token saved in: credentials/token_work.json
โ
Subsequent uses โ automatically, without a browser (token refreshed hourly)What is account_id (e.g., "work", "private")?
account_id is your own short alias (label) that you assign to a given Google account:
You do not need to provide the full email address in prompts. Instead of writing "Check mail on lukasz.kowalski.firma@gmail.com", you tell the model: "Check mail on the work account".
Each alias creates a separate token file in the
credentials/token_<alias>.jsondirectory (e.g.,token_work.json,token_private.json).You can use any name:
work,private,company,marketing,youtube-channel, etc.
Two ways to log in / add accounts:
Method A โ Via terminal (CLI โ recommended at the start):
You can log in an account upfront before starting the chat:
source venv/bin/activate
python auth.py add workMethod B โ Automatically via a chat query (Claude / Gemini):
Just use the account name in a query:
"Check emails on the 'work' account"The server will detect the missing token, open a browser window, and automatically save the token after logging in.
7. Example Prompts
Gmail
"Show my 10 latest unread emails on the 'work' account"
"Do I have any emails from boss@company.com on the 'work' account?"
"Send an email to john@example.com from the 'work' account with the subject 'Offer'"
Google Drive
"Show files from Drive on the 'work' account modified recently"
"Find PDF files on my 'private' drive"
"Create a folder 'Reports 2026' on the 'work' drive"
Google Calendar
"What do I have planned over the next 7 days? Account: 'work'"
"Create a 'Stand-up' meeting tomorrow at 9:00 on the 'work' account with a Google Meet link"
"Delete the meeting with ID 'abc123' and notify participants"
YouTube
"Provide stats for my YouTube channel (account: 'work')"
"Search for videos on 'Python MCP tutorial'"
Google Sheets
"Read data from the range 'Sheet1!A1:D20' in file '1xyz...'"
"Add row ['John', 'Doe', '500', '2026-09-27'] to the sheet"
8. Account Management
Checking logged-in accounts
python auth.py listOr ask in chat: "List available Google accounts".
Logging in / adding a new account
python auth.py add workLogging out / removing an account
Method 1 (CLI):
python auth.py revoke workMethod 2 (Chat): "Log out the 'work' account".
9. Extending with New APIs
Add new services by enabling the API in Google Cloud Console, adding the scope to config.py, creating a tools module, and registering it in server.py.
10. Open-Source Version
If you want to share the project on GitHub:
Ensure your
.gitignoreprotects your keys (credentials/andcredentials.json).Provide instructions and
.env.exampletemplates.
11. Troubleshooting
FileNotFoundError: credentials.json: Make sure you downloaded the client secret from Google Cloud Console and placed it incredentials/.Error 403: access_denied: Your email address is not in the Test Users list in the OAuth consent screen.Error 400: redirect_uri_mismatch: Incorrect credentials type โ you must use "Desktop app".Claude doesn't see tools: Ensure the path in
claude_desktop_config.jsonpoints to the correct virtual environmentvenv/bin/python.
๐ Security Summary
File | Where | Security |
|
| ๐ด NEVER commit! |
|
| ๐ด NEVER commit! |
๐ License
MIT License.
๐ค Roadmap
Gmail, Google Drive, Calendar, YouTube, Google Sheets, Analytics, AdSense
Google Tasks, Contacts, Forms
Docker container
This server cannot be deployed
Maintenance
Related MCP Connectors
Multiple Google accounts (Gmail, Calendar, Drive, Contacts, Tasks) in one Claude connector.
Multiple Google accounts (Gmail, Calendar, Drive, Contacts, Tasks) in one Claude connector.
Multiple Gmail accounts, editable Google Sheets & Docs for AI agents. Deny-by-default access rules.
Gmail, Outlook, Drive, OneDrive and calendars for AI agents. Many accounts, one endpoint, audit log.
Related MCP Servers
- -licenseNot gradedqualityNot gradedmaintenanceEnables AI assistants to securely manage Google Workspace services (Gmail, Calendar, Drive, Sheets, Contacts) with persistent multi-account OAuth. Uses OS keychain for credential storage with health monitoring and granular business rules for enterprise security.-
- FlicenseNot gradedqualityAmaintenanceExposes 25 tools for Claude Code across Gmail, Calendar, Drive, Docs, Sheets, and Slides. Supports multi-account, local-first, encrypted OAuth tokens.97-
- AlicenseAqualityBmaintenanceEnables natural language interaction with multiple Google accounts (Gmail, Drive, Calendar) from MCP-compatible clients like Claude.6361 npm2MIT
- FlicenseNot gradedqualityBmaintenanceConnects multiple Gmail and Google Calendar accounts to Claude Desktop locally, enabling email management (search, send, draft, label) and calendar operations (list events, search) via natural language.-