google-connections-mcp
Allows reading, sending, searching, labeling, archiving, and managing Gmail messages.
Allows listing, creating, updating, and deleting events across all Google Calendars.
Allows creating documents, reading and editing content, and formatting (bold, italic, fonts, headings, bullets, margins).
Allows searching, listing folders, creating, moving, renaming, deleting, sharing, copying files, and downloading content.
Provides full spreadsheet control with flexible row/column addressing, cell-level operations, and worksheet management including querying, updating, and merging.
Allows managing tasks and task lists, including creation, updating, deleting, completing, and starring tasks.
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 Connections MCP
A Model Context Protocol (MCP) server that provides AI assistants with access to Google Workspace APIs. Deploy once on Railway (or any hosting platform), connect from Claude or any MCP-compatible client.
Features
Google Sheets - Full spreadsheet control with flexible row/column addressing (by header name or column letter), cell-level operations, and worksheet management
Google Calendar - List, create, update, and delete events across all your calendars
Gmail - Read, send, search, label, archive, and manage messages
Google Tasks - Full task and task list management
Google Drive - Search, list folders, create/move/rename/delete/share/copy files, download content
Google Docs - Create documents, read/edit content, formatting (bold, italic, fonts, headings, bullets, margins)
Search Console - Search performance (queries, pages, clicks, impressions, position), URL index status, sitemaps (read only)
Google Analytics (GA4) - Reports, realtime activity, property list (read only)
Markdown files in Drive - List, read, create and edit
.mdfiles by exact text (no delete), with a version check so an edit never overwrites changes made since the file was readOne endpoint per product -
/mcphas every tool;/gmail/mcp,/markdown/mcpand the rest each have only their own, so an AI app gets just what it needsTime - Get current date/time in any IANA timezone
Related MCP server: Google Docs, Drive & Sheets MCP Server
How It Works
You deploy this server to Railway (or similar) with a small volume for its tokens
You set up OAuth credentials in Google Cloud Console
You add the connector in your AI app with the
/mcpaddressThe app sends you to Google's sign-in. Sign in as the owner account and approve: that one step grants the Google permissions AND connects the app. Any other Google account is turned away.
The MCP endpoint (/mcp, Streamable HTTP) needs a sign-in for every request. Behind it is an OAuth 2.1 authorization server (discovery, dynamic client registration, PKCE, rotating refresh tokens, revocation) whose login is Google, built on the MCP SDK's auth support.
Each user deploys their own instance with their own credentials - your data stays yours.
Quick Start
Prerequisites
Python 3.10+
A Google Cloud project with OAuth 2.0 credentials
Railway account (free tier works) or another hosting platform
Claude.ai account (or another MCP-compatible client)
1. Google Cloud Setup
Go to Google Cloud Console
Create a new project (e.g., "My MCP Server")
Enable these APIs (APIs & Services → Enable APIs):
Google Calendar API
Gmail API
Google Drive API
Google Sheets API
Google Tasks API
Google Search Console API
Google Analytics Data API
Google Analytics Admin API (only for
analytics_list_properties)
Configure OAuth consent screen (APIs & Services → OAuth consent screen):
User Type: External
App name: Whatever you want (e.g., "My Google Connections")
User support email: Your email
Developer contact: Your email
Scopes: Add the following:
https://www.googleapis.com/auth/calendarhttps://www.googleapis.com/auth/gmail.modifyhttps://www.googleapis.com/auth/gmail.sendhttps://www.googleapis.com/auth/drivehttps://www.googleapis.com/auth/spreadsheetshttps://www.googleapis.com/auth/taskshttps://www.googleapis.com/auth/webmasters.readonlyhttps://www.googleapis.com/auth/analytics.readonly
Google may say some scopes need verification. For an app only you use, skip it: you'll see "Google hasn't verified this app" when you authorize; choose Advanced → Go to (app name). Unverified apps are limited to 100 users.
Test users: Add your email
Important: Click "Publish App" to move from Testing to Production (this prevents tokens from expiring every 7 days)
Create OAuth 2.0 credentials (APIs & Services → Credentials):
Click "Create Credentials" → "OAuth client ID"
Application type: Web application
Name: Whatever you want
Authorized redirect URIs:
https://your-app-name.up.railway.app/oauth/callback(Use your actual Railway URL - you'll get this after deploying)Click "Create" and download the JSON file
2. Deploy to Railway
Fork this repository to your GitHub account
Go to Railway and create a new project
Choose "Deploy from GitHub repo" and select your fork
Railway will auto-detect the Python app and start deploying
Go to Settings → Networking → Generate Domain (note this URL)
Go back to Google Cloud and update your OAuth redirect URI with the actual Railway URL
Add a volume (the service → Settings → Volumes → Add, mount path
/data). Tokens are kept there; without it every deploy signs your AI app out.Add environment variables in Railway (Settings → Variables):
GOOGLE_CREDENTIALS = (paste the entire contents of your downloaded OAuth JSON file) OWNER_EMAIL = you@gmail.com (the only Google account allowed to sign in) DATA_DIR = /data (the volume's mount path)The public address is read from Railway's
RAILWAY_PUBLIC_DOMAIN; setPUBLIC_URLif you use a custom domain.Trigger a redeploy after adding the variables
3. Connect your AI app
Claude: Settings → Connectors → + Add → Add Custom Connector. Name it, paste https://your-railway-url/mcp, and tap Continue. The next screen comes filled in (Sign in now and Use Claude's published identity, marked Detected): leave it and tap Add. Claude opens Google's sign-in: sign in as OWNER_EMAIL and approve. (Unverified app? Choose Advanced → Go to (app name).)
ChatGPT (on the website; the ChatGPT app can't add custom servers): Plugins → Add → Add Custom MCP Server. Name it, optionally add an icon (download one from /icons/<name>.png), leave Server URL selected and paste the same URL, leave Authentication on OAuth, tick I understand and want to continue, then Create as a Plugin and Connect.
One product per connector (optional): besides /mcp (every tool), each product has its own address with only its tools: /gmail/mcp, /calendar/mcp, /drive/mcp, /docs/mcp, /sheets/mcp, /tasks/mcp, /search-console/mcp, /analytics/mcp and /markdown/mcp. Add any of them as its own connector the same way. They share one sign-in and one Google token, so connecting a second one asks you to sign in again but changes nothing else. Smaller toolsets help a lot with small local models, and an app only gets the products you give it. (Google itself grants the same permissions to all of them: the split is in which tools each address offers.)
Icons. Each address has its own icon (an envelope for /gmail/mcp, a bar chart for /analytics/mcp, a hub for /mcp, and so on), offered two ways: in the MCP serverInfo.icons each address returns when an app connects (spec 2025-11-25; PNG at /icons/<name>.png, 256px, and SVG at /icons/<name>.svg, where <name> is the product slug or google-connections for /mcp), and as the site's favicon (/favicon.ico, /favicon.svg, /apple-touch-icon.png, linked from /), which is the /mcp icon because a favicon is one per domain. The art is original, not Google's product logos: the SVGs live in src/google_connections_mcp/icons/, and NODE_PATH=$(npm root -g) node scripts/render_icons.js re-renders the PNGs and favicon.ico after an edit (Playwright and ImageMagick). Whether an app shows them is up to the app. As of November 2026 Claude.ai doesn't read serverInfo.icons for custom connectors and picks the icon itself from the domain when the connector is added (anthropics/claude-ai-mcp#152). On a *.up.railway.app address that lookup lands on railway.app, so expect Railway's icon or a globe there; a custom domain (PUBLIC_URL) is what lets this server's favicon count.
To grant new Google permissions later (after a scope is added to oauth_config.py), reconnect the connector: the sign-in asks for them.
You're done!
Guests on /analytics/mcp
Any Google account can connect its own Google Analytics to /analytics/mcp, and nothing else. For example, a friend connects his own Google Analytics to his own Claude through your server. A guest sees only the GA4 properties their own Google account can see. They never touch your token, your Gmail, Drive or anything else, and GA4_PROPERTY_ID (your default property) is never applied for them. There is no invite list: anyone who has the address can connect as a guest.
How it works. The sign-in for /analytics/mcp is told apart from the others by the resource parameter the AI app sends to /authorize (RFC 8707: an MCP client names the address it's connecting to, and Claude does). For /analytics/mcp, Google is asked for only openid, email and Analytics (read only). After Google:
You (
OWNER_EMAIL): signed in as always. Your saved Google token is kept as it is; a sign-in for the analytics address never replaces it with the narrower one.Any other account signing in for
/analytics/mcp: a guest. Their Google token is saved under their email, beside yours, and their connector's tokens work only at/analytics/mcp. Every other address,/mcpincluded, refuses them (401/403).Any other account at any other address: "This server belongs to someone else", and nothing is saved.
Google's limits on unverified apps. Unless the OAuth app has been through Google's verification, every guest sees "Google hasn't verified this app" and has to choose Advanced → Go to (app name). Google also caps an unverified app at 100 users over its lifetime (shown in Google Cloud Console → OAuth consent screen); you and every guest count toward it. The Google Analytics Data API (and Admin API, for analytics_list_properties) must be enabled in the project, as for you.
Only if the OAuth app is in Testing mode: each guest must be added under Test users on the OAuth consent screen, and their refresh tokens expire after 7 days. An app in Production needs neither.
Connect (guest): Claude → Settings → Connectors → Add custom connector, URL https://your-railway-url/analytics/mcp. Sign in with your own Google account and approve read-only Analytics (unverified app: Advanced → Go to (app name)). Then ask Claude to run analytics_list_properties and use the numeric property ID it gives.
Disconnecting: a guest removes the connector in Claude, and can revoke the app's access in their Google Account → Security → Third-party connections, after which their saved token stops working.
Moving from the old /sse setup
Older installs connected to /sse with no sign-in, using a GOOGLE_TOKEN_JSON copied from the logs. Both keep working until an AI app first connects through /mcp; after that /sse, /messages and /oauth/start answer 410 Gone for good, because /sse lets anyone with the URL use your Google account. Steps: add the volume and OWNER_EMAIL/DATA_DIR, deploy, then replace the connector's URL with /mcp and sign in. GOOGLE_TOKEN_JSON can be deleted once that works (the sign-in saves its own token). LEGACY_SSE=on or off overrides the automatic switch.
Available Tools
Every tool is named for its service (gmail_, calendar_, drive_, docs_, sheets_, tasks_, search_console_, analytics_) and carries a title like "Gmail: Send Message". Tools that only read are marked read-only, so MCP clients can list them separately from tools that change things. get_time keeps its plain name.
Google Sheets
All Sheets tools support a mode parameter: "header" (default) uses column header names, "letter" uses column letters (A, B, C...).
Tool | Description |
| Query with filters, sorting, column selection. Supports date comparisons. |
| Get complete row(s) by row number or unique ID lookup |
| Get cell value(s) by A1 notation (e.g., "A1", "B5") |
| Get all values in a column with row numbers (for easy update_cells follow-up) |
| Find row number(s) by searching a column for a value |
| Update specific cells in existing row(s) by row number or unique ID |
| Update cell(s) directly by A1 notation - the core write primitive |
| Append new row(s) to the end of the sheet |
| Insert row at specific position (shifts existing rows down) |
| Delete row(s) by row number or unique ID lookup |
| Insert column at position (shifts right) or append to first empty if no position given |
| Delete a column by header name or letter |
| Create a new Google Sheets document with optional worksheets |
| Add a new worksheet (tab) to an existing spreadsheet |
| Delete a worksheet from a spreadsheet |
| List all worksheets in a spreadsheet with their properties |
| Rename a worksheet |
| Get spreadsheet metadata (title, URL, all worksheets) |
| Clear cell contents in a range without deleting rows/columns |
| Sort entire worksheet by a column |
| Copy a worksheet to the same or a different spreadsheet |
| Merge a range of cells into one |
| Unmerge previously merged cells |
| Freeze rows and/or columns (headers stay visible while scrolling) |
Query Operators: ==, !=, >, <, >=, <=, in, not in, contains, not contains, is_null, not_null
Date Handling: Date columns are automatically parsed and compared correctly. Use == with full date strings (e.g., 1/27/2026 or 2026-01-27) for exact matching. Avoid contains for dates as it does substring matching.
Row Identification: Tools that modify rows accept either {"row": 6} for direct row numbers, or {"unique_id_column": "ID", "unique_id_value": "abc123"} for lookup-based identification.
Google Calendar
Tool | Description |
| List all calendars |
| List events with time range and search |
| Get specific event details |
| Create new event with optional attendees/reminders/timezone |
| Modify existing event |
| Remove event |
Timezone: calendar_create_event and calendar_update_event accept an optional timezone parameter (IANA format, e.g., 'America/New_York', 'Europe/London', 'UTC'). If omitted, uses the calendar's default timezone.
Gmail
Tool | Description |
| Search/list messages with Gmail query syntax |
| Get full message content |
| Send email (with CC/BCC support) |
| Add/remove labels |
| Bulk label operations |
| Mark messages as read/unread |
| Star/unstar messages |
| Archive messages |
| Move messages back to inbox |
| Move to trash |
| Mark as spam |
| List all labels |
| Create new label |
Google Tasks
Tool | Description |
| List all task lists |
| Manage task lists |
| List tasks (with completed/hidden options) |
| Get task details |
| Create task with notes, due date, parent task |
| Modify task |
| Mark complete |
| Remove task |
| Move between lists |
| Star/unstar tasks |
| Clear completed from list |
Google Drive
Tool | Description |
| Search files by query (name, type, etc.) |
| Get file metadata |
| Download and return file content |
| List contents of a folder (simpler than search) |
| Create a new folder |
| Move a file to a different folder |
| Rename a file or folder |
| Delete/trash a file or folder |
| Share a file with another user |
| Create a copy of a file |
Download supports:
Text files → returns text content
PDFs → extracts and returns text (requires PyMuPDF)
Google Docs → exports as plain text
Google Sheets → exports as CSV
Google Slides → exports as plain text
Images → returns base64-encoded data
File operations:
drive_delete_filemoves to trash by default; usepermanent=Trueto delete foreverdrive_share_filesupports roles:reader,commenter,writerdrive_copy_filecannot copy folders, only files
Google Docs
Tool | Description |
| Create a new Google Doc with optional initial content and folder placement |
| Get document content as plain text with structure info |
| Append text to the end of a document |
| Insert text at a specific index position |
| Find and replace all occurrences of text |
| Delete a range of content by start/end index |
| Remove excessive empty lines/paragraphs (configurable threshold) |
| Apply text formatting by index range (bold, italic, underline, font size, colors) |
| Find text and apply formatting (easier - no indices needed) |
| Apply paragraph formatting: alignment, line spacing, space above/below, indentation |
| Add bullet or numbered list formatting to paragraphs |
| Remove bullet/list formatting from paragraphs |
| Apply heading styles (Heading 1-6 or normal text) |
| Set page margins (top, bottom, left, right in inches) |
| Get detailed document structure with index positions for each element |
| Add a hyperlink to existing text (requires indices) |
| Find text and make it a hyperlink (easier - no indices needed) |
| Insert an image from a URL |
| Create a table with specified rows and columns |
| Insert a page break |
Index positions: Google Docs uses 1-based indexing. Use docs_get_structure to see each paragraph with its start/end indices for precise formatting.
Bullet presets: BULLET_DISC_CIRCLE_SQUARE (default), BULLET_CHECKBOX, NUMBERED_DECIMAL_ALPHA_ROMAN, NUMBERED_DECIMAL_NESTED, and more.
Search Console (read only)
Tool | Description |
| Properties this account can see, with permission level |
| Clicks, impressions, CTR and position by query, page, country, device or date, with filters |
| Google's index status for one URL: indexed or not, last crawl, chosen canonical |
| Submitted sitemaps with last download, warnings and errors |
Google Analytics (GA4, read only)
Tool | Description |
| Accounts and properties with their numeric property IDs |
| Any metrics over a date range, split by dimensions (pages, sources, countries, events), with a filter and sort |
| Activity in the last 30 minutes |
IDs: a Search Console property is written as Search Console shows it: sc-domain:example.com (domain property) or https://www.example.com/ (URL property). A GA4 property ID is the number in Admin → Property details, not the G-XXXX measurement ID.
Adding these to an existing install: enable the APIs and add the two scopes (step 1), deploy, then visit /oauth/start again and replace GOOGLE_TOKEN_JSON with the new token from the logs. Until then these tools say so, and every other tool keeps working on the old token.
Markdown files in Drive
.md files only (by name, or a text/markdown file type). Nothing here can delete, rename, move, share or trash a file, and content is written back as the same file, never converted to a Google Doc; Drive keeps every revision. Set MARKDOWN_FOLDER_ID and these tools refuse any file outside that one folder.
Tool | Arguments | Description |
|
| The |
|
| The text with 1-based line numbers ( |
|
| A new |
|
| Inserts lines after line N (0 = top) or after the line an exact, unique |
|
| Removes exact text that appears once; whole lines go with their line break |
|
| Swaps exact text that appears once (an edit is a replace) |
Every edit returns the new version and how many lines were added and removed. Text that's missing or appears more than once is refused with the count, so the model adds more surrounding text instead of guessing. Passing the version from markdown_read as expected_version refuses the edit if the file changed in between.
Utility
Tool | Description |
| Get current date/time for any IANA timezone |
Local Development
# Clone the repository
git clone https://github.com/michaelzrork/google-connections-mcp.git
cd google-connections-mcp
# Install uv if you don't have it
pip install uv
# Install dependencies
uv sync
# Set environment variables
export GOOGLE_CREDENTIALS='{"web":{"client_id":"..."}}'
export GOOGLE_TOKEN_JSON='{"token":"...","refresh_token":"..."}'
# Run the server
python -m google_connections_mcp.serverThe server runs on port 8000 by default (or $PORT if set).
Markdown on your own computer (VS Code + Ollama)
The markdown_* tools can also run on your computer over stdio, with no hosted server: for an editor like VS Code with Continue or Cline and a local Ollama model. It signs in to Google on that computer and asks only for Drive.
At work, check first. Signing in to a personal Google account from a company computer, or putting company notes in a personal Drive, may be against your company's IT or data policy.
1. A Desktop OAuth client. In Google Cloud Console (the same project is fine): APIs & Services → Credentials → Create Credentials → OAuth client ID → Application type Desktop app → Create → Download JSON. Save it somewhere private, e.g. ~/.config/markdown-drive-mcp/client_secret.json. The Drive API must be enabled in the project; if the consent screen is in Testing, your account must be a test user.
2. Install and sign in once (Python 3.10+):
pip install git+https://github.com/michaelzrork/google-connections-mcp.git
export MARKDOWN_CLIENT_SECRET=~/.config/markdown-drive-mcp/client_secret.json
export MARKDOWN_FOLDER_ID=<the id at the end of the folder's Drive URL>
markdown-drive-mcp --login # or: python -m google_connections_mcp.local_markdown --loginA browser opens for Google's sign-in. The sign-in is saved at ~/.config/markdown-drive-mcp/token.json (%APPDATA%\markdown-drive-mcp\token.json on Windows; MARKDOWN_TOKEN_PATH overrides it) and refreshes itself.
3. Tell the editor about it. Continue: a file .continue/mcpServers/markdown-drive.yaml in your workspace (or the mcpServers section of ~/.continue/config.yaml):
name: Markdown Drive
version: 0.0.1
schema: v1
mcpServers:
- name: Markdown Drive
command: markdown-drive-mcp
env:
MARKDOWN_CLIENT_SECRET: /home/you/.config/markdown-drive-mcp/client_secret.json
MARKDOWN_FOLDER_ID: your-folder-idCline: MCP Servers → Configure → cline_mcp_settings.json:
{
"mcpServers": {
"markdown-drive": {
"command": "markdown-drive-mcp",
"env": {
"MARKDOWN_CLIENT_SECRET": "/home/you/.config/markdown-drive-mcp/client_secret.json",
"MARKDOWN_FOLDER_ID": "your-folder-id"
}
}
}
}On Windows use full paths (C:\\Users\\you\\...), and if markdown-drive-mcp isn't on the editor's PATH, use "command": "python", "args": ["-m", "google_connections_mcp.local_markdown"]. Pick an Ollama model that supports tool calls (Qwen 2.5/3, Llama 3.1+, Mistral Small and similar).
Environment Variables
Variable | Required | Description |
| Yes | OAuth client configuration JSON from Google Cloud Console |
| Yes | The Google account allowed to sign in; everyone else is refused |
| Yes* | Where tokens are kept: a mounted volume, e.g. |
| No | This server's public address; defaults to |
| No | Old setup only: a token copied from the logs. Used when the sign-in hasn't saved one |
| No |
|
| No | Default Search Console property for the Search Console tools |
| No | Default numeric GA4 property ID for the Analytics tools |
| No | The only Drive folder the |
| No | Server port (default: 8000) |
*Without a volume the server still runs, but tokens are lost on every deploy and the AI app has to sign in again.
Endpoints
Endpoint | Description |
| MCP endpoint (Streamable HTTP, sign-in required): what your AI app connects to |
| The same, with only that product's tools (plus |
| OAuth discovery (one protected-resource document per endpoint) |
| OAuth 2.1: client registration, sign-in, tokens, revocation |
| Google's redirect back after sign-in |
| Each address's icon ( |
| The site icon (same as |
| Status: Google signed in, the |
| Old setup, open until the first |
Troubleshooting
"Token expired" or constant reauthorization
Make sure you've published your OAuth app to Production in Google Cloud Console. Testing mode tokens expire every 7 days.
Can't connect from Claude
Check that your Railway deployment is running (
/healthendpoint should return{"status": "ok"})Verify the URL ends in
/mcp"This server belongs to someone else": you signed in with a Google account other than
OWNER_EMAIL(guests can connect only at/analytics/mcp)Signed out after every deploy: the volume isn't mounted, or
DATA_DIRdoesn't point at it (/healthshowsstorage_persistent)Check Railway logs for errors
OAuth callback fails
Make sure your redirect URI in Google Cloud Console exactly matches your Railway URL
The URL should be
https://(nothttp://)Include the full path:
https://your-app.up.railway.app/oauth/callback
PDF text extraction not working
PyMuPDF should be included in dependencies. Check that your deployment includes it. PDFs will fall back to base64 if text extraction fails.
Architecture
This server uses:
FastMCP for MCP protocol handling
gspread for Google Sheets
google-api-python-client for other Google APIs
PyMuPDF for PDF text extraction
Starlette for HTTP transport
The MCP SDK's OAuth support (
mcp.server.auth) with Google as the login:mcp_oauth.py, tokens intoken_store.pymarkdown_drive.py: the Markdown tools and their edit logic, shared by the hosted server and the local stdio server (local_markdown.py)uv for fast dependency management
Known Limitations
Images from Drive: Returned as base64. AI assistants need to decode and save locally to view.
Large files: Very large files may timeout. Consider using
drive_get_filefor metadata and accessing viawebViewLinkinstead.Google Workspace files: Docs/Sheets/Slides are exported to text/CSV, not native format.
License
MIT
Contributing
Issues and pull requests welcome!
Author
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
Related MCP Connectors
Connect an AI assistant to your Google Sheets, Drive, Docs, PDFs, BigQuery and Gmail.
Connect AI assistants to Google Sheets through controlled tools for reading and updating rows.
Use your apps from your AI: Gmail, Slack, Google Sheets, HubSpot and 2,300+ more on your accounts.
Gmail, Outlook, Drive, OneDrive and calendars for AI agents. Many accounts, one endpoint, audit log.
Related MCP Servers
- AlicenseBqualityDmaintenanceProvides comprehensive natural language control over Google Workspace services including Gmail, Drive, Calendar, Docs, Sheets, Slides, Forms, Tasks, and Chat. Features multi-user OAuth 2.1 support, flexible tool tiers, and seamless integration with AI assistants.843MIT
- AlicenseNot gradedqualityDmaintenanceEnables deep integration with Google Workspace for AI assistants, allowing for document creation, spreadsheet manipulation, and file management. It supports advanced features like template processing, comment thread management, and cell formatting.MIT
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to interact with Google Workspace services (Gmail, Drive, Docs, Tasks, Calendar) through OAuth 2.0 authentication, providing 25+ operations for business automation and productivity.1-
- AlicenseNot gradedqualityDmaintenanceProvides unified access to Google Workspace APIs including Gmail, Drive, Sheets, Calendar, Docs, Forms, and Chat through a single interface, enabling email management, file operations, spreadsheet editing, event scheduling, and more via natural language.MIT