### Cloudflare Workers Setup (Wrangler CLI) Source: https://github.com/petergarety/gdrive-mcp/blob/main/README.md Commands to install Wrangler, log in, create KV namespaces, generate TypeScript types, and deploy a Cloudflare Worker. ```bash npm install -g wrangler wrangler login npx wrangler kv namespace create "TOKEN_STORE" npx wrangler kv namespace create "CACHE" npx wrangler types npm run build npx wrangler deploy npx wrangler secret put GOOGLE_CLIENT_ID npx wrangler secret put GOOGLE_CLIENT_SECRET ``` -------------------------------- ### Install and Run Local MCP Server Source: https://github.com/petergarety/gdrive-mcp/blob/main/README.md Steps to clone the repository, install dependencies, set up environment variables, build, and run the local MCP server for personal Google Workspace access. ```bash git clone https://github.com/petergarety/gdrive-mcp.git cd gdrive-mcp npm install cp env.example .env # Edit .env and add: # GOOGLE_SERVICE_ACCOUNT_PATH=/absolute/path/to/service-account.json # GOOGLE_USER_EMAIL=your-email@yourdomain.com npm run build:mcp npm run start:mcp ``` -------------------------------- ### MCP Configuration Example Source: https://github.com/petergarety/gdrive-mcp/blob/main/README.md Example of the `mcp.json` configuration file used by Cursor. Ensure all paths are absolute and the configuration is correct. ```json { "google_service_account_path": "/path/to/your/service-account.json", "google_user_email": "user@your-domain.com" } ``` -------------------------------- ### Cloudflare Wrangler Configuration Source: https://github.com/petergarety/gdrive-mcp/blob/main/README.md Example configuration for wrangler.toml, including placeholders for worker name, redirect URI, and KV namespace IDs. ```bash cp wrangler.toml.example wrangler.toml # Edit wrangler.toml and update: # - Replace "your-gdrive-mcp-server" with your desired worker name # - Update GOOGLE_REDIRECT_URI placeholder # - Add the KV namespace IDs from step 2 ``` -------------------------------- ### Troubleshooting: OAuth Redirect URI Mismatch Source: https://github.com/petergarety/gdrive-mcp/blob/main/README.md Example of a Google OAuth redirect URI. Ensure this matches the URI configured in your Google Cloud Console for your Cloudflare Worker. ```bash https://gdrive-mcp-server.your-subdomain.workers.dev/callback ``` -------------------------------- ### Cloudflare Workers OAuth Redirect URI Source: https://github.com/petergarety/gdrive-mcp/blob/main/README.md Example of the Authorized redirect URIs for a Web application in Google Cloud Console. ```bash https://your-worker.workers.dev/callback ``` -------------------------------- ### Troubleshooting: Build MCP Locally Source: https://github.com/petergarety/gdrive-mcp/blob/main/README.md Command to build the MCP project for local development. It's important to use the specific build command for local development, not the general build command. ```bash npm run build:mcp ``` -------------------------------- ### Google Cloud APIs Enablement Source: https://github.com/petergarety/gdrive-mcp/blob/main/README.md List of Google Cloud APIs to enable for the gdrive-mcp project. ```bash # Enable these APIs: # - Google Docs API # - Google Drive API ``` -------------------------------- ### Troubleshooting: Test MCP Server Source: https://github.com/petergarety/gdrive-mcp/blob/main/README.md This snippet demonstrates how to manually test the MCP server by sending a 'tools/list' JSONRPC request via stdin. It's useful for diagnosing 'Tools not found' errors in Cursor. ```bash echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/list", "params": {}}' | npm run start:mcp ``` -------------------------------- ### GDrive MCP Available Tools Source: https://github.com/petergarety/gdrive-mcp/blob/main/README.md Lists the available tools provided by the GDrive MCP server for interacting with Google Docs, including document listing, content retrieval, creation, updates, search, and metadata extraction. ```APIDOC Tool: list_documents Description: List Google Docs in your Drive Tool: get_document Description: Get full document content with formatting Tool: get_document_text Description: Get plain text content of a document Tool: create_document Description: Create a new Google Doc Tool: update_document Description: Update document content Tool: search_documents Description: Search documents by content or title Tool: get_document_info Description: Get document metadata Tool: get_document_tabs Description: List tabs in a document Tool: get_document_headings Description: Extract headings (H1-H6) from a document Tool: get_content_under_heading Description: Get content under a specific heading ``` -------------------------------- ### Configure Cursor Desktop for GDrive MCP Source: https://github.com/petergarety/gdrive-mcp/blob/main/README.md Configuration snippet for Cursor Desktop to connect to the locally running GDrive MCP server via stdio transport. ```json { "mcpServers": { "gdrive": { "command": "node", "args": ["/absolute/path/to/gdrive-mcp/dist/mcp-server.js"], "cwd": "/absolute/path/to/gdrive-mcp" } } } ``` -------------------------------- ### Google Admin Console OAuth Scopes Source: https://github.com/petergarety/gdrive-mcp/blob/main/README.md Required OAuth scopes for authorizing the service account with domain-wide delegation. ```bash https://www.googleapis.com/auth/documents,https://www.googleapis.com/auth/drive ``` -------------------------------- ### Cloudflare Workers OAuth Consent Screen Scopes Source: https://github.com/petergarety/gdrive-mcp/blob/main/README.md Scopes required for the Cloudflare Workers OAuth consent screen. ```bash # Add scopes: # - https://www.googleapis.com/auth/documents # - https://www.googleapis.com/auth/drive # - openid, profile, email ``` -------------------------------- ### Troubleshooting: Unauthorized Client Error Source: https://github.com/petergarety/gdrive-mcp/blob/main/README.md Required OAuth scopes for domain-wide delegation with service accounts. These scopes grant the necessary permissions to access Google Docs and Drive. ```bash https://www.googleapis.com/auth/documents,https://www.googleapis.com/auth/drive ``` -------------------------------- ### MCP Client Configuration Source: https://github.com/petergarety/gdrive-mcp/blob/main/README.md JSON configuration for the MCP client to connect to the Cloudflare Worker. ```json { "mcpServers": { "gdriveCF": { "url": "https://your-worker-url/mcp", "headers": { "Authorization": "Bearer YOUR_API_KEY_FROM_STEP_9" } } } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.