Skip to content

fix: harden org-scoped MCP config chat gating, updates, and visibility - #28065

Open
ibetitsmike wants to merge 9 commits into
mike/codagt-711-mcp-apidocsfrom
mike/codagt-711-mcp-hardening
Open

fix: harden org-scoped MCP config chat gating, updates, and visibility#28065
ibetitsmike wants to merge 9 commits into
mike/codagt-711-mcp-apidocsfrom
mike/codagt-711-mcp-hardening

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Hardens the org-scoped MCP server config surface from #27942 with fixes and regression pins that are independent of the core cutover:

  • Keep chats sendable after a selected MCP server is disabled (persisted selections are exempt from message-time rejection).
  • Keep cached MCP selections usable after a background refetch error (gate the composer on missing data, not isSuccess).
  • Merge PATCH updates onto the current row so unset fields are not clobbered.
  • Give auditors the full management view of MCP configs their audit logs reference (site and org auditor roles).
  • Regression pins: frozen OAuth2 callback path, cross-org concealment for item routes, OAuth callback token binding, and disconnect responses indistinguishable from nonexistent config IDs.
  • Storybook: semantic textbox queries in MCP loading stories; docs note that the MCP settings page needs deployment access.

Stack context

Part of the MCP org-separation stack (CODAGT-711 org scope -> apidocs -> hardening -> CODAGT-717 audit -> CODAGT-712 ACLs -> CODAGT-806 token RBAC). Split out of #27942 to keep the core cutover reviewable; each change here builds on the org-scoped routes and chat gating introduced below it.

Mux (AI agent) authored this PR on Mike's behalf.

@linear-code

linear-code Bot commented Aug 12, 2026

Copy link
Copy Markdown

CODAGT-711

@github-actions

Copy link
Copy Markdown

Docs preview

Check off each page once it's been reviewed. If a page changes in a later push, its checkbox clears automatically so it gets a fresh look. Pages not yet wired into the docs navigation aren't listed here.

@ibetitsmike ibetitsmike changed the title mike/codagt 711 mcp hardening fix: harden org-scoped MCP config chat gating, updates, and visibility Aug 12, 2026
@ibetitsmike
ibetitsmike marked this pull request as ready for review August 12, 2026 11:03
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 20125f49fa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

updateMCPServerConfig merged request fields onto the param middleware's
snapshot, taken before the request body was parsed, so an overlapping
update could have its changes to omitted fields silently reverted.
Re-fetch the row on the transaction handle before constructing the
merged update, restoring the pre-existing behavior.
…er refetch errors

A failed background refetch flips the MCP query's isSuccess off while
TanStack Query v5 retains the cached data, so gating the composer on
isSuccess blocked sends despite a usable organization MCP list. Gate on
missing data instead; the error alert still surfaces refetch failures.
The auditor roles' MCP config read grant exists so auditors can inspect
the resources audit logs reflect, but the full-view gate only checked
update permission, leaving auditors with the member view: redacted
management fields and 404s for disabled configs. Before org scoping the
site auditor's deployment-config read selected the full view. Gate the
full view on org audit-log read as well, which site and org auditors
hold and ordinary members do not.
The cross-org concealment helper prefixed every case with
/mcp-servers, so the callback case hit a router 404 without invoking
the handler; the callback lives on the frozen /mcp/servers route.
Disconnect deliberately returns 200 for callers without a token so
config IDs cannot be probed, which the 404 expectation contradicted.
Also pin that legacy MCP selection migration is a no-op while the
server list has not resolved.
…ect body concealment

Add a cross-organization callback test proving tokens bind to
(user, org-scoped config) with no cross-org reuse, and restore the
full-response equality check that a concealed config's disconnect is
indistinguishable from a nonexistent ID.
@ibetitsmike
ibetitsmike force-pushed the mike/codagt-711-mcp-hardening branch from 20125f4 to d0783f3 Compare August 12, 2026 11:42
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d0783f3ff4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread coderd/mcp.go
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