Google Docs MCP server

Provides a bridge between Google Docs and AI tools for reading document content, appending text, and applying formatting to specific text within documents.
Back to servers
Setup instructions
Provider
a-bonus
Release date
Apr 15, 2025
Language
TypeScript
Stats
124 stars

This Google Docs & Drive MCP server enables Claude and other MCP clients to interact with your Google documents and Drive files. It provides a comprehensive set of tools for reading, writing, formatting documents, and managing files in your Google Drive through a seamless integration.

Getting Started

Prerequisites

Before installation, ensure you have:

  1. Node.js (v18+) installed from nodejs.org
  2. Git installed from git-scm.com
  3. A Google Account with access to the documents you want to work with
  4. Basic command line familiarity
  5. Claude Desktop (optional but recommended)

Setup Instructions

Step 1: Google Cloud Project & Credentials

  1. Visit the Google Cloud Console
  2. Create or select a project:
    • For a new project, click the project dropdown → "NEW PROJECT"
    • Name it (e.g., "My MCP Docs Server") and click "CREATE"
  3. Enable required APIs:
    • Search for "APIs & Services" → "Library"
    • Enable both "Google Docs API" and "Google Drive API"
  4. Configure OAuth consent screen:
    • Go to "APIs & Services" → "OAuth consent screen"
    • Select "External" and click "CREATE"
    • Fill in required information:
      • App name (e.g., "Claude Docs MCP Access")
      • Your email address for support and developer contact
    • Add these scopes:
      • https://www.googleapis.com/auth/documents
      • https://www.googleapis.com/auth/drive.file
    • Add your Google email address as a test user
  5. Create OAuth credentials:
    • Go to "APIs & Services" → "Credentials"
    • Click "+ CREATE CREDENTIALS" → "OAuth client ID"
    • Select "Desktop app" and name it
    • Download the JSON file and rename it to credentials.json

Step 2: Get the Server Code

git clone https://github.com/a-bonus/google-docs-mcp.git mcp-googledocs-server
cd mcp-googledocs-server

Move your credentials.json file into the mcp-googledocs-server directory.

Step 3: Install Dependencies

npm install

Step 4: Build the Server

npm run build

Step 5: First Run & Google Authorization

node ./dist/server.js

Follow these authorization steps:

  1. Copy the authorization URL from the terminal
  2. Open it in your browser and log in with your Google account
  3. Grant permissions to the app
  4. Copy the code from the URL (after code= and before &scope)
  5. Paste the code into the terminal prompt
  6. Verify a token.json file appears in your directory

Step 6: Configure Claude Desktop (Optional)

  1. Find the absolute path to your server directory using pwd (macOS/Linux) or cd (Windows)
  2. Locate or create the Claude configuration file:
    • macOS: ~/Library/Application Support/Claude/mcp_config.json
    • Windows: %APPDATA%\Claude\mcp_config.json
    • Linux: ~/.config/Claude/mcp_config.json
  3. Add this server configuration (replace the path with your actual path):
{
  "mcpServers": {
    "google-docs-mcp": {
      "command": "node",
      "args": [
        "/PATH/TO/YOUR/CLONED/REPO/mcp-googledocs-server/dist/server.js"
      ],
      "env": {}
    }
  }
}
  1. Save the file and restart Claude Desktop

Using the Server with Claude

You can now use commands like:

  • "Use the google-docs-mcp server to read the document with ID YOUR_GOOGLE_DOC_ID."
  • "Append 'This was added by Claude!' to document YOUR_GOOGLE_DOC_ID."

Document Operations

# Reading documents
"Read the Google Doc with ID 1abc123xyz456 using the google-docs-mcp server."

# Appending content
"Append the text 'New section added by Claude' to document 1abc123xyz456."

# Inserting text at specific locations
"Insert 'This is important!' at index 500 in document 1abc123xyz456."

# Deleting content
"Delete text from index 200 to 300 in document 1abc123xyz456."

Text Formatting

# Apply text styling
"Make the text 'Important Note' bold and red (#FF0000) in document 1abc123xyz456."

# Paragraph formatting
"Center-align the paragraph containing 'Executive Summary' in document 1abc123xyz456."

Document Structure

# Create a table
"Insert a 3x4 table at index 200 in document 1abc123xyz456."

# Insert page breaks
"Add a page break after the 'References' section in document 1abc123xyz456."

Image Insertion

From URL

To insert an image from a public URL:

"Insert the image from https://example.com/logo.png at index 100 in document 1abc123xyz456."

Parameters:

  • documentId: Google Document ID
  • imageUrl: Publicly accessible URL
  • index: Position in the document
  • width (optional): Image width in points
  • height (optional): Image height in points

Local Image Upload

To upload and insert a local image:

"Upload and insert the image from /Users/myname/Pictures/chart.png at index 200 in document 1abc123xyz456."

Parameters:

  • documentId: Google Document ID
  • localImagePath: Path to the local image file
  • index: Position in the document
  • width and height (optional): Image dimensions in points
  • uploadToSameFolder (optional, default: true): Whether to upload to the document's folder

Supported formats: .jpg, .jpeg, .png, .gif, .bmp, .webp, .svg

Comment Management

# List all comments
"List all comments in document 1abc123xyz456."

# Add a new comment
"Add a comment 'Please verify this data' to the text 'Q2 results' in document 1abc123xyz456."

# Reply to comments
"Reply 'Updated as requested' to comment ABC123 in document 1abc123xyz456."

# Resolve comments
"Resolve comment DEF456 in document 1abc123xyz456."

Google Drive Management

# List documents
"List my recent Google Docs."

# Search for documents
"Search for documents containing 'Project Proposal'."

# Create folders
"Create a new folder named 'Project Alpha' in my Google Drive."

# List folder contents
"Show me the contents of folder 2abc123xyz456."

# Create documents
"Create a new Google Doc titled 'Meeting Notes - May 2023'."

Troubleshooting

If Claude fails to connect to the server:

  • Verify the path in mcp_config.json is correct and absolute
  • Confirm the dist folder exists (run npm run build if needed)
  • Try running the server manually to check for errors
  • Ensure your Google authentication is still valid

If you encounter Google authorization errors:

  • Confirm you've enabled the correct APIs
  • Verify you added your email as a test user
  • Check that credentials.json is properly placed in the project root

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "google-docs-mcp" '{"command":"node","args":["/PATH/TO/YOUR/CLONED/REPO/mcp-googledocs-server/dist/server.js"],"env":[]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "google-docs-mcp": {
            "command": "node",
            "args": [
                "/PATH/TO/YOUR/CLONED/REPO/mcp-googledocs-server/dist/server.js"
            ],
            "env": []
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "google-docs-mcp": {
            "command": "node",
            "args": [
                "/PATH/TO/YOUR/CLONED/REPO/mcp-googledocs-server/dist/server.js"
            ],
            "env": []
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later