home / mcp / google docs mcp server

Google Docs MCP Server

Provides programmatic access to Google Docs, Sheets, and Drive for reading, writing, and management via MCP.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "a-bonus-google-docs-mcp": {
      "command": "node",
      "args": [
        "/PATH/TO/YOUR/CLONED/REPO/mcp-googledocs-server/dist/server.js"
      ],
      "env": {
        "SERVICE_ACCOUNT_PATH": "/path/to/service-account-key.json",
        "GOOGLE_IMPERSONATE_USER": "[email protected]"
      }
    }
  }
}

This Google Docs, Sheets, and Drive MCP Server bridges your Claude Desktop or other MCP clients with Google Docs, Sheets, and Drive. It enables reading, writing, formatting, and organizing documents and spreadsheets, while also managing your Google Drive files through a single MCP endpoint for practical automation and AI-assisted workflows.

How to use

You connect your MCP client to the server to access Google Docs, Sheets, and Drive. Use the available tools to read content, write and format text, manage document structure, and manipulate spreadsheets and files in Drive. You can work with multi-tab Google Docs, read and write markdown, insert images, create tables, and manage comments. When you issue a command, specify the target document or spreadsheet by its ID and choose the tool that matches your task, such as reading a range in a sheet, appending text to a document, or inserting an image from a URL.

For multi-tab documents, you can list tabs, read from a specific tab using tabId, and write to a tab without affecting others. If tabId is omitted, operations target the first tab or the document body for legacy documents.

How to install

Prerequisites and setup follow these concrete steps.

1. Install Node.js and npm. Use a recent LTS release, preferably Node.js 18 or higher.

2. Install Git if you do not have it.

3. Prepare credentials for Google APIs by following the OAuth setup and obtaining a downloaded credentials.json file. Rename the downloaded file to credentials.json and place it in the server project directory.

4. Clone the server repository and place credentials in the project folder.

5. Install dependencies and build the server.

6. Run the server once to authorize access to Google APIs, then use the generated token.json for subsequent runs.

Configuration and usage notes

The server supports OAuth-based access to Google Docs, Sheets, and Drive, with an optional enterprise setup using a service account and domain-wide delegation. When using a service account, set environment variables for the service account path and the user to impersonate. If you configure impersonation, the server will access the specified user’s documents and Drive content.

Claude Desktop can be configured to launch the MCP server process, using an absolute path to the compiled server file. Place the configuration in the dedicated MCP config location for your OS and ensure the command and arguments are correct and absolute.

Security & token handling

Keep credentials.json and token.json secure. Do not commit them to version control. The token.json file grants access to your Google data and should be treated as a secret.

Troubleshooting

If you see startup or authorization issues, verify path correctness, ensure you built the project, and check for any error messages printed by the server. Review OAuth setup steps to confirm APIs are enabled and test users are configured. If tab-related errors appear, confirm the tabId exists by listing document tabs.

Tools and capabilities

The server exposes a comprehensive set of capabilities to interact with Google Docs, Sheets, and Drive. You can read, write, format, and structure documents, manage tabs, handle comments, and perform advanced actions on spreadsheets and files. Specific functions include reading documents, appending text, inserting text at a position, deleting ranges, and tab-aware operations; markdown support; rich text and paragraph styling; table creation; image insertion from URLs or local uploads; comment management; spreadsheet read/write/append/clear operations; spreadsheet metadata retrieval; sheet creation and labeling; and drive file management tasks such as listing, creating folders, moving, copying, renaming, and deleting.

Example usage patterns

Google Docs: read content, modify with markdown, apply text and paragraph styles, insert tables or images, and manage comments. Use tab-specific variants to operate on a particular tab.

Google Sheets: read and write ranges in A1 notation, append rows, create new spreadsheets or add sheets, clear ranges, and fetch detailed spreadsheet information.

Known limitations

Some operations may be limited by Google Drive API behavior, such as anchored comments or certain merge/convert scenarios. In such cases, adjust your workflow to use manual interactions for full fidelity.

License

This project is licensed under the MIT License.

Available tools

readGoogleDoc

Read content from a Google Document. Returns plain text, JSON structure, or markdown depending on the request.

appendToGoogleDoc

Append text to a Google Document, with optional tab targeting.

insertText

Insert text at a specific position, with optional tab targeting.

deleteRange

Delete content within a specified range, with optional tab targeting.

listDocumentTabs

List all tabs in a multi-tab Google Document and provide IDs and summaries.

listComments

List all comments in a document with metadata such as author and dates.

getComment

Retrieve a specific comment and its replies.

addComment

Add a new comment anchored to a location in the document.

replyToComment

Add a reply to an existing comment.

resolveComment

Mark a comment as resolved when supported by the API.

deleteComment

Delete a comment from the document.

readSpreadsheet

Read data from a Google Sheet range using A1 notation.

writeSpreadsheet

Write data to a specified spreadsheet range, overwriting existing data.

appendSpreadsheetRows

Append new rows to a spreadsheet.

clearSpreadsheetRange

Clear values within a spreadsheet range.

getSpreadsheetInfo

Retrieve detailed metadata about a spreadsheet and its sheets.

createSpreadsheet

Create a new spreadsheet, optionally with initial data.

addSpreadsheetSheet

Add a new sheet/tab to an existing spreadsheet.

listGoogleSheets

List spreadsheets accessible by the authenticated user.

insertTable

Create a table in a Google Document at a specified position.

insertPageBreak

Insert a page break at a given location in a document.

insertImageFromUrl

Insert an image into a document from a public URL.

insertLocalImage

Upload a local image to Drive and insert it into the document.

applyTextStyle

Apply rich text styling such as bold, italic, color, and size to selected text.

applyParagraphStyle

Apply paragraph styling such as alignment and spacing to a block of text.

formatMatchingText

Format text that matches a given pattern across the document.

createDocument

Create a new Google Document, optionally with initial content.

createFromTemplate

Create a document from a template.

Google Docs MCP Server - a-bonus/google-docs-mcp