Google Workspace MCP Server
Allows sending plain-text emails through the user's authorized Gmail account, supporting to, cc, bcc, subject, body, and optional confirmation before sending.
Allows non-destructively appending plain text to the end of an existing Google Doc without overwriting, deleting, or replacing existing document content.
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 ServerSend an email to team@example.com about tomorrow's 10am project review."
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 (google-workspace-mcp)
A secure, client-agnostic Model Context Protocol (MCP) server that provides AI agents (Claude, Cursor, ChatGPT, Gemini, Antigravity) with controlled, user-authorized actions in Google Workspace.
Capabilities (Version 1)
gmail_send_email: Sends plain-text emails through the user's authorized Gmail account. Supportsto,cc,bcc,subject, andbody. Includes a configurable safe confirmation policy.google_docs_append_text: Non-destructively appends plain text to the very end of an existing Google Doc. Guaranteed never to overwrite, delete, or replace existing document content.
Related MCP server: Google Workspace MCP Server
Architectural Highlights
Client Agnostic: 100% compliant with standard MCP JSON-RPC 2.0 specifications. No client-specific or vendor-specific dependencies in business logic.
Least-Privilege Scopes: Requests only
https://www.googleapis.com/auth/gmail.sendandhttps://www.googleapis.com/auth/documents. Broad read scopes (e.g.gmail.readonly, fulldrive) are strictly prohibited.Safe Confirmation Policy: By default (
REQUIRE_EMAIL_CONFIRMATION=true), the server forces a two-phase commit on outbound emails, requiring the calling agent to confirm intent with the user before dispatching.Strict Privacy & Zero PII Logging: All logs output to
stderrin structured JSON. Email bodies, document content, recipient addresses, and OAuth tokens are strictly masked and redacted.Stdio Integrity: The
stdoutstream is exclusively reserved for framed MCP protocol communication.
For complete architectural details, see Docs/Architecture.md.
Prerequisites
Node.js: v20.0.0 or higher
Google Cloud Account: With permission to create an OAuth 2.0 application
Quickstart & Setup Guide
1. Google Cloud Platform Configuration
Visit the Google Cloud Console.
Create a new Google Cloud Project (e.g.
google-workspace-mcp-app).Enable Required APIs:
Navigate to APIs & Services > Library.
Search for Gmail API and click Enable.
Search for Google Docs API and click Enable.
Configure OAuth Consent Screen:
Navigate to APIs & Services > OAuth consent screen.
Choose External (or Internal if using a Google Workspace organization).
Fill in the required application name and support email.
On the Scopes step, add the following two scopes:
https://www.googleapis.com/auth/gmail.sendhttps://www.googleapis.com/auth/documents
Under Test users, add your Google email address.
Create OAuth Credentials:
Navigate to APIs & Services > Credentials.
Click Create Credentials > OAuth client ID.
Application type: Web application.
Name:
Workspace MCP Client.Authorized redirect URIs:
http://localhost:3000/oauth2callback.Click Create and copy your Client ID and Client Secret.
2. Configure Environment
Copy the example environment template and configure your credentials:
cp .env.example .envEdit .env:
GOOGLE_CLIENT_ID=your-client-id.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=your-client-secret
GOOGLE_REDIRECT_URI=http://localhost:3000/oauth2callback
TOKEN_STORAGE_PATH=./.credentials/tokens.json
REQUIRE_EMAIL_CONFIRMATION=true
LOG_LEVEL=info3. Authorize Your Google Account
Run the interactive authorization CLI:
npm run authYour default browser will open automatically to Google's OAuth consent screen.
Select your test Google account and grant the requested Gmail and Google Docs permissions.
Once completed, the tokens will be automatically saved to
./.credentials/tokens.jsonwith secure0600permissions.
4. Build the Project
npm run buildClient Configuration Examples
Claude Desktop
Add the following to your claude_desktop_config.json:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"google-workspace": {
"command": "node",
"args": ["c:/Users/jaya.manocha/Documents/myProjects/MCP/dist/src/index.js"],
"env": {
"GOOGLE_CLIENT_ID": "YOUR_CLIENT_ID.apps.googleusercontent.com",
"GOOGLE_CLIENT_SECRET": "YOUR_CLIENT_SECRET",
"TOKEN_STORAGE_PATH": "c:/Users/jaya.manocha/Documents/myProjects/MCP/.credentials/tokens.json",
"REQUIRE_EMAIL_CONFIRMATION": "true"
}
}
}
}Cursor IDE
Create or update .cursor/mcp.json in your project root or user config:
{
"mcpServers": {
"google-workspace": {
"command": "node",
"args": ["c:/Users/jaya.manocha/Documents/myProjects/MCP/dist/src/index.js"],
"env": {
"GOOGLE_CLIENT_ID": "YOUR_CLIENT_ID.apps.googleusercontent.com",
"GOOGLE_CLIENT_SECRET": "YOUR_CLIENT_SECRET",
"TOKEN_STORAGE_PATH": "c:/Users/jaya.manocha/Documents/myProjects/MCP/.credentials/tokens.json"
}
}
}
}Tool Reference
gmail_send_email
Sends an email using the authenticated Gmail account.
Parameters:
to(array of strings, required): One or more valid recipient email addresses.subject(string, required): Non-empty subject line (max 500 characters).body(string, required): Plain-text body content.cc(array of strings, optional): Carbon-copy recipient email addresses.bcc(array of strings, optional): Blind-carbon-copy recipient email addresses.confirm_send(boolean, optional): Explicit confirmation flag. Required whenREQUIRE_EMAIL_CONFIRMATION=true.request_id(string, optional): Correlation ID for traceability and duplicate prevention.
Example Response:
{
"success": true,
"message_id": "18f0a1b2c3d4e5f6",
"thread_id": "18f0a1b2c3d4e5f6",
"status": "Email sent"
}google_docs_append_text
Appends text to the end of a document without modifying prior contents.
Parameters:
document_id(string, required): Google Docs document ID or fulldocs.google.comURL.text(string, required): Exact plain text to append.prepend_newline(boolean, optional, default: true): Inserts a newline separator before the appended text.request_id(string, optional): Correlation ID.
Example Response:
{
"success": true,
"document_id": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms",
"status": "Text appended to Google Doc",
"characters_appended": 42
}Error Handling & Taxonomy
When a failure occurs, tools return a standardized error object:
{
"success": false,
"error_code": "RESOURCE_NOT_FOUND",
"message": "The requested Google Doc or mailbox resource was not found. Please verify the document ID.",
"retryable": false
}Error Code | Description |
| Malformed email addresses, empty text, or schema validation error. |
| Email was invoked without |
| Missing OAuth credentials. Run |
| Refresh token expired or was revoked. Re-run |
| Google account has not granted Gmail send or Docs permissions. |
| Document ID does not exist. |
| Account does not have write access to the document. |
| Rate limit or quota exceeded (retryable). |
| Email body or document append exceeds configured maximum size. |
Testing
Run the automated test suite with Vitest:
npm testBuild verification:
npm run buildLicense
Licensed under the Apache License, Version 2.0. See LICENSE for details.
This server cannot be deployed
Maintenance
Related MCP Connectors
Multiple Gmail accounts, editable Google Sheets & Docs for AI agents. Deny-by-default access rules.
Context and control for any AI. Agent identity, scoped access, and proof across tools.
Gmail, Outlook, Drive, OneDrive and calendars for AI agents. Many accounts, one endpoint, audit log.
- MailowsOAuthcom.mailows
Give AI agents their own email inboxes: list, read and send mail via scoped, revocable OAuth grants.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to compose and send Gmail emails and append text to Google Docs using the Model Context Protocol.1,151 npmMIT
- AlicenseNot gradedqualityDmaintenanceEnables sending and drafting emails via Gmail and appending content to Google Docs through the Model Context Protocol.8 npmMIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to send emails via Gmail and append text to Google Docs through the Model Context Protocol.221 npmMIT
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to send Gmail messages and append content to Google Docs using the Model Context Protocol.-