Google MCP Server
Allows creating styled HTML email drafts in Gmail from markdown content.
Enables appending formatted content (headings, lists, bold, etc.) to a Google Doc.
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., "@Google MCP Serverappend action items to my project doc"
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 MCP Server
A lightweight Python server that exposes Google Docs and Gmail as HTTP endpoints. Send markdown-formatted content and it renders as properly styled Docs headings/bullets and professional HTML emails — not plain text walls.
Live deployment: https://mcp-server-google-695514226672.europe-west1.run.app
Features
POST /append_to_doc— append formatted content to any Google DocPOST /create_email_draft— create a styled HTML Gmail draftPOST /send_email— send a styled HTML Gmail messageMarkdown rendering: headings, bold, italic, bullet lists, dividers
Operator approval gate before every Google API call (or auto-approve for pipelines)
Optional API key authentication via
X-Api-Keyrequest headerDeployed on Google Cloud Run — continuous deployment from GitHub via Cloud Build
Related MCP server: Google MCP Server
Markdown Syntax
All three content endpoints accept markdown in their text fields:
Syntax | Output |
| Docs: named heading style · Email: |
| Docs: bulleted list · Email: |
| Bold |
| Italic |
| Bold + italic |
| Docs: spacing paragraph · Email: |
Quick Start (Local)
1. Google Cloud setup
Go to Google Cloud Console → APIs & Services → Library
Enable Google Docs API and Gmail API
Go to Credentials → Create Credentials → OAuth 2.0 Client ID
Application type: Desktop app → Download JSON → save as
credentials.jsonin the project rootAdd your Google account as a test user under OAuth consent screen → Test users
2. Install and run
python -m venv .venv
.venv\Scripts\activate # Windows
# source .venv/bin/activate # macOS / Linux
pip install -r requirements.txt
cp .env.example .env # edit .env if needed
uvicorn server:app --reloadOn first run the browser opens for OAuth. After approving, token.json is saved and reused.
The OAuth token requests Google Docs access plus Gmail's gmail.compose scope, which supports both draft creation and message sending.
curl http://localhost:8000/health
# → {"status":"ok"}Environment Variables
Variable | Default | Description |
| (unset) | Server-side secret. When set, all endpoints require the HTTP header |
|
|
|
|
| Path to OAuth client credentials (local dev) |
|
| Path to cached OAuth token (local dev) |
| (unset) | Raw JSON content of |
| (unset) | Raw JSON content of |
|
| HTTP listen port — Cloud Run injects this automatically |
SERVER_API_KEYvsX-Api-Key:SERVER_API_KEYis the environment variable the server reads.X-Api-Keyis the HTTP request header clients must send. They are not the same thing — do not addX-API-KEYas an env var.
Copy .env.example to .env and fill in values for local development.
API Reference
All mutating endpoints require X-Api-Key when SERVER_API_KEY is set.
Append to a Google Doc
SERVICE_URL="https://mcp-server-google-695514226672.europe-west1.run.app"
API_KEY="PASTE_YOUR_API_KEY_HERE"
cat > payload.json <<'EOF'
{"doc_id":"YOUR_GOOGLE_DOC_ID","content":"# Section\n\n**Key point:** something important.\n\n- Item one\n- Item two"}
EOF
curl -i -X POST "$SERVICE_URL/append_to_doc" \
-H "Content-Type: application/json" \
-H "X-Api-Key: $API_KEY" \
--data-binary @payload.json{"status": "ok", "doc_id": "YOUR_DOC_ID", "chars_added": 58}doc_id comes from your Doc URL: https://docs.google.com/document/d/{doc_id}/edit
Create a Gmail draft
SERVICE_URL="https://mcp-server-google-695514226672.europe-west1.run.app"
API_KEY="PASTE_YOUR_API_KEY_HERE"
cat > payload.json <<'EOF'
{"to":"recipient@example.com","subject":"Project Update","body":"# Project Update\n\n**Status:** On track\n\n- Milestone A complete\n- Milestone B in progress\n\n*Regards*"}
EOF
curl -i -X POST "$SERVICE_URL/create_email_draft" \
-H "Content-Type: application/json" \
-H "X-Api-Key: $API_KEY" \
--data-binary @payload.json{"status": "ok", "draft_id": "r12345abc"}The draft appears in Gmail → Drafts with full HTML formatting (600 px card, proper heading hierarchy, bullet lists).
Send a Gmail message
Use the same payload as draft creation, but call the send endpoint:
curl -i -X POST "$SERVICE_URL/send_email" \
-H "Content-Type: application/json" \
-H "X-Api-Key: $API_KEY" \
--data-binary @payload.json{"status": "ok", "message_id": "18f...", "thread_id": "18f..."}Health check (no auth required)
curl https://mcp-server-google-695514226672.europe-west1.run.app/health
# → {"status":"ok"}Interactive docs: http://localhost:8000/docs (local only)
Tests
python -m pytest tests -qThe current suite contains 6 tests covering authentication, approval behavior, document append, Gmail draft creation, and Gmail sending.
Docker
# Pre-generate token.json on a machine with a browser (one-time)
python -c "from auth import get_credentials; get_credentials()"
# Build
docker build -t google-mcp-server .
# Run — mount credentials at runtime, never bake them into the image
docker run -d \
--name google-mcp-server \
-p 8000:8000 \
-e SERVER_API_KEY=your-secret-key \
-e APPROVAL_MODE=auto \
-e GOOGLE_CREDENTIALS_PATH=/secrets/credentials.json \
-e GOOGLE_TOKEN_PATH=/secrets/token.json \
-v /path/to/credentials.json:/secrets/credentials.json:ro \
-v /path/to/token.json:/secrets/token.json \
google-mcp-serverDeploy to Cloud Run
The service is live and continuously deployed via Cloud Run's built-in GitHub integration.
Detail | Value |
Project | NextLeap ( |
Service |
|
Region |
|
URL |
|
Deployment | Cloud Run built-in CD: push to |
Auth | Allow unauthenticated at Cloud Run level; app enforces |
How it works
Push to
main→ Cloud Build triggers automaticallyCloud Build builds the Docker image and pushes it to Artifact Registry (managed automatically)
Cloud Run deploys the new revision
At startup,
start.shwritesGOOGLE_CREDENTIALS_JSONandGOOGLE_TOKEN_JSON(from Secret Manager) to/tmp, sets path env vars, then starts uvicorn
Cloud Run environment
Variable | Source | Value |
| Plain env var |
|
| Secret Manager: | Raw |
| Secret Manager: | Raw |
| Secret Manager: | Backend API key |
For the full setup guide, API key rotation, log commands, and troubleshooting see deployment_plan.md.
Security
File | Purpose | Committed? |
| OAuth 2.0 client secret | No — |
| Cached user OAuth token | No — |
| Local secrets | No — |
SERVER_API_KEYis stored in Google Secret Manager in production — never in code or committed filesAPPROVAL_MODE=terminalis the safe default locally — requires explicitybefore any Google API callCloud Run provides managed TLS on
*.run.appautomaticallyNo GitHub Actions, no
GCP_SA_KEY/GCP_PROJECT_IDsecrets needed in GitHub
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.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/md-ammar-97/mcp-server-google'
If you have feedback or need assistance with the MCP directory API, please join our Discord server