trackmcp
Back to directory
jasonWong-serviceDirect

google-docs-mcp-shared

View on GitHub

Google Docs & Drive

3 stars TypeScriptOthers Updated Aug 24, 2026

Documentation

Ultimate Google Docs & Drive MCP Server

Demo Animation

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:

Document Access & Editing

  • Read Documents: Read content with `readGoogleDoc` (plain text, JSON structure, or markdown)
  • Append to Documents: Add text to documents with `appendToGoogleDoc`
  • Insert Text: Place text at specific positions with `insertText`
  • Delete Content: Remove content from a document with `deleteRange`

Formatting & Styling

  • Text Formatting: Apply rich styling with `applyTextStyle` (bold, italic, colors, etc.)
  • Paragraph Formatting: Control paragraph layout with `applyParagraphStyle` (alignment, spacing, etc.)
  • Find & Format: Format by text content using `formatMatchingText` (legacy support)

Document Structure

  • Tables: Create tables with `insertTable`
  • Page Breaks: Insert page breaks with `insertPageBreak`
  • Experimental Features: Tools like `fixListFormatting` for automatic list detection

๐Ÿ†• Google Drive File Management

  • Document Discovery: Find and list documents with `listGoogleDocs`, `searchGoogleDocs`, `getRecentGoogleDocs`
  • Document Information: Get detailed metadata with `getDocumentInfo`
  • Folder Management: Create folders (`createFolder`), list contents (`listFolderContents`), get info (`getFolderInfo`)
  • File Operations: Move (`moveFile`), copy (`copyFile`), rename (`renameFile`), delete (`deleteFile`)
  • Document Creation: Create new docs (`createDocument`) or from templates (`createFromTemplate`)
  • ๐Ÿš€ Shared Drive Support: Full support for Google Workspace shared drives! All operations now work seamlessly with shared drives

Integration

  • Google Authentication: Secure OAuth 2.0 authentication with full Drive access
  • MCP Compliant: Designed for use with Claude and other MCP clients
  • VS Code Integration: Setup guide for VS Code MCP extension

Prerequisites

Before you start, make sure you have:

1. Node.js and npm: A recent version of Node.js (which includes npm) installed on your computer. You can download it from nodejs.org. (Version 18 or higher recommended).

2. Git: Required for cloning this repository. (Download Git).

3. A Google Account: The account that owns or has access to the Google Docs you want to interact with.

4. Command Line Familiarity: Basic comfort using a terminal or command prompt (like Terminal on macOS/Linux, or Command Prompt/PowerShell on Windows).

5. Claude Desktop (Optional): If your goal is to connect this server to Claude, you'll need the Claude Desktop application installed.


Setup Instructions

Follow these steps carefully to get your own instance of the server running.

Step 1: Google Cloud Project & Credentials (The Important Bit!)

This server needs permission to talk to Google APIs on your behalf. You'll create special "keys" (credentials) that only your server will use.

1. Go to Google Cloud Console: Open your web browser and go to the Google Cloud Console. You might need to log in with your Google Account.

