Skip to content

feat(mcp-gateway): team MCP gateway UI replacing the marketplace behind the mcp-gateway flag#3643

Draft
cvolzer3 wants to merge 2 commits into
mainfrom
posthog-code/mcp-gateway-ui
Draft

feat(mcp-gateway): team MCP gateway UI replacing the marketplace behind the mcp-gateway flag#3643
cvolzer3 wants to merge 2 commits into
mainfrom
posthog-code/mcp-gateway-ui

Conversation

@cvolzer3

Copy link
Copy Markdown
Contributor

Problem

The MCP servers page in PostHog Code is a per-user install list: each member connects servers for themselves and approves tools for themselves, with no shared team view or control. The backend now models a team MCP gateway (PostHog/posthog#72409, behind the mcp-gateway flag) — a control plane for which servers a team runs, under whose credentials, with which tools allowed, and who called what. The desktop app needs the matching UI.

Why: we're refactoring the existing MCP server marketplace into the gateway experience from the design handoff, so teams manage servers, credentials, agent identities, per-tool policies, and auditing in one place — implemented here per the design artifacts.

Changes

  • New packages/ui/src/features/mcp-gateway feature rendered at /mcp-servers when the mcp-gateway flag is on; the legacy marketplace stays as the fallback while the flag is off.
  • Screens per the design handoff: servers home (search, category chips, connection status), server detail (connect/disconnect, shared-credential and pre-authorized states, admin Access section, per-scope tool policies with rule/admin locks, share-with-agent modal), team & agents, agent detail (identity, show-once token + rotation, shared servers, recent calls), member detail (per-server revocation), team settings (custom-server gate, approval baselines, server access, team rules), and the audit log with quick filters and pagination.
  • @posthog/api-client: hand-written types + client methods for the mcp_gateway API family (not in the generated OpenAPI client yet); install methods accept the new sharing options.
  • @posthog/core/mcp-gateway: portable helpers (filtering, policy counts, time formatting, add-server request building, install flow) with unit tests.
  • OAuth connect flows reuse the existing desktop mcpCallback deep-link round-trip.

Adaptations where the backend constrains the design: member self-disable only shows when the member has their own connection row; the audit caller filter covers agents only (the API has no human-caller filter); agent identities render their handle rather than an email.

How did you test this?

  • pnpm typecheck across the workspace (24 tasks green).
  • biome lint clean on all touched packages (including zero noRestrictedImports in packages/core).
  • Unit tests: new packages/core/src/mcp-gateway suites (33 tests), existing mcp-servers/mcp-server-manager UI suites, and the full @posthog/api-client suite (106 tests) all pass.
  • node scripts/check-host-boundaries.mjs — no new violations.
  • Not exercised against a live backend: the gateway endpoints ship behind the mcp-gateway flag in PostHog/posthog#72409, which is still open.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Created with PostHog Code

…ateway flag

Replaces the per-user MCP marketplace with the team gateway surface from the
design handoff when the mcp-gateway flag is on: servers home with connection
status, server detail with per-scope tool policies and the admin access
section, team & agents roster, agent service-account detail (identity, token
rotation, shared servers, call history), member detail with per-server
revocation, team settings (custom-server gate, approval baselines, server
access, team rules), the audit log, and the gateway add-server form with
sharing options. The legacy marketplace remains the fallback while the flag
is off.

Adds hand-written /api/projects/{id}/mcp_gateway/* client methods and types
to @posthog/api-client (the endpoints are not in the generated OpenAPI client
yet), and portable helpers with tests in @posthog/core/mcp-gateway.

Generated-By: PostHog Code
Task-Id: 7ecfb6f3-39d8-4443-96e7-36e9d1ebd144
@trunk-io

trunk-io Bot commented Jul 21, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown

React Doctor found 7 issues in 5 files · 7 warnings.

7 warnings

src/features/mcp-gateway/components/parts/GatewayAddServer.tsx

src/features/mcp-gateway/components/parts/GatewayServerDetail.tsx

src/features/mcp-gateway/components/parts/GiveAccessDialog.tsx

src/features/mcp-gateway/components/parts/avatars.tsx

src/features/mcp-servers/components/McpServersView.tsx

Reviewed by React Doctor for commit a190a1d.

…nstead of a state-sync effect

Addresses the react-doctor blocking finding (no-adjust-state-on-prop-change)
on the add-server form: the mutation now re-reads the gateway registry and
returns the created server, so the form navigates from the mutation result
instead of chaining pendingUrl state through an effect. Also derives the
role-guarded route at render in McpGatewayView rather than correcting it in
an effect, and renames the audit pager's map variable so the key reads as
the page number it is.

Generated-By: PostHog Code
Task-Id: 7ecfb6f3-39d8-4443-96e7-36e9d1ebd144
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