Skip to content

feat(api): profiles and clients REST surface, config funnel and access explainer (Spec 108-f) - #1439

Merged
github-actions[bot] merged 18 commits into
mainfrom
108-f-profiles-clients-rest
Sep 30, 2026
Merged

github-actions[bot] merged 18 commits into
mainfrom
108-f-profiles-clients-rest

Conversation

@Dumbris

@Dumbris Dumbris commented Sep 30, 2026

Copy link
Copy Markdown
Member

Implements PR 108-f of Spec 108 (Profiles v3): the REST surface and runtime services for profiles and clients, on top of the merged 108-a through 108-e policy, enforcement and clients-hub work.

What changes

  • Config-write funnel (Runtime.MutateConfig): one path for every profile or client config write. It reads the desired config, applies the mutation, runs the FR-008a binding guard over the whole candidate state, re-pins tokens in a single bbolt transaction (restored on failure), applies the config, records profile_change activity and reconciles the per-profile search indexes. GET/PUT /profiles/active stay but now send Deprecation and Link headers.
  • Profiles service and routes: GET/POST /profiles, GET/PUT/DELETE /profiles/{name}, POST /profiles/{name}/rename, POST /profiles/try, GET /profiles/{name}/effective-tools, with typed validation errors (field plus the FR-007 text), 409 profile_in_use with used_by, profile_is_anonymous_profile even under force, and reassign_to with the guard delta. Scoped callers see only reachable profiles, and unreachable profiles answer with the same 404 as unknown ones.
  • Access explainer: GET /access/explain returns the nine-step chain for a client, token, anonymous caller or explicit profile. Built-in tools are rejected with 400. Scoped callers get 403.
  • Live notification: profile edits, renames and hand edits of the config file publish profiles.changed on the admin SSE stream and send tools/list_changed to affected MCP sessions once the new (index, snapshot) pair is published. Scoped SSE streams never receive either event.
  • Clients REST: rewritten list and detail (list stays read-free, detail classifies on demand and persists the observation across restarts), bindings, custom clients with display names and mcp_cli_ credentials, rotate and finalize, forget with optional disconnect, and the admin-key upgrade preview and apply with a combined precondition token. The binding guard applies to every write.
  • Tokens: profile on create sets the pin with defaults, client- names are reserved, and GET /tokens and GET /clients accept profile and client filters.
  • Generated artifacts and docs: oas/swagger.yaml, frontend contract types, docs/api/rest-api.md, and the Spec 108 documents (plan edits applied, T067 to T077 ticked).

Verification

Unit and integration tests were written first for each task. go test -race passes for the touched packages in both editions using the CI skip regex, golangci-lint reports nothing in changed files, and the frontend build and vitest, plus swift test for the tray decode check, pass. The quickstart recipe for 108-f was replayed against a scratch instance with its own data directory, covering the client and profile flows, rename with a live session, hand edit, guard refusals, scoped callers, custom client rotation and forget.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Deploying mcpproxy-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: c28dab5
Status: ✅  Deploy successful!
Preview URL: https://803902c8.mcpproxy-docs.pages.dev
Branch Preview URL: https://108-f-profiles-clients-rest.mcpproxy-docs.pages.dev

View logs

F3.1 (medium): the admin-key upgrade no longer skips a client whose config
read was denied or malformed, or whose status call failed. Such a client may
still hold the admin key, so it is now an unresolved preview row with an error,
a failed[] entry on apply, and withholds next_step (rotate_admin_api_key) until
every client is resolved. Test fails without the fix.

F5.1 (medium): the profile-change notifier remembers every published snapshot,
including ones with an empty delta, and delivers a batch once the runtime's
current snapshot is the batch's or any later one. An unrelated publication
racing a profile edit no longer strands the batch until the 5s drop. Test
fails without the fix.

F5.2 (low): a rename holds notification delivery (new
ProfileSessionHook.HoldProfileNotifications) from before the publish until
ProfileRenamed rewrote the stored selections, so the client's re-list follows
the rename. Residual: an unrelated request in the publish-to-rewrite window
can still resolve the old selection; not closed here.

F4.1 (low): PUT /profiles/{name} keeps the nameless-body convenience; an empty
name is handled like an omitted one (already true, now tested). Documented as
accepted-by-spec in docs/api/rest-api.md and contracts/rest-api.md; swagger
regenerated.

sol:6b.1 (low): the conservative-guard delete test could not fail (auth was
on). Replaced by a test with require_mcp_auth off and a spy guard that
refuses the post-reassign binding; it fails if the funnel stops consulting
the guard. Note: the real conservative guard never refuses a delete-with-
reassign of an already-bound client (not newly bypassable), so the refusal is
driven by the spy.
Round 2 confirmed F3.1 and F5.2 fixed (both tests fail if reverted). The
residual lows it named are closed here, test-first.

