> ## Documentation Index
> Fetch the complete documentation index at: https://docs.connectkey.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# One MCP server or one per app?

> Compare per-app MCP servers with ConnectKey's single workspace-scoped MCP server, authorization boundary, and agent disconnect model.

**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.

When each app runs its own MCP server, a common setup requires configuring and authorizing each server separately in every agent, and cutting off one agent requires revoking each app connection it holds.

With ConnectKey, every agent uses the same MCP URL. Sharing or pasting that URL alone grants no access: during OAuth 2.1 authorization, you sign in to ConnectKey and choose one workspace. ConnectKey binds that agent's grant in `workspace_grants` to `(owner_id, workspace_id)` and exposes eligible connected accounts in that workspace as `<tag>.<action>` tools (for example `<tag>.calendar.events.list` for Google Calendar). In local test mode, `tools/list` queries eligible connected accounts dynamically for a server-allowlisted test owner with a valid `calendar:read` grant (up to 32 eligible Calendar connections; a 33rd makes the list unavailable, and an excluded owner receives no tools and cannot dispatch calls). The staging path additionally filters to one configured tester workspace and connection.

## How the two models compare

| Action | Example per-app server setup | ConnectKey workspace model (in `app` source) |
| - | - | - |
| Connect a new agent | Configure and authorize each app server in that agent | Add one MCP URL and authorize the agent against one workspace |
| Add another app account | Often requires adding another server in each agent that needs it | Connect the account to the workspace; in local mode, eligible accounts appear on `tools/list` for a server-allowlisted test owner holding a valid `calendar:read` grant (staging currently pins one tester workspace and connection) |
| Stop one agent grant across the workspace | Revoke that agent's connection on each app server | Disconnect that agent's grant (`POST /api/workspaces/:workspaceId/agents/:grantId/disconnect`); other grants stay active |
| Keep an app away from a specific agent | Omit that server from that agent's config | Planned via [separate workspaces](https://docs.connectkey.ai/concepts/workspace-access.md); note that current `app` source creates at most one first workspace (`apps/api/src/workspaces/create.ts`) |
| Provider credential custody | Each server or client handles its own provider auth | Agent bearer tokens stop at ConnectKey; ConnectKey uses the account's encrypted provider credential and never sends it to the agent |

## What happens when you disconnect

Suppose a workspace holds connected accounts and two agent grants are authorized on that workspace:

* **Stop one agent grant across the workspace:** Disconnect that agent in ConnectKey. In `app` source, disconnecting revokes that specific `workspace_grants` row (`revoked_at` set once), so further bearer verification and token refreshes on that grant fail immediately while other grants (including any separate grant held by the same OAuth client) remain active. For Google Calendar reads, ConnectKey also rechecks grant, token, and connection validity at release time before returning events and withholds the events if that check fails.
* **Stop all agents from using one connected account:** If Google returns a definitive HTTP 400 `invalid_grant` during a token refresh and the stored credential generation still matches, ConnectKey marks that `connected_accounts` row `needs_sign_in` so subsequent calls against it fail. Removing a connected account through a self-serve HTTP route, pausing an agent, and signing out every agent in a workspace at once are **not built** in `app` source yet.

Separating which agents can see an account requires [separate workspaces](https://docs.connectkey.ai/concepts/workspace-access.md) (multi-workspace creation is not yet built in `apps/api/src/workspaces/routes.ts`).

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

* **Connectors in source:** Google Calendar read (`calendar.events.list`) is the only connector wired through to MCP in source, with new-connection enrollment gated to local test mode and a pre-enrolled read-only custody path for staging. Other connector modules exist offline in source and are not mounted.
* **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:** Authorizing an agent, listing workspace tools, calling a tool over `/mcp`, and disconnecting an active agent on a deployed host remain **Untested** until staging serves `/mcp` and `/oauth/authorize`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.