Skip to content

feat(mcp): profiles admin tool (Spec 108-h) - #1443

Merged
github-actions[bot] merged 7 commits into
mainfrom
108-h-mcp-profiles-tool
Sep 30, 2026
Merged

github-actions[bot] merged 7 commits into
mainfrom
108-h-mcp-profiles-tool

Conversation

@Dumbris

@Dumbris Dumbris commented Sep 30, 2026

Copy link
Copy Markdown
Member

Implements PR 108-h of Spec 108 (Profiles v3): the profiles administrator MCP tool. Spec: specs/108-profiles-v3 (FR-005, FR-008a, FR-016, FR-017, FR-030, FR-037; parity rows 1-5, 7-9, 14, 18 and 21, MCP column). Closes tasks T086, T087, T088 and T089 of Phase 9 in tasks.md.

What changes for users

MCP. A new tool profiles lets an administrator agent manage profiles and client bindings with the REST argument names and the REST result data:

  • Operations: list, get, create, update (full replace), delete, rename, classify, assign (one client to a profile, or every client of from_profile to to_profile), list_clients, effective_tools and explain.
  • The input schema is generated by reflection from config.ProfileConfig, so a new profile field reaches MCP automatically and nothing like profile_json exists. effective_tools also takes server and reason, as the REST route does.
  • Errors are the REST error body without the success and request_id envelope keys: profile_in_use and profile_is_anonymous_profile with used_by, no_client_credential, binding_bypassable_without_auth with bindings and fixes, and validator errors with field.
  • Every mutating operation goes through the same services as its REST route, so the FR-008a binding guard runs first and a refusal writes nothing. Each write records profile_change with surface=mcp and the actor kind api_key or socket.
  • Visibility follows FR-017: only an administrator credential of kind api_key or socket, under no profile or a profile with management_tools: true. An anonymous caller (even an unconfined one), an agent token, a client credential and a profile with the field unset or false neither list nor can call it; a hidden call answers unknown tool: profiles.
  • read_only_mode and disable_management are read per call from the live configuration. The tool stays listed under both, the read operations keep working, and the six mutating operations answer Operation not allowed in read-only mode or Server management is disabled for security. It is registered on the default, call-tool and code-execution servers, never on the direct server, never in the REST tools/call dispatch and not reachable from code_execution.
  • In the server edition the client operations answer client not found, the same text REST gives there.

REST, CLI, Web UI, macOS app. No route, field or wire shape changes, so swagger and the frontend contract types are unchanged. The REST error writers now share one mapping (httpapi.ProfilesErrorBody) with MCP; bodies are the same apart from JSON key order. ProfilesService.Classify now returns the profile and its warnings (the PUT shape) instead of only the profile.

Internals

  • internal/httpapi: profiles_error_body.go (the shared status and body mapping), admin_views.go and clients_views.go (admin read views that both the REST handlers and the tool use; a server-edition stub answers client not found), handleAccessExplain delegates to ExplainAccess, and handleGetClients to clientsListResponse.
  • internal/server: mcp_profiles_tool.go, mcp_profiles_tool_schema.go, registration in the three builders and a profiles case in the profile tool filter, wired with SetAdminViews next to SetProfilesService.
  • CLAUDE.md built-in tools line, contracts/mcp-tools.md, the FR-017 line of spec.md, research.md D34 and ticked tasks.

Declared golden changes (toolsurface)

  • internal/server/testdata/toolslist_goldens/default_server.json, retrieve_tools_mode.json, code_execution_mode.json: only the profiles entry is added; every other entry is byte-identical (checked with jq). The frozen pre099/ and pre105/ directories are untouched.
  • internal/server/testdata/toolslist_goldens/default_server_read_only.json is new: the default server under read_only_mode, where profiles is present and upstream_servers, quarantine_security, search_servers and list_registries are absent.
  • toolsListAllowedAdditions and the menu-surface test declare the addition. bench/tokens_test.go no longer requires the code_execution menu to stay under the 45-tool micro-corpus baseline, because the benchmark catalog (built from the live builders on purpose) now carries this tool; the arithmetic checks stay.

Tool-surface cost

The profiles definition is 4,099 bytes (description plus input schema) and 867 cl100k tokens, inside the 1,200-token budget. It is listed only to administrator sessions. At $3 and $15 per million input tokens that is about $2.60 and $13.00 per thousand administrator sessions, uncached, for Sonnet-class and Opus-class input prices.

Tests added

  • internal/server/mcp_profiles_tool_v3_test.go: argument and omission parity, error parity against REST, read results equal to REST data, classification_stale, assign modes and bulk form, records, the REST tools/call door and the code sandbox.
  • internal/server/mcp_profiles_guard_coverage_v3_test.go: every operation of the built schema is classified, and each mutating one is refused by the guard with config bytes, token store and record count unchanged.
  • internal/server/mcp_profiles_visibility_v3_test.go: the visibility table through the filter, the handler and real mcp-go surfaces, the two global gates, hot reload and refusal records.
  • internal/server/mcp_profiles_notify_v3_test.go, mcp_profiles_tool_server_v3_test.go (server edition), toolslist_profiles_v3_test.go, the profiles column of the management matrix in set_profile_v3_test.go, and internal/httpapi/profiles_error_body_test.go.

Deviations from the plan and follow-ups

  • The narrow interface installed on the proxy is SetAdminViews and covers the profile list, get, effective-tools and explain reads as well as the client views, so all read data comes from one implementation.
  • list_clients also accepts the client filter that GET /clients has. conflicting_token is a mint refusal no profiles operation produces.
  • Follow-up: upstream_servers still reads read_only_mode and disable_management from the construction-time configuration; only profiles is live. Folding the expanded quickstart row into quickstart.md belongs to 108-l.

@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: 4941ad1
Status: ✅  Deploy successful!
Preview URL: https://be579043.mcpproxy-docs.pages.dev
Branch Preview URL: https://108-h-mcp-profiles-tool.mcpproxy-docs.pages.dev

View logs

F2.1 (medium, fixed): the profiles tool's create/update copied only known
ProfileConfig keys before decoding, so a top-level typo such as max_teir was
silently dropped while REST rejects it with 400. profileConfigFromArgs now
refuses any argument outside the ProfileConfig fields, operation and the
declared operation arguments, naming the field. Test-first:
TestProfilesTool_UnknownTopLevelArgumentRefused fails without the fix.
@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

📦 Build Artifacts

Workflow Run: View Run
Branch: 108-h-mcp-profiles-tool

Available Artifacts

  • archive-darwin-amd64 (31 MB)
  • archive-darwin-arm64 (28 MB)
  • archive-linux-amd64 (18 MB)
  • archive-linux-arm64 (17 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-goYWF6D2.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 36786728176 --repo smart-mcp-proxy/mcpproxy-go

Note: Artifacts expire in 14 days.

@codecov-commenter

Copy link
Copy Markdown

@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 9031f9d 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