F1.1 (low): the admin-key upgrade guard (FR-008a) judged every preview row,
including unresolved clients and failed previews that the apply never writes.
With a named profile that could refuse a request minting nothing, and named
clients that would receive no binding. The guard now considers only rows
without an error. Test fails without the fix.

F1.2 (low): awaitPublished counted the time a rename held delivery against
its publish deadline, so a rename outlasting waitFor (5s) dropped the batch.
A held notifier now resets the deadline. Test fails without the fix.

F1.3 (low): the held() check and deliver() were separate, so a rename could
begin between them. The check and a delivering flag are now atomic under one
mutex, and hold() waits for an in-flight delivery. Test fails without the fix.
Comment thread internal/index/bleve.go Fixed
@github-actions

Copy link
Copy Markdown
Contributor

📦 Build Artifacts

Workflow Run: View Run
Branch: 108-f-profiles-clients-rest

Available Artifacts

  • archive-darwin-amd64 (31 MB)
  • archive-darwin-arm64 (27 MB)
  • archive-linux-amd64 (18 MB)
  • archive-linux-arm64 (16 MB)
  • archive-windows-amd64 (30 MB)
  • archive-windows-arm64 (27 MB)
  • frontend-dist-pr (0 MB)
  • installer-dmg-darwin-amd64 (25 MB)
  • installer-dmg-darwin-arm64 (23 MB)
  • smart-mcp-proxymcpproxy-go2HZX0K.dockerbuild (0 MB)

How to Download

Option 1: GitHub Web UI (easiest)

  1. Go to the workflow run page linked above
  2. Scroll to the bottom "Artifacts" section
  3. Click on the artifact you want to download

Option 2: GitHub CLI

gh run download 36769738698 --repo smart-mcp-proxy/mcpproxy-go

Note: Artifacts expire in 14 days.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved (Model B): Paperclip review verdicts = ACCEPT and qa-gate green at this head SHA. Arming auto-merge; GitHub merges when all required checks pass.

