convez.ai
MCP ServerIntegração & APIsIntermediário
barath-srinivas

Google MCP Server

barath-srinivas/Baraths-MCP-Server

Integração segura com Google Docs e Gmail via MCP com aprovação interativa

Ver no GitHub
InicialPluginScore · de 0 a 100

Servidor 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-Server

1 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

Estrelas
0
Forks
0
Acompanhando
0
Saúde
14%
Último commit
há 5 meses
Versão
—
Issues abertas
0
Contribuidores
1

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

  1. A Google Cloud project
  2. Google Docs API and Gmail API enabled for that project
  3. OAuth 2.0 Desktop app credentials downloaded as credentials.json

Google Cloud setup

  1. Go to Google Cloud Console → APIs & Services → Library.
  2. Enable:
    • Google Docs API
    • Gmail API
  3. Go to APIs & Services → Credentials → Create Credentials → OAuth client ID.
  4. Choose Desktop app, download the JSON, and save it as credentials.json in this folder.
  5. 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

ScopePurpose
https://www.googleapis.com/auth/documentsRead and edit Google Docs
https://www.googleapis.com/auth/gmail.composeCreate and manage Gmail drafts

Security notes

  • Do not commit credentials.json or token.json.
  • Run the server locally; the approval prompt assumes a trusted operator at the terminal.
  • Revoke access anytime at Google Account permissions.

Troubleshooting

IssueFix
Missing credentials.jsonDownload OAuth desktop credentials from Google Cloud Console
403 Access Not ConfiguredEnable Google Docs API and Gmail API in your project
invalid_grant on token refreshDelete token.json and authenticate again
Approval prompt never appearsRun python server.py in a terminal (not detached); stdin must be connected
Doc append failsConfirm the signed-in account can edit the document
Ver o original no GitHub

Bom para

Relacionados