Google MCP Server
Allows creating Gmail drafts through the MCP server.
Allows appending text to Google Docs through the MCP server.
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 MCP ServerCreate a draft email to alice@example.com about the project update."
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 Python FastAPI server that exposes Google Docs and Gmail tools with terminal-based approval before each action.
Features
POST /append_to_doc — Append text to a Google Doc
POST /create_email_draft — Create a Gmail draft
Approval gate — Every action prints its name and payload, then waits for
yin the terminal before executing
Related MCP server: Google MCP Server
Project Structure
google-mcp-server/
├── server.py # FastAPI app with tool endpoints
├── auth.py # Google OAuth authentication
├── docs_tool.py # Google Docs tool (append content)
├── gmail_tool.py # Gmail tool (create draft)
├── requirements.txt # Dependencies
├── credentials.json # OAuth client secrets (not committed)
└── token.json # Saved OAuth token (not committed)Prerequisites
Google Docs API and Gmail API enabled
OAuth 2.0 Desktop app credentials downloaded as
credentials.json
Google Cloud setup
Go to Google Cloud Console → APIs & Services → Library.
Enable Google Docs API and Gmail API.
Go to APIs & Services → Credentials → Create Credentials → OAuth client ID.
Application type: Desktop app.
Download the JSON file and save it as
credentials.jsonin this directory.Under OAuth consent screen, add your Google account as a test user (if the app is in testing mode).
Installation
cd google-mcp-server
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txtPlace credentials.json in the project root before starting the server.
First-time authentication
On the first API call that needs Google access, a browser window opens for OAuth login. After you approve, a token.json file is created. Subsequent runs reuse that token (refreshing it automatically when expired).
Run the server
python server.pyOr with uvicorn directly:
uvicorn server:app --host 127.0.0.1 --port 8000 --reloadThe server runs at http://127.0.0.1:8000. Interactive API docs: http://127.0.0.1:8000/docs.
Important: Run the server in a terminal where you can type
yornwhen prompted. Approval happens in that terminal, not in the HTTP client.
Usage examples
Append to a Google Doc
Find the document ID in the URL:
https://docs.google.com/document/d/DOCUMENT_ID/edit
curl -X POST http://127.0.0.1:8000/append_to_doc \
-H "Content-Type: application/json" \
-d '{
"doc_id": "YOUR_DOCUMENT_ID",
"content": "\nHello from the MCP server!"
}'The server terminal will show:
Action: append_to_doc
Payload: {'doc_id': '...', 'content': '...'}
Approve? (y/n):Type y to proceed.
Create a Gmail draft
curl -X POST http://127.0.0.1:8000/create_email_draft \
-H "Content-Type: application/json" \
-d '{
"to": "recipient@example.com",
"subject": "Test draft",
"body": "This is a draft created via the MCP server."
}'Approve in the server terminal when prompted. Check Gmail → Drafts for the new message.
OAuth scopes
Scope | Purpose |
| Read and edit Google Docs |
| Create and manage Gmail drafts |
Troubleshooting
Issue | Fix |
| Download OAuth desktop credentials from Google Cloud Console |
| Add your account as a test user on the OAuth consent screen |
| Type |
Token errors | Delete |
Security notes
Never commit
credentials.jsonortoken.json.This server is intended for local development with manual approval.
Do not expose it to the public internet without proper authentication.
This server cannot be deployed
Maintenance
Related MCP Connectors
Multiple Gmail accounts, editable Google Sheets & Docs for AI agents. Deny-by-default access rules.
MCP server connecting AI agents to 100+ apps (Gmail, Slack, Notion, GitHub) via one-click OAuth.
Connect AI assistants to Google Sheets through controlled tools for reading and updating rows.
Supervised API-write gateway for AI agents with policy, human approval and execution receipts.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables appending text to Google Docs and creating Gmail drafts with interactive approval via terminal.-
- FlicenseNot gradedqualityCmaintenanceA server enabling appending text to Google Docs and creating Gmail drafts via OAuth 2.0 with manual approval.-
- FlicenseNot gradedqualityCmaintenanceThis server integrates with Google Docs and Gmail, allowing agents to append content to documents and create draft emails via a lightweight REST API.-
- FlicenseNot gradedqualityCmaintenanceA Model Context Protocol-style server using FastAPI that integrates Google Docs and Gmail via official Google APIs with OAuth 2.0 and interactive terminal-based human-in-the-loop approval.-