Skip to content

feat(cli): profile, client binding and access explain commands (Spec 108-g) - #1441

Merged
github-actions[bot] merged 7 commits into
mainfrom
108-g-cli-profiles-clients
Sep 30, 2026
Merged

github-actions[bot] merged 7 commits into
mainfrom
108-g-cli-profiles-clients

Conversation

@Dumbris

@Dumbris Dumbris commented Sep 30, 2026

Copy link
Copy Markdown
Member

Spec 108 (Profiles v3), PR 108-g: the command line for profiles, client bindings and access explain. Spec: specs/108-profiles-v3 (FR-005 stale-classification report, FR-008a guard exit and fixes, FR-021/021a/025/026/036, US4, US5-4, parity rows 1-5, 7-9, 11-14, 21, 23 and 24, CLI column). Audit findings addressed on the CLI surface: P2 (profiles manageable only in the config file), P3 (tool tier, unannotated handling and code execution on a profile), P4 (per-client identity and binding), P5 (why a tool is visible or hidden, and where a profile comes from) and P7 (tokens duplicating profiles).

What changes for users

CLI (this PR adds no REST route, MCP tool, Go enum, Web UI or macOS change; 108-h, 108-i and 108-k carry those)

  • mcpproxy profile list|show|create|update|rename|delete|classify|try|anonymous. show prints every policy field with where its effective value comes from ("off (default under max tier read)", "on (inherited)"); show --effective lists every tool with callable, visible or hidden and the reason, and flags a classification that no longer applies ("classification ignored - tool is now annotated"). try previews a draft profile (saved or brand new) against a query with --set key=value overrides and saves nothing. update is a read-modify-write of the stored fields. delete of a profile in use exits 1 and prints who uses it; the anonymous profile can only be deleted with --reassign-to. Enum input as-write and as-read is accepted and always stored as as_write and as_read.
  • mcpproxy client set-profile|lock|unlock|add|rotate|upgrade-admin-key-holders|forget. Without --lock/--switchable the current mode is kept; all means All servers; the bulk form is --from-profile/--to-profile (skipped clients print to stderr, exit 0). add and a custom rotate print the new credential once with a header snippet. A supported-client rotate previews the config change and asks to confirm (--yes; non-interactive without it exits 1 and sends nothing). upgrade-admin-key-holders previews, exits 1 without applying when the FR-008a guard would refuse, and ends with the remaining admin-key rotation step. A client without a client credential exits 1 with mcpproxy connect <id> --profile <p>.
  • client list keeps Spec 109's columns (including CONFIG PATH) and appends CREDENTIAL PROFILE MODE SOURCE BLOCKED 24H; --profile and --client filter. client show adds the credential and binding lines and PROFILE/SOURCE session columns. Warnings print to stderr in table mode with the command that fixes them.
  • mcpproxy access explain --tool <server:tool> with exactly one of --client, --token, --profile, --anonymous: the ordered chain, the verdict (exit 0 whenever an explanation is produced) and the fixes with the command that performs each.
  • token create --profile <p> (scope comes from the profile; --servers/--permissions optional; --profile-pin stays as a hidden deprecated alias with a notice; legacy flags print a hint). token list columns are now NAME PREFIX KIND CLIENT PROFILE MODE SERVERS PERMISSIONS LEGACY SCOPE REVOKED EXPIRES with --profile and --token filters; token list|show honour -o json|yaml.
  • mcpproxy doctor gains a "Profiles & clients" section and the additive JSON key profile_checks: profiles.binding_bypass and connect.admin_key_in_client_config, both derived only from the GET /api/v1/clients warnings (the same evaluator as the API refusal), so doctor never reads a client config. A daemon without /clients reports them as skipped.
  • connect's guard refusal now names mcpproxy profile anonymous <p> instead of the config key.
  • All new commands are daemon-only, exit 1 on every refusal (including text that mentions "config"), print the REST data object for -o json|yaml, and appear in --help-json.

Tests

  • New: profile_cmd_test.go, client_binding_cmd_test.go, access_cmd_test.go, token_cmd_profile_test.go, doctor_profiles_test.go, daemon_rest_test.go, help_json_108_test.go (recording fake daemon: each test asserts the request the CLI sends and what it prints), and internal/server/binding_guard_doctor_pair_v3_test.go (pins the doctor scenario pair against the one guard evaluator and the clients warning; it pins existing behaviour, so it is green on the base).
  • Declared goldens: testdata/cli109/client-list.golden, client-show.golden and client-list-help-json.golden (appended columns and new flags only; the first six client list columns are byte-identical, asserted by a test); new testdata/cli108/*.
  • Intended edits to existing tests: TestConnectProfileFlags_DaemonGuardRefusalPrintsBothFixesAndExits1 (new fix wording), TestRunTokenList_TableOutput and TestTokenCreateCmd_RequiredFlags (new columns and rules).
  • The new cmd/mcpproxy test files reference commands that do not exist on the merge base, so that package does not compile there; that is the red state.

Docs and spec

docs/cli-management-commands.md (profile, client, access explain, token, doctor) and docs/features/agent-tokens.md; spec edits limited to Phase 8 of tasks.md (T078-T085 ticked), contracts/cli.md, the FR-036 line of spec.md, the 108-g row of quickstart.md and research entry D33; ROADMAP.md regenerated.

Notes and follow-ups

  • profile update, profile classify and client lock|unlock are read-modify-write over REST, which has no ETag: a concurrent edit in the one-round-trip window is lost. Follow-up: If-Match on PUT /profiles/{name}.
  • On the command line all always means All servers; a profile literally named all can still be assigned via REST, Web or macOS. Follow-up for the REST validator owner: reserve all next to active and try.
  • client upgrade-admin-key-holders also exits 1 when some client could not be upgraded after printing the Failed list.
  • Reviewed read-only with codex gpt-6-luna in four chunks (profile commands and helper, client commands, access/token/doctor, docs); the three code chunks returned a clean verdict and the docs chunk's findings were checked and found to be misreadings.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying mcpproxy-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: d57f8b6
Status: ✅  Deploy successful!
Preview URL: https://23b6d2d7.mcpproxy-docs.pages.dev
Branch Preview URL: https://108-g-cli-profiles-clients.mcpproxy-docs.pages.dev

View logs

@codecov-commenter

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

📦 Build Artifacts

Workflow Run: View Run
Branch: 108-g-cli-profiles-clients

Available Artifacts

  • archive-darwin-amd64 (31 MB)
  • archive-darwin-arm64 (28 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-goQMQWFF.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 36780094243 --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 a2815c1 into main Sep 30, 2026
59 checks passed
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.

2 participants