Skip to content

fix(mcp): apply every access rule on the per-connection routes - #7453

Merged
reachjalil merged 1 commit into
devfrom
fix/mcp-connection-route-access-rules
Nov 16, 2026
Merged

reachjalil merged 1 commit into
devfrom
fix/mcp-connection-route-access-rules

Conversation

@reachjalil

Copy link
Copy Markdown
Member

What is this about?

The two Den routes that serve a single connection as its own MCP server. They now apply the same access rules as the main agent endpoint.

What problem does it solve?

Two rules an admin relies on were skipped there: a connection blocked until its changed sign-in provider is reviewed, and a connection set to "Not allowed" for Workbot. A malformed connection id also caused a server error instead of a refusal.

What was the situation before?

A client that already had a connection's URL kept getting answers from a connection every other path reported as blocked for review. A Workbot turn's token was served a connection the admin had taken away from Workbot. A request with a malformed id got a 500.

How is this implemented?

  • external-capabilities.ts: mcpMemberForToken builds the member from the token, including the connections withheld from Workbot; externalMcpConnectionHold returns the review or Workbot refusal. execute_capability reads both from it, in the order it had.
  • external-connection-proxy.ts (/mcp/agent/connections/:id): applies the hold after the grant check, so only a member with access is told why. A malformed id gets the same 403 as an unknown one.
  • connection-server.ts (/mcp/agent/servers/:id): builds its member the same way and treats a withheld connection as unavailable.

What else changed?

Release note

Connections blocked for an admin's review, or not allowed for Workbot, are now refused on every route that reaches them.

Evidence

ee/apps/den-api/test/api/mcp-connection-route-access.api.test.ts — before: a blocked or Workbot-withheld connection is served and a malformed id returns 500; after: each is refused. No E2E; no screen changed.

Den serves one connection on its own at two routes:
/mcp/agent/connections/:id (the App host, and clients of a directly
exposed connection) and /mcp/agent/servers/:id. Both check the member's
grant on every request, but neither applied two rules that
execute_capability applies to a granted connection.

A connection whose OAuth issuer changed is blocked until an
organization admin reviews it. The connections route did not look at
that, so a client that already had the connection's URL kept calling the
provider with the saved sign-in.

A connection an admin set to "Not allowed" for Workbot is named in a
Workbot turn's token. Only /mcp/agent read that from the token, so both
per-connection routes served such a connection to a Workbot turn's
token. Workbot's runner does not use these routes itself.

The member is now built from the token in one place
(mcpMemberForToken), and the two refusals come from one function
(externalMcpConnectionHold) that execute_capability and the connections
route both read. execute_capability keeps the order it had. The servers
route treats a withheld connection as unavailable; its tool calls
already run through execute_capability. Only a member with a grant is
told why a connection is held.

The connections route also threw on a malformed connection id, which
surfaced as an unhandled server error. It now answers as it does for an
unknown id.

The connections route's lookups can be supplied by a caller, as the
servers route's already can, so the new test drives both routes with a
held connection and a Workbot token. The malformed id goes through the
real app. The test is added to the security list so it runs on every
PR.

Signed-off-by: Jalil <reachjalil@gmail.com>
@vercel

vercel Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

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

3 Skipped Deployments
Project Deployment Actions Updated
openwork-app Skipped Skipped Nov 16, 2026 11:31pm UTC
openwork-den Skipped Skipped Nov 16, 2026 11:31pm UTC
openwork-landing Skipped Skipped v0 Nov 16, 2026 11:31pm UTC

Request Review

@vercel
vercel Bot temporarily deployed to Preview – openwork-landing November 16, 2026 23:31 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-den November 16, 2026 23:31 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-app November 16, 2026 23:31 Inactive
@reachjalil
reachjalil merged commit 03eaf61 into dev Nov 16, 2026
19 checks passed

This branch was previously deployed

3 inactive deployments
Preview – openwork-den — 810b7fed Deployed Nov 16, 2026 by vercel[bot]
Preview – openwork-app — 810b7fed Deployed Nov 16, 2026 by vercel[bot]
Preview – openwork-landing — 810b7fed Deployed Nov 16, 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