feat: run the upstream OAuth migration per organization from the admin dashboard

Merged
DA
1mo ago
+14730-4007

Adds the upstream OAuth migration to the staff admin dashboard, so staff run it one organization at a time instead of through a migration CLI.

The new Upstream OAuth migration page (Platform Management) lists every organization with an MCP server signed in through a user session issuer. Each row shows whether that organization is migrated. Staff can migrate one organization (our own first, to test), then use Migrate all pending to work through the rest in order. That loop runs in the browser, and an interrupted run is safe to start again.

Status

getUpstreamOAuthMigrationStatus dry-runs both backfills for one organization and writes nothing. An organization is migrated when nothing is left to write and no server needs configuring. The status also reports:

  • associations and credential choices still to record
  • servers whose client the configuration does not prove, by server and project ID, for an administrator to configure. These are servers whose evidence names several clients, or whose grants and derived authorization server disagree (see #7644). A server with no evidence for any client uses none and is not listed
  • how many credentials will be asked to reconnect because no single client is decided for them. These do not block the checkmark: reconnecting is the intended repair once serving reads choices.

The organization list covers servers reached through their own issuer, a stored gateway's issuer, or the organization gateway's issuer, counting only live issuers of the server's tenant. Migrate all pending waits for every check to settle, migrates only organizations confirmed pending, and reports any it leaves unmigrated.

Run

runUpstreamOAuthMigration records the proven server to client associations first, then each live credential's choice, using the same statement new sign-ins use. It returns the counts written and the status after the run. Both steps are idempotent, and every association write is conditional on the evidence it was decided from.

The backfill logic is the association and selection backfills from #7644 and #7647, which now live under server/internal/mcpservers/upstreamclients/ with no CLI. This PR contains no serving changes and no branching. #7653 switches serving and merges only once every organization shows as migrated.

Notes

  • Staff Admin MCP: no tool added. This is a one-time rollout operation that will be removed after the cutover, a write would need the full proposal and approval flow, and the status is already on the dashboard.
  • A run is recorded as a structured log line with the operator, like the global remote session operations, not as an audit row in the customer's organization.

Summary by cubic

Adds an admin dashboard page for staff to run the upstream OAuth migration per organization, replacing the migration CLI. This implements the write/backfill stage of AIM-585 without switching serving readers.

Staff can list every organization with a live MCP server signed in through a user session issuer โ€” hosted, unproxied, and gateway-fronted servers โ€” see each organization's migration status from a dry run, and migrate one or all pending organizations in order. A credential pair waiting on a server's client configuration keeps the organization unmigrated; servers whose client the configuration doesn't prove are listed for an administrator to configure. A run records server-to-client associations and credential client choices idempotently, and "Migrate all pending" waits for every check to settle and reports any organization it leaves unmigrated. Runs are logged as structured log lines, not as audit rows in the customer's organization.


๐Ÿš€ Preview Environment (PR #7659)

Preview URL: https://pr-7659.dev.getgram.ai

ComponentStatusDetailsUpdated (UTC)
โœ… DatabaseReadyExisting database reused2026-10-20 15:00:13.
โœ… ImagesAvailableContainer images ready2026-10-20 15:03:38.

Gram Preview Bot