Skip to content

feat(connect): harden external MCP OAuth conformance - #2771

Merged
reachjalil merged 5 commits into
different-ai:devfrom
reachjalil:feature/mcp-oauth-conformance
Jul 15, 2026
Merged

reachjalil merged 5 commits into
different-ai:devfrom
reachjalil:feature/mcp-oauth-conformance

Conversation

@reachjalil

@reachjalil reachjalil commented Jul 15, 2026 •

Copy link
Copy Markdown
Member

Feature

This PR makes Den-managed external MCP connections standards-first from URL entry through usable tools. An administrator can discover a server's requirements before saving, choose the correct authorization server and permissions, complete OAuth through one deployment-wide callback, and see a normalized connection state in the dashboard.

Existing behavior retained

  • external MCP connections using no authentication or an API key
  • organization-shared credentials and per-member credentials
  • organization, team, and member access grants
  • manually supplied OAuth client credentials
  • encrypted OAuth tokens and client secrets stored in Den
  • connected MCP tools exposed through the existing agent-facing capability surface
  • temporary server-side compatibility for untouched legacy callbacks and version-one authorization state already in flight

New functionality

Requirements discovery

  • adds admin-only POST /v1/mcp-connections/discover
  • performs unauthenticated MCP initialization plus protected-resource and authorization-server metadata discovery
  • reports authentication type, issuers, registration methods, required/recommended scopes, refresh support, tool visibility, and administrator-only prerequisites
  • applies Den's SSRF policy and bounded redirects, response sizes, authorization servers, tools, and total deadline
  • performs no client registration, credential save, or database write

Standards-based OAuth registration

  • uses manually supplied credentials when configured, otherwise CIMD when advertised, then dynamic client registration
  • sends application_type: web, authorization-code and refresh-token grants, PKCE S256, the MCP resource indicator, and the resolved least-privilege scope set
  • binds discovery, client registration, pending authorization, and tokens to the MCP resource and selected issuer
  • preserves refresh tokens when a refresh response omits a replacement and reports typed reauthorization or incremental-authorization states

Deployment-wide shared callback

  • gives every new OAuth connection one callback derived from DEN_API_PUBLIC_URL:
    https:///v1/mcp-connections/oauth/callback
  • routes the callback only after signed version-two state is verified
  • verifies tenant, member, connection binding, issuer, callback mode, client-registration revision, and PKCE transaction before token exchange
  • keeps the legacy callback route only for untouched existing connections and short-lived version-one flows

One-way callback migration

  • shows existing manual clients “Callback update required” with a copy → allowlist → reconnect flow
  • permanently moves manual clients to the shared callback while preserving the entered client ID/secret and existing access grants
  • automatically invalidates and re-registers older dynamic clients against the shared callback during reconnect
  • clears stale tokens and pending authorizations during migration
  • provides no API or dashboard action that returns a migrated connection to legacy mode
  • keeps deletion as a clearly warned recovery option because it can remove grants, member authorization state, and plugin or marketplace bindings

Dashboard and supportability

  • exposes one normalized connection contract regardless of the selected server-side implementation
  • displays callback mode, registration source, issuer, requested/granted scopes, callback URL, client-metadata URL, connection state, and available tools without exposing secrets
  • distinguishes configuration required, authorization required, refreshing, reauthorization required, issuer mismatch, and connected states
  • adds phase-coded, redacted diagnostics and updated administrator guidance
  • keeps the long add-connection dialog inside the viewport using bounded internal scrolling, so the header and final action remain reachable on short screens

Verification

  • pnpm --filter @openwork/enterprise-mcp-client test — 33 passed
  • pnpm --filter @openwork/enterprise-mcp-client typecheck
  • pnpm --filter @openwork/enterprise-mcp-mock-server check — 162 passed; typecheck and build passed
  • Den callback route suite — 15 passed
  • Den callback migration/concurrent refresh suite — 4 passed
  • Den route guard/runtime-selection suites — 5 passed
  • Den external MCP diagnostics suite — 57 passed
  • Den API typecheck and production build
  • dashboard callback contract suite — 3 passed
  • Den web typecheck and production build
  • schema push against the isolated MySQL development database
  • Fraimz browser E2E — 1 passed, 0 failed, including side-effect-free discovery, DCR/PKCE, shared callback, normalized dashboard state, agent-facing tool execution, and short-viewport modal scrolling (report and screenshots)
  • git diff --check

