Skip to main content
Glama
ravindra-gs

Google Docs MCP Server

by ravindra-gs

Google Docs MCP Server

An MCP (Model Context Protocol) server that provides read-only access to Google Docs and Google Sheets.

Features

  • Read Google Docs content

  • Read Google Sheets data

  • List accessible documents and spreadsheets

  • Search documents by query

Related MCP server: Google Drive MCP Server

Available Tools

Tool

Description

get_document

Get full content of a Google Doc by ID or URL

list_documents

List accessible Google Docs with optional search

get_spreadsheet

Get spreadsheet metadata and sheet list

get_sheet_data

Read data from a specific range

list_spreadsheets

List accessible Sheets with optional search

Setup

1. Create Google Cloud Credentials

  1. Go to Google Cloud Console

  2. Create a new project (or select an existing one)

  3. Enable the following APIs:

    • Google Docs API

    • Google Sheets API

    • Google Drive API

  4. Go to APIs & ServicesOAuth consent screen

    • Select "External" user type

    • Fill in the required fields (app name, support email)

    • Add scopes: docs.readonly, spreadsheets.readonly, drive.readonly

    • Add your email as a test user

  5. Go to APIs & ServicesCredentials

    • Click Create CredentialsOAuth client ID

    • Select Desktop application

    • Download the JSON file

2. Install the Server

# Clone or navigate to the project
cd google-docs-mcp

# Place your downloaded credentials file in the project root
mv ~/Downloads/client_secret_*.json ./client_secret.json

# Install dependencies
bun install

3. Authenticate

bun run auth

This will:

  1. Open your browser for Google login

  2. Ask you to grant read-only access to Docs, Sheets, and Drive

  3. Save the refresh token to .credentials/tokens.json

4. Run the Server

The server supports two transport modes:

HTTP Mode (Default)

# Start with HTTP transport (default, port 12333)
bun run start

# Or explicitly
bun run start --http

# Custom port via environment variable
MCP_PORT=8080 bun run start

Stdio Mode

# Start with stdio transport (for MCP clients that use stdio)
bun run start --stdio

5. Configure Your MCP Client

Claude Desktop (stdio mode)

Add to your Claude Desktop config (~/.config/claude/claude_desktop_config.json):

{
  "mcpServers": {
    "google-docs": {
      "command": "bun",
      "args": ["run", "/path/to/google-docs-mcp/src/index.ts", "--stdio"]
    }
  }
}

Claude Code (stdio mode)

Add to your Claude Code MCP settings:

{
  "mcpServers": {
    "google-docs": {
      "command": "bun",
      "args": ["run", "/path/to/google-docs-mcp/src/index.ts", "--stdio"]
    }
  }
}

HTTP Mode

For clients that support HTTP transport, connect to:

  • RPC endpoint: POST http://localhost:12333/rpc

  • Health check: GET http://localhost:12333/health

Environment Variables

Variable

Description

Default

MCP_PORT

Port for HTTP server

12333

PORT

Alternative port variable

12333

Usage Examples

Once configured, you can ask your MCP client to:

File Structure

google-docs-mcp/
├── client_secret.json     # Your Google OAuth credentials (git-ignored)
├── .credentials/          # Stored tokens (git-ignored)
│   └── tokens.json
├── src/
│   ├── index.ts           # MCP server entry point
│   ├── auth/
│   │   └── oauth.ts       # OAuth2 client management
│   ├── tools/
│   │   ├── docs.ts        # Google Docs tools
│   │   └── sheets.ts      # Google Sheets tools
│   └── types/
│       └── index.ts       # TypeScript types
└── bin/
    └── auth.ts            # CLI authentication script

Re-authenticating

If you need to re-authenticate (e.g., token expired or want to use a different account):

rm -rf .credentials
bun run auth

Troubleshooting

"Google credentials not found"

Make sure client_secret.json is in the project root directory.

"Not authenticated"

Run bun run auth to complete the OAuth flow.

"Access denied" errors

Ensure you've enabled the required APIs in Google Cloud Console and added your email as a test user in the OAuth consent screen.

Token expired

For apps in "Testing" status, refresh tokens may expire after 7 days. Re-run bun run auth to get a new token, or publish your app in Google Cloud Console for longer-lived tokens.

License

MIT

A
license - permissive license
-
quality - not tested
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ravindra-gs/google-docs-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server