Skip to main content
Glama
NolanFoster

Google Workspace MCP

by NolanFoster
README.md
# Google Workspace MCP on Cloudflare Workers

[![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/nolanfoster/google-workspace-mcp-cloudflare)

This is a Model Context Protocol (MCP) server that runs on Cloudflare Workers and interacts with Google Docs, Sheets, and Drive. It allows AI assistants like Claude Desktop, Cursor, and others to securely access and manage your Google Workspace documents.

## Features

- **Google Drive**: Search and list files with `listDriveFiles`.
- **Google Docs**: 
  - Read document content with `readDocument`.
  - Create new documents with `createDocument`.
  - Append text to documents with `appendDocumentText`.
  - List document tabs with `listDocumentTabs`.
- **Google Sheets**: Read values from a range with `readSheet`.

## Setup

### 1. Google Cloud Console Configuration

1. Go to the [Google Cloud Console](https://console.cloud.google.com/).
2. Create a new project.
3. Enable the following APIs:
   - Google Drive API
   - Google Docs API
   - Google Sheets API
4. Go to **APIs & Services > Credentials**.
5. Create an **OAuth 2.0 Client ID** (Web application).
6. Add `http://localhost:8787/oauth/callback` to the **Authorized redirect URIs**.
7. Note down your **Client ID** and **Client Secret**.

### 2. Configuration & Secrets

1. Create a KV namespace:
   ```bash
   npx wrangler kv:namespace create GOOGLE_AUTH_KV
   ```
2. Update your `wrangler.jsonc` with the KV namespace ID.
3. Set your Google OAuth secrets:
   ```bash
   npx wrangler secret put GOOGLE_CLIENT_ID
   npx wrangler secret put GOOGLE_CLIENT_SECRET
   ```

### 3. Deployment

```bash
npm install
npm run deploy
```

## Authentication

Once deployed (or running locally with `npm run dev`), visit the following URL to authenticate with your Google account:

`http://localhost:8787/oauth/login` (or your deployed worker URL)

This will securely store your refresh token in Cloudflare KV.

## MCP Configuration

Add the following to your MCP client configuration (e.g., `claude_desktop_config.json`):

```json
{
  "mcpServers": {
    "google-workspace": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/sdk-server-sse", "http://localhost:8787/mcp"]
    }
  }
}
```

## Development

```bash
npm run dev
```