2. Create or Select a Project:

    3. Enable APIs: You need to turn on the specific Google services this server uses.

      4. Configure OAuth Consent Screen: This screen tells users (usually just you) what your app wants permission for.

        5. Create Credentials (The Keys!):

          6. โฌ‡๏ธ DOWNLOAD THE CREDENTIALS FILE: A box will pop up showing your Client ID. Click the "DOWNLOAD JSON" button.

            7. โš ๏ธ SECURITY WARNING: Treat this `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).

            Step 2: Get the Server Code

            1. Clone the Repository: Open your terminal/command prompt and run:

            bash
            git clone https://github.com/jasonWong-serviceDirect/google-docs-mcp-shared.git mcp-googledocs-server

            2. Navigate into Directory:

            bash
            cd mcp-googledocs-server

            3. Place Credentials: Move or copy the `credentials.json` file you downloaded and renamed (from Step 1.6) directly into this `mcp-googledocs-server` folder.

            Step 3: Install Dependencies

            Your server needs some helper libraries specified in the `package.json` file.

            1. In your terminal (make sure you are inside the `mcp-googledocs-server` directory), run:

            bash
            npm install

            This will download and install all the necessary packages into a `node_modules` folder.

            Step 4: Build the Server Code

            The server is written in TypeScript (`.ts`), but we need to compile it into JavaScript (`.js`) that Node.js can run directly.

            1. In your terminal, run:

            bash
            npm run build

            This uses the TypeScript compiler (`tsc`) to create a `dist` folder containing the compiled JavaScript files.

            Step 5: First Run & Google Authorization (One Time Only)

            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.

            1. In your terminal, run the _compiled_ server using `node`:

            bash
            node ./dist/server.js

            2. Watch the Terminal: The script will print:

              3. Authorize in Browser:

                4. Get the Authorization Code:

                  5. Paste Code into Terminal: Go back to your terminal where the script is waiting ("Enter the code from that page here:"). Paste the code you just copied.

                  6. Press Enter.

                  7. Success! The script should print:

                    8. โœ… Check: You should now see a new file named `token.json` in your `mcp-googledocs-server` folder.

                    9. โš ๏ธ SECURITY WARNING: This `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.

                    Step 6: Configure Claude Desktop (Optional)

                    If you want to use this server with Claude Desktop, you need to tell Claude how to run it.

                    1. Find Your Absolute Path: You need the full path to the server code.

                      2. Locate `mcp_config.json`: Find Claude's configuration file:

                        3. 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:

                        json
                        {
                              "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
                            }

                          4. Save `mcp_config.json`.

                          5. Restart Claude Desktop: Close Claude completely and reopen it.


                          Usage with Claude Desktop

                          Once configured, you should be able to use the tools in your chats with Claude:

                          • "Use the `google-docs-mcp` server to read the document with ID `YOUR_GOOGLE_DOC_ID`."
                          • "Can you get the content of Google Doc `YOUR_GOOGLE_DOC_ID`?"
                          • "Append 'This was added by Claude!' to document `YOUR_GOOGLE_DOC_ID` using the `google-docs-mcp` tool."

                          Advanced Usage Examples:

                          • Text Styling: "Use `applyTextStyle` to make the text 'Important Section' bold and red (#FF0000) in document `YOUR_GOOGLE_DOC_ID`."
                          • Paragraph Styling: "Use `applyParagraphStyle` to center-align the paragraph containing 'Title Here' in document `YOUR_GOOGLE_DOC_ID`."
                          • Table Creation: "Insert a 3x4 table at index 500 in document `YOUR_GOOGLE_DOC_ID` using the `insertTable` tool."
                          • Legacy Formatting: "Use `formatMatchingText` to find the second instance of 'Project Alpha' and make it blue (#0000FF) in doc `YOUR_GOOGLE_DOC_ID`."

                          ๐Ÿš€ Shared Drive Support:

                          The server now fully supports Google Workspace shared drives! You can:

                          • List shared drive contents: "List all documents in shared drive `SHARED_DRIVE_ID` using `listGoogleDocs` with corpora='drive'"
                          • Search across all drives: "Search for 'budget' across all my drives using `searchGoogleDocs` with corpora='allDrives'"
                          • Create in shared drives: "Create a new document in shared drive `SHARED_DRIVE_ID` using `createDocument` with driveId parameter"
                          • List folder in shared drive: "List contents of folder `FOLDER_ID` in shared drive `DRIVE_ID` using `listFolderContents`"

                          The `corpora` parameter controls the search scope:

                          • `'user'` (default): Only the user's personal drive
                          • `'drive'`: A specific shared drive (requires `driveId`)
                          • `'allDrives'`: All accessible drives including shared drives

                          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.


                          Security & Token Storage

                          • `.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 Storage: This server stores the Google authorization token (`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.

                          Troubleshooting

                          • Claude shows "Failed" or "Could not attach":
                            • Double-check the absolute path in `mcp_config.json`.
                            • Ensure you ran `npm run build` successfully and the `dist` folder exists.
                            • Try running the command from `mcp_config.json` manually in your terminal: `node /PATH/TO/YOUR/CLONED/REPO/mcp-googledocs-server/dist/server.js`. Look for any errors printed.
                            • Check the Claude Desktop logs (see the official MCP debugging guide).
                            • Make sure all `console.log` status messages in the server code were changed to `console.error`.
                          • Google Authorization Errors:
                            • Ensure you enabled the correct APIs (Docs, Drive).
                            • Make sure you added your email as a Test User on the OAuth Consent Screen.
                            • Verify the `credentials.json` file is correctly placed in the project root.

                          License

                          This 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).

                          Frequently asked questions

                          What is google-docs-mcp-shared?

                          google-docs-mcp-shared is Google Docs & Drive

                          How do I install google-docs-mcp-shared?

                          Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.

                          Is google-docs-mcp-shared open source?

                          Yes โ€” it is hosted on GitHub at https://github.com/jasonWong-serviceDirect/google-docs-mcp-shared and has 3 stars.

                          Related MCP tools

                          Run your own MCP server? See who uses it and what to fix.

                          Measure it with TrackMCP