Google Docs Drive
STDIOComprehensive MCP server for Google Docs editing and Google Drive management with OAuth authentication
Comprehensive MCP server for Google Docs editing and Google Drive management with OAuth authentication

Connect Claude Desktop (or other MCP clients) to your Google Docs and Google Drive!
🔥 Check out 15 powerful tasks you can accomplish with this enhanced server! 📁 NEW: Complete Google Drive file management capabilities!
This comprehensive server uses the Model Context Protocol (MCP) and the fastmcp library to provide tools for reading, writing, formatting, structuring Google Documents, and managing your entire Google Drive. It acts as a powerful bridge, allowing AI assistants like Claude to interact with your documents and files programmatically with advanced capabilities.
Features:
readGoogleDoc (plain text, JSON structure, or markdown)appendToGoogleDocinsertTextdeleteRangelistDocumentTabs and optional tabId parameter in read/write operationsapplyTextStyle (bold, italic, colors, etc.)applyParagraphStyle (alignment, spacing, etc.)formatMatchingText (legacy support)insertTableinsertPageBreakinsertImageFromUrl, or upload local images with insertLocalImagefixListFormatting for automatic list detectionlistComments (shows author, date, and quoted text)getCommentaddCommentreplyToCommentresolveCommentdeleteCommentlistGoogleDocs, searchGoogleDocs, getRecentGoogleDocsgetDocumentInfocreateFolder), list contents (listFolderContents), get info (getFolderInfo)moveFile), copy (copyFile), rename (renameFile), delete (deleteFile)createDocument) or from templates (createFromTemplate)Before you start, make sure you have:
Follow these steps carefully to get your own instance of the server running.
This server needs permission to talk to Google APIs on your behalf. You'll create special "keys" (credentials) that only your server will use.
https://www.googleapis.com/auth/documents (Allows reading/writing docs)https://www.googleapis.com/auth/drive.file (Allows access to specific files opened/created by the app)client_secret_....json.credentials.json.credentials.json file like a password! Do not share it publicly, and never commit it to GitHub. Anyone with this file could potentially pretend to be your application (though they'd still need user consent to access data).git clone https://github.com/a-bonus/google-docs-mcp.git mcp-googledocs-server
cd mcp-googledocs-server
credentials.json file you downloaded and renamed (from Step 1.6) directly into this mcp-googledocs-server folder.Your server needs some helper libraries specified in the package.json file.
mcp-googledocs-server directory), run:
This will download and install all the necessary packages into anpm install
node_modules folder.The server is written in TypeScript (.ts), but we need to compile it into JavaScript (.js) that Node.js can run directly.
This uses the TypeScript compiler (npm run build
tsc) to create a dist folder containing the compiled JavaScript files.Now you need to run the server once manually to grant it permission to access your Google account data. This will create a token.json file that saves your permission grant.
node:
node ./dist/server.js
https://accounts.google.com/... URL.http://localhost and show a "This site can't be reached" error. THIS IS NORMAL!http://localhost/?code=4/0Axxxxxxxxxxxxxx&scope=...code= and the &scope part. This is your single-use authorization code.Ctrl+C to stop it).token.json in your mcp-googledocs-server folder.token.json file contains the key that allows the server to access your Google account without asking again. Protect it like a password. Do not commit it to GitHub. The included .gitignore file should prevent this automatically.If you want to use this server with Claude Desktop, you need to tell Claude how to run it.
Find Your Absolute Path: You need the full path to the server code.
mcp-googledocs-server directory.pwd command (on macOS/Linux) or cd (on Windows, just displays the path)./Users/yourname/projects/mcp-googledocs-server or C:\Users\yourname\projects\mcp-googledocs-server).Locate mcp_config.json: Find Claude's configuration file:
~/Library/Application Support/Claude/mcp_config.json (You might need to use Finder's "Go" -> "Go to Folder..." menu and paste ~/Library/Application Support/Claude/)%APPDATA%\Claude\mcp_config.json (Paste %APPDATA%\Claude into File Explorer's address bar)~/.config/Claude/mcp_config.jsonClaude folder or mcp_config.json file doesn't exist, create them.Edit mcp_config.json: Open the file in a text editor. Add or modify the mcpServers section like this, replacing /PATH/TO/YOUR/CLONED/REPO with the actual absolute path you copied in Step 6.1:
{ "mcpServers": { "google-docs-mcp": { "command": "node", "args": [ "/PATH/TO/YOUR/CLONED/REPO/mcp-googledocs-server/dist/server.js" ], "env": {} } // Add commas here if you have other servers defined } // Other Claude settings might be here }
"args" is correct and absolute!mcpServers object. Ensure the JSON is valid (check commas!).Save mcp_config.json.
Restart Claude Desktop: Close Claude completely and reopen it.
Once configured, you should be able to use the tools in your chats with Claude:
google-docs-mcp server to read the document with ID YOUR_GOOGLE_DOC_ID."YOUR_GOOGLE_DOC_ID?"YOUR_GOOGLE_DOC_ID using the google-docs-mcp tool."Google Docs now supports multi-tab documents. This MCP server provides full support for working with tabs:
Listing Tabs:
YOUR_GOOGLE_DOC_ID using the listDocumentTabs tool."YOUR_GOOGLE_DOC_ID."Reading from Specific Tabs:
TAB_ID in document YOUR_GOOGLE_DOC_ID using the readGoogleDoc tool."TAB_ID in document YOUR_GOOGLE_DOC_ID."Writing to Specific Tabs:
TAB_ID in document YOUR_GOOGLE_DOC_ID."TAB_ID of document YOUR_GOOGLE_DOC_ID."TAB_ID of document YOUR_GOOGLE_DOC_ID."Note: The following tools support the optional tabId parameter:
readGoogleDoc - Read from a specific tabappendToGoogleDoc - Append to a specific tabinsertText - Insert text into a specific tabdeleteRange - Delete content from a specific tabWhen tabId is not specified, operations target the first tab (or the legacy document body for older documents without tabs).
applyTextStyle to make the text 'Important Section' bold and red (#FF0000) in document YOUR_GOOGLE_DOC_ID."applyParagraphStyle to center-align the paragraph containing 'Title Here' in document YOUR_GOOGLE_DOC_ID."YOUR_GOOGLE_DOC_ID using the insertTable tool."insertImageFromUrl to insert an image from 'https://example.com/image.png' at index 100 in document YOUR_GOOGLE_DOC_ID."insertLocalImage to upload '/path/to/image.jpg' and insert it at index 200 in document YOUR_GOOGLE_DOC_ID."formatMatchingText to find the second instance of 'Project Alpha' and make it blue (#0000FF) in doc YOUR_GOOGLE_DOC_ID."Remember to replace YOUR_GOOGLE_DOC_ID with the actual ID from a Google Doc's URL (the long string between /d/ and /edit).
Claude will automatically launch your server in the background when needed using the command you provided. You do not need to run node ./dist/server.js manually anymore.
This server provides two ways to insert images into Google Documents:
insertImageFromUrl)Inserts an image directly from a publicly accessible URL. The image URL must be accessible without authentication.
Parameters:
documentId: The Google Document IDimageUrl: Publicly accessible URL (http:// or https://)index: Position in the document (1-based indexing)width (optional): Image width in pointsheight (optional): Image height in pointsExample:
"Insert an image from https://example.com/logo.png at index 100 in document YOUR_DOC_ID"
insertLocalImage)Uploads a local image file to Google Drive and inserts it into the document. This is a two-step process that:
Parameters:
documentId: The Google Document IDlocalImagePath: Absolute path to the local image fileindex: Position in the document (1-based indexing)width (optional): Image width in pointsheight (optional): Image height in pointsuploadToSameFolder (optional, default: true): If true, uploads to the document's folder; if false, uploads to Drive rootSupported formats: .jpg, .jpeg, .png, .gif, .bmp, .webp, .svg
Example:
"Upload and insert the image at /Users/myname/Pictures/chart.png at index 200 in document YOUR_DOC_ID with width 400 and height 300"
Note: The uploaded image will be made publicly readable so it can be displayed in the document. The image file will remain in your Google Drive and can be managed separately.
.gitignore: This repository includes a .gitignore file which should prevent you from accidentally committing your sensitive credentials.json and token.json files. Do not remove these lines from .gitignore.token.json) directly in the project folder for simplicity during setup. In production or more security-sensitive environments, consider storing this token more securely, such as using system keychains, encrypted files, or dedicated secret management services.The multi-tab support features have been thoroughly tested and verified:
✅ Tested Features:
listDocumentTabs - Lists all tabs with IDs, titles, positions, and content summariesreadGoogleDoc with tabId - Reads specific tabs; backward compatible without tabIdappendToGoogleDoc with tabId - Appends to specific tabs without affecting othersinsertText with tabId - Inserts text at specific positions in specific tabsdeleteRange with tabId - Deletes content from specific tabs in isolationtabId default to first tab (legacy documents supported)All tab-related features have been validated with real Google Docs containing multiple tabs, confirming:
mcp_config.json.npm run build successfully and the dist folder exists.mcp_config.json manually in your terminal: node /PATH/TO/YOUR/CLONED/REPO/mcp-googledocs-server/dist/server.js. Look for any errors printed.console.log status messages in the server code were changed to console.error.credentials.json file is correctly placed in the project root.listDocumentTabs to see all available tab IDstabId - operations work on the document body automaticallyThis project is licensed under the MIT License - see the LICENSE file for details. (Note: You should add a LICENSE file containing the MIT License text to your repository).