Repository navigation
fix(den): standardize external MCP OAuth on enterprise client - #2810
Merged
reachjalil merged 10 commits intoJul 15, 2026
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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
marked this pull request as ready for review
July 15, 2026 20:36
…mcp-oauth # Conflicts: # ee/apps/den-api/src/routes/org/mcp-connections.ts # ee/apps/den-web/app/(den)/dashboard/_components/mcp-connections-screen.tsx
This was referenced Jul 16, 2026
benjaminshafii
pushed a commit
that referenced
this pull request
Jul 25, 2026
…t path (#3122) An external MCP capability got 30s for the whole session -- connect, OAuth refresh, initialize and tools/call shared one budget -- and execute_capability spent that budget twice, once for schema-digest discovery and once for the call. Slow providers died at ~31s. The 120s/150s tool budget from #2750 was never reached. #2810 deleted the legacy runtime, so callExternalMcpTool resolves to the enterprise client, and the adapter's tool-call path forwarded no lifecycle deadline -- unlike listExternalMcpTools beside it -- leaving the package's 30s default in charge. A Math.min(operationTimeoutMs, ...) clamp meant injecting the longer deadline would have been clipped back to 30s anyway. The only test asserting 120s exercised the bypassed file. Make an injected lifecycle deadline authoritative in both directions and demote operationTimeoutMs to the fallback default. Forward the deadline on the tool-call path, and share one deadline between discovery and the call so the handshake and the budget are paid once. Split the per-request timeout from the absolute bound and stop cancelling a provider that is still reporting progress, matching the calling harness instead of being stricter than it; the SDK only attaches a progressToken when an onprogress handler is present, so the flag alone was inert.
benjaminshafii
added a commit
that referenced
this pull request
Aug 4, 2026
The runtime standardized list/call/inspect on the enterprise MCP client (#2810) before this branch was cut, so the session pool introduced here never engaged on the live capability path: unit tests exercised the pooled module directly and passed while production traffic dialed a fresh downstream session per operation. Route listExternalMcpTools/callExternalMcpTool/inspectExternalMcpToolCall through the pooled SDK client; connect/OAuth lifecycle stays on the enterprise client. Stopgap until the pool moves inside @openwork/enterprise-mcp-client (follow-up issue), after which tool ops flip back and the SDK client path retires.
benjaminshafii
pushed a commit
that referenced
this pull request
Aug 4, 2026
…#3208) * feat(den): reuse downstream MCP sessions across capability operations Every search_capabilities and execute_capability opened a full MCP session against the customer's gateway (initialize, initialized notice, SSE probe, work, close) and threw it away — roughly two handshakes per agent prompt, which shows up as request bursts in partner gateway logs. Add an in-process session pool for listExternalMcpTools and runExternalMcpToolCall: - key: sha256 over connection id/url/authType/credentialMode, hashed apiKey/oauth config, row updatedAt, and for per_member connections the orgMembershipId plus the member's connected-account revision — token rotation or config change naturally misses the old session; per-member sessions can never be shared across members - exclusive lease per operation with a mutable lease slot: the pooled transport's fetch resolves deadline, diagnostic tracker, and tool-call inspector from the current lease, so one operation's lifecycle can never leak into the next; concurrent same-key callers wait up to 2s then fall back to a throwaway session - 120s idle TTL, 10m absolute lifetime, 64-entry LRU (idle entries only), single-flight connects, close-on-evict - reused sessions that fail with auth-, session-, or transport-shaped errors are evicted and retried once on a fresh session; deadline exhaustion is never retried; fresh-session failures surface exactly as before - invalidation hooks on OAuth token save/refresh/invalidate, connection update/delete/disconnect, and member disconnect - kill switch: DEN_EXTERNAL_MCP_SESSION_REUSE=0 restores session-per-operation Health probes (connectExternalMcp) and OAuth completion stay ephemeral by design, and the live tools/list catalog semantics are unchanged — this reuses the session, not the catalog. * fix(den): route external MCP tool operations through the pooled client The runtime standardized list/call/inspect on the enterprise MCP client (#2810) before this branch was cut, so the session pool introduced here never engaged on the live capability path: unit tests exercised the pooled module directly and passed while production traffic dialed a fresh downstream session per operation. Route listExternalMcpTools/callExternalMcpTool/inspectExternalMcpToolCall through the pooled SDK client; connect/OAuth lifecycle stays on the enterprise client. Stopgap until the pool moves inside @openwork/enterprise-mcp-client (follow-up issue), after which tool ops flip back and the SDK client path retires. * test(evals): prove external MCP session reuse contract end-to-end Fast-lane spec (no app): Den is driven directly and the mock connector is the witness. Claims: search->execute reuses one session (one initialize); a second member never rides the first member's session (distinct sessionId + tokenId, negative halves asserted); credential rotation forces a fresh handshake; a killed session evicts and retries exactly once; DEN_EXTERNAL_MCP_SESSION_REUSE=0 restores session-per-operation. Witness: mock MCP server now records initialize handshakes and per-request session ids, and exposes handshakes() plus session invalidation for dead-session drills. Additive only. The first run of this spec exposed the runtime bypass fixed in the previous commit; with the original routing restored the reuse claim fails and the kill-switch claim passes, so the spec discriminates. * fix(evals): gate session-reuse spec on Den availability so CI skips loudly This mirrors skill-grant-access's test.skipIf mechanism, gating the contract on a Den URL or local MySQL and the kill switch on local MySQL. * chore: trigger warden analysis after draft-to-ready (no changes)
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes from
devdevalready has Den-managed external MCP connections, shared and per-connection callback routes, connection editing, and non-destructive Disconnect. This PR makes these specific changes:@openwork/enterprise-mcp-clientfor remote MCP discovery, OAuth, refresh, tool listing, and tool calls. It removes the environment flag, organization engine setting, runtime toggle, and legacy runtime selection.New version-two OAuth transactions use the enterprise package. Version-one transactions already in flight can finish through their original verifier only for the existing ten-minute state lifetime.
Review map
ee/apps/den-api/src/capability-sources/external-mcp-client-runtime.tsee/apps/den-api/src/capability-sources/external-mcp-connections.tsandee/apps/den-api/src/routes/org/mcp-connections.tsee/apps/den-api/src/capability-sources/oauth-callback-page.tspackages/enterprise-mcp-client/src/oauth-discovery-binding.tspackages/enterprise-mcp-client/src/authorization-response.ts,oauth-provider.ts, andrequirements-discovery.tsee/apps/den-web/app/(den)/dashboard/_components/mcp-connections-screen.tsxpackages/docs/cloud/share-with-your-team/shared-mcp-connections.mdxCurrent
devsyncThe branch includes
upstream/devthrough480dcfbf(feat(den): support non-destructive MCP disconnect). Its admin/member Disconnect behavior, creator attribution, API changes, and tests are retained. At publication, the branch is 0 commits behindupstream/dev.Validation
@openwork/enterprise-mcp-client: 36 tests passed; package build passed.Scope
This changes only Den-managed OpenWork Connect. Local/direct engine MCP and the engine-to-Den meta-MCP are unchanged. The implementation and tests follow MCP/OAuth metadata contracts and contain no provider-specific runtime branch. Optional Vercel previews can report authorization-required because the fork cannot deploy to the upstream Different AI project; that is not a code-test failure.