Google Workspace MCP Server
Provides tools for drafting, updating, sending, and retrieving emails via the Gmail API.
Provides tools for creating, reading, appending content to, and retrieving metadata of Google Docs documents.
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 Workspace MCP Server Draft an email to John about tomorrow's meeting"
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 Workspace MCP Server
A generic Model Context Protocol (MCP) Server that exposes Gmail and Google Docs as standardized tools, enabling any MCP-compatible AI agent (Claude, ChatGPT, Cursor, VS Code agents, etc.) to securely interact with Google Workspace.
Features
Gmail Tools — Draft, update, send, and retrieve emails
Google Docs Tools — Create, read, append to, and inspect documents
OAuth 2.0 — Secure authentication with automatic token refresh
MCP-Compliant — Works with any MCP client out of the box
Structured Responses — Consistent JSON response envelopes for all tools
Extensible — Modular architecture for adding Google Sheets, Drive, Calendar, etc.
Related MCP server: Gmail MCP Server
Prerequisites
Python 3.11+
A Google Cloud project with Gmail API and Google Docs API enabled
OAuth 2.0 credentials (
credentials.json)
Google Cloud Setup
Go to the Google Cloud Console
Create a new project (or select an existing one)
Navigate to APIs & Services → Library
Enable Gmail API and Google Docs API
Navigate to APIs & Services → Credentials
Click Create Credentials → OAuth 2.0 Client ID
Select Desktop app as the application type
Download the credentials file and save it as
credentials.jsonin the project rootNavigate to OAuth consent screen and add your email as a test user
Installation
# Clone the repository
git clone <repository-url>
cd google-mcp-server
# Create a virtual environment
python -m venv .venv
source .venv/bin/activate # macOS/Linux
# .venv\Scripts\activate # Windows
# Install the package
pip install -e .
# Install dev dependencies (optional)
pip install -e ".[dev]"Configuration
Copy the environment template and configure:
cp .env.example .envEdit .env as needed:
GOOGLE_CREDENTIALS_PATH=./credentials.json
GOOGLE_TOKEN_PATH=./token.json
LOG_LEVEL=INFOFirst Run
On the first run, the server will open your browser for Google OAuth consent:
python -m google_mcp_server.serverA browser window will open asking you to sign in to Google
Grant the requested permissions (Gmail compose/read, Google Docs read/write)
The token is saved to
token.jsonfor future useThe server starts on stdio transport, ready for MCP client connections
Available Tools
Gmail
Tool | Description |
| Create a new email draft with To, CC, BCC, Subject, and Body |
| Update an existing draft (unchanged fields are preserved) |
| Send an email directly without creating a draft |
| Send a previously created draft |
| Retrieve a draft by ID with headers and snippet |
Google Docs
Tool | Description |
| Create a new document with optional initial content |
| Read the full text content of a document |
| Append text to the end of a document |
| Get document metadata (title, revision, URL) |
MCP Client Configuration
Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"google-workspace": {
"command": "python",
"args": ["-m", "google_mcp_server.server"],
"env": {
"GOOGLE_CREDENTIALS_PATH": "/absolute/path/to/credentials.json",
"GOOGLE_TOKEN_PATH": "/absolute/path/to/token.json"
}
}
}
}Cursor
Add to your MCP settings:
{
"mcpServers": {
"google-workspace": {
"command": "python",
"args": ["-m", "google_mcp_server.server"],
"cwd": "/path/to/google-mcp-server"
}
}
}VS Code (Copilot)
Add to your VS Code settings:
{
"mcp": {
"servers": {
"google-workspace": {
"command": "python",
"args": ["-m", "google_mcp_server.server"],
"cwd": "/path/to/google-mcp-server"
}
}
}
}Vercel Deployment
This MCP server is configured for serverless deployment on Vercel using Server-Sent Events (SSE).
Push your code to a GitHub repository.
Go to the Vercel Dashboard and create a new project from your repository.
In the environment variables section, add the following variable:
Key:
GOOGLE_TOKEN_JSONValue: (Paste the exact contents of your local
token.jsonfile)
Also add:
Key:
VERCELValue:
1
Deploy the project!
Once deployed, your MCP SSE endpoint will be available at:
https://<your-vercel-domain>/sse
Clients connecting to a Vercel-deployed server must use the SSE transport configuration instead of the stdio transport.
Testing with MCP Inspector
Use the official MCP Inspector to test your server interactively:
npx -y @modelcontextprotocol/inspector python -m google_mcp_server.serverRunning Tests
# Run all tests
pytest tests/ -v
# Run with coverage
pytest tests/ --cov=src/google_mcp_server --cov-report=term-missing
# Lint
ruff check src/ tests/Docker
# Build
docker build -f docker/Dockerfile -t google-mcp-server .
# Run (mount your credentials)
docker run -it \
-v $(pwd)/credentials.json:/app/credentials.json \
-v $(pwd)/token.json:/app/token.json \
google-mcp-serverProject Structure
google-mcp-server/
├── pyproject.toml # Project config & dependencies
├── .env.example # Environment variable template
├── credentials.json # Google OAuth credentials (gitignored)
├── token.json # Cached OAuth token (gitignored)
├── src/
│ └── google_mcp_server/
│ ├── server.py # FastMCP server entry point
│ ├── config.py # Settings & environment loading
│ ├── auth/
│ │ └── oauth.py # OAuth 2.0 flow & token management
│ ├── gmail/
│ │ ├── service.py # Gmail API wrapper functions
│ │ └── tools.py # Gmail MCP tool definitions
│ ├── docs/
│ │ ├── service.py # Google Docs API wrapper functions
│ │ └── tools.py # Docs MCP tool definitions
│ └── utils/
│ └── errors.py # Error handling & response formatting
├── tests/ # Unit tests
└── docker/
└── Dockerfile # Docker deploymentLicense
MIT
Available Tools
9 toolsappend_to_google_docA
Append content to the end of an existing Google Document.
The content is added after the existing text without overwriting anything.
Args: document_id: The ID of the Google Document to append to. content: The text content to append to the document.
Returns: Document ID, title, number of characters appended, and URL.
Inputs: content (required), document_id (required).
create_google_docA
Create a new Google Document.
Args: title: The title of the new document. content: Optional initial text content to add to the document body.
Returns: Document ID, title, and URL on success, or error details on failure.
Inputs: title (required), content.
draft_emailA
Create a new email draft in Gmail.
Args: to: Recipient email address (comma-separated for multiple recipients). subject: Email subject line. body: Email body content. cc: CC recipients (comma-separated, optional). bcc: BCC recipients (comma-separated, optional). body_type: Content type — "plain" for plain text or "html" for HTML content.
Returns: Draft ID, message ID, and a summary of the created draft.
Inputs: to (required), body (required), subject (required), cc, +2 more.
get_email_draftB
Retrieve an existing email draft from Gmail.
Args: draft_id: The ID of the draft to retrieve.
Returns: Draft details including headers, snippet, and IDs.
Inputs: draft_id (required).
get_google_doc_metadataA
Get metadata for a Google Document.
Retrieves the document's title, revision ID, URL, and page size without reading the full content.
Args: document_id: The ID of the Google Document.
Returns: Document metadata including title, revision, and URL.
Inputs: document_id (required).
read_google_docA
Read the full content of a Google Document.
Extracts all text content from the document, preserving paragraph structure.
Args: document_id: The ID of the Google Document to read (found in the document URL).
Returns: Document ID, title, full text content, and URL.
Inputs: document_id (required).
send_existing_draftB
Send an existing email draft via Gmail.
Args: draft_id: The ID of the draft to send.
Returns: Sent message details or error information.
Inputs: draft_id (required).
send_new_emailA
Send an email directly via Gmail.
This sends the email immediately without creating a draft first.
Args: to: Recipient email address (comma-separated for multiple recipients). subject: Email subject line. body: Email body content. cc: CC recipients (comma-separated, optional). bcc: BCC recipients (comma-separated, optional). body_type: Content type — "plain" for plain text or "html" for HTML content.
Returns: Sent message ID and thread details, or error information.
Inputs: to (required), body (required), subject (required), cc, +2 more.
update_email_draftA
Update an existing email draft in Gmail.
Only provide the fields you want to change — unchanged fields will be preserved from the original draft.
Args: draft_id: The ID of the draft to update. to: New recipient(s), or leave empty to keep existing. subject: New subject, or leave empty to keep existing. body: New body content, or leave empty to keep existing. cc: New CC recipients, or leave empty to keep existing. bcc: New BCC recipients, or leave empty to keep existing. body_type: Content type — "plain" or "html".
Returns: Updated draft details or error information.
Inputs: draft_id (required), cc, to, bcc, +3 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Each tool targets a distinct action and service (Docs vs. Gmail), with no overlapping purposes. Operations are clearly separated (e.g., draft_email vs. send_new_email, get_google_doc_metadata vs. read_google_doc).
All tools follow a consistent verb_noun pattern (e.g., create_google_doc, draft_email, get_email_draft). No mixing of conventions or vague verbs.
9 tools cover core operations for two distinct services (Docs and Gmail). The count is well-scoped, neither too few nor excessive for the stated purpose.
Core CRUD operations are present for Docs (create, read, append, metadata) but missing update and delete. Gmail covers drafting and sending but lacks listing drafts, deleting, or searching. Notable gaps but not severely incomplete.
Maintenance
Related MCP Connectors
MCP server connecting AI agents to 100+ apps (Gmail, Slack, Notion, GitHub) via one-click OAuth.
Email infrastructure for AI agents — send, receive, search, and reply to email over MCP.
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA complete MCP server integrating Gmail and Google Docs, enabling email management (list, send, search, reply) and document operations (create, edit, search, share) through natural language.-
- FlicenseNot gradedqualityDmaintenanceProduction-ready MCP server for Gmail, enabling AI agents to search, read, send, draft, and manage emails, labels, and attachments via the Google Gmail API.-
- AlicenseBqualityDmaintenanceA generic MCP server that exposes Gmail and Google Docs capabilities as tools for AI agents. Enables sending emails and appending content to Google Docs.2ISC
- AlicenseBqualityDmaintenanceA production-ready MCP server that bridges AI agents with Google Workspace (Gmail & Docs) to securely compose emails and edit documents via standardized tools.3MIT