Skip to main content
Draft: This page reflects the connectkey-ai/app development source at commit 18a289644daa381b7683aa688c09cbfdbe655791 and unauthenticated staging probes on 2026-11-25. Signed-in flows, browser authorization, and live MCP calls remain Untested because staging does not serve /mcp or /oauth/authorize yet. An agent’s access follows the workspace you select during OAuth 2.1 authorization, not a per-agent tool allowlist. In app source, each approved grant in workspace_grants binds one OAuth client_id to one (owner_id, workspace_id) pair. On tools/list, ConnectKey checks a server-side owner allowlist independently before returning tools: in local test mode, eligible Google Calendar accounts connected to that workspace appear for a server-allowlisted test owner with a valid calendar:read grant (up to the 32-account query bound; a 33rd eligible account makes the list unavailable), while an owner outside the allowlist gets no tools and no provider call even with calendar:read. The staging path additionally filters to one configured tester workspace and connection. Accounts in another workspace stay out of reach through owner-level PostgreSQL Row-Level Security (FORCE ROW LEVEL SECURITY), workspace-level query predicates, and composite foreign keys referencing workspaces(owner_id, id).

Where would access stop?

Diagram of ConnectKey's workspace access model in app source: a connected agent connects via ConnectKey for one chosen workspace while ConnectKey uses your app credentials only to contact the provider so the agent never sees them; inside this connection only approved access such as read-only Google Calendar is reachable (new write access needs new approval), while another workspace stays separate and unreachable (creating additional workspaces is not built in app source yet).

Planned workspace access boundary from ConnectKey app source. Live workspace authorization and tool calls remain untested.

Inside this connection

Chosen workspace

Connected agents can reach eligible connected accounts in this workspace within the access you approved (currently read-only Google Calendar in source). New write access requires a separate approval. ConnectKey uses your connected app credentials to contact the provider and returns only tool results; your agent never sees those credentials.

Example: a connected Google Calendar (read-only)

Outside this connection

Other workspace

An account connected only to another workspace stays separate and unreachable by this agent (note: creating additional workspaces is not built in app source yet).

What controls what an agent can do?

In app source, three independent checks bound what a connected agent can run:
  1. Server owner allowlist (current Calendar read gate): apps/api/src/google/calendar-read/service.ts checks that the grant’s owner is on the server allowlist (and in staging, matches the configured tester workspace and connection) before listing or calling tools; an excluded owner holding a valid calendar:read grant receives no tools and triggers no provider call.
  2. OAuth grant scopes approved at consent: Although the consent UI defines plain-English labels for calendar:read, tools:read, and tools:call (apps/web/src/authorize/permission-summary.ts), the issuer scope resolver (packages/database/src/issuer-client-registry.ts) currently grants only calendar:read or an empty scope. The MCP resource handler enforces the required scope before dispatch and returns HTTP 403 (insufficient_scope) when a grant lacks calendar:read.
  3. Provider scopes and tool actions: In the current source, Google Calendar (calendar.events.list) is the only connector wired to MCP. It requests only openid, email, and https://www.googleapis.com/auth/calendar.events.owned.readonly, verifies the Google ID token and scopes on initial local consent, verifies those exact effective scopes on every refresh (normalizing Google’s userinfo.email alias), accepts zero client arguments, and returns up to 10 upcoming events from the primary calendar (projected data capped at 16 KiB). It cannot create, edit, or delete events.
No retroactive elevation and no per-call approvals: Per docs/plan/DECISIONS.md (CON-247 and CON-110), existing grants are never retroactively elevated to write access: future write actions require a separate, fresh approval. Separate grant approval is distinct from per-call confirmation prompts, which ConnectKey does not have. There are also no per-agent tool allowlists in source: in the current local Calendar read path, once a server-allowlisted test owner holds an approved calendar:read grant for a workspace, every eligible Calendar connection in that workspace is callable without per-action prompts. Keep accounts that not every agent should reach in a separate workspace (note: apps/api/src/workspaces/create.ts currently creates at most one first workspace; creating additional workspaces is not built in apps/api/src/workspaces/routes.ts yet).

Who holds the credentials?

  • Agent tokens stay at ConnectKey: Agents authenticate to ConnectKey with OAuth 2.1 and PKCE (S256). ConnectKey stores only 32-byte SHA-256 digests of authorization codes, access tokens, and refresh tokens, and never forwards the agent’s bearer token to any provider.
  • Provider credentials stay encrypted in ConnectKey: For Google Calendar reads, ConnectKey decrypts the connected account’s AES-256-GCM-encrypted Google refresh token (bound by authenticated associated data to version, environment, provider, client, owner, workspace, and connection ID), exchanges it at Google’s token endpoint for a Google access token, calls the primary Calendar events endpoint, and zeroes the key and refresh-token buffers in memory. The agent never receives provider credentials.
  • Revocation and release-time recheck: Disconnecting an agent (POST /api/workspaces/:workspaceId/agents/:grantId/disconnect) revokes that specific workspace_grants row immediately so new calls and refreshes on that grant fail. For Google Calendar reads, ConnectKey rechecks current grant, token, and connection validity at release time before returning events; if an otherwise successful read fails that check and finalization commits, ConnectKey returns no events and records outcome = 'failed' with reason = 'result_withheld'.
See One server or one per app? for how workspace revocation compares with separate per-app servers.

Current source and staging status (2026-11-25)

  • Staging probes (2026-11-25): Unauthenticated curl checks confirmed the staging MCP host returned HTTP 200 on /healthz and /readyz and HTTP 404 on /mcp, /.well-known/oauth-protected-resource, /.well-known/oauth-protected-resource/mcp, and /.well-known/oauth-authorization-server. The staging app host returned HTTP 200 on / and /signin, HTTP 401 (signed_out) on /api/workspaces, and HTTP 404 on /oauth/authorize.
  • Untested: Selecting a workspace on /authorize/workspace, approving consent, listing tools, calling a tool over /mcp, and observing release-time revocation on a deployed host remain Untested until staging serves /mcp and /oauth/authorize.