@github-actions
github-actions Bot merged commit 337eecf into main Sep 30, 2026
60 checks passed
github-actions Bot pushed a commit that referenced this pull request Oct 1, 2026
…ewing chip (Spec 108-i) (#1444)

## Summary

Spec 108 PR 108-i: the Web UI for profiles, client bindings, token
profiles, the access explainer and the header Viewing chip. It is
frontend-only (plus the e2e sweep, scripts/docs and spec docs). REST,
CLI, MCP and the macOS app are unchanged here: the REST surface is 108-f
(#1439), the CLI and MCP tool are 108-g and 108-h, the macOS app is
108-k.

Spec: `specs/108-profiles-v3` (FR-005, FR-008a, FR-021 to FR-026, FR-040
to FR-046; tasks T090 to T103 including T042w and T098a; decisions
recorded as D35 in research.md). Audit group `108-i`; it removes the
header "Profile:" switcher that read as agent scoping (P1) and gives the
admin-key remediation a Web path (P4).

## What changes for the user

**Profiles page (`/profiles`)**
- Card grid: title and slug, max tier, tool counts by tier, unannotated
hidden, who uses the profile (administrators only), calls and blocked in
24 h, and Tools, Activity, Clients and Tokens links that carry
`?profile=` through the link map.
- An "All servers" card comes first and shows the anonymous status with
a link to Settings.
- "Add profile" (also `+ Add` and the palette via `?create=1`) creates a
profile in one dialog: name, title, servers and a starting point
(Read-only, Read + write, Everything, Custom).
- Card actions: Edit, Assign to client, Create token with this profile,
Delete.
- A server-edition tenant sees the page read-only without `used_by`.

**Profile editor (`/profiles/:name`)**
- Form with title and description counters, servers (unknown ones
flagged), max tier, unannotated handling, code execution and management
tools (On, Off, Inherit), "Agent may switch to", and "Assigned to".
- Per-tool table from `effective-tools`: tier, the access reason in
words, Allow and Deny toggles, Classify for unannotated tools, and the
stale-classification marker "classification ignored — tool is now
annotated".
- Edits change a local draft with a sticky Save and Discard footer; the
PUT body follows the omission semantics. A 400 marks the field, a 409
guard refusal keeps the draft and shows the two fix buttons.
- "Try it" posts the current draft to `/profiles/try`. Rename and Delete
list what moves first (clients with mode, tokens, `switchable_to`
references, anonymous callers); delete requires a target unless "leave
them without a profile" is chosen, which is not offered for the
anonymous profile.
- `?focus=server:tool` rings the row, sets `aria-current`, focuses its
Allow toggle and announces it; if the server is not in the profile it
offers to add it.
- A `profiles.changed` event never overwrites an unsaved draft; it shows
"This profile changed elsewhere" with Reload.

**Clients page**
- One "Profile" column is appended after Config path; Spec 109's columns
are unchanged. The chip shows `Work · Read-only · locked by credential`
(or `switchable`), a Locked switch, the credential badge and blocked
calls. Selecting a profile sends the binding without a mode.
- Rows with no client credential disable the chip and switch and offer
"Upgrade to client credential" or "Reconnect", which opens the connect
dialog on that client.
- Warnings banner (`role="status"`, severity in text) for every warning
code, each with its action.
- Toolbar: "Move clients…" (bulk, with the skipped list), "Upgrade
admin-key clients…" (preview, guard, apply with the combined
precondition token, then the "Rotate the admin API key" panel; the
dialog never rotates the key) and "Add other client…" (custom client;
the credential is shown once and cleared on close).
- Expanded row: credential details, staged Rotate (supported clients
preview first; custom clients show the new credential once, then a
pending badge and "Finalize now"), Forget, and "Explain access…".
- The profile and client filters of the URL contract are sent to `GET
/clients` and `GET /tokens`.

**Connect dialog (T042w)**: profile picker and Locked switch, the masked
`mcp_cli_••••` credential and the notice that the admin key is never
written, the management-tools notice, a keyless option only while
authentication is off, guard and token-name-conflict errors, and the
same profile for a bulk connect.

**Token dialog**: Profile first, with "None — legacy scope" enabling the
legacy fields; the list shows Kind, Profile, Mode and a Legacy scope
badge; client-credential rows are read-only with a pointer to Clients.

**Settings → Security**: "Anonymous callers" profile selector with the
binding-guard explanation. A guard fix button navigates here with the
value preselected and never saves.

**Header**: the Viewing chip replaces the profile switcher. It reads and
writes the URL filter contract, never calls a binding route, collapses
to an icon below 1100 px, and is hidden for tenants and when there is
nothing to filter by.

## Deviations from the plan (recorded in research.md D35)

- The anonymous setting saves through a new `setAnonymousProfile` API
method (PATCH `/config`) instead of `patchConfig`, because `patchConfig`
drops the 409 body.
- The static "Other client?" snippet stays (existing tests pin it) and
points at "Add other client…".
- The connect dialog sends profile, mode and keyless only after a
binding control was touched, so a reconnect keeps the credential's
binding.
- `explain_blocked.json` already has the F24 shape, so the conditional
Go fixture change did not happen and this PR changes no Go file.
- `Settings.vue` already highlights `?focus=<key>` rows, so
`SettingsSection` needed no `focus` prop.
- Tokens under "Assigned to" link to the Tokens tab (no route re-pins a
token).
- The `/tokens` redirect route gets the name `tokens` that the link map
already assumed.

## Tests

New vitest specs: `profiles-page`, `profile-policy-editor`,
`client-binding-controls`, `token-dialog-profile`, `access-explainer`,
`viewing-filter`, `contract-fixtures`, `connect-profile-fields`,
`settings-anonymous-profile`, `api-error-body`, `profiles-sse-refresh`.
New Playwright spec `e2e/web-ui-sweep/profiles-clients.spec.ts` (seeded
over REST by `profiles-seed.ts`), listed in `scripts/run-web-smoke.sh`;
`visual-a11y-sweep.spec.ts` gains the Profiles, editor and Clients
routes in both themes; `navigation-consistency.spec.ts` now expects the
Profiles sidebar entry and the Profile item in the Add menu.

Existing specs updated: `header-layout`, `top-header-tenant-gating` (the
profile population gate moved to the chip), `auth-shell-recovery`,
`connect-preview` (credential notice replaces the API-key notice).
Deleted with the component: `profile-switcher` and
`profile-switcher-hidden`.

## Follow-ups

The Tools and Activity entry points of the explainer and the Tools
view-as and Activity attribution UI are 108-j.
github-actions Bot pushed a commit that referenced this pull request Oct 1, 2026
…nd explainer (Spec 108-k) (#1442)

## Summary

Spec 108-k (`specs/108-profiles-v3`, tasks T110a to T120 and T042m): the
macOS app and tray learn profiles, per-client bindings, token profiles,
scoped views and the access explainer. It consumes the REST surface
merged in 108-f (#1439); it changes no Go, frontend, `oas` or contract
file.

## What a user sees

- **Profiles page.** A new sidebar item in Connect (Clients, Profiles,
Servers, Tools) and a "Profile" entry in the toolbar "+" menu. An "All
servers" card first, then one card per profile with its tier, tool
counts, what uses it, calls and blocked calls in 24 h, and Tools,
Activity, Clients and Tokens links that open filtered by that profile.
The editor covers every profile field, a per-tool table with Allow, Deny
and Classify (unannotated tools only), the stale-classification marker,
"Try it" on the unsaved draft, "Assigned to", and rename and delete
sheets that list what they move and require a target.
- **Clients.** A binding label and credential badge on each row; in the
detail a profile Picker, a Locked toggle, credential state and expiry,
blocked calls, Rotate, Finalize rotation, Forget and Explain access. A
client without an active client credential gets no working picker, only
"Upgrade to client credential…" or "Reconnect…". A warnings banner,
"Move Clients…", "Upgrade Admin-Key Clients…" and "Other Client…" (the
credential is shown once, never stored). A binding-guard refusal shows
both fixes; the fix buttons only open Settings.
- **Connect sheet.** Profile Picker and Locked toggle, the masked
`mcp_cli_••••` credential line in place of the API-key notice, the
notice that a client credential cannot reach management tools unless the
profile allows them, keyless under Advanced only while authentication is
off, and the CLI-format result line. Nothing about the binding is sent
until the controls are touched, so a reconnect keeps its binding.
- **Tray.** The "Profile:" switcher is gone. A "Clients" submenu lists
each credentialed or connected client as `name — profile 🔒` with the
profile list, a checkmark and Lock or Unlock; a client without a
credential offers "Upgrade to client credential…". Glance client rows
open that client's activity once the core attributes calls.
- **Agent Tokens.** Create Token asks for a Profile and an Expiry; the
legacy servers and permissions sit under "Legacy scope (advanced)". The
list shows kind, profile chip and mode, read-only legacy scope with a
"Migrate to a profile" hint, no Revoke on client credentials, and
Profile and token-name filters.
- **Settings.** Security gains "Anonymous callers" (PATCH
`anonymous_profile`, guard refusal shown, fix buttons preselect without
saving) and scroll-to-and-highlight for `require_mcp_auth`.
- **Scoped views.** Activity gets a Caller column and Profile, Client
and Token pickers; Tools gets "View as" with greyed rows, reasons and a
"Why?" button; Home filters usage and sessions and shows Profile and
Source columns; Servers filters by profile.
- **Live refresh.** SSE `profiles.changed` and `client.binding_changed`
refresh the lists (debounced).

The command-number shortcuts shift: Profiles is third, so Servers is now
⌘4, Tools ⌘5, Review Queue ⌘6, Secrets ⌘7, Activity ⌘8 (documented in
`docs/development/macos-tray.md`).

## Audit findings addressed

The macOS column of the parity matrix for profiles, client bindings,
credential state, token profile and expiry, anonymous callers, view-as,
attribution columns, bulk move, admin-key upgrade, rotate, forget,
custom client, explainer and the tray Clients submenu (FR-005 editor
marker, FR-047 to FR-050, T042m).

## Spec

`specs/108-profiles-v3` (tasks.md Phase 12 ticked, FR-047 to FR-049
wording, quickstart row, research D36).

## Tests

New suites: `ProfilesV3ContractTests`, `ClientsTrayMenuTests`,
`ProfileEditorModelTests`, `ClientBindingModelTests`,
`AccessExplainerModelTests`, `TokensCreateModelTests`,
`AnonymousProfileSectionTests`, `APIClientProfilesTests`. Extended in
place: `NavigationStructureTests`, `ScopeFilterTests`,
`ConnectClientModelTests`, `ProfileModelsTests`, `TrayAuditMenuTests`
(inverted), `TrayPresentationTests`. The full suite passes (1575 tests).
The new tests do not compile on the merge base, which lacks the models
they use.

## Deviations from the plan

- Activity shows one "Caller" column (client, profile with source,
token, block reason) instead of three columns, to keep the list usable
next to the detail panel at 800 pt; the detail panel carries each field
separately.
- Delete requires a "Move them to" target whenever anything is listed
(identical to the Web plan).
- Accessibility id is `toolbar-add-Profile`, capitalised like the other
109-i ids.
- The token list model now decodes the real response shape (`name`,
`allowed_servers`); the old model required an `id` and read `servers`,
and the old Create Token sheet sent `servers`, which the core ignores.
- There is no separate F24 access-explanation fixture on main;
`explain_blocked.json` already carries `subject.kind` and is decoded.
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.

3 participants