Repository navigation
feat(mcp): profiles admin tool (Spec 108-h) - #1443
Merged
Merged
Conversation
Deploying mcpproxy-docs with
|
| 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 |
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.
Contributor
📦 Build ArtifactsWorkflow Run: View Run Available Artifacts
How to DownloadOption 1: GitHub Web UI (easiest)
Option 2: GitHub CLI gh run download 36786728176 --repo smart-mcp-proxy/mcpproxy-go
|
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements PR 108-h of Spec 108 (Profiles v3): the
profilesadministrator 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 intasks.md.What changes for users
MCP. A new tool
profileslets an administrator agent manage profiles and client bindings with the REST argument names and the REST result data:list,get,create,update(full replace),delete,rename,classify,assign(one client to a profile, or every client offrom_profiletoto_profile),list_clients,effective_toolsandexplain.config.ProfileConfig, so a new profile field reaches MCP automatically and nothing likeprofile_jsonexists.effective_toolsalso takesserverandreason, as the REST route does.successandrequest_idenvelope keys:profile_in_useandprofile_is_anonymous_profilewithused_by,no_client_credential,binding_bypassable_without_authwithbindingsandfixes, and validator errors withfield.profile_changewithsurface=mcpand the actor kindapi_keyorsocket.api_keyorsocket, under no profile or a profile withmanagement_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 answersunknown tool: profiles.read_only_modeanddisable_managementare read per call from the live configuration. The tool stays listed under both, the read operations keep working, and the six mutating operations answerOperation not allowed in read-only modeorServer 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 RESTtools/calldispatch and not reachable fromcode_execution.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.Classifynow returns the profile and its warnings (thePUTshape) instead of only the profile.Internals
internal/httpapi:profiles_error_body.go(the shared status and body mapping),admin_views.goandclients_views.go(admin read views that both the REST handlers and the tool use; a server-edition stub answersclient not found),handleAccessExplaindelegates toExplainAccess, andhandleGetClientstoclientsListResponse.internal/server:mcp_profiles_tool.go,mcp_profiles_tool_schema.go, registration in the three builders and aprofilescase in the profile tool filter, wired withSetAdminViewsnext toSetProfilesService.CLAUDE.mdbuilt-in tools line,contracts/mcp-tools.md, the FR-017 line ofspec.md,research.mdD34 and ticked tasks.Declared golden changes (toolsurface)
internal/server/testdata/toolslist_goldens/default_server.json,retrieve_tools_mode.json,code_execution_mode.json: only theprofilesentry is added; every other entry is byte-identical (checked withjq). The frozenpre099/andpre105/directories are untouched.internal/server/testdata/toolslist_goldens/default_server_read_only.jsonis new: the default server underread_only_mode, whereprofilesis present andupstream_servers,quarantine_security,search_serversandlist_registriesare absent.toolsListAllowedAdditionsand the menu-surface test declare the addition.bench/tokens_test.gono 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
profilesdefinition 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 RESTdata,classification_stale,assignmodes and bulk form, records, the RESTtools/calldoor 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, theprofilescolumn of the management matrix inset_profile_v3_test.go, andinternal/httpapi/profiles_error_body_test.go.Deviations from the plan and follow-ups
SetAdminViewsand 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_clientsalso accepts theclientfilter thatGET /clientshas.conflicting_tokenis a mint refusal noprofilesoperation produces.upstream_serversstill readsread_only_modeanddisable_managementfrom the construction-time configuration; onlyprofilesis live. Folding the expanded quickstart row intoquickstart.mdbelongs to 108-l.