{"id":29113616,"url":"https://github.com/taylorwilsdon/google_workspace_mcp","last_synced_at":"2026-04-02T21:39:44.460Z","repository":{"id":290241724,"uuid":"973788136","full_name":"taylorwilsdon/google_workspace_mcp","owner":"taylorwilsdon","description":"Control Gmail, Google Calendar, Docs, Sheets, Slides, Chat, Forms, Tasks, Search \u0026 Drive with AI - Comprehensive Google Workspace / G Suite MCP Server \u0026 CLI Tool","archived":false,"fork":false,"pushed_at":"2026-03-01T23:29:25.000Z","size":12523,"stargazers_count":1607,"open_issues_count":54,"forks_count":489,"subscribers_count":10,"default_branch":"main","last_synced_at":"2026-03-02T01:46:50.365Z","etag":null,"topics":["ai","g-suite","gmail","google-calendar","google-chat","google-docs","google-drive","google-forms","google-sheets","google-tasks","google-workspace","gsuite","llm","llm-tools","mcp","mcp-server","model-context-protocol","model-context-protocol-server","model-context-protocol-servers","workspace"],"latest_commit_sha":null,"homepage":"https://workspacemcp.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/taylorwilsdon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"taylorwilsdon"}},"created_at":"2025-04-27T18:31:13.000Z","updated_at":"2026-03-02T01:44:55.000Z","dependencies_parsed_at":"2025-04-27T19:34:05.516Z","dependency_job_id":"1140b4cd-3a96-4ee8-8fb2-78ecefb3f401","html_url":"https://github.com/taylorwilsdon/google_workspace_mcp","commit_stats":null,"previous_names":["taylorwilsdon/google_workspace_mcp"],"tags_count":79,"template":false,"template_full_name":null,"purl":"pkg:github/taylorwilsdon/google_workspace_mcp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taylorwilsdon%2Fgoogle_workspace_mcp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taylorwilsdon%2Fgoogle_workspace_mcp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taylorwilsdon%2Fgoogle_workspace_mcp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taylorwilsdon%2Fgoogle_workspace_mcp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/taylorwilsdon","download_url":"https://codeload.github.com/taylorwilsdon/google_workspace_mcp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taylorwilsdon%2Fgoogle_workspace_mcp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30068347,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T01:03:42.280Z","status":"ssl_error","status_checked_at":"2026-03-04T01:03:23.410Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","g-suite","gmail","google-calendar","google-chat","google-docs","google-drive","google-forms","google-sheets","google-tasks","google-workspace","gsuite","llm","llm-tools","mcp","mcp-server","model-context-protocol","model-context-protocol-server","model-context-protocol-servers","workspace"],"created_at":"2025-06-29T11:05:41.834Z","updated_at":"2026-04-02T21:39:44.443Z","avatar_url":"https://github.com/taylorwilsdon.png","language":"Python","funding_links":["https://github.com/sponsors/taylorwilsdon"],"categories":["Productivity","Workflow \u0026 Automation Mcp Servers","📚 Projects (1974 total)","Community Servers","پیاده‌سازی‌های سرور","Python","Communication","Containerised MCP Servers","📦 Other","MCP Ecosystem","Workplace \u0026 Productivity","🤖 AI \u0026 Machine Learning","可用服务","MCP Frameworks and libraries","MCP Servers \u0026 Protocol","📂 By Category","Server Implementations"],"sub_categories":["Google Workspace","MCP Servers","🏢 \u003ca name=\"workplace-and-productivity\"\u003e\u003c/a\u003eمحیط کار و بهره‌وری","How to Submit","Web \u0026 Content","Servers","生产力工具","Python","📊 Productivity \u0026 Collaboration","🏢 \u003ca name=\"workplace-and-productivity\"\u003e\u003c/a\u003eWorkplace \u0026 Productivity"],"readme":"\u003c!-- mcp-name: io.github.taylorwilsdon/workspace-mcp --\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n# \u003cspan style=\"color:#cad8d9\"\u003eGoogle Workspace MCP Server\u003c/span\u003e \u003cimg src=\"https://github.com/user-attachments/assets/b89524e4-6e6e-49e6-ba77-00d6df0c6e5c\" width=\"80\" align=\"right\" /\u003e\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Python 3.10+](https://img.shields.io/badge/Python-3.10%2B-blue.svg)](https://www.python.org/downloads/)\n[![PyPI](https://img.shields.io/pypi/v/workspace-mcp.svg)](https://pypi.org/project/workspace-mcp/)\n[![PyPI Downloads](https://static.pepy.tech/personalized-badge/workspace-mcp?period=total\u0026units=INTERNATIONAL_SYSTEM\u0026left_color=BLACK\u0026right_color=BLUE\u0026left_text=downloads)](https://pepy.tech/projects/workspace-mcp)\n[![Website](https://img.shields.io/badge/Website-workspacemcp.com-green.svg)](https://workspacemcp.com)\n\n*Full natural language control over Google Calendar, Drive, Gmail, Docs, Sheets, Slides, Forms, Tasks, Contacts, and Chat through all MCP clients, AI assistants and developer tools. Includes a full featured CLI for use with tools like Claude Code and Codex!*\n\n**The most feature-complete Google Workspace MCP server**, with Remote OAuth2.1 multi-user support and 1-click Claude installation. With native OAuth 2.1, stateless mode and external auth server support, it's the only Workspace MCP you can host for your whole organization centrally \u0026 securely!\n\n###### Support for all free Google accounts (Gmail, Docs, Drive etc) \u0026 Google Workspace plans (Starter, Standard, Plus, Enterprise, Non Profit) with expanded app options like Chat \u0026 Spaces. \u003cbr/\u003e\u003cbr /\u003e Interested in a private, managed cloud instance? [That can be arranged.](https://workspacemcp.com/workspace-mcp-cloud)\n\n\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n\u003ca href=\"https://www.pulsemcp.com/servers/taylorwilsdon-google-workspace\"\u003e\n\u003cimg width=\"375\" src=\"https://github.com/user-attachments/assets/0794ef1a-dc1c-447d-9661-9c704d7acc9d\" align=\"center\"/\u003e\n\u003c/a\u003e\n\u003c/div\u003e\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\u003ctable\u003e\n\u003ctr\u003e\n\u003ctd align=\"center\"\u003e\n\u003cb\u003e⚡ Start\u003c/b\u003e\u003cbr\u003e\n\u003csub\u003e\n\u003ca href=\"#quick-start\"\u003eQuick Start\u003c/a\u003e · \u003ca href=\"#prerequisites\"\u003ePrerequisites\u003c/a\u003e\u003cbr\u003e\n\u003ca href=\"#configuration\"\u003eGoogle Cloud\u003c/a\u003e · \u003ca href=\"#-credential-configuration\"\u003eCredentials\u003c/a\u003e\n\u003c/sub\u003e\n\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\n\u003cb\u003e🧰 Tools\u003c/b\u003e\u003cbr\u003e\n\u003csub\u003e\n\u003ca href=\"#-available-tools\"\u003eAll Tools\u003c/a\u003e · \u003ca href=\"#tool-tiers\"\u003eTool Tiers\u003c/a\u003e\u003cbr\u003e\n\u003ca href=\"#cli\"\u003eCLI\u003c/a\u003e · \u003ca href=\"#start-the-server\"\u003eStart Server\u003c/a\u003e\n\u003c/sub\u003e\n\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\n\u003cb\u003e🔌 Connect\u003c/b\u003e\u003cbr\u003e\n\u003csub\u003e\n\u003ca href=\"#one-click-claude-desktop-install-claude-desktop-only-stdio-single-user\"\u003e1-Click Install\u003c/a\u003e · \u003ca href=\"#connect-to-claude-desktop\"\u003eClaude Desktop\u003c/a\u003e\u003cbr\u003e\n\u003ca href=\"#claude-code-mcp-client-support\"\u003eClaude Code\u003c/a\u003e · \u003ca href=\"#vs-code-mcp-client-support\"\u003eVS Code\u003c/a\u003e · \u003ca href=\"#connect-to-lm-studio\"\u003eLM Studio\u003c/a\u003e\n\u003c/sub\u003e\n\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\n\u003cb\u003e🚀 Deploy\u003c/b\u003e\u003cbr\u003e\n\u003csub\u003e\n\u003ca href=\"#oauth-21-support-multi-user-bearer-token-authentication\"\u003eOAuth 2.1\u003c/a\u003e · \u003ca href=\"#stateless-mode-container-friendly\"\u003eStateless\u003c/a\u003e\u003cbr\u003e\n\u003ca href=\"#external-oauth-21-provider-mode\"\u003eExternal OAuth\u003c/a\u003e · \u003ca href=\"#reverse-proxy-setup\"\u003eReverse Proxy\u003c/a\u003e\n\u003c/sub\u003e\n\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\n\u003cb\u003e📐 Develop\u003c/b\u003e\u003cbr\u003e\n\u003csub\u003e\n\u003ca href=\"#-development\"\u003eArchitecture\u003c/a\u003e · \u003ca href=\"#local-development-setup\"\u003eDev Setup\u003c/a\u003e\u003cbr\u003e\n\u003ca href=\"#-security\"\u003eSecurity\u003c/a\u003e · \u003ca href=\"#-license\"\u003eLicense\u003c/a\u003e\n\u003c/sub\u003e\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\n**See it in action:**\n\u003cdiv align=\"center\"\u003e\n  \u003cvideo width=\"400\" src=\"https://github.com/user-attachments/assets/a342ebb4-1319-4060-a974-39d202329710\"\u003e\u003c/video\u003e\n\u003c/div\u003e\n\n---\n\n## \u003cspan style=\"color:#adbcbc\"\u003eOverview\u003c/span\u003e\n\nWorkspace MCP is the single most complete MCP server that integrates all major Google Workspace services with AI assistants. It supports both single-user operation and multi-user authentication via OAuth 2.1, making it a powerful backend for custom applications. Built with FastMCP for optimal performance, featuring advanced authentication handling, service caching, and streamlined development patterns. The entire toolset is available for CLI usage supporting both local and remote instances.\n\n**Simplified Setup**: Now uses Google Desktop OAuth clients - no redirect URIs or port configuration needed!\n\n\n## \u003cspan style=\"color:#adbcbc\"\u003eFeatures\u003c/span\u003e\n\n\u003e **12 services** \u0026ensp;—\u0026ensp; Gmail · Drive · Calendar · Docs · Sheets · Slides · Forms · Chat · Apps Script · Tasks · Contacts · Search\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003ctd valign=\"top\" width=\"50%\"\u003e\n\n**📧 Gmail** — Complete email management, end-to-end coverage\u003cbr\u003e\n**📁 Drive** — File operations with sharing, permissions \u0026 Office formats\u003cbr\u003e\n**📅 Calendar** — Full event management with advanced features\u003cbr\u003e\n**📝 Docs** — Deep, fine-grained editing, formatting \u0026 comments\u003cbr\u003e\n**📊 Sheets** — Flexible cell management, formatting \u0026 conditional rules\u003cbr\u003e\n**🖼️ Slides** — Presentation creation, updates \u0026 content manipulation\u003cbr\u003e\n**📋 Forms** — Creation, publish settings \u0026 response management\u003cbr\u003e\n**💬 Chat** — Space management, messaging \u0026 reactions\n\n\u003c/td\u003e\n\u003ctd valign=\"top\" width=\"50%\"\u003e\n\n**⚡ Apps Script** — Cross-application workflow automation\u003cbr\u003e\n\u003csub\u003e\u0026ensp;Projects · deployments · versions · execution · debugging\u003c/sub\u003e\n\n**✅ Tasks** — Task \u0026 list management with hierarchy\u003cbr\u003e\n**👤 Contacts** — People API with groups \u0026 batch operations\u003cbr\u003e\n**🔍 Custom Search** — Programmable Search Engine integration\n\n---\n\n**🔐 Authentication \u0026 Security**\u003cbr\u003e\n\u003csub\u003eOAuth 2.0 \u0026 2.1 · auto token refresh · multi-user bearer tokens · transport-aware callbacks · CORS proxy\u003c/sub\u003e\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n---\n\n## Quick Start\n\n\u003e Set credentials → pick a launch command → connect your client\n\n```bash\n# 1. Credentials\nexport GOOGLE_OAUTH_CLIENT_ID=\"...\"\nexport GOOGLE_OAUTH_CLIENT_SECRET=\"...\"\n\n# 2. Launch — pick a tier\nuvx workspace-mcp --tool-tier core       # essential tools\nuvx workspace-mcp --tool-tier extended   # core + management ops\nuvx workspace-mcp --tool-tier complete   # everything\n\n# Or cherry-pick services\nuv run main.py --tools gmail drive calendar\n```\n\n\u003csub\u003e[Credential setup →](#-credential-configuration) · [All launch options →](#start-the-server) · [Tier details →](#tool-tiers)\u003c/sub\u003e\n\n\u003cdetails open\u003e\n\u003csummary\u003e\u003cb\u003eEnvironment Variable Reference\u003c/b\u003e\u003c/summary\u003e\n\u003csub\u003e\n\n| Variable | | Purpose |\n|----------|:---:|---------|\n| **🔐 Authentication** | | |\n| `GOOGLE_OAUTH_CLIENT_ID` | **required** | OAuth client ID from Google Cloud |\n| `GOOGLE_OAUTH_CLIENT_SECRET` | **required** | OAuth client secret |\n| `OAUTHLIB_INSECURE_TRANSPORT` | **required**\u0026ast; | Set to `1` for development — allows `http://` redirect |\n| `USER_GOOGLE_EMAIL` | | Default email for single-user auth |\n| `GOOGLE_CLIENT_SECRET_PATH` | | Custom path to `client_secret.json` |\n| `GOOGLE_MCP_CREDENTIALS_DIR` | | Credential storage directory — default `~/.google_workspace_mcp/credentials` |\n| **🖥️ Server** | | |\n| `WORKSPACE_MCP_BASE_URI` | | Base server URI (no port) — default `http://localhost` |\n| `WORKSPACE_MCP_PORT` | | Listening port — default `8000` |\n| `WORKSPACE_MCP_HOST` | | Bind host — default `0.0.0.0` |\n| `WORKSPACE_EXTERNAL_URL` | | External URL for reverse proxy setups |\n| `WORKSPACE_ATTACHMENT_DIR` | | Downloaded attachments dir — default `~/.workspace-mcp/attachments/` |\n| `WORKSPACE_MCP_URL` | | Remote MCP endpoint URL for CLI |\n| `ALLOWED_FILE_DIRS` | | Colon-separated allowlist for local file reads |\n| **🔑 OAuth 2.1 \u0026 Multi-User** | | |\n| `MCP_ENABLE_OAUTH21` | | `true` to enable OAuth 2.1 multi-user support |\n| `EXTERNAL_OAUTH21_PROVIDER` | | `true` for external OAuth flow with bearer tokens |\n| `WORKSPACE_MCP_STATELESS_MODE` | | `true` for stateless container-friendly operation |\n| `GOOGLE_OAUTH_REDIRECT_URI` | | Override OAuth callback URL — default auto-constructed |\n| `OAUTH_CUSTOM_REDIRECT_URIS` | | Comma-separated additional redirect URIs |\n| `OAUTH_ALLOWED_ORIGINS` | | Comma-separated additional CORS origins |\n| `WORKSPACE_MCP_OAUTH_PROXY_STORAGE_BACKEND` | | `memory`, `disk`, or `valkey` — see [storage backends](#oauth-proxy-storage-backends) |\n| `FASTMCP_SERVER_AUTH_GOOGLE_JWT_SIGNING_KEY` | | Custom encryption key for OAuth proxy storage |\n| **🔍 Custom Search** | | |\n| `GOOGLE_PSE_API_KEY` | | API key for Programmable Search Engine |\n| `GOOGLE_PSE_ENGINE_ID` | | Search Engine ID for PSE |\n\n\u0026ast;Required for development only. Claude Desktop stores credentials securely in the OS keychain — set them once in the extension pane.\n\n\u003c/sub\u003e\n\u003c/details\u003e\n\n---\n\n### One-Click Claude Desktop Install\n\n\u003e `.dxt` bundles server, deps \u0026 manifest — download → double-click → done. No terminal, no JSON editing.\n\n1. **Download** the latest `google_workspace_mcp.dxt` from [Releases](https://github.com/taylorwilsdon/google_workspace_mcp/releases)\n2. **Install** — double-click the file, Claude Desktop prompts to install\n3. **Configure** — Settings → Extensions → Google Workspace MCP, paste your OAuth credentials\n4. **Use it** — start a new Claude chat and call any Google Workspace tool\n\n\u003cdiv align=\"center\"\u003e\n  \u003cvideo width=\"832\" src=\"https://github.com/user-attachments/assets/83cca4b3-5e94-448b-acb3-6e3a27341d3a\"\u003e\u003c/video\u003e\n\u003c/div\u003e\n\n---\n\n### Prerequisites\n\n**Python 3.10+** · **[uv/uvx](https://github.com/astral-sh/uv)** · **Google Cloud Project** with OAuth 2.0 credentials\n\n### Configuration\n\n\u003cdetails open\u003e\n\u003csummary\u003e\u003cb\u003eGoogle Cloud Setup\u003c/b\u003e\u003c/summary\u003e\n\n1. **Create Project** — [Open Console →](https://console.cloud.google.com/) → Create new project\n2. **Create OAuth Credentials** — APIs \u0026 Services → Credentials → Create Credentials → OAuth Client ID\n   - Choose **Desktop Application** (no redirect URIs needed!)\n   - Download and note your Client ID \u0026 Client Secret\n3. **Enable APIs** — APIs \u0026 Services → Library, then enable each service:\n\n   | | | | |\n   |:--|:--|:--|:--|\n   | [Calendar](https://console.cloud.google.com/flows/enableapi?apiid=calendar-json.googleapis.com) | [Drive](https://console.cloud.google.com/flows/enableapi?apiid=drive.googleapis.com) | [Gmail](https://console.cloud.google.com/flows/enableapi?apiid=gmail.googleapis.com) | [Docs](https://console.cloud.google.com/flows/enableapi?apiid=docs.googleapis.com) |\n   | [Sheets](https://console.cloud.google.com/flows/enableapi?apiid=sheets.googleapis.com) | [Slides](https://console.cloud.google.com/flows/enableapi?apiid=slides.googleapis.com) | [Forms](https://console.cloud.google.com/flows/enableapi?apiid=forms.googleapis.com) | [Tasks](https://console.cloud.google.com/flows/enableapi?apiid=tasks.googleapis.com) |\n   | [Chat](https://console.cloud.google.com/flows/enableapi?apiid=chat.googleapis.com) | [People](https://console.cloud.google.com/flows/enableapi?apiid=people.googleapis.com) | [Custom Search](https://console.cloud.google.com/flows/enableapi?apiid=customsearch.googleapis.com) | [Apps Script](https://console.cloud.google.com/flows/enableapi?apiid=script.googleapis.com) |\n\n4. **Set Credentials** — see [Environment Variable Reference](#quick-start) above, or:\n   ```bash\n   export GOOGLE_OAUTH_CLIENT_ID=\"your-client-id\"\n   export GOOGLE_OAUTH_CLIENT_SECRET=\"your-secret\"\n   ```\n\n\u003csub\u003e[Full OAuth documentation →](https://developers.google.com/workspace/guides/auth-overview) · [Credential setup details →](#-credential-configuration)\u003c/sub\u003e\n\n\u003c/details\u003e\n\n### Google Custom Search Setup\n\n\u003cdetails open\u003e\n\u003csummary\u003e◆ \u003cb\u003eCustom Search Configuration\u003c/b\u003e \u003csub\u003e\u003csup\u003e← Enable web search capabilities\u003c/sup\u003e\u003c/sub\u003e\u003c/summary\u003e\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003ctd width=\"33%\" align=\"center\"\u003e\n\n**1. Create Search Engine**\n```text\nprogrammablesearchengine.google.com\n/controlpanel/create\n\n→ Configure sites or entire web\n→ Note your Engine ID (cx)\n```\n\u003csub\u003e[Open Control Panel →](https://programmablesearchengine.google.com/controlpanel/create)\u003c/sub\u003e\n\n\u003c/td\u003e\n\u003ctd width=\"33%\" align=\"center\"\u003e\n\n**2. Get API Key**\n```text\ndevelopers.google.com\n/custom-search/v1/overview\n\n→ Create/select project\n→ Enable Custom Search API\n→ Create credentials (API Key)\n```\n\u003csub\u003e[Get API Key →](https://developers.google.com/custom-search/v1/overview)\u003c/sub\u003e\n\n\u003c/td\u003e\n\u003ctd width=\"34%\" align=\"center\"\u003e\n\n**3. Set Variables**\n```bash\nexport GOOGLE_PSE_API_KEY=\\\n  \"your-api-key\"\nexport GOOGLE_PSE_ENGINE_ID=\\\n  \"your-engine-id\"\n```\n\u003csub\u003eConfigure in environment\u003c/sub\u003e\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd colspan=\"3\"\u003e\n\n\u003cdetails open\u003e\n\u003csummary\u003e≡ \u003cb\u003eQuick Setup Guide\u003c/b\u003e \u003csub\u003e\u003csup\u003e← Step-by-step instructions\u003c/sup\u003e\u003c/sub\u003e\u003c/summary\u003e\n\n**Complete Setup Process:**\n\n1. **Create Search Engine** - Visit the [Control Panel](https://programmablesearchengine.google.com/controlpanel/create)\n   - Choose \"Search the entire web\" or specify sites\n   - Copy the Search Engine ID (looks like: `017643444788157684527:6ivsjbpxpqw`)\n\n2. **Enable API \u0026 Get Key** - Visit [Google Developers Console](https://console.cloud.google.com/)\n   - Enable \"Custom Search API\" in your project\n   - Create credentials → API Key\n   - Restrict key to Custom Search API (recommended)\n\n3. **Configure Environment** - Add to your shell or `.env`:\n   ```bash\n   export GOOGLE_PSE_API_KEY=\"AIzaSy...\"\n   export GOOGLE_PSE_ENGINE_ID=\"01764344478...\"\n   ```\n\n≡ [Full Documentation →](https://developers.google.com/custom-search/v1/overview)\n\n\u003c/details\u003e\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n\u003c/details\u003e\n\n### Start the Server\n\n\u003e **📌 Transport Mode Guidance**: Use **streamable HTTP mode** (`--transport streamable-http`) for all modern MCP clients including Claude Code, VS Code MCP, and MCP Inspector. Stdio mode is only for clients with incomplete MCP specification support.\n\n\u003cdetails open\u003e\n\u003csummary\u003e▶ \u003cb\u003eLaunch Commands\u003c/b\u003e \u003csub\u003e\u003csup\u003e← Choose your startup mode\u003c/sup\u003e\u003c/sub\u003e\u003c/summary\u003e\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003ctd width=\"33%\" align=\"center\"\u003e\n\n**▶ Legacy Mode**\n```bash\nuv run main.py\n```\n\u003csub\u003e⚠️ Stdio mode (incomplete MCP clients only)\u003c/sub\u003e\n\n\u003c/td\u003e\n\u003ctd width=\"33%\" align=\"center\"\u003e\n\n**◆ HTTP Mode (Recommended)**\n```bash\nuv run main.py \\\n  --transport streamable-http\n```\n\u003csub\u003e✅ Full MCP spec compliance \u0026 OAuth 2.1\u003c/sub\u003e\n\n\u003c/td\u003e\n\u003ctd width=\"34%\" align=\"center\"\u003e\n\n**@ Single User**\n```bash\nuv run main.py \\\n  --single-user\n```\n\u003csub\u003eSimplified authentication\u003c/sub\u003e\n\u003csub\u003e⚠️ Cannot be used with OAuth 2.1 mode\u003c/sub\u003e\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd colspan=\"3\"\u003e\n\n\u003cdetails open\u003e\n\u003csummary\u003e◆ \u003cb\u003eAdvanced Options\u003c/b\u003e \u003csub\u003e\u003csup\u003e← Tool selection, tiers \u0026 Docker\u003c/sup\u003e\u003c/sub\u003e\u003c/summary\u003e\n\n**▶ Selective Tool Loading**\n```bash\n# Load specific services only\nuv run main.py --tools gmail drive calendar\nuv run main.py --tools sheets docs\n\n# Combine with other flags\nuv run main.py --single-user --tools gmail\n```\n\n\n**🔒 Read-Only Mode**\n```bash\n# Requests only read-only scopes \u0026 disables write tools\nuv run main.py --read-only\n\n# Combine with specific tools or tiers\nuv run main.py --tools gmail drive --read-only\nuv run main.py --tool-tier core --read-only\n```\nRead-only mode provides secure, restricted access by:\n- Requesting only `*.readonly` OAuth scopes (e.g., `gmail.readonly`, `drive.readonly`)\n- Automatically filtering out tools that require write permissions at startup\n- Allowing read operations: list, get, search, and export across all services\n\n**🔐 Granular Permissions**\n```bash\n# Per-service permission levels\nuv run main.py --permissions gmail:organize drive:readonly\n\n# Combine permissions with tier filtering\nuv run main.py --permissions gmail:send drive:full --tool-tier core\n```\nGranular permissions mode provides service-by-service scope control:\n- Format: `service:level` (one entry per service)\n- Gmail levels: `readonly`, `organize`, `drafts`, `send`, `full` (cumulative)\n- Tasks levels: `readonly`, `manage`, `full` (cumulative; `manage` allows create/update/move but denies `delete` and `clear_completed`)\n- Other services currently support: `readonly`, `full`\n- `--permissions` and `--read-only` are mutually exclusive\n- `--permissions` cannot be combined with `--tools`; enabled services are determined by the `--permissions` entries (optionally filtered by `--tool-tier`)\n- With `--tool-tier`, only tier-matched tools are enabled and only services that have tools in the selected tier are imported\n\n**★ Tool Tiers**\n```bash\nuv run main.py --tool-tier core      # ● Essential tools only\nuv run main.py --tool-tier extended  # ◐ Core + additional\nuv run main.py --tool-tier complete  # ○ All available tools\n```\n\n**◆ Docker Deployment**\n```bash\ndocker build -t workspace-mcp .\ndocker run -p 8000:8000 -v $(pwd):/app \\\n  workspace-mcp --transport streamable-http\n\n# With tool selection via environment variables\ndocker run -e TOOL_TIER=core workspace-mcp\ndocker run -e TOOLS=\"gmail drive calendar\" workspace-mcp\n```\n\n**Available Services**: `gmail` • `drive` • `calendar` • `docs` • `sheets` • `forms` • `tasks` • `contacts` • `chat` • `search`\n\n\u003c/details\u003e\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n\u003c/details\u003e\n\n### CLI\n\nThe `workspace-cli` command lists tools and calls them against a running server — with encrypted, disk-backed OAuth token caching so you only authenticate once. On first run it opens a browser for Google consent; subsequent runs reuse the cached tokens automatically.\n\nTokens are stored encrypted at `~/.workspace-mcp/cli-tokens/` using a Fernet key auto-generated at `~/.workspace-mcp/.cli-encryption-key`.\n\n\u003cdetails open\u003e\n\u003csummary\u003e▶ \u003cb\u003eworkspace-cli Commands\u003c/b\u003e \u003csub\u003e\u003csup\u003e← Persistent OAuth, no re-auth on every call\u003c/sup\u003e\u003c/sub\u003e\u003c/summary\u003e\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003ctd width=\"50%\" align=\"center\"\u003e\n\n**▶ List Tools**\n```bash\nuv run workspace-cli list\nuv run workspace-cli --url https://custom.server/mcp list\n\n# Or, if installed globally:\nworkspace-cli list\nworkspace-cli --url https://custom.server/mcp list\n```\n\u003csub\u003eView all available tools\u003c/sub\u003e\n\n\u003c/td\u003e\n\u003ctd width=\"50%\" align=\"center\"\u003e\n\n**◆ Call a Tool**\n```bash\nuv run workspace-cli call search_gmail_messages \\\n  query=\"is:unread\" max_results=5\n```\n\u003csub\u003eExecute a tool with key=value arguments\u003c/sub\u003e\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\nSet URL for remote endpoints with `--url` or the `WORKSPACE_MCP_URL` environment variable.\n\n\u003cdetails open\u003e\n\u003csummary\u003e≡ \u003cb\u003eAdvanced: FastMCP CLI\u003c/b\u003e \u003csub\u003e\u003csup\u003e← inspect, install, discover\u003c/sup\u003e\u003c/sub\u003e\u003c/summary\u003e\n\nThe upstream [FastMCP CLI](https://gofastmcp.com/cli) is also bundled and provides additional commands for schema inspection, client installation, and editor discovery. Note that `fastmcp` uses in-memory token storage, so each invocation may re-trigger the OAuth flow.\n\n```bash\nfastmcp inspect fastmcp_server.py                        # print tools, resources, prompts\nfastmcp install claude-code fastmcp_server.py             # one-command client setup\nfastmcp install cursor fastmcp_server.py\nfastmcp discover                                          # find servers configured in editors\n```\n\nSee `fastmcp --help` or the [FastMCP CLI docs](https://gofastmcp.com/cli) for the full command reference.\n\n\u003c/details\u003e\n\n\u003c/details\u003e\n\n### Tool Tiers\n\nThe server organizes tools into **three progressive tiers** for simplified deployment. Choose a tier that matches your usage needs and API quota requirements.\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003ctd width=\"65%\" valign=\"top\"\u003e\n\n#### \u003cspan style=\"color:#72898f\"\u003eAvailable Tiers\u003c/span\u003e\n\n**\u003cspan style=\"color:#2d5b69\"\u003e●\u003c/span\u003e Core** (`--tool-tier core`)\nEssential tools for everyday tasks. Perfect for light usage with minimal API quotas. Includes search, read, create, and basic modify operations across all services.\n\n**\u003cspan style=\"color:#72898f\"\u003e●\u003c/span\u003e Extended** (`--tool-tier extended`)\nCore functionality plus management tools. Adds labels, folders, batch operations, and advanced search. Ideal for regular usage with moderate API needs.\n\n**\u003cspan style=\"color:#adbcbc\"\u003e●\u003c/span\u003e Complete** (`--tool-tier complete`)\nFull API access including comments, headers/footers, publishing settings, and administrative functions. For power users needing maximum functionality.\n\n\u003c/td\u003e\n\u003ctd width=\"35%\" valign=\"top\"\u003e\n\n#### \u003cspan style=\"color:#72898f\"\u003eImportant Notes\u003c/span\u003e\n\n\u003cspan style=\"color:#72898f\"\u003e▶\u003c/span\u003e **Start with `core`** and upgrade as needed\n\u003cspan style=\"color:#72898f\"\u003e▶\u003c/span\u003e **Tiers are cumulative** – each includes all previous\n\u003cspan style=\"color:#72898f\"\u003e▶\u003c/span\u003e **Mix and match** with `--tools` for specific services\n\u003cspan style=\"color:#72898f\"\u003e▶\u003c/span\u003e **Configuration** in `core/tool_tiers.yaml`\n\u003cspan style=\"color:#72898f\"\u003e▶\u003c/span\u003e **Authentication** included in all tiers\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n#### \u003cspan style=\"color:#72898f\"\u003eUsage Examples\u003c/span\u003e\n\n```bash\n# Basic tier selection\nuv run main.py --tool-tier core                            # Start with essential tools only\nuv run main.py --tool-tier extended                        # Expand to include management features\nuv run main.py --tool-tier complete                        # Enable all available functionality\n\n# Selective service loading with tiers\nuv run main.py --tools gmail drive --tool-tier core        # Core tools for specific services\nuv run main.py --tools gmail --tool-tier extended          # Extended Gmail functionality only\nuv run main.py --tools docs sheets --tool-tier complete    # Full access to Docs and Sheets\n\n# Combine tier selection with granular permission levels\nuv run main.py --permissions gmail:organize drive:full --tool-tier core\n```\n\n## 📋 Credential Configuration\n\n\u003cdetails open\u003e\n\u003csummary\u003e🔑 \u003cb\u003eOAuth Credentials Setup\u003c/b\u003e \u003csub\u003e\u003csup\u003e← Essential for all installations\u003c/sup\u003e\u003c/sub\u003e\u003c/summary\u003e\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003ctd width=\"33%\" align=\"center\"\u003e\n\n**🚀 Environment Variables**\n```bash\nexport GOOGLE_OAUTH_CLIENT_ID=\\\n  \"your-client-id\"\nexport GOOGLE_OAUTH_CLIENT_SECRET=\\\n  \"your-secret\"\n```\n\u003csub\u003eBest for production\u003c/sub\u003e\n\n\u003c/td\u003e\n\u003ctd width=\"33%\" align=\"center\"\u003e\n\n**📁 File-based**\n```bash\n# Download \u0026 place in project root\nclient_secret.json\n\n# Or specify custom path\nexport GOOGLE_CLIENT_SECRET_PATH=\\\n  /path/to/secret.json\n```\n\u003csub\u003eTraditional method\u003c/sub\u003e\n\n\u003c/td\u003e\n\u003ctd width=\"34%\" align=\"center\"\u003e\n\n**⚡ .env File**\n```bash\ncp .env.oauth21 .env\n# Edit .env with credentials\n```\n\u003csub\u003eBest for development\u003c/sub\u003e\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd colspan=\"3\"\u003e\n\n\u003cdetails open\u003e\n\u003csummary\u003e📖 \u003cb\u003eCredential Loading Details\u003c/b\u003e \u003csub\u003e\u003csup\u003e← Understanding priority \u0026 best practices\u003c/sup\u003e\u003c/sub\u003e\u003c/summary\u003e\n\n**Loading Priority**\n1. Environment variables (`export VAR=value`)\n2. `.env` file in project root (warning - if you run via `uvx` rather than `uv run` from the repo directory, you are spawning a standalone process not associated with your clone of the repo and it will not find your .env file without specifying it directly)\n3. `client_secret.json` via `GOOGLE_CLIENT_SECRET_PATH`\n4. Default `client_secret.json` in project root\n\n**Why Environment Variables?**\n- ✅ **Docker/K8s ready** - Native container support\n- ✅ **Cloud platforms** - Heroku, Railway, Vercel\n- ✅ **CI/CD pipelines** - GitHub Actions, Jenkins\n- ✅ **No secrets in git** - Keep credentials secure\n- ✅ **Easy rotation** - Update without code changes\n\n\u003c/details\u003e\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n\u003c/details\u003e\n\n---\n\n## 🧰 Available Tools\n\n\u003e **Note**: All tools support automatic authentication via `@require_google_service()` decorators with 30-minute service caching.\n\n#### 📅 Google Calendar \u003csub\u003e[`calendar_tools.py`](gcalendar/calendar_tools.py)\u003c/sub\u003e\n\n| \u003csub\u003eTool\u003c/sub\u003e | \u003csub\u003eTier\u003c/sub\u003e | \u003csub\u003eDescription\u003c/sub\u003e |\n|------|------|-------------|\n| \u003csub\u003e`list_calendars`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eList accessible calendars\u003c/sub\u003e |\n| \u003csub\u003e`get_events`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eRetrieve events with time range filtering\u003c/sub\u003e |\n| \u003csub\u003e`manage_event`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eCreate, update, or delete calendar events\u003c/sub\u003e |\n| \u003csub\u003e`manage_out_of_office`\u003c/sub\u003e | \u003csub\u003eExtended\u003c/sub\u003e | \u003csub\u003eCreate, list, update, or delete Out of Office events\u003c/sub\u003e |\n| \u003csub\u003e`manage_focus_time`\u003c/sub\u003e | \u003csub\u003eExtended\u003c/sub\u003e | \u003csub\u003eCreate, list, update, or delete Focus Time events\u003c/sub\u003e |\n\n#### 📁 Google Drive \u003csub\u003e[`drive_tools.py`](gdrive/drive_tools.py)\u003c/sub\u003e\n\n| \u003csub\u003eTool\u003c/sub\u003e | \u003csub\u003eTier\u003c/sub\u003e | \u003csub\u003eDescription\u003c/sub\u003e |\n|------|------|-------------|\n| \u003csub\u003e`search_drive_files`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eSearch files with query syntax\u003c/sub\u003e |\n| \u003csub\u003e`get_drive_file_content`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eRead file content (Office formats)\u003c/sub\u003e |\n| \u003csub\u003e`get_drive_file_download_url`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eDownload Drive files to local disk\u003c/sub\u003e |\n| \u003csub\u003e`create_drive_file`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eCreate files or fetch from URLs\u003c/sub\u003e |\n| \u003csub\u003e`create_drive_folder`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eCreate empty folders in Drive or shared drives\u003c/sub\u003e |\n| \u003csub\u003e`import_to_google_doc`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eImport files (MD, DOCX, HTML, etc.) as Google Docs\u003c/sub\u003e |\n| \u003csub\u003e`get_drive_shareable_link`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eGet shareable links for a file\u003c/sub\u003e |\n| \u003csub\u003e`list_drive_items`\u003c/sub\u003e | \u003csub\u003eExtended\u003c/sub\u003e | \u003csub\u003eList folder contents\u003c/sub\u003e |\n| \u003csub\u003e`copy_drive_file`\u003c/sub\u003e | \u003csub\u003eExtended\u003c/sub\u003e | \u003csub\u003eCopy existing files (templates) with optional renaming\u003c/sub\u003e |\n| \u003csub\u003e`update_drive_file`\u003c/sub\u003e | \u003csub\u003eExtended\u003c/sub\u003e | \u003csub\u003eUpdate file metadata, move between folders\u003c/sub\u003e |\n| \u003csub\u003e`manage_drive_access`\u003c/sub\u003e | \u003csub\u003eExtended\u003c/sub\u003e | \u003csub\u003eGrant, update, revoke permissions, and transfer ownership\u003c/sub\u003e |\n| \u003csub\u003e`set_drive_file_permissions`\u003c/sub\u003e | \u003csub\u003eExtended\u003c/sub\u003e | \u003csub\u003eSet link sharing and file-level sharing settings\u003c/sub\u003e |\n| \u003csub\u003e`get_drive_file_permissions`\u003c/sub\u003e | \u003csub\u003eComplete\u003c/sub\u003e | \u003csub\u003eGet detailed file permissions\u003c/sub\u003e |\n| \u003csub\u003e`check_drive_file_public_access`\u003c/sub\u003e | \u003csub\u003eComplete\u003c/sub\u003e | \u003csub\u003eCheck public sharing status\u003c/sub\u003e |\n\n#### 📧 Gmail \u003csub\u003e[`gmail_tools.py`](gmail/gmail_tools.py)\u003c/sub\u003e\n\n| \u003csub\u003eTool\u003c/sub\u003e | \u003csub\u003eTier\u003c/sub\u003e | \u003csub\u003eDescription\u003c/sub\u003e |\n|------|------|-------------|\n| \u003csub\u003e`search_gmail_messages`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eSearch with Gmail operators\u003c/sub\u003e |\n| \u003csub\u003e`get_gmail_message_content`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eRetrieve message content\u003c/sub\u003e |\n| \u003csub\u003e`get_gmail_messages_content_batch`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eBatch retrieve message content\u003c/sub\u003e |\n| \u003csub\u003e`send_gmail_message`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eSend emails\u003c/sub\u003e |\n| \u003csub\u003e`get_gmail_thread_content`\u003c/sub\u003e | \u003csub\u003eExtended\u003c/sub\u003e | \u003csub\u003eGet full thread content\u003c/sub\u003e |\n| \u003csub\u003e`modify_gmail_message_labels`\u003c/sub\u003e | \u003csub\u003eExtended\u003c/sub\u003e | \u003csub\u003eModify message labels\u003c/sub\u003e |\n| \u003csub\u003e`list_gmail_labels`\u003c/sub\u003e | \u003csub\u003eExtended\u003c/sub\u003e | \u003csub\u003eList available labels\u003c/sub\u003e |\n| \u003csub\u003e`list_gmail_filters`\u003c/sub\u003e | \u003csub\u003eExtended\u003c/sub\u003e | \u003csub\u003eList Gmail filters\u003c/sub\u003e |\n| \u003csub\u003e`manage_gmail_label`\u003c/sub\u003e | \u003csub\u003eExtended\u003c/sub\u003e | \u003csub\u003eCreate/update/delete labels\u003c/sub\u003e |\n| \u003csub\u003e`manage_gmail_filter`\u003c/sub\u003e | \u003csub\u003eExtended\u003c/sub\u003e | \u003csub\u003eCreate or delete Gmail filters\u003c/sub\u003e |\n| \u003csub\u003e`draft_gmail_message`\u003c/sub\u003e | \u003csub\u003eExtended\u003c/sub\u003e | \u003csub\u003eCreate drafts\u003c/sub\u003e |\n| \u003csub\u003e`get_gmail_threads_content_batch`\u003c/sub\u003e | \u003csub\u003eComplete\u003c/sub\u003e | \u003csub\u003eBatch retrieve thread content\u003c/sub\u003e |\n| \u003csub\u003e`batch_modify_gmail_message_labels`\u003c/sub\u003e | \u003csub\u003eComplete\u003c/sub\u003e | \u003csub\u003eBatch modify labels\u003c/sub\u003e |\n| \u003csub\u003e`start_google_auth`\u003c/sub\u003e | \u003csub\u003eComplete\u003c/sub\u003e | \u003csub\u003eLegacy OAuth 2.0 auth (disabled when OAuth 2.1 is enabled)\u003c/sub\u003e |\n\n\u003cdetails open\u003e\n\u003csummary\u003e\u003cb\u003e📎 Email Attachments\u003c/b\u003e \u003csub\u003e\u003csup\u003e← Send emails with files\u003c/sup\u003e\u003c/sub\u003e\u003c/summary\u003e\n\nBoth `send_gmail_message` and `draft_gmail_message` support attachments via two methods:\n\n**Option 1: File Path** (local server only)\n```python\nattachments=[{\"path\": \"/path/to/report.pdf\"}]\n```\nReads file from disk, auto-detects MIME type. Optional `filename` override.\n\n**Option 2: Base64 Content** (works everywhere)\n```python\nattachments=[{\n    \"filename\": \"report.pdf\",\n    \"content\": \"JVBERi0xLjQK...\",  # base64-encoded\n    \"mime_type\": \"application/pdf\"   # optional\n}]\n```\n\n**⚠️ Centrally Hosted Servers**: When the MCP server runs remotely (cloud, shared instance), it cannot access your local filesystem. Use **Option 2** with base64-encoded content. Your MCP client must encode files before sending.\n\n\u003c/details\u003e\n\n\u003cdetails open\u003e\n\u003csummary\u003e\u003cb\u003e📥 Downloaded Attachment Storage\u003c/b\u003e \u003csub\u003e\u003csup\u003e← Where downloaded files are saved\u003c/sup\u003e\u003c/sub\u003e\u003c/summary\u003e\n\nWhen downloading Gmail attachments (`get_gmail_attachment_content`) or Drive files (`get_drive_file_download_url`), files are saved to a persistent local directory rather than a temporary folder in the working directory.\n\n**Default location:** `~/.workspace-mcp/attachments/`\n\nFiles are saved with their original filename plus a short UUID suffix for uniqueness (e.g., `invoice_a1b2c3d4.pdf`). In **stdio mode**, the tool returns the absolute file path for direct filesystem access. In **HTTP mode**, it returns a download URL via the `/attachments/{file_id}` endpoint.\n\nTo customize the storage directory:\n```bash\nexport WORKSPACE_ATTACHMENT_DIR=\"/path/to/custom/dir\"\n```\n\nSaved files expire after 1 hour and are cleaned up automatically.\n\n\u003c/details\u003e\n\n#### 📝 Google Docs \u003csub\u003e[`docs_tools.py`](gdocs/docs_tools.py)\u003c/sub\u003e\n\n| \u003csub\u003eTool\u003c/sub\u003e | \u003csub\u003eTier\u003c/sub\u003e | \u003csub\u003eDescription\u003c/sub\u003e |\n|------|------|-------------|\n| \u003csub\u003e`get_doc_content`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eExtract document text\u003c/sub\u003e |\n| \u003csub\u003e`create_doc`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eCreate new documents\u003c/sub\u003e |\n| \u003csub\u003e`modify_doc_text`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eInsert, replace, and richly format text with tab/segment targeting, append-to-segment support, advanced typography, and link management\u003c/sub\u003e |\n| \u003csub\u003e`search_docs`\u003c/sub\u003e | \u003csub\u003eExtended\u003c/sub\u003e | \u003csub\u003eFind documents by name\u003c/sub\u003e |\n| \u003csub\u003e`find_and_replace_doc`\u003c/sub\u003e | \u003csub\u003eExtended\u003c/sub\u003e | \u003csub\u003eFind and replace text\u003c/sub\u003e |\n| \u003csub\u003e`list_docs_in_folder`\u003c/sub\u003e | \u003csub\u003eExtended\u003c/sub\u003e | \u003csub\u003eList docs in folder\u003c/sub\u003e |\n| \u003csub\u003e`insert_doc_elements`\u003c/sub\u003e | \u003csub\u003eExtended\u003c/sub\u003e | \u003csub\u003eAdd tables, lists, page breaks\u003c/sub\u003e |\n| \u003csub\u003e`update_paragraph_style`\u003c/sub\u003e | \u003csub\u003eExtended\u003c/sub\u003e | \u003csub\u003eApply advanced paragraph styling including headings, spacing, direction, pagination controls, shading, and bulleted/numbered/checkbox lists with nesting\u003c/sub\u003e |\n| \u003csub\u003e`get_doc_as_markdown`\u003c/sub\u003e | \u003csub\u003eExtended\u003c/sub\u003e | \u003csub\u003eExport document as formatted Markdown with optional comments\u003c/sub\u003e |\n| \u003csub\u003e`insert_doc_image`\u003c/sub\u003e | \u003csub\u003eComplete\u003c/sub\u003e | \u003csub\u003eInsert images from Drive/URLs\u003c/sub\u003e |\n| \u003csub\u003e`update_doc_headers_footers`\u003c/sub\u003e | \u003csub\u003eComplete\u003c/sub\u003e | \u003csub\u003eCreate or update headers and footers with correct segment-aware writes\u003c/sub\u003e |\n| \u003csub\u003e`batch_update_doc`\u003c/sub\u003e | \u003csub\u003eComplete\u003c/sub\u003e | \u003csub\u003eExecute atomic multi-step Docs API operations including named ranges, section breaks, document/section layout, header/footer creation, segment-aware inserts, images, tables, and rich formatting\u003c/sub\u003e |\n| \u003csub\u003e`inspect_doc_structure`\u003c/sub\u003e | \u003csub\u003eComplete\u003c/sub\u003e | \u003csub\u003eAnalyze document structure, including safe insertion points, tables, section breaks, headers/footers, and named ranges\u003c/sub\u003e |\n| \u003csub\u003e`export_doc_to_pdf`\u003c/sub\u003e | \u003csub\u003eExtended\u003c/sub\u003e | \u003csub\u003eExport document to PDF\u003c/sub\u003e |\n| \u003csub\u003e`create_table_with_data`\u003c/sub\u003e | \u003csub\u003eComplete\u003c/sub\u003e | \u003csub\u003eCreate data tables\u003c/sub\u003e |\n| \u003csub\u003e`debug_table_structure`\u003c/sub\u003e | \u003csub\u003eComplete\u003c/sub\u003e | \u003csub\u003eDebug table issues\u003c/sub\u003e |\n| \u003csub\u003e`list_document_comments`\u003c/sub\u003e | \u003csub\u003eComplete\u003c/sub\u003e | \u003csub\u003eList all document comments\u003c/sub\u003e |\n| \u003csub\u003e`manage_document_comment`\u003c/sub\u003e | \u003csub\u003eComplete\u003c/sub\u003e | \u003csub\u003eCreate, reply to, or resolve comments\u003c/sub\u003e |\n\n#### 📊 Google Sheets \u003csub\u003e[`sheets_tools.py`](gsheets/sheets_tools.py)\u003c/sub\u003e\n\n| \u003csub\u003eTool\u003c/sub\u003e | \u003csub\u003eTier\u003c/sub\u003e | \u003csub\u003eDescription\u003c/sub\u003e |\n|------|------|-------------|\n| \u003csub\u003e`read_sheet_values`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eRead cell ranges\u003c/sub\u003e |\n| \u003csub\u003e`modify_sheet_values`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eWrite/update/clear cells\u003c/sub\u003e |\n| \u003csub\u003e`create_spreadsheet`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eCreate new spreadsheets\u003c/sub\u003e |\n| \u003csub\u003e`list_spreadsheets`\u003c/sub\u003e | \u003csub\u003eExtended\u003c/sub\u003e | \u003csub\u003eList accessible spreadsheets\u003c/sub\u003e |\n| \u003csub\u003e`get_spreadsheet_info`\u003c/sub\u003e | \u003csub\u003eExtended\u003c/sub\u003e | \u003csub\u003eGet spreadsheet metadata\u003c/sub\u003e |\n| \u003csub\u003e`format_sheet_range`\u003c/sub\u003e | \u003csub\u003eExtended\u003c/sub\u003e | \u003csub\u003eApply colors, number formats, text wrapping, alignment, bold/italic, font size\u003c/sub\u003e |\n| \u003csub\u003e`create_sheet`\u003c/sub\u003e | \u003csub\u003eComplete\u003c/sub\u003e | \u003csub\u003eAdd sheets to existing files\u003c/sub\u003e |\n| \u003csub\u003e`list_spreadsheet_comments`\u003c/sub\u003e | \u003csub\u003eComplete\u003c/sub\u003e | \u003csub\u003eList all spreadsheet comments\u003c/sub\u003e |\n| \u003csub\u003e`manage_spreadsheet_comment`\u003c/sub\u003e | \u003csub\u003eComplete\u003c/sub\u003e | \u003csub\u003eCreate, reply to, or resolve comments\u003c/sub\u003e |\n| \u003csub\u003e`manage_conditional_formatting`\u003c/sub\u003e | \u003csub\u003eComplete\u003c/sub\u003e | \u003csub\u003eAdd, update, or delete conditional formatting rules\u003c/sub\u003e |\n\n#### 🖼️ Google Slides \u003csub\u003e[`slides_tools.py`](gslides/slides_tools.py)\u003c/sub\u003e\n\n| \u003csub\u003eTool\u003c/sub\u003e | \u003csub\u003eTier\u003c/sub\u003e | \u003csub\u003eDescription\u003c/sub\u003e |\n|------|------|-------------|\n| \u003csub\u003e`create_presentation`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eCreate new presentations\u003c/sub\u003e |\n| \u003csub\u003e`get_presentation`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eRetrieve presentation details\u003c/sub\u003e |\n| \u003csub\u003e`batch_update_presentation`\u003c/sub\u003e | \u003csub\u003eExtended\u003c/sub\u003e | \u003csub\u003eApply multiple updates\u003c/sub\u003e |\n| \u003csub\u003e`get_page`\u003c/sub\u003e | \u003csub\u003eExtended\u003c/sub\u003e | \u003csub\u003eGet specific slide information\u003c/sub\u003e |\n| \u003csub\u003e`get_page_thumbnail`\u003c/sub\u003e | \u003csub\u003eExtended\u003c/sub\u003e | \u003csub\u003eGenerate slide thumbnails\u003c/sub\u003e |\n| \u003csub\u003e`list_presentation_comments`\u003c/sub\u003e | \u003csub\u003eComplete\u003c/sub\u003e | \u003csub\u003eList all presentation comments\u003c/sub\u003e |\n| \u003csub\u003e`manage_presentation_comment`\u003c/sub\u003e | \u003csub\u003eComplete\u003c/sub\u003e | \u003csub\u003eCreate, reply to, or resolve comments\u003c/sub\u003e |\n\n#### 📋 Google Forms \u003csub\u003e[`forms_tools.py`](gforms/forms_tools.py)\u003c/sub\u003e\n\n| \u003csub\u003eTool\u003c/sub\u003e | \u003csub\u003eTier\u003c/sub\u003e | \u003csub\u003eDescription\u003c/sub\u003e |\n|------|------|-------------|\n| \u003csub\u003e`create_form`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eCreate new forms\u003c/sub\u003e |\n| \u003csub\u003e`get_form`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eRetrieve form details \u0026 URLs\u003c/sub\u003e |\n| \u003csub\u003e`set_publish_settings`\u003c/sub\u003e | \u003csub\u003eComplete\u003c/sub\u003e | \u003csub\u003eConfigure form settings\u003c/sub\u003e |\n| \u003csub\u003e`get_form_response`\u003c/sub\u003e | \u003csub\u003eComplete\u003c/sub\u003e | \u003csub\u003eGet individual responses\u003c/sub\u003e |\n| \u003csub\u003e`list_form_responses`\u003c/sub\u003e | \u003csub\u003eExtended\u003c/sub\u003e | \u003csub\u003eList all responses with pagination\u003c/sub\u003e |\n| \u003csub\u003e`batch_update_form`\u003c/sub\u003e | \u003csub\u003eComplete\u003c/sub\u003e | \u003csub\u003eApply batch updates (questions, settings)\u003c/sub\u003e |\n\n#### ✓ Google Tasks \u003csub\u003e[`tasks_tools.py`](gtasks/tasks_tools.py)\u003c/sub\u003e\n\n| \u003csub\u003eTool\u003c/sub\u003e | \u003csub\u003eTier\u003c/sub\u003e | \u003csub\u003eDescription\u003c/sub\u003e |\n|------|------|-------------|\n| \u003csub\u003e`list_tasks`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eList tasks with filtering\u003c/sub\u003e |\n| \u003csub\u003e`get_task`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eRetrieve task details\u003c/sub\u003e |\n| \u003csub\u003e`manage_task`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eCreate, update, delete, or move tasks\u003c/sub\u003e |\n| \u003csub\u003e`list_task_lists`\u003c/sub\u003e | \u003csub\u003eComplete\u003c/sub\u003e | \u003csub\u003eList task lists\u003c/sub\u003e |\n| \u003csub\u003e`get_task_list`\u003c/sub\u003e | \u003csub\u003eComplete\u003c/sub\u003e | \u003csub\u003eGet task list details\u003c/sub\u003e |\n| \u003csub\u003e`manage_task_list`\u003c/sub\u003e | \u003csub\u003eComplete\u003c/sub\u003e | \u003csub\u003eCreate, update, delete task lists, or clear completed tasks\u003c/sub\u003e |\n\n#### 👤 Google Contacts \u003csub\u003e[`contacts_tools.py`](gcontacts/contacts_tools.py)\u003c/sub\u003e\n\n| \u003csub\u003eTool\u003c/sub\u003e | \u003csub\u003eTier\u003c/sub\u003e | \u003csub\u003eDescription\u003c/sub\u003e |\n|------|------|-------------|\n| \u003csub\u003e`search_contacts`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eSearch contacts by name, email, phone\u003c/sub\u003e |\n| \u003csub\u003e`get_contact`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eRetrieve detailed contact info\u003c/sub\u003e |\n| \u003csub\u003e`list_contacts`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eList contacts with pagination\u003c/sub\u003e |\n| \u003csub\u003e`manage_contact`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eCreate, update, or delete contacts\u003c/sub\u003e |\n| \u003csub\u003e`list_contact_groups`\u003c/sub\u003e | \u003csub\u003eExtended\u003c/sub\u003e | \u003csub\u003eList contact groups/labels\u003c/sub\u003e |\n| \u003csub\u003e`get_contact_group`\u003c/sub\u003e | \u003csub\u003eExtended\u003c/sub\u003e | \u003csub\u003eGet group details with members\u003c/sub\u003e |\n| \u003csub\u003e`manage_contacts_batch`\u003c/sub\u003e | \u003csub\u003eComplete\u003c/sub\u003e | \u003csub\u003eBatch create, update, or delete contacts\u003c/sub\u003e |\n| \u003csub\u003e`manage_contact_group`\u003c/sub\u003e | \u003csub\u003eComplete\u003c/sub\u003e | \u003csub\u003eCreate, update, delete groups, or modify membership\u003c/sub\u003e |\n\n#### 💬 Google Chat \u003csub\u003e[`chat_tools.py`](gchat/chat_tools.py)\u003c/sub\u003e\n\n| \u003csub\u003eTool\u003c/sub\u003e | \u003csub\u003eTier\u003c/sub\u003e | \u003csub\u003eDescription\u003c/sub\u003e |\n|------|------|-------------|\n| \u003csub\u003e`list_spaces`\u003c/sub\u003e | \u003csub\u003eExtended\u003c/sub\u003e | \u003csub\u003eList chat spaces/rooms\u003c/sub\u003e |\n| \u003csub\u003e`get_messages`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eRetrieve space messages\u003c/sub\u003e |\n| \u003csub\u003e`send_message`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eSend messages to spaces\u003c/sub\u003e |\n| \u003csub\u003e`search_messages`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eSearch across chat history\u003c/sub\u003e |\n| \u003csub\u003e`create_reaction`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eAdd emoji reaction to a message\u003c/sub\u003e |\n| \u003csub\u003e`download_chat_attachment`\u003c/sub\u003e | \u003csub\u003eExtended\u003c/sub\u003e | \u003csub\u003eDownload attachment from a chat message\u003c/sub\u003e |\n\n#### 🔍 Google Custom Search \u003csub\u003e[`search_tools.py`](gsearch/search_tools.py)\u003c/sub\u003e\n\n| \u003csub\u003eTool\u003c/sub\u003e | \u003csub\u003eTier\u003c/sub\u003e | \u003csub\u003eDescription\u003c/sub\u003e |\n|------|------|-------------|\n| \u003csub\u003e`search_custom`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003ePerform web searches (supports site restrictions via sites parameter)\u003c/sub\u003e |\n| \u003csub\u003e`get_search_engine_info`\u003c/sub\u003e | \u003csub\u003eComplete\u003c/sub\u003e | \u003csub\u003eRetrieve search engine metadata\u003c/sub\u003e |\n\n#### ⚡ Google Apps Script \u003csub\u003e[`apps_script_tools.py`](gappsscript/apps_script_tools.py)\u003c/sub\u003e\n\n| \u003csub\u003eTool\u003c/sub\u003e | \u003csub\u003eTier\u003c/sub\u003e | \u003csub\u003eDescription\u003c/sub\u003e |\n|------|------|-------------|\n| \u003csub\u003e`list_script_projects`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eList accessible Apps Script projects\u003c/sub\u003e |\n| \u003csub\u003e`get_script_project`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eGet complete project with all files\u003c/sub\u003e |\n| \u003csub\u003e`get_script_content`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eRetrieve specific file content\u003c/sub\u003e |\n| \u003csub\u003e`create_script_project`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eCreate new standalone or bound project\u003c/sub\u003e |\n| \u003csub\u003e`update_script_content`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eUpdate or create script files\u003c/sub\u003e |\n| \u003csub\u003e`run_script_function`\u003c/sub\u003e | \u003csub\u003eCore\u003c/sub\u003e | \u003csub\u003eExecute function with parameters\u003c/sub\u003e |\n| \u003csub\u003e`list_deployments`\u003c/sub\u003e | \u003csub\u003eExtended\u003c/sub\u003e | \u003csub\u003eList all project deployments\u003c/sub\u003e |\n| \u003csub\u003e`manage_deployment`\u003c/sub\u003e | \u003csub\u003eExtended\u003c/sub\u003e | \u003csub\u003eCreate, update, or delete script deployments\u003c/sub\u003e |\n| \u003csub\u003e`list_script_processes`\u003c/sub\u003e | \u003csub\u003eExtended\u003c/sub\u003e | \u003csub\u003eView recent executions and status\u003c/sub\u003e |\n\n\u003csub\u003e\n\n**Tool Tier Legend:**\u003cbr\u003e\n\u003cspan style=\"color:#2d5b69\"\u003e●\u003c/span\u003e **Core** — Essential tools for basic functionality · Minimal API usage · Getting started\u003cbr\u003e\n\u003cspan style=\"color:#72898f\"\u003e●\u003c/span\u003e **Extended** — Core + additional features · Regular usage · Expanded capabilities\u003cbr\u003e\n\u003cspan style=\"color:#adbcbc\"\u003e●\u003c/span\u003e **Complete** — All available tools including advanced features · Power users · Full API access\n\n\u003c/sub\u003e\n\n---\n\n### Connect to Claude Desktop\n\nThe server supports two transport modes:\n\n#### Stdio Mode (Legacy - For Clients with Incomplete MCP Support)\n\n\u003e **⚠️ Important**: Stdio mode is a **legacy fallback** for clients that don't properly implement the MCP specification with OAuth 2.1 and streamable HTTP support. **Claude Code and other modern MCP clients should use streamable HTTP mode** (`--transport streamable-http`) for proper OAuth flow and multi-user support.\n\nIn general, you should use the one-click DXT installer package for Claude Desktop.\nIf you are unable to for some reason, you can configure it manually via `claude_desktop_config.json`\n\n**Manual Claude Configuration (Alternative)**\n\n\u003cdetails open\u003e\n\u003csummary\u003e📝 \u003cb\u003eClaude Desktop JSON Config\u003c/b\u003e \u003csub\u003e\u003csup\u003e← Click for manual setup instructions\u003c/sup\u003e\u003c/sub\u003e\u003c/summary\u003e\n\n1. Open Claude Desktop Settings → Developer → Edit Config\n   - **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`\n   - **Windows**: `%APPDATA%\\Claude\\claude_desktop_config.json`\n\n2. Add the server configuration:\n```json\n{\n  \"mcpServers\": {\n    \"google_workspace\": {\n      \"command\": \"uvx\",\n      \"args\": [\"workspace-mcp\"],\n      \"env\": {\n        \"GOOGLE_OAUTH_CLIENT_ID\": \"your-client-id\",\n        \"GOOGLE_OAUTH_CLIENT_SECRET\": \"your-secret\",\n        \"OAUTHLIB_INSECURE_TRANSPORT\": \"1\"\n      }\n    }\n  }\n}\n```\n\u003c/details\u003e\n\n### Connect to LM Studio\n\nAdd a new MCP server in LM Studio (Settings → MCP Servers) using the same JSON format:\n\n```json\n{\n  \"mcpServers\": {\n    \"google_workspace\": {\n      \"command\": \"uvx\",\n      \"args\": [\"workspace-mcp\"],\n      \"env\": {\n        \"GOOGLE_OAUTH_CLIENT_ID\": \"your-client-id\",\n        \"GOOGLE_OAUTH_CLIENT_SECRET\": \"your-secret\",\n        \"OAUTHLIB_INSECURE_TRANSPORT\": \"1\",\n      }\n    }\n  }\n}\n```\n\n\n### 2. Advanced / Cross-Platform Installation\n\nIf you’re developing, deploying to servers, or using another MCP-capable client, keep reading.\n\n#### Instant CLI (uvx)\n\n\u003cdetails open\u003e\n\u003csummary\u003e⚡ \u003cb\u003eQuick Start with uvx\u003c/b\u003e \u003csub\u003e\u003csup\u003e← No installation required!\u003c/sup\u003e\u003c/sub\u003e\u003c/summary\u003e\n\n```bash\n# Requires Python 3.10+ and uvx\n# First, set credentials (see Credential Configuration above)\nuvx workspace-mcp --tool-tier core  # or --tools gmail drive calendar\n```\n\n\u003e **Note**: Configure [OAuth credentials](#credential-configuration) before running. Supports environment variables, `.env` file, or `client_secret.json`.\n\n\u003c/details\u003e\n\n### Local Development Setup\n\n\u003cdetails open\u003e\n\u003csummary\u003e🛠️ \u003cb\u003eDeveloper Workflow\u003c/b\u003e \u003csub\u003e\u003csup\u003e← Install deps, lint, and test\u003c/sup\u003e\u003c/sub\u003e\u003c/summary\u003e\n\n```bash\n# Install everything needed for linting, tests, and release tooling\nuv sync --group dev\n\n# Run the same linter that git hooks invoke automatically\nuv run ruff check .\n\n# Execute the full test suite (async fixtures require pytest-asyncio)\nuv run pytest\n```\n\n- `uv sync --group test` installs only the testing stack if you need a slimmer environment.\n- `uv run main.py --transport streamable-http` launches the server with your checked-out code for manual verification.\n- Ruff is part of the `dev` group because pre-push hooks call `ruff check` automatically—run it locally before committing to avoid hook failures.\n\n\u003c/details\u003e\n\n### OAuth 2.1 Support (Multi-User Bearer Token Authentication)\n\nThe server includes OAuth 2.1 support for bearer token authentication, enabling multi-user session management. **OAuth 2.1 automatically reuses your existing `GOOGLE_OAUTH_CLIENT_ID` and `GOOGLE_OAUTH_CLIENT_SECRET` credentials** - no additional configuration needed!\n\n**When to use OAuth 2.1:**\n- Multiple users accessing the same MCP server instance\n- Need for bearer token authentication instead of passing user emails\n- Building web applications or APIs on top of the MCP server\n- Production environments requiring secure session management\n- Browser-based clients requiring CORS support\n\n**⚠️ Important: OAuth 2.1 and Single-User Mode are mutually exclusive**\n\nOAuth 2.1 mode (`MCP_ENABLE_OAUTH21=true`) cannot be used together with the `--single-user` flag:\n- **Single-user mode**: For legacy clients that pass user emails in tool calls\n- **OAuth 2.1 mode**: For modern multi-user scenarios with bearer token authentication\n\nChoose one authentication method - using both will result in a startup error.\n\n**Enabling OAuth 2.1:**\nTo enable OAuth 2.1, set the `MCP_ENABLE_OAUTH21` environment variable to `true`.\n\n```bash\n# OAuth 2.1 requires HTTP transport mode\nexport MCP_ENABLE_OAUTH21=true\nuv run main.py --transport streamable-http\n```\n\nIf `MCP_ENABLE_OAUTH21` is not set to `true`, the server will use legacy authentication, which is suitable for clients that do not support OAuth 2.1.\n\n\u003cdetails open\u003e\n\u003csummary\u003e🔐 \u003cb\u003eHow the FastMCP GoogleProvider handles OAuth\u003c/b\u003e \u003csub\u003e\u003csup\u003e← Advanced OAuth 2.1 details\u003c/sup\u003e\u003c/sub\u003e\u003c/summary\u003e\n\nFastMCP ships a native `GoogleProvider` that we now rely on directly. It solves the two tricky parts of using Google OAuth with MCP clients:\n\n1.  **Dynamic Client Registration**: Google still doesn't support OAuth 2.1 DCR, but the FastMCP provider exposes the full DCR surface and forwards registrations to Google using your fixed credentials. MCP clients register as usual and the provider hands them your Google client ID/secret under the hood.\n\n2.  **CORS \u0026 Browser Compatibility**: The provider includes an OAuth proxy that serves all discovery, authorization, and token endpoints with proper CORS headers. We no longer maintain custom `/oauth2/*` routes—the provider handles the upstream exchanges securely and advertises the correct metadata to clients.\n\nThe result is a leaner server that still enables any OAuth 2.1 compliant client (including browser-based ones) to authenticate through Google without bespoke code.\n\n\u003c/details\u003e\n\n### Stateless Mode (Container-Friendly)\n\nThe server supports a stateless mode designed for containerized environments where file system writes should be avoided:\n\n**Enabling Stateless Mode:**\n```bash\n# Stateless mode requires OAuth 2.1 to be enabled\nexport MCP_ENABLE_OAUTH21=true\nexport WORKSPACE_MCP_STATELESS_MODE=true\nuv run main.py --transport streamable-http\n```\n\n**Key Features:**\n- **No file system writes**: Credentials are never written to disk\n- **No debug logs**: File-based logging is completely disabled\n- **Memory-only sessions**: All tokens stored in memory via OAuth 2.1 session store\n- **Container-ready**: Perfect for Docker, Kubernetes, and serverless deployments\n- **Token per request**: Each request must include a valid Bearer token\n\n**Requirements:**\n- Must be used with `MCP_ENABLE_OAUTH21=true`\n- Incompatible with single-user mode\n- Clients must handle OAuth flow and send valid tokens with each request\n\nThis mode is ideal for:\n- Cloud deployments where persistent storage is unavailable\n- Multi-tenant environments requiring strict isolation\n- Containerized applications with read-only filesystems\n- Serverless functions and ephemeral compute environments\n\n**MCP Inspector**: No additional configuration needed with desktop OAuth client.\n\n**Claude Code**: No additional configuration needed with desktop OAuth client.\n\n### OAuth Proxy Storage Backends\n\nThe server supports pluggable storage backends for OAuth proxy state management via FastMCP 2.13.0+. Choose a backend based on your deployment needs.\n\n**Available Backends:**\n\n| Backend | Best For | Persistence | Multi-Server |\n|---------|----------|-------------|--------------|\n| Memory | Development, testing | ❌ | ❌ |\n| Disk | Single-server production | ✅ | ❌ |\n| Valkey/Redis | Distributed production | ✅ | ✅ |\n\n**Configuration:**\n\n```bash\n# Memory storage (fast, no persistence)\nexport WORKSPACE_MCP_OAUTH_PROXY_STORAGE_BACKEND=memory\n\n# Disk storage (persists across restarts)\nexport WORKSPACE_MCP_OAUTH_PROXY_STORAGE_BACKEND=disk\nexport WORKSPACE_MCP_OAUTH_PROXY_DISK_DIRECTORY=~/.fastmcp/oauth-proxy\n\n# Valkey/Redis storage (distributed, multi-server)\nexport WORKSPACE_MCP_OAUTH_PROXY_STORAGE_BACKEND=valkey\nexport WORKSPACE_MCP_OAUTH_PROXY_VALKEY_HOST=redis.example.com\nexport WORKSPACE_MCP_OAUTH_PROXY_VALKEY_PORT=6379\n```\n\n\u003e Disk support requires `workspace-mcp[disk]` (or `py-key-value-aio[disk]`) when installing from source.\n\u003e The official Docker image includes the `disk` extra by default.\n\u003e Valkey support is optional. Install `workspace-mcp[valkey]` (or `py-key-value-aio[valkey]`) only if you enable the Valkey backend.\n\u003e Windows: building `valkey-glide` from source requires MSVC C++ build tools with C11 support. If you see `aws-lc-sys` C11 errors, set `CFLAGS=/std:c11`.\n\n\u003cdetails open\u003e\n\u003csummary\u003e🔐 \u003cb\u003eValkey/Redis Configuration Options\u003c/b\u003e\u003c/summary\u003e\n\n| Variable | Default | Description |\n|----------|---------|-------------|\n| `WORKSPACE_MCP_OAUTH_PROXY_VALKEY_HOST` | localhost | Valkey/Redis host |\n| `WORKSPACE_MCP_OAUTH_PROXY_VALKEY_PORT` | 6379 | Port (6380 auto-enables TLS) |\n| `WORKSPACE_MCP_OAUTH_PROXY_VALKEY_DB` | 0 | Database number |\n| `WORKSPACE_MCP_OAUTH_PROXY_VALKEY_USE_TLS` | auto | Enable TLS (auto if port 6380) |\n| `WORKSPACE_MCP_OAUTH_PROXY_VALKEY_USERNAME` | - | Authentication username |\n| `WORKSPACE_MCP_OAUTH_PROXY_VALKEY_PASSWORD` | - | Authentication password |\n| `WORKSPACE_MCP_OAUTH_PROXY_VALKEY_REQUEST_TIMEOUT_MS` | 5000 | Request timeout for remote hosts |\n| `WORKSPACE_MCP_OAUTH_PROXY_VALKEY_CONNECTION_TIMEOUT_MS` | 10000 | Connection timeout for remote hosts |\n\n**Encryption:** Disk and Valkey storage are encrypted with Fernet. The encryption key is derived from `FASTMCP_SERVER_AUTH_GOOGLE_JWT_SIGNING_KEY` if set, otherwise from `GOOGLE_OAUTH_CLIENT_SECRET`.\n\n\u003c/details\u003e\n\n### External OAuth 2.1 Provider Mode\n\nThe server supports an external OAuth 2.1 provider mode for scenarios where authentication is handled by an external system. In this mode, the MCP server does not manage the OAuth flow itself but expects valid bearer tokens in the Authorization header of tool calls.\n\n**Enabling External OAuth 2.1 Provider Mode:**\n```bash\n# External OAuth provider mode requires OAuth 2.1 to be enabled\nexport MCP_ENABLE_OAUTH21=true\nexport EXTERNAL_OAUTH21_PROVIDER=true\nuv run main.py --transport streamable-http\n```\n\n**How It Works:**\n- **Protocol-level auth enabled**: All MCP requests (including `initialize` and `tools/list`) require a valid Bearer token, following the standard OAuth 2.1 flow. Unauthenticated requests receive a `401` with resource metadata pointing to Google's authorization server.\n- **External OAuth flow**: Your external system handles the OAuth flow and obtains Google access tokens (`ya29.*`)\n- **Token validation**: Server validates bearer tokens by calling Google's userinfo API\n- **Multi-user support**: Each request is authenticated independently based on its bearer token\n- **Resource metadata discovery**: The server serves `/.well-known/oauth-protected-resource` (RFC 9728) advertising Google as the authorization server and the required scopes\n\n**Key Features:**\n- **No local OAuth flow**: Server does not provide `/authorize`, `/token`, or `/register` endpoints — only resource metadata\n- **Bearer token only**: All authentication via `Authorization: Bearer \u003ctoken\u003e` headers\n- **Stateless by design**: Works seamlessly with `WORKSPACE_MCP_STATELESS_MODE=true`\n- **External identity providers**: Integrate with your existing authentication infrastructure\n\n**Requirements:**\n- Must be used with `MCP_ENABLE_OAUTH21=true`\n- OAuth credentials still required for token validation (`GOOGLE_OAUTH_CLIENT_ID`, `GOOGLE_OAUTH_CLIENT_SECRET`)\n- External system must obtain valid Google OAuth access tokens (ya29.*)\n- Each tool call request must include valid bearer token\n\n**Use Cases:**\n- Integrating with existing authentication systems\n- Custom OAuth flows managed by your application\n- API gateways that handle authentication upstream\n- Multi-tenant SaaS applications with centralized auth\n- Mobile or web apps with their own OAuth implementation\n\n\n### VS Code MCP Client Support\n\n\u003e **✅ Recommended**: VS Code MCP extension properly supports the full MCP specification. **Always use HTTP transport mode** for proper OAuth 2.1 authentication.\n\n\u003cdetails open\u003e\n\u003csummary\u003e🆚 \u003cb\u003eVS Code Configuration\u003c/b\u003e \u003csub\u003e\u003csup\u003e← Setup for VS Code MCP extension\u003c/sup\u003e\u003c/sub\u003e\u003c/summary\u003e\n\n```json\n{\n    \"servers\": {\n        \"google-workspace\": {\n            \"url\": \"http://localhost:8000/mcp/\",\n            \"type\": \"http\"\n        }\n    }\n}\n```\n\n*Note: Make sure to start the server with `--transport streamable-http` when using VS Code MCP.*\n\u003c/details\u003e\n\n### Claude Code MCP Client Support\n\n\u003e **✅ Recommended**: Claude Code is a modern MCP client that properly supports the full MCP specification. **Always use HTTP transport mode** with Claude Code for proper OAuth 2.1 authentication and multi-user support.\n\n\u003cdetails open\u003e\n\u003csummary\u003e🆚 \u003cb\u003eClaude Code Configuration\u003c/b\u003e \u003csub\u003e\u003csup\u003e← Setup for Claude Code MCP support\u003c/sup\u003e\u003c/sub\u003e\u003c/summary\u003e\n\n```bash\n# Start the server in HTTP mode first\nuv run main.py --transport streamable-http\n\n# Then add to Claude Code\nclaude mcp add --transport http workspace-mcp http://localhost:8000/mcp\n```\n\u003c/details\u003e\n\n#### Reverse Proxy Setup\n\nIf you're running the MCP server behind a reverse proxy (nginx, Apache, Cloudflare, etc.), you have two configuration options:\n\n**Problem**: When behind a reverse proxy, the server constructs OAuth URLs using internal ports (e.g., `http://localhost:8000`) but external clients need the public URL (e.g., `https://your-domain.com`).\n\n**Solution 1**: Set `WORKSPACE_EXTERNAL_URL` for all OAuth endpoints:\n```bash\n# This configures all OAuth endpoints to use your external URL\nexport WORKSPACE_EXTERNAL_URL=\"https://your-domain.com\"\n```\n\n**Solution 2**: Set `GOOGLE_OAUTH_REDIRECT_URI` for just the callback:\n```bash\n# This only overrides the OAuth callback URL\nexport GOOGLE_OAUTH_REDIRECT_URI=\"https://your-domain.com/oauth2callback\"\n```\n\nYou also have options for:\n| `OAUTH_CUSTOM_REDIRECT_URIS` *(optional)* | Comma-separated list of additional redirect URIs |\n| `OAUTH_ALLOWED_ORIGINS` *(optional)* | Comma-separated list of additional CORS origins |\n\n**Important**:\n- Use `WORKSPACE_EXTERNAL_URL` when all OAuth endpoints should use the external URL (recommended for reverse proxy setups)\n- Use `GOOGLE_OAUTH_REDIRECT_URI` when you only need to override the callback URL\n- The redirect URI must exactly match what's configured in your Google Cloud Console\n- Your reverse proxy must forward OAuth-related requests (`/oauth2callback`, `/oauth2/*`, `/.well-known/*`) to the MCP server\n\n\u003cdetails open\u003e\n\u003csummary\u003e🚀 \u003cb\u003eAdvanced uvx Commands\u003c/b\u003e \u003csub\u003e\u003csup\u003e← More startup options\u003c/sup\u003e\u003c/sub\u003e\u003c/summary\u003e\n\n```bash\n# Configure credentials first (see Credential Configuration section)\n\n# Start with specific tools only\nuvx workspace-mcp --tools gmail drive calendar tasks\n\n# Start with tool tiers (recommended for most users)\nuvx workspace-mcp --tool-tier core      # Essential tools\nuvx workspace-mcp --tool-tier extended  # Core + additional features\nuvx workspace-mcp --tool-tier complete  # All tools\n\n# Start in HTTP mode for debugging\nuvx workspace-mcp --transport streamable-http\n```\n\u003c/details\u003e\n\n*Requires Python 3.10+ and [uvx](https://github.com/astral-sh/uv). The package is available on [PyPI](https://pypi.org/project/workspace-mcp).*\n\n### Development Installation\n\nFor development or customization:\n\n```bash\ngit clone https://github.com/taylorwilsdon/google_workspace_mcp.git\ncd google_workspace_mcp\nuv run main.py\n```\n\n**Development Installation (For Contributors)**:\n\n\u003cdetails open\u003e\n\u003csummary\u003e🔧 \u003cb\u003eDeveloper Setup JSON\u003c/b\u003e \u003csub\u003e\u003csup\u003e← For contributors \u0026 customization\u003c/sup\u003e\u003c/sub\u003e\u003c/summary\u003e\n\n```json\n{\n  \"mcpServers\": {\n    \"google_workspace\": {\n      \"command\": \"uv\",\n      \"args\": [\n        \"run\",\n        \"--directory\",\n        \"/path/to/repo/google_workspace_mcp\",\n        \"main.py\"\n      ],\n      \"env\": {\n        \"GOOGLE_OAUTH_CLIENT_ID\": \"your-client-id\",\n        \"GOOGLE_OAUTH_CLIENT_SECRET\": \"your-secret\",\n        \"OAUTHLIB_INSECURE_TRANSPORT\": \"1\"\n      }\n    }\n  }\n}\n```\n\u003c/details\u003e\n\n#### HTTP Mode (For debugging or web interfaces)\nIf you need to use HTTP mode with Claude Desktop:\n\n```json\n{\n  \"mcpServers\": {\n    \"google_workspace\": {\n      \"command\": \"npx\",\n      \"args\": [\"mcp-remote\", \"http://localhost:8000/mcp\"]\n    }\n  }\n}\n```\n\n*Note: Make sure to start the server with `--transport streamable-http` when using HTTP mode.*\n\n### First-Time Authentication\n\nThe server uses **Google Desktop OAuth** for simplified authentication:\n\n- **No redirect URIs needed**: Desktop OAuth clients handle authentication without complex callback URLs\n- **Automatic flow**: The server manages the entire OAuth process transparently\n- **Transport-agnostic**: Works seamlessly in both stdio and HTTP modes\n\nWhen calling a tool:\n1. Server returns authorization URL\n2. Open URL in browser and authorize\n3. Google provides an authorization code\n4. Paste the code when prompted (or it's handled automatically)\n5. Server completes authentication and retries your request\n\n---\n\n## \u003cspan style=\"color:#adbcbc\"\u003e◆ Development\u003c/span\u003e\n\n### \u003cspan style=\"color:#72898f\"\u003eProject Structure\u003c/span\u003e\n\n```\ngoogle_workspace_mcp/\n├── auth/              # Authentication system with decorators\n├── core/              # MCP server and utilities\n├── g{service}/        # Service-specific tools\n├── main.py            # Server entry point\n├── client_secret.json # OAuth credentials (not committed)\n└── pyproject.toml     # Dependencies\n```\n\n### Adding New Tools\n\n```python\nfrom auth.service_decorator import require_google_service\n\n@require_google_service(\"drive\", \"drive_read\")  # Service + scope group\nasync def your_new_tool(service, param1: str, param2: int = 10):\n    \"\"\"Tool description\"\"\"\n    # service is automatically injected and cached\n    result = service.files().list().execute()\n    return result  # Return native Python objects\n```\n\n### Architecture Highlights\n\n- **Service Caching**: 30-minute TTL reduces authentication overhead\n- **Scope Management**: Centralized in `SCOPE_GROUPS` for easy maintenance\n- **Error Handling**: Native exceptions instead of manual error construction\n- **Multi-Service Support**: `@require_multiple_services()` for complex tools\n\n### Credential Store System\n\nThe server includes an abstract credential store API and a default backend for managing Google OAuth\ncredentials with support for multiple storage backends:\n\n**Features:**\n- **Abstract Interface**: `CredentialStore` base class defines standard operations (get, store, delete, list users)\n- **Local File Storage**: `LocalDirectoryCredentialStore` implementation stores credentials as JSON files\n- **Configurable Storage**: Environment variable `GOOGLE_MCP_CREDENTIALS_DIR` sets storage location\n- **Multi-User Support**: Store and manage credentials for multiple Google accounts\n- **Automatic Directory Creation**: Storage directory is created automatically if it doesn't exist\n\n**Configuration:**\n```bash\n# Optional: Set custom credentials directory\nexport GOOGLE_MCP_CREDENTIALS_DIR=\"/path/to/credentials\"\n\n# Default locations (if GOOGLE_MCP_CREDENTIALS_DIR not set):\n# - ~/.google_workspace_mcp/credentials (if home directory accessible)\n# - ./.credentials (fallback)\n```\n\n**Usage Example:**\n```python\nfrom auth.credential_store import get_credential_store\n\n# Get the global credential store instance\nstore = get_credential_store()\n\n# Store credentials for a user\nstore.store_credential(\"user@example.com\", credentials)\n\n# Retrieve credentials\ncreds = store.get_credential(\"user@example.com\")\n\n# List all users with stored credentials\nusers = store.list_users()\n```\n\nThe credential store automatically handles credential serialization, expiry parsing, and provides error handling for storage operations.\n\n---\n\n## \u003cspan style=\"color:#adbcbc\"\u003e⊠ Security\u003c/span\u003e\n- **Prompt Injection**: This MCP server has the capability to retrieve your email, calendar events and drive files. Those emails, events and files could potentially contain prompt injections - i.e. hidden white text that tells it to forward your emails to a different address. You should exercise caution and in general, only connect trusted data to an LLM!\n- **Credentials**: Never commit `.env`, `client_secret.json` or the `.credentials/` directory to source control!\n- **OAuth Callback**: Uses `http://localhost:8000/oauth2callback` for development (requires `OAUTHLIB_INSECURE_TRANSPORT=1`)\n- **Transport-Aware Callbacks**: Stdio mode starts a minimal HTTP server only for OAuth, ensuring callbacks work in all modes\n- **Production**: Use HTTPS \u0026 OAuth 2.1 and configure accordingly\n- **Scope Minimization**: Tools request only necessary permissions\n- **Local File Access Control**: Tools that read local files (e.g., attachments, `file://` uploads) are restricted to the user's home directory by default. Override this with the `ALLOWED_FILE_DIRS` environment variable:\n  ```bash\n  # Colon-separated list of directories (semicolon on Windows) from which local file reads are permitted\n  export ALLOWED_FILE_DIRS=\"/home/user/documents:/data/shared\"\n  ```\n  Regardless of the allowlist, access to sensitive paths (`.env`, `.ssh/`, `.aws/`, `/etc/shadow`, credential files, etc.) is always blocked.\n\n---\n\n\n---\n\n## \u003cspan style=\"color:#adbcbc\"\u003e≡ License\u003c/span\u003e\n\nMIT License - see `LICENSE` file for details.\n\n---\n\nValidations:\n[![MCP Badge](https://lobehub.com/badge/mcp/taylorwilsdon-google_workspace_mcp)](https://lobehub.com/mcp/taylorwilsdon-google_workspace_mcp)\n\n[![Verified on MseeP](https://mseep.ai/badge.svg)](https://mseep.ai/app/eebbc4a6-0f8c-41b2-ace8-038e5516dba0)\n\n\n\u003cdiv align=\"center\"\u003e\n\u003cimg width=\"842\" alt=\"Batch Emails\" src=\"https://github.com/user-attachments/assets/0876c789-7bcc-4414-a144-6c3f0aaffc06\" /\u003e\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaylorwilsdon%2Fgoogle_workspace_mcp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftaylorwilsdon%2Fgoogle_workspace_mcp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaylorwilsdon%2Fgoogle_workspace_mcp/lists"}