Skip to content

feat: allow sharing MCP servers with users and groups - #28593

Merged
ibetitsmike merged 18 commits into
mainfrom
mike/acl-sharing-a8yw
Aug 26, 2026
Merged

feat: allow sharing MCP servers with users and groups#28593
ibetitsmike merged 18 commits into
mainfrom
mike/acl-sharing-a8yw

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds the missing user-facing half of MCP server config ACLs: admins can now share an MCP server with individual users and groups from the UI, backed by a new permission-safe candidate-discovery endpoint.

Problem

The MCP server config ACL backend already existed (share RBAC action, hydrated GET .../acl, sparse PATCH .../acl), but there was no frontend for it. There was also no way to populate a sharing autocomplete without the generic organization member/group APIs, which require organization_member:read and group:read and would wrongly couple MCP sharing to the workspace-sharing mode (the same bug fixed for chat models in #28542).

Changes

Backend:

  • New v2-only GET /api/v2/organizations/{organization}/mcp-servers/{mcpserverconfig}/acl/available returning codersdk.ACLAvailable; because this API is new, it is not mounted under the experimental compatibility prefix. Gated on ActionShare for the specific server config; performs bounded org-scoped member/group lookups via dbauthz.AsSystemRestricted; excludes system users; supports q, limit, offset, and after_id with template/chat-model autocomplete semantics.
  • Tests cover authorization (404 without share), search, pagination, system-user exclusion, org scoping, and a share-only custom role under all three workspace-sharing modes (none, service_accounts, everyone).

Frontend:

  • shareMCPServerConfig permission plumbing; the MCP servers list, details page, and AI settings sidebar now admit share-only users (share does not require update; share-only users cannot edit the server form).
  • Share-only access follows the established permission contract: a bare-share role manages sharing through the list and ACL endpoints (the detail route still requires read, update, or delete, matching the existing enterprise permission-matrix tests), and the disabled-config gate now also admits the share permission so a sharer with read access can open a disabled server. Top-level navigation (Admin settings menu and the /ai/settings index redirect) discovers organization-level MCP sharers and surfaces permission lookup failures instead of silently falling back.
  • "Share server" action on the MCP server edit page opening a sharing dialog: hydrated ACL grants render from the GET .../acl response, adds/removals are saved as sparse PATCH deltas ("read" / "").
  • Principal autocomplete backed exclusively by the new /acl/available endpoint; the sharing flow never calls the generic org member/group APIs (Storybook enforces this by rejecting those API spies). A discovery error surfaces under the autocomplete without hiding existing grants.
  • Storybook interaction coverage for the dialog (hydrated rendering, add/remove, sparse deltas, error/cancel/reopen paths, autocomplete exclusion and failure) and share-only access to the page/form.

Dogfood UAT ran remotely against a dev instance and passed, including verifying via the network log that candidate discovery only hits /acl/available. The share-only custom role UI flow could not be exercised there (no premium license on the dev instance); it is covered by the backend permission-matrix tests.

🤖 This PR was authored by Xum (an AI coding agent) acting on Mike's behalf.

@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: 5f4a1ed40e

ℹ️ 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 site/src/pages/AISettingsPage/MCPServersPage/MCPServersPage.tsx
Comment thread site/src/modules/management/AISettingsSidebar.tsx Outdated
Comment thread coderd/mcp_acl.go
@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: 82b68dc909

ℹ️ 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
Comment thread site/src/pages/AISettingsPage/AISettingsIndexRedirect.test.tsx Outdated
@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 it up!

Reviewed commit: 115f9780dc

ℹ️ 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".

@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: ff0a96b0cd

ℹ️ 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 site/src/pages/AISettingsPage/AISettingsIndexRedirect.tsx
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 220826f96b

ℹ️ 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".

@ibetitsmike
ibetitsmike marked this pull request as ready for review August 25, 2026 21:22
@coderagents

coderagents Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Documentation Check

Updates Needed

  • docs/ai-coder/agents/platform-controls/mcp-servers.md — The Access control section now documents managing grants via Server actions > Manage permissions and drops the "no ACL editor in the settings page" statement. docs/ai-coder/agents/platform-controls/organizations.md was updated to match. Addressed.
  • docs/ai-coder/agents/platform-controls/mcp-servers.md — The Permissions table still maps Manage ACLs to Organization admin, which now contradicts the updated Access control prose ("Members with MCP server share permission can ... Manage permissions"). Update the Manage ACLs row to reflect share-only access.

    ⚠️ Prose in Access control was updated, but the Permissions table row was not; the two now conflict.


Automated review via Coder Agents

# Conflicts:
#	site/src/pages/AISettingsPage/ModelsPage/components/ChatModelSharingDialog.tsx
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

🤖 Xum is acting on Mike's behalf.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 395e0aba10

ℹ️ 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 site/src/pages/AISettingsPage/MCPServersPage/components/MCPServerFormHeader.tsx Outdated

@ethanndickson ethanndickson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

docs will need updating, and make sure to do the UI rename mentioned above, but otherwise 👍

@ethanndickson ethanndickson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

oh also since this is a PR to main, dont forget to change the /experimental/ to /v2/.

Maybe stack it on top of my PR #28542 ?

@linear-code

linear-code Bot commented Aug 26, 2026

Copy link
Copy Markdown

CODAGT-980

@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

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 merged commit 35cbca0 into main Aug 26, 2026
35 checks passed
@ibetitsmike
ibetitsmike deleted the mike/acl-sharing-a8yw branch August 26, 2026 17:49
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 26, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants