Repository navigation
v1.1.0 — multi-tenant cloud auth
[1.1.0] — 2026-05-18
Multi-tenant cloud auth. The remote HTTP MCP (claude.ai connector
via Fly.io) is now genuinely multi-tenant — each cloud-chat user
operates on their own Drive with their own Google identity. Before
1.1, the entire Fly deployment was single-tenant: every cloud-chat
user's tool calls implicitly used the operator's cached OAuth token,
so docs were created in the operator's Drive and the retrofit Apps
Script Web App (deployed access: MYSELF) was unusable for anyone
but the operator.
New: gdocs_setup_apps_script MCP tool
One-shot setup for the per-user Apps Script Web App needed by
gdocs_tab_existing_doc (the lossless content-move path). Run once
per user; idempotent on retry (resumes from the last successful
step). Stdio mode keeps calling the v1.0 local CLI; HTTP mode
deploys a Web App into the calling user's Drive.
Cloud architecture: "Shape C"
- FastMCP's
GoogleProviderhandles claude.ai connector auth
(identity-onlyopenid emailscopes, butvalid_scopesadvertises
the full Workspace union so consent grants Docs/Drive/Apps Script
at the same time) - Separate auth-code flow we own (
/oauth/google/api/callback)
obtains tokens we can actually use for Google API calls - Per-user state in SQLite on the Fly volume, keyed by Google
sub - Per-user lock on refresh so two concurrent tool calls don't
rotate each other's refresh_token
Why not just rely on GoogleProvider for the API tokens too: the
upstream Google tokens it holds live in private attributes
(_upstream_token_store, no public getter, no API contract). The
MCP spec blesses two-flow designs in the "URL Mode Elicitation for
OAuth Flows" pattern; production reference is
taylorwilsdon/google_workspace_mcp.
New env vars (HTTP deploy)
Required when running the Fly server with the new auth wiring:
GOOGLE_OAUTH_BASE_URL— public HTTPS hostname of the deployment
(e.g.https://my-app.fly.dev). Must exactly match the actual URL
or claude.ai's connector OAuth discovery silently fails.GOOGLE_OAUTH_CLIENT_SECRETS_JSON— full OAuth client JSON inline,
orGOOGLE_OAUTH_CLIENT_SECRETS_PATHpointing at a file.MCP_BEARER_TOKEN(already required) — reused as the HMAC signing
key for the OAuth state parameter.
Auto-set by configure_auth_for_http:
OAUTHLIB_RELAX_TOKEN_SCOPE=1 (so partial-grant consents don't
crash the OAuth callback).
Breaking: existing claude.ai connector users must reconnect
The OAuth scope set is changing. Existing connector connections need
to be disconnected + reconnected in claude.ai's connector settings to
pick up the new scopes.
Internal modules added
user_store.py— SQLite per-user state (WAL mode, per-path init
guard, merge-semantics on save, typo-rejection)oauth_state.py— HMAC-signed, single-use state-param for OAuth
callback (CSRF + replay protection)oauth_google.py—google_auth_oauthlib.Flowsetup, callback
code-exchange, GoogleProvider activationcredentials.py—get_credentials_for_user(sub)with per-user
refresh lock,invalid_grant→NeedsReauthErrormappingsetup_apps_script_for_user— cloud-side variant of
setup_apps_script_autousinguser_storeas the per-user ledger
Production bug fix in user_store
The concurrent-writes test surfaced a real PRAGMA journal_mode=WAL
race that busy_timeout doesn't mitigate. Fixed via per-path init
guard under threading.Lock — would have fired on Fly the moment
two cloud users finished OAuth simultaneously.
Tests
+49 unit tests across the v1.1 modules:
test_user_store.py (13), test_oauth_state.py (12),
test_oauth_google.py (13), test_credentials.py (11),
test_setup_apps_script_for_user.py (9),
test_phase6_consumer_branching.py (7),
test_configure_auth_for_http.py (9). Total: 158 unit + 4 live.
Dependencies
fastmcp>=2.13(was>=2.0) —GoogleProvider+valid_scopes+
_default_scope_strpost-init patch all require 2.13+.