ECC
The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
npx ecc-install --profile fullThe agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
npx ecc-install --profile fullFair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.
npx n8nAn open-source AI agent that brings the power of Gemini directly into your terminal.
npx @google/gemini-cliSupports Claude Code, Codex, Cursor, Mcp
Carries strong trust indicators from repository metadata
2810 GitHub stars recorded
Set credentials โ pick a launch command โ connect your client
๐ก New to Workspace MCP? Check out the Interactive Quick Start Guide โ with step-by-step setup, screenshots, and troubleshooting tips!
Confidential Client Quick Start
# 1. Credentials
export GOOGLE_OAUTH_CLIENT_ID="..."
export GOOGLE_OAUTH_CLIENT_SECRET="..."
# 2. Launch โ pick a tier
uvx workspace-mcp --tool-tier core # essential tools
uvx workspace-mcp --tool-tier extended # core + management ops
uvx workspace-mcp --tool-tier complete # everything
# Or cherry-pick services
uv run main.py --tools gmail drive calendar
Secretless / Public OAuth 2.1 (PKCE) Quick Start
# 1. Credentials
export MCP_ENABLE_OAUTH21=true
export GOOGLE_OAUTH_CLIENT_ID="..."
export WORKSPACE_MCP_PORT=8000
export GOOGLE_OAUTH_REDIRECT_URI="http://localhost:${WORKSPACE_MCP_PORT}/oauth2callback"
export OAUTHLIB_INSECURE_TRANSPORT=1
# Leave GOOGLE_OAUTH_CLIENT_SECRET unset for public PKCE clients
export FASTMCP_SERVER_AUTH_GOOGLE_JWT_SIGNING_KEY="$(openssl rand -hex 32)"
# 2. Launch โ OAuth 2.1 requires HTTP transport
uvx workspace-mcp --transport streamable-http --tool-tier core
uvx workspace-mcp --transport streamable-http --tool-tier extended
uvx workspace-mcp --transport streamable-http --tool-tier complete
# Or cherry-pick services
uv run main.py --transport streamable-http --tools gmail drive calendar
Credential setup โ ยท All launch options โ ยท Tier details โ
| Variable | Purpose | |
|---|---|---|
| ๐ Authentication | ||
GOOGLE_OAUTH_CLIENT_ID | required | OAuth client ID from Google Cloud |
GOOGLE_OAUTH_CLIENT_SECRET | OAuth client secret for confidential clients; optional for public OAuth 2.1 PKCE clients | |
OAUTHLIB_INSECURE_TRANSPORT | required* | Set to 1 for development โ allows http:// redirect |
USER_GOOGLE_EMAIL | Default email for single-user auth | |
GOOGLE_CLIENT_SECRET_PATH | Custom path to client_secret.json | |
GOOGLE_MCP_CREDENTIALS_DIR | Credential directory โ default ~/.google_workspace_mcp/credentials | |
| ๐ฅ๏ธ Server | ||
WORKSPACE_MCP_BASE_URI | Base server URI (no port) โ default http://localhost | |
WORKSPACE_MCP_PORT | Listening port โ default 8000. Also controls the stdio-mode OAuth callback port. The PORT env var takes precedence if set. | |
WORKSPACE_MCP_HOST | Bind host โ default 0.0.0.0 for OAuth 2.1 HTTP, 127.0.0.1 for legacy streamable HTTP. | |
WORKSPACE_MCP_TRANSPORT | stdio or streamable-http; used when --transport is not passed | |
WORKSPACE_MCP_HTTP_PORT | Advanced legacy-stdio sidecar /mcp port for local workspace-cli access. Disabled when empty. Binds to 127.0.0.1 only and is accessible to local processes. | |
WORKSPACE_EXTERNAL_URL | External URL for reverse proxy setups | |
WORKSPACE_MCP_BRAND_NAME | OAuth 2.1 consent-page server name โ default FastMCP's name | |
WORKSPACE_MCP_BRAND_ICON_URL | OAuth 2.1 consent-page logo (hosted URL or data: URI), shown at 64px wide โ default FastMCP's logo | |
WORKSPACE_MCP_BRAND_WEBSITE_URL | OAuth 2.1 consent-page website link | |
WORKSPACE_ATTACHMENT_DIR | Downloaded attachments dir and default trusted local attachment directory โ default ~/.workspace-mcp/attachments/ | |
WORKSPACE_MCP_URL | Remote MCP endpoint URL for CLI | |
ALLOWED_FILE_DIRS | Colon-separated allowlist for local file reads | |
| ๐งฐ Tool Selection | ||
WORKSPACE_MCP_TOOLS | Comma-separated services, e.g. gmail,drive,calendar; empty means all services | |
WORKSPACE_MCP_TOOL_TIER | core, extended, or complete; empty means all tools | |
WORKSPACE_MCP_READ_ONLY | true, 1, or yes to request read-only scopes and filter write tools | |
WORKSPACE_MCP_PERMISSIONS | Space-separated service:level entries, e.g. gmail:send drive:readonly; mutually exclusive with tools and read-only | |
| ๐ OAuth 2.1 & Multi-User | ||
MCP_ENABLE_OAUTH21 | true to enable OAuth 2.1 multi-user support. Required for remote or shared HTTP endpoints (--transport streamable-http); optional for local-only legacy HTTP, which binds to 127.0.0.1 by default. | |
EXTERNAL_OAUTH21_PROVIDER | true for external OAuth flow with bearer tokens | |
WORKSPACE_MCP_STATELESS_MODE | true for stateless container-friendly operation | |
WORKSPACE_MCP_LOG_DIR | Directory for mcp_server_debug.log โ defaults to ~/.google_workspace_mcp/logs | |
GOOGLE_OAUTH_REDIRECT_URI | Override OAuth callback URL โ default auto-constructed | |
OAUTH_CUSTOM_REDIRECT_URIS | Comma-separated additional redirect URIs | |
OAUTH_ALLOWED_ORIGINS | Comma-separated additional CORS origins | |
WORKSPACE_MCP_OAUTH_PROXY_STORAGE_BACKEND | memory, disk, or valkey โ see storage backends | |
FASTMCP_SERVER_AUTH_GOOGLE_JWT_SIGNING_KEY | Custom encryption key for OAuth proxy storage; required for public OAuth 2.1 clients when GOOGLE_OAUTH_CLIENT_SECRET is omitted | |
WORKSPACE_MCP_ALLOWED_CLIENT_REDIRECT_URIS | Comma-separated allowlist of redirect URIs that dynamically-registered OAuth clients may use. Default is unset (any URI permitted, per DCR). Supports FastMCP's glob patterns (*, *.example.com) | |
| ๐๏ธ Credential Store | ||
WORKSPACE_MCP_CREDENTIAL_STORE_BACKEND | local_directory (default) or gcs โ see credential store system | |
WORKSPACE_MCP_CREDENTIALS_DIR | Directory for the local_directory backend | |
GOOGLE_MCP_CREDENTIALS_DIR | Backward-compatible alias for WORKSPACE_MCP_CREDENTIALS_DIR | |
WORKSPACE_MCP_GCS_BUCKET | Required when backend is gcs โ GCS bucket name | |
WORKSPACE_MCP_GCS_PREFIX | Optional object-name prefix for the gcs backend | |
WORKSPACE_MCP_GCS_REQUIRE_CMEK | true to require a bucket default KMS key at startup (fails fast if unset) | |
| ๐ง Service Account | ||
GOOGLE_SERVICE_ACCOUNT_KEY_FILE | Path to service account JSON key file (domain-wide delegation) | |
GOOGLE_SERVICE_ACCOUNT_KEY_JSON | Inline service account JSON key (alternative to file) | |
DWD_ALLOWED_DOMAINS | Comma-separated domain allowlist for per-request impersonation (optional) | |
| ๐ Custom Search | ||
GOOGLE_PSE_API_KEY | API key for Programmable Search Engine | |
GOOGLE_PSE_ENGINE_ID | Search Engine ID for PSE |
*Required for development only. Claude Desktop stores credentials securely in the OS keychain โ set them once in the extension pane.
The recommended setup is to run an instance and connect Claude to it via a Connector. Full instructions at workspacemcp.com/quick-start.
Python 3.10+ ยท uv/uvx ยท Google Cloud Project with OAuth 2.0 credentials
If you want the GCS credential store backend, install the optional dependency first:
uv sync --extra gcs
# or
pip install "workspace-mcp[gcs]"
Create Project โ Open Console โ โ Create new project
Create OAuth Credentials โ APIs & Services โ Credentials โ Create Credentials โ OAuth Client ID
Enable APIs โ APIs & Services โ Library, then enable each service:
Full OAuth documentation โ ยท Credential setup details โ
FastMCP is already instrumented with OpenTelemetry, but spans are a no-op until an
SDK and exporter are configured. Install the otel extra (already included in the
Docker image) and point the server at an OTLP collector โ tracing stays off unless
an endpoint is set.
pip install "workspace-mcp[otel]"
# Or, when installing from source: uv sync --extra otel
export OTEL_EXPORTER_OTLP_ENDPOINT="http://otel-collector:4317"
export OTEL_EXPORTER_OTLP_PROTOCOL="grpc" # or "http/protobuf" (default: grpc)
export OTEL_SERVICE_NAME="google-workspace-mcp" # optional; this is the default
Standard OTLP tracing variables for endpoints, protocols, headers, TLS, sampling,
batching, and resource attributes are honored. OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
and OTEL_EXPORTER_OTLP_TRACES_PROTOCOL override their general counterparts. When
neither endpoint variable is set, tracing is fully disabled.
Spans already carry the opaque enduser.id FastMCP derives from the OAuth token.
To also record the authenticated user's email as the OpenTelemetry user.email
attribute โ so traces can be attributed to a person โ opt in explicitly. This is
PII and is off by default:
export WORKSPACE_MCP_OTEL_USER_EMAIL="true" # default: unset (disabled)
1. Create Search Engine
programmablesearchengine.google.com
/controlpanel/create
โ Configure sites or entire web
โ Note your Engine ID (cx)
2. Get API Key
developers.google.com
/custom-search/v1/overview
โ Create/select project
โ Enable Custom Search API
โ Create credentials (API Key)
3. Set Variables
export GOOGLE_PSE_API_KEY=\
"your-api-key"
export GOOGLE_PSE_ENGINE_ID=\
"your-engine-id"
Configure in environment
Complete Setup Process:
Create Search Engine - Visit the Control Panel
017643444788157684527:6ivsjbpxpqw)Enable API & Get Key - Visit Google Developers Console
Configure Environment - Add to your shell or .env:
export GOOGLE_PSE_API_KEY="AIzaSy..."
export GOOGLE_PSE_ENGINE_ID="01764344478..."
๐ Transport Mode Guidance: Use streamable HTTP mode (
--transport streamable-http) for all modern MCP clients including Claude Code, VS Code MCP, and MCP Inspector. For Claude Desktop, run an instance and connect via a Connector. Stdio mode is a legacy fallback. For deployments, prefer OAuth 2.1 with stateless mode (MCP_ENABLE_OAUTH21=true,WORKSPACE_MCP_STATELESS_MODE=true) unless you need local attachment or credential storage.
OAuth state safety: Legacy stdio starts a local-only OAuth callback server. In single-user mode only, it may recover a missing Google
stateparameter by consuming the most recent pending local OAuth state. This fallback is intentionally disabled outside single-user mode because it can cross session boundaries. Do not enable or emulate this behavior in streamable HTTP, hosted, or multi-user deployments; those modes must require an explicit state match.
โถ Legacy Mode
uv run main.py
โ ๏ธ Stdio mode (incomplete MCP clients only)
โ HTTP Mode (Recommended)
export MCP_ENABLE_OAUTH21=true
export GOOGLE_OAUTH_CLIENT_ID="..."
uv run main.py \
--transport streamable-http
โ Full MCP spec compliance & OAuth 2.1
@ Single User
uv run main.py \
--single-user
Simplified authentication โ ๏ธ Cannot be used with OAuth 2.1 mode
โถ Selective Tool Loading
# Load specific services only
uv run main.py --tools gmail drive calendar
uv run main.py --tools sheets docs
# Combine with other flags
uv run main.py --single-user --tools gmail
๐ Read-Only Mode
# Requests only read-only scopes & disables write tools
uv run main.py --read-only
# Combine with specific tools or tiers
uv run main.py --tools gmail drive --read-only
uv run main.py --tool-tier core --read-only
Read-only mode provides secure, restricted access by:
*.readonly OAuth scopes (e.g., gmail.readonly, drive.readonly)๐ Granular Permissions
# Per-service permission levels
uv run main.py --permissions gmail:organize drive:readonly
# Combine permissions with tier filtering
uv run main.py --permissions gmail:send drive:full --tool-tier core
Granular permissions mode provides service-by-service scope control:
service:level (one entry per service)readonly, organize, drafts, send, full (cumulative)readonly, manage, full (cumulative; manage allows create/update/move but denies delete and clear_completed)readonly, full--permissions and --read-only are mutually exclusive--permissions cannot be combined with --tools; enabled services are determined by the --permissions entries (optionally filtered by --tool-tier)--tool-tier, only tier-matched tools are enabled and only services that have tools in the selected tier are importedThe WORKSPACE_MCP_TOOLS, WORKSPACE_MCP_TOOL_TIER, WORKSPACE_MCP_READ_ONLY, and WORKSPACE_MCP_PERMISSIONS environment variables provide the same controls for plugin and container installs. Empty strings are ignored. Non-empty malformed values fail closed at startup. Explicit CLI flags take precedence over mutually exclusive env vars.
Advanced legacy stdio sidecar
# Optional bridge only for local legacy stdio sessions
WORKSPACE_MCP_HTTP_PORT=8001 uv run main.py
workspace-cli --url http://127.0.0.1:8001/mcp list
The sidecar is disabled unless WORKSPACE_MCP_HTTP_PORT is set. It only exists to bridge local workspace-cli calls into a legacy stdio server. Do not use it for normal Claude Code, VS Code, hosted, or multi-user deployments; use streamable HTTP with OAuth 2.1 instead. When enabled, it validates ports in the 1..65535 range, binds to 127.0.0.1, and logs a warning if the port is already in use while keeping stdio running.
โ Tool Tiers
uv run main.py --tool-tier core # โ Essential tools only
uv run main.py --tool-tier extended # โ Core + additional
uv run main.py --tool-tier complete # โ All available tools
โ Docker Deployment
docker build -t workspace-mcp .
docker run -p 8000:8000 -v $(pwd):/app \
-e MCP_ENABLE_OAUTH21=true \
-e GOOGLE_OAUTH_CLIENT_ID="..." \
workspace-mcp --transport streamable-http
# With tool selection via environment variables
docker run -e TOOL_TIER=core workspace-mcp
docker run -e TOOLS="gmail drive calendar" workspace-mcp
Available Services: gmail โข drive โข calendar โข docs โข sheets โข forms โข tasks โข contacts โข chat โข search
The 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.
Tokens are stored encrypted at ~/.workspace-mcp/cli-tokens/ using a Fernet key auto-generated at ~/.workspace-mcp/.cli-encryption-key.
To use workspace-cli globally, you'll want to start in this repo and run uv tool install .
Once complete, you'll have workspace-cli available globally via workspace-cli
Note: there is a public (but abandoned) pypi package with the same name - do not use uvx, as it will pull the wrong thing.
โถ List Tools
uv run workspace-cli list
uv run workspace-cli --url https://custom.server/mcp list
# Or, if installed globally:
workspace-cli list
workspace-cli --url https://custom.server/mcp list
View all available tools
โ Call a Tool
uv run workspace-cli call search_gmail_messages \
query="is:unread" max_results=5
Execute a tool with key=value arguments
Set URL for remote endpoints with --url or the WORKSPACE_MCP_URL environment variable.
The upstream FastMCP 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.
fastmcp inspect fastmcp_server.py # print tools, resources, prompts
fastmcp install claude-code fastmcp_server.py # one-command client setup
fastmcp install cursor fastmcp_server.py
fastmcp discover # find servers configured in editors
See fastmcp --help or the FastMCP CLI docs for the full command reference.
The server organizes tools into three progressive tiers for simplified deployment. Choose a tier that matches your usage needs and API quota requirements.
โ Core (--tool-tier core)
Essential tools for everyday tasks. Perfect for light usage with minimal API quotas. Includes search, read, create, and basic modify operations across all services.
โ Extended (--tool-tier extended)
Core functionality plus management tools. Adds labels, folders, batch operations, and advanced search. Ideal for regular usage with moderate API needs.
โ Complete (--tool-tier complete)
Full API access including comments, headers/footers, publishing settings, and administrative functions. For power users needing maximum functionality.
โถ Start with core and upgrade as needed
โถ Tiers are cumulative โ each includes all previous
โถ Mix and match with --tools for specific services
โถ Configuration in core/tool_tiers.yaml
โถ Authentication included in all tiers
# Basic tier selection
uv run main.py --tool-tier core # Start with essential tools only
uv run main.py --tool-tier extended # Expand to include management features
uv run main.py --tool-tier complete # Enable all available functionality
# Selective service loading with tiers
uv run main.py --tools gmail drive --tool-tier core # Core tools for specific services
uv run main.py --tools gmail --tool-tier extended # Extended Gmail functionality only
uv run main.py --tools docs sheets --tool-tier complete # Full access to Docs and Sheets
# Combine tier selection with granular permission levels
uv run main.py --permissions gmail:organize drive:full --tool-tier core
Workspace MCP is the single most complete MCP server, the only that integrates all major Google Workspace services with AI assistants and all agent platforms. The entire toolset is available for CLI usage supporting both local and remote instances.
| Tasks |
| Chat | People | Custom Search | Apps Script |
Google Chat needs extra setup. Enabling the API is not enough โ you must also configure a Chat app and use a Workspace account. See Chat setup under the tool list.
Set Credentials โ see Environment Variable Reference above, or:
export GOOGLE_OAUTH_CLIENT_ID="your-client-id"
export GOOGLE_OAUTH_CLIENT_SECRET="your-secret"
For public OAuth 2.1 PKCE clients, omit GOOGLE_OAUTH_CLIENT_SECRET and set FASTMCP_SERVER_AUTH_GOOGLE_JWT_SIGNING_KEY instead.
The license is 21 lines and says what it means.
Configuration:
# Install the optional dependency if you plan to use the GCS backend:
# uv sync --extra gcs
# or: pip install "workspace-mcp[gcs]"
#
# Select backend (default: local_directory). Supported: local_directory, gcs
export WORKSPACE_MCP_CREDENTIAL_STORE_BACKEND="gcs"
# --- local_directory options ---
export WORKSPACE_MCP_CREDENTIALS_DIR="/path/to/credentials"
# Backward-compatible alias:
export GOOGLE_MCP_CREDENTIALS_DIR="/path/to/credentials"
# Default directory locations (if no directory env var is set):
# - ~/.google_workspace_mcp/credentials (if home directory accessible)
# - ./.credentials (fallback)
# --- gcs options ---
export WORKSPACE_MCP_GCS_BUCKET="my-workspace-mcp-tokens" # required
export WORKSPACE_MCP_GCS_PREFIX="credentials/" # optional
export WORKSPACE_MCP_GCS_REQUIRE_CMEK="true" # optional; see below
Backend selection:
local_directory (default): Plaintext JSON records. Suitable for local development and single-user stdio mode.
Existing pre-URL-encoding local credential filenames remain readable during migration; new writes use the URL-encoded filename mapping unless a legacy file already exists for that user.gcs: Stores credentials as objects in a GCS bucket using the JSON API. Authenticates via Application Default Credentials โ on Cloud Run this means the runtime service account needs roles/storage.objectUser (or equivalent) on the bucket. Does not support list_users() โ designed for multi-user OAuth 2.1 mode where users are looked up individually by email.CMEK enforcement (gcs backend):
By default GCS encrypts objects with Google-managed keys. For customer-managed encryption, set a default KMS key on the bucket (e.g. via Terraform's google_storage_bucket.encryption.default_kms_key_name). All credentials written to the bucket will inherit the key transparently โ no application-level key to manage.
To guard against accidentally deploying against a bucket without CMEK, set WORKSPACE_MCP_GCS_REQUIRE_CMEK=true. The store will verify the bucket has a default KMS key at startup and refuse to initialize otherwise. Note that this check reads bucket metadata, so the runtime service account additionally needs storage.buckets.get โ grant roles/storage.bucketViewer on the bucket (or a custom role containing storage.buckets.get) in addition to the object-level role. roles/storage.objectUser alone covers only object operations.
Usage Example:
from auth.credential_store import get_credential_store, LocalDirectoryCredentialStore
# Get the global credential store instance
store = get_credential_store()
# Store credentials for a user
store.store_credential("user@example.com", credentials)
# Retrieve credentials
creds = store.get_credential("user@example.com")
# List all users with stored credentials (local_directory backend only;
# GCSCredentialStore intentionally does not support enumeration โ use the
# upstream identity provider to enumerate users instead).
if isinstance(store, LocalDirectoryCredentialStore):
users = store.list_users()
The credential store automatically handles credential serialization, expiry parsing, and provides error handling for storage operations.