MCP Google Server
Allows creating Gmail drafts and sending emails via the Gmail API, supporting recipients, subject, body, and plain-text or HTML content.
Allows appending text to existing Google Docs documents while preserving their existing content.
Click on "Install 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., "@MCP Google ServerDraft an email to the team about the upcoming release"
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.
MCP Google Server
A generic, reusable Model Context Protocol (MCP) server that lets any MCP-compatible AI agent draft and send Gmail emails and append content to Google Docs — without the agent needing to understand Google's APIs.
AI Agent ──MCP──► mcp-google-server ──────► Gmail API
└───► Google Docs APIFeatures
Tool | Description | Side Effect |
| Create a Gmail draft (does NOT send) | None — safe |
| Send an email via Gmail | ⚠️ Sends immediately |
| Append text to an existing Google Doc | Modifies document |
Related MCP server: Generic MCP Server for Google Workspace
Prerequisites
Node.js 18+
A Google Cloud project with the Gmail API and Google Docs API enabled
OAuth 2.0 credentials (Desktop app type)
Setup
1. Clone and install dependencies
git clone <your-repo-url> mcp-google-server
cd mcp-google-server
npm install2. Create a Google Cloud project and enable APIs
Go to the Google Cloud Console
Create a new project (or select an existing one)
Enable the following APIs:
3. Create OAuth 2.0 credentials
Go to APIs & Services → Credentials
Click Create Credentials → OAuth 2.0 Client IDs
Application type: Desktop app
Download the JSON file
4. Configure environment variables
cp .env.example .envEdit .env with your credentials:
GOOGLE_CLIENT_ID=your-client-id.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=your-client-secret
GOOGLE_REDIRECT_URI=http://localhost:3000/oauth/callback
GOOGLE_TOKEN_PATH=./tokens.json
LOG_LEVEL=info⚠️ Never commit
.envortokens.json— they are already in.gitignore.
5. Authorize with Google
Run the one-time OAuth consent flow:
npm run authThis will:
Print an authorization URL
Wait for you to open it in your browser and approve access
Ask you to paste the authorization code
Store tokens in
tokens.json
6. Start the MCP server
npm run dev # Development (with tsx, no build needed)
npm run build && npm start # ProductionThe server communicates over stdio and is now ready for MCP clients to connect.
Connecting an MCP Client
Claude Desktop
Add the following to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"google": {
"command": "node",
"args": ["/absolute/path/to/mcp-google-server/dist/index.js"],
"env": {
"GOOGLE_CLIENT_ID": "your-client-id",
"GOOGLE_CLIENT_SECRET": "your-client-secret",
"GOOGLE_TOKEN_PATH": "/absolute/path/to/tokens.json"
}
}
}
}Generic MCP Client (stdio)
node dist/index.jsThe server exposes three discoverable tools over stdin/stdout using the MCP protocol.
Tool Documentation
gmail_create_draft
Creates a Gmail draft. Does not send the email.
Parameter | Type | Required | Description |
|
| ✅ | Recipient email addresses |
|
| ❌ | CC recipients |
|
| ❌ | BCC recipients |
|
| ✅ | Email subject line |
|
| ✅ | Email body content |
|
| ❌ | Body content type (default: |
Success response:
{
"success": true,
"draft_id": "1234567890abcdef",
"message": "Draft created successfully."
}Error response:
{
"success": false,
"error": {
"code": "AUTHENTICATION_REQUIRED",
"message": "No Google credentials found. Run `npm run auth` to authorize the server."
}
}gmail_send_email
Sends an email immediately. ⚠️ This is an irreversible external action.
Parameter | Type | Required | Description |
|
| ✅ | Recipient email addresses |
|
| ❌ | CC recipients |
|
| ❌ | BCC recipients |
|
| ✅ | Email subject line |
|
| ✅ | Email body content |
|
| ❌ | Body content type (default: |
Success response:
{
"success": true,
"message_id": "18abc123def456",
"thread_id": "18abc123def456",
"message": "Email sent successfully."
}google_docs_append
Appends text to the end of an existing Google Doc. Existing content is preserved.
Parameter | Type | Required | Description |
|
| ✅ | The Google Docs document ID (from the URL) |
|
| ✅ | Text to append |
|
| ❌ | Prepend a newline before content (default: |
Finding the document ID: In the Google Docs URL https://docs.google.com/document/d/DOCUMENT_ID/edit, the DOCUMENT_ID is the long alphanumeric string.
Success response:
{
"success": true,
"document_id": "1AbCdEfGhIjKlMnOpQrStUvWxYz",
"message": "Content appended successfully."
}Error codes:
Code | Description |
| No credentials or expired token. Run |
| Insufficient Google API permissions or OAuth scopes. |
| Document ID is wrong or document is inaccessible. |
| Input validation failed (e.g., invalid email address). |
| Google API rate limit hit. Retry after a short wait. |
| Unclassified Google API error. |
| Unexpected server error. |
Development
npm run dev # Start with hot reload
npm test # Run all tests
npm run test:watch # Watch mode
npm run test:coverage # Coverage report
npm run lint # Type-check without emitting
npm run build # Compile to dist/Project Structure
src/
├── index.ts # Entry point
├── server/
│ ├── mcp-server.ts # MCP server setup
│ └── tool-registry.ts # Tool registration
├── tools/
│ ├── gmail/ # Gmail tool handlers + schemas
│ └── google-docs/ # Docs tool handlers + schemas
├── services/ # Google API wrappers
├── validation/ # Input validation (Zod)
├── errors/ # Error codes, McpError, error handler
├── logging/ # Pino logger with redaction
├── config/ # Environment config
└── types/ # TypeScript typesAdding a New Google Service
Create
src/tools/<service>/schemas.ts— Zod input schemaCreate
src/services/<service>.service.ts— API wrapperCreate
src/tools/<service>/<tool>.tool.ts— thin handlerRegister in
src/server/tool-registry.tsAdd the required OAuth scope to
src/config/config.ts
No changes needed to the core server, transport, or auth layers.
Security
Least-privilege OAuth scopes: only
gmail.compose,gmail.send, anddocumentsNo secrets in code: all credentials via environment variables
Tokens not logged: Pino redacts
access_token,refresh_token,client_secretToken file permissions: stored with
0o600(owner read/write only)No stack traces to clients: errors are translated to structured codes before returning
License
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Email infrastructure for AI agents — send, receive, search, and reply to email over MCP.
MCP server connecting AI agents to 100+ apps (Gmail, Slack, Notion, GitHub) via one-click OAuth.
Multiple Gmail accounts, editable Google Sheets & Docs for AI agents. Deny-by-default access rules.
1Automate 1,000+ services from any MCP-compatible AI agent: build Applets, run actions and queries.
Related MCP Servers
- AlicenseBqualityCmaintenanceExposes Gmail (send/draft) and Google Docs (append) capabilities as tools for any MCP-compliant agent.351ISC
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to send emails, create drafts in Gmail, and append content to Google Docs via standardized MCP tools.51ISC
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to send Gmail emails, create drafts, and append content to Google Docs through MCP tools. Provides secure OAuth-based integration with Google Workspace.152MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to send and draft Gmail emails and append content to Google Docs through standardized MCP tools.19MIT