πŸš€ Google Docs + Gmail MCP Server

A lightweight MCP-style server that integrates with Google Docs and Gmail.

This project demonstrates how to build structured AI tool interfaces with approval gating, inspired by the Model Context Protocol (MCP).

✨ Features

  • πŸ“„ Append structured content to Google Docs
  • πŸ“§ Create Gmail drafts
  • πŸ” OAuth-based Google authentication
  • 🧠 MCP-style tool interface
  • βœ… Human-in-the-loop approval before execution
  • 🧩 Modular and extensible design

How to Use in Your Project

  1. Run the MCP server:uvicorn server:app --reload

  2. Call tools via API:POST /append_to_docPOST /create_email_draft

  3. Integrate with your AI workflow:

    • Generate content using LLM
    • Send output to these endpoints

πŸ“ Project Structure

google-mcp-server/
│── server.py
│── auth.py
│── docs_tool.py
│── gmail_tool.py
│── requirements.txt
│── credentials.json   (not committed)
│── token.json         (not committed)
│── README.md

βš™οΈ Setup

1. Clone the repository

git clone <your-repo-url>
cd google-mcp-server

2. Create virtual environment

python3 -m venv venv
source venv/bin/activate

3. Install dependencies

pip install -r requirements.txt

4. πŸ”‘ Google API Setup

  1. Go to Google Cloud Console

  2. Create a new project

  3. Enable:

    • Google Docs API
    • Gmail API
  4. Configure OAuth Consent Screen

  5. Create OAuth Credentials (Desktop App)

  6. Download credentials.json

  7. Place it in project root

5. πŸ” Run OAuth

python3 auth.py
  • Opens browser for login
  • Generates token.json

6. ▢️ Run Server

uvicorn server:app --reload

Open:

http://127.0.0.1:8000/docs

πŸ§ͺ How to Test

Append to Google Doc

Endpoint: POST /append_to_doc

Example:

{
  "doc_id": "YOUR_DOC_ID",
  "content": "Hello from MCP πŸš€"
}

Create Email Draft

Endpoint: POST /create_email_draft

Example:

{
  "to": "[email protected]",
  "subject": "Test Draft",
  "body": "This is a test email"
}

πŸ”„ Workflow

Request β†’ Approval β†’ Tool Execution β†’ Response
  • Every action requires manual approval
  • Ensures safe and controlled execution

⚠️ Important Notes

Do NOT commit:

  • credentials.json
  • token.json

Approval is CLI-based (terminal input)Designed for local development

⚠️ Approval Flow

Every action requires manual approval in terminal:

ACTION: append_to_doc
PAYLOAD: {...}
Approve? (y/n):

Type:

y

🧠 MCP Design

This project demonstrates:

  • Structured tool calls
  • Separation of generation and execution
  • Human approval before tool execution

❗ Notes

  • No emails are sent automatically (draft only)
  • Google Doc must have edit access
  • Token is stored locally

πŸ“„ License

Apache License

MCP Server Β· Populars

MCP Server Β· New

    PascaleBeier

    HitKeep

    HitKeep is privacy-first analytics for humans and AI agents, self-hosted or in managed EU/US cloud regions.

    Community PascaleBeier
    prometheus

    prometheus-mcp

    MCP server for LLMs to interact with Prometheus

    Community prometheus
    TencentEdgeOne

    edgeone-makers-mcp

    An MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.

    Community TencentEdgeOne
    bonfire-systems

    reaper-mcp

    A comprehensive Model Context Protocol (MCP) server that enables AI agents to create fully mixed and mastered tracks in REAPER with both MIDI and audio capabilities.

    Community bonfire-systems
    Wanyi424

    wanyi-watermark

    ζŠ–ιŸ³γ€ε°ηΊ’δΉ¦η­‰εΉ³ε°εŽ»ζ°΄ε°οΌŒθ§†ι’‘θ§£ζžε·₯ε…·οΌŒζ”―ζŒMCP服劑

    Community Wanyi424