Google Docs & Gmail MCP Server

Google Docs & Gmail MCP Server

Enables appending content to Google Docs and creating email drafts in Gmail via FastAPI endpoints.

Category
Visit Server

README

Google Docs & Gmail MCP Server

A FastAPI-based MCP-style server that provides tools to append content to Google Docs and create email drafts in Gmail.

Project Structure

  • server.py: FastAPI application with endpoints.
  • auth.py: Handles Google OAuth 2.0 flow.
  • docs_tool.py: Contains the logic to append text to Google Docs.
  • gmail_tool.py: Contains the logic to create Gmail drafts.
  • requirements.txt: Python dependencies.

Setup Instructions

1. Google Cloud Console Setup

Before running the application, you need to configure an OAuth client in the Google Cloud Console.

  1. Go to the Google Cloud Console.
  2. Create a new project or select an existing one.
  3. Navigate to APIs & Services > Library and enable the following APIs:
    • Google Docs API
    • Gmail API
  4. Navigate to APIs & Services > OAuth consent screen:
    • Choose External (or Internal if you have a Google Workspace).
    • Fill in the required fields (App name, User support email, Developer contact information).
    • Under Test users, click ADD USERS and enter the email address you will use to test the application.
  5. Navigate to APIs & Services > Credentials:
    • Click CREATE CREDENTIALS > OAuth client ID.
    • Select Desktop app as the Application type.
    • Name it (e.g., "MCP Server Local") and click Create.
    • Download the JSON file, rename it to credentials.json, and place it in the google-mcp-server directory.

2. Install Dependencies

Ensure you have Python 3.7+ installed. Run the following command in the google-mcp-server directory:

pip install -r requirements.txt

3. Initial Authentication

To generate the token.json file, run the auth.py script directly:

python auth.py

This will open a browser window for you to log in with your Google account (ensure you use the email added as a Test User in the consent screen). After granting permission, a token.json file will be created in your directory. You can close the browser window once authenticated.

4. Running the Server

Start the FastAPI server using uvicorn:

uvicorn server:app --reload

Alternatively, run python server.py.

The server will be running at http://127.0.0.1:8000. You can view the API documentation at http://127.0.0.1:8000/docs.

Usage

When you make a request to the server, it will intercept the action and prompt you in the terminal for approval:

--- ACTION REQUIRED ---
Action: Append to Google Doc
Payload: {'doc_id': '...', 'content': '...'}
Approve? (y/n):

You must type y in the terminal where the server is running to proceed.

Example Request: Append to Doc

curl -X 'POST' \
  'http://127.0.0.1:8000/append_to_doc' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "doc_id": "YOUR_DOCUMENT_ID",
  "content": "\nThis is a new appended line!"
}'

Example Request: Create Email Draft

curl -X 'POST' \
  'http://127.0.0.1:8000/create_email_draft' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "to": "example@example.com",
  "subject": "Test Draft",
  "body": "Hello, this is a draft from MCP Server!"
}'

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured