Skip to main content
Glama
kajolchawla98

Google Docs + Gmail MCP Server

๐Ÿš€ 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_doc POST /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": "test@example.com",
  "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

A
license - permissive license
-
quality - not tested
C
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

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/kajolchawla98/MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server