Google MCP Server
barath-srinivas/Baraths-MCP-Server
Integração segura com Google Docs e Gmail via MCP com aprovação interativa
Ver no GitHubServidor MCP em Python que integra Google Docs e Gmail com aprovação interativa. Permite anexar texto a documentos e criar rascunhos de email através de endpoints FastAPI, com cada ação requerendo confirmação manual no terminal antes de executar.
Instalação
npx convez-ai barath-srinivas/Baraths-MCP-Server1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.
Métricas
Casos de uso
- Automatizar criação de rascunhos de email a partir de workflows Claude
- Anexar conteúdo gerado a documentos Google com controle manual
- Integrar Google Workspace em pipelines de automação com segurança
Veredito

MCP server bem estruturado para integração com Google Workspace, com OAuth 2.0 apropriado e sistema de aprovação interativa que aumenta segurança. Ideal para automações que requerem controle humano sobre ações em Docs e Gmail.
README
A tradução para o português deste README ainda está na fila.
Google MCP Server
A Python FastAPI server that integrates with Google Docs (append text) and Gmail (create drafts). Each action is printed to the terminal and requires interactive approval before it runs.
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
├── README.md # This file
├── credentials.json # OAuth client credentials (not committed)
└── token.json # Saved OAuth token (not committed)
Prerequisites
- A Google Cloud project
- Google Docs API and Gmail API enabled for that project
- 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
- Gmail API
- Go to APIs & Services → Credentials → Create Credentials → OAuth client ID.
- Choose Desktop app, download the JSON, and save it as
credentials.jsonin this folder. - 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
# Windows
.venv\Scripts\activate
# macOS / Linux
source .venv/bin/activate
pip install -r requirements.txt
First-time authentication
On the first API call (or when you run a quick auth check), a browser window opens for Google sign-in. After you approve, a token.json file is created. Later runs reuse that token and refresh it automatically when needed.
To authenticate before starting the server:
python -c "from auth import get_credentials; get_credentials()"
Run the server
python server.py
Default URL: http://127.0.0.1:8000
Optional custom port:
python server.py 8080
Interactive API docs: http://127.0.0.1:8000/docs
Endpoints
GET /health
Health check.
POST /append_to_doc
Append text to a Google Doc.
Body:
{
"doc_id": "YOUR_DOCUMENT_ID",
"content": "Text to append.\n"
}
The document ID is the long string in the Doc URL:
https://docs.google.com/document/d/DOCUMENT_ID/edit
Example (curl):
curl -X POST http://127.0.0.1:8000/append_to_doc \
-H "Content-Type: application/json" \
-d "{\"doc_id\": \"YOUR_DOCUMENT_ID\", \"content\": \"Hello from the MCP server!\\n\"}"
The server prints the action and payload, then prompts:
Action: append_to_doc
Payload: {'doc_id': '...', 'content': '...'}
Approve? (y/n):
Type y to proceed, anything else cancels with HTTP 403.
POST /create_email_draft
Create a Gmail draft (does not send).
Body:
{
"to": "recipient@example.com",
"subject": "Draft subject",
"body": "Draft body text."
}
Example (curl):
curl -X POST http://127.0.0.1:8000/create_email_draft \
-H "Content-Type: application/json" \
-d "{\"to\": \"you@example.com\", \"subject\": \"Test draft\", \"body\": \"Hello!\"}"
Same approval prompt appears in the terminal before the draft is created.
OAuth scopes
| Scope | Purpose |
|---|---|
https://www.googleapis.com/auth/documents | Read and edit Google Docs |
https://www.googleapis.com/auth/gmail.compose | Create and manage Gmail drafts |
Security notes
- Do not commit
credentials.jsonortoken.json. - Run the server locally; the approval prompt assumes a trusted operator at the terminal.
- Revoke access anytime at Google Account permissions.
Troubleshooting
| Issue | Fix |
|---|---|
Missing credentials.json | Download OAuth desktop credentials from Google Cloud Console |
403 Access Not Configured | Enable Google Docs API and Gmail API in your project |
invalid_grant on token refresh | Delete token.json and authenticate again |
| Approval prompt never appears | Run python server.py in a terminal (not detached); stdin must be connected |
| Doc append fails | Confirm the signed-in account can edit the document |