Rollout and compatibility

  • the schema change is additive: one nullable, versioned OAuth configuration column
  • new OAuth connections always use the shared callback
  • shared-callback migration is deliberately irreversible
  • the enterprise MCP implementation is the default; DEN_ENABLE_ENTERPRISE_MCP_CLIENT=false remains an emergency server-side rollback
  • the legacy callback remains server-side only until existing callback usage reaches zero

Remaining acceptance gates

  • run the supplied customer gateway journey from the actual Den network environment once its URL and credentials are available
  • recheck the authorization language against the July 28 final MCP release before merge; as of July 14 only release-candidate material is available

@vercel

vercel Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openwork-landing Ready Ready Preview, Comment, Open in v0 Jul 15, 2026 4:18am

@vercel

vercel Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

@reachjalil is attempting to deploy a commit to the Different AI Team on Vercel.

A member of the Team first needs to authorize it.

@reachjalil

reachjalil commented Jul 15, 2026 •

Copy link
Copy Markdown
Member Author

Fraimz end-to-end proof

The mcp-oauth-conformance browser flow passed against an isolated Den database and the local OAuth MCP conformance server:

  • URL-only discovery reported OAuth, dynamic registration, scopes, and manual requirements without creating a connection or registering a client.
  • DCR sent application_type: web, exactly one deployment-wide callback, PKCE completed, and the provider returned through the shared callback.
  • The normalized dashboard contract reported Connected, Shared callback, dynamic registration, and the granted mcp:read scope.
  • The authorized Mock Echo tool appeared in the catalog and succeeded through both search_capabilities and execute_capability.
  • At a 600px-tall viewport, the add-connection dialog stayed within the viewport, used internal scrolling, and kept the final action reachable. Measured bounds were 24px–576px with a 550px client height, 745px scroll height, and overflow-y: auto.

Run result: PASSED — 1 passed, 0 failed, 0 skipped. The report, flow, narration, and frames are committed in 5ccefc24. Each image URL below is pinned to that immutable commit and returned 200 image/png before this comment was updated.

1. Side-effect-free requirements discovery

Requirements discovery

2. Shared callback authorization success

Shared callback success

3. Normalized shared-callback connection

Normalized shared-callback connection

4. Authorized tool catalog

Authorized tool catalog

@reachjalil

Copy link
Copy Markdown
Member Author

Fraimz end-to-end proof — Vercel Blob

Fraimz run 2026-07-15T02-36-45-026Z passed the complete user-facing OAuth journey. These public, immutable proof images are hosted in the Different AI openwork-share Blob store and were verified before posting.

1. Requirements discovery — URL-only preflight explains OAuth, dynamic registration, least-privilege scopes, and administrator checks before any connection or OAuth client is created. The short-viewport dialog keeps its actions reachable with internal scrolling.

Requirements discovery shows detected OAuth details, scopes, and administrator actions

2. Shared callback authorization — Dynamic registration identifies OpenWork as a web client, PKCE completes, and the provider returns through the deployment-wide shared callback.

OAuth authorization succeeds through the shared callback

3. Normalized connected state — The connection card reports Connected, Shared callback, dynamic registration, and the requested/granted scope without exposing runtime selection or offering a return to legacy mode.

Connected MCP card shows shared callback and dynamic registration

4. Authorized tool catalog — The OAuth-backed server exposes its Mock Echo tool in the dashboard and the same connection succeeds through the agent-facing capability surface.

Authorized MCP tool catalog shows Mock Echo available to agents

Verification: all four URLs returned HTTP 200, image/png, and byte-for-byte SHA-256 matches with the local Fraimz captures.

@reachjalil
reachjalil merged commit 0b97035 into different-ai:dev Jul 15, 2026
12 checks passed
@reachjalil
reachjalil deleted the feature/mcp-oauth-conformance branch July 17, 2026 07:06

This branch was successfully deployed

1 active deployment
Preview – openwork-landing — 41696a2a Deployed Jul 15, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant