Repository navigation
feat(skills): hold, scan, approve and block upstream skills (spec 125, PR-2) - #1923
Merged
Merged
Conversation
…ignatures) Related #1895
…/block API, skill_quarantine_change activity Related #1895
…s collect nothing The scanner needs about a second for 48 KiB of text. One refresh scans for 45 seconds and leaves the rest to a follow-up refresh; a scan of one skill stops after two minutes (time_limit) and is not repeated. The scan cap is 1 MiB of text per skill. An approval or block writes records only, so it cannot delete blobs a running refresh has staged. Related #1895
…ad door for a scoped caller Related #1895
- a scan with degraded coverage is not progress, so it schedules no follow-up - a background trigger that finds a refresh running is followed by one more refresh instead of joining one that may already have decided - the refresh answer reads records and incarnation as one settled answer - CLI: text is bound to the listed digest, structured output keeps direction and control characters off the terminal, an unwritten review sends no approval, a refusal that quotes skill names always exits 1 Related #1895
- every content that is newly held gets its activity row: a further change while already held, and a skill back from unusable with other content - CLI: a file the listing does not have is refused without a request; any refusal by the core exits 1 whatever a skill name in it says Related #1895
…d retries A skill whose scan stays degraded and takes the whole scan budget was retried first on every refresh, so the skills listed after it were never scanned. It now keeps its earlier result and is retried with the time that is left. Related #1895
A degraded first scan that used the scan budget left the skills after it without a follow-up. A follow-up now runs whenever the refresh gave a skill its first scan and never-scanned skills remain, so the chain ends once every skill has been scanned once; retries of degraded scans start none. Related #1895
…ns, CLAUDE.md line Related #1895
Deploying mcpproxy-docs with
|
| Latest commit: |
80f1ef9
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://f6cd38b4.mcpproxy-docs.pages.dev |
| Branch Preview URL: | https://125-skills-pr2-gate.mcpproxy-docs.pages.dev |
Dumbris
enabled auto-merge (squash)
November 17, 2026 06:15
On Windows the real clock ticks too coarsely for a tiny budget to have passed after one fake scan, so two budget tests scanned every skill in one refresh. The budget is now read through skillsLimits.scanClock, which the tests step. Related #1895
Contributor
📦 Build ArtifactsWorkflow Run: View Run Available Artifacts
How to DownloadOption 1: GitHub Web UI (easiest)
Option 2: GitHub CLI gh run download 44033261574 --repo smart-mcp-proxy/mcpproxy-go
|
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Dumbris
added a commit
that referenced
this pull request
Nov 17, 2026
## What failed `TestRetire_LauncherControl_LaunchesWhenNotRetired` (`internal/upstream`) failed three times in one day on loaded runners: in "Unit Tests (ubuntu-latest)" and "Unit Tests (shuffle)" on #1923, and again on `main` after that PR merged. Each time: "Condition never satisfied", with sibling shell-spawning tests taking 12 s in the same log. ## Cause The control's launcher waited 500 ms for its URL and then killed the command. A shell that needs longer than that to start is killed before it touches the marker file the test waits for. The connect itself had a 4 s limit. ## Change (tests only) - The two controls (launcher, Docker) connect in the background with a 60 s budget; the connect is cancelled and awaited when the test ends. - The launcher control waits the whole budget for the URL, so a slow shell is not killed early. - Both return as soon as the launch is seen, so a healthy run takes as long as before (package: 33 s under `-race`). ## Checked With the marker shell delayed by 2 s (`sleep 2; touch …`), the old 500 ms wait fails with the same message as CI and the new fixture passes in 3.6 s. `go test -race ./internal/upstream/` passes; the four tests pass five times in a row.
Dumbris
added a commit
that referenced
this pull request
Nov 18, 2026
…tools (spec 125, PR-3) (#1928) Related #1895 (spec 125, PR-3 of 5). Builds on #1921 and #1923. ## What this adds Approved skills become reachable by agents, in every MCP client, through three read-only built-in tools. `enable_skills` stays off by default; with it off the tool list is what it was before. - **`retrieve_skills(query, limit)`**: search over the skills available to the caller. Returns id, name, origin server, description, number of files and size, never a skill body. - **`load_skill(id, offset, limit, version)`**: the approved `SKILL.md` with a header that names its origin and says it is untrusted text from an upstream server, plus the list of the skill's files. - **`read_skill_file(id, path, offset, limit, version)`**: one supporting text file of the approved copy. How they behave: - **Approved copy only.** Text comes from the copy that was approved, re-checked against its SHA-256 before every answer. A skill that changed upstream is held and answers `skill not found` until the change is approved; nothing of the new text reaches an agent before that. - **One refusal.** Unknown, pending, changed, blocked, unusable, no longer listed, server disabled, quarantined or excluded, out of the caller's reach, feature off, a stored copy that fails its check: all answer `skill not found: <id>`, byte for byte the same. - **Server reach decides.** Agent token, profile and pinned profile apply as they do for the server's tools. A profile's tool rules do not apply (the tools only read). - **Long files** come in parts of at most 60,000 bytes, cut on character boundaries, with the offset that continues them. - **Where they are offered.** On every surface that offers `retrieve_tools`, and on the direct surface. Not on `/mcp/s/<server>`, not callable from `code_execution`. One function (`RefreshSkillsAvailability`) makes every surface follow the live switch. - **Search index.** Memory-only Bleve index in `internal/skills/index`, one per reach, rebuilt lazily when skills or the configuration change. - **Activity.** Every search, load and read writes a `skill_access` row (action, id, outcome, sizes, caller; never the text). - **REST.** `GET /api/v1/servers/{id}/skills` and `…/skills/content` now also answer a scoped agent token whose reach includes the server: available skills only, from the approved copy, through the same output policy. Refresh, approve, block and unblock stay administrator-only. - **Instructions.** The default MCP instructions and `mcpproxy agent-instructions` name the skill tools while they are offered. - **Docs**: `docs/features/skills.md` "Skills for agents", REST and agent-instructions pages. ## Decisions taken without asking Each is the maintainer's to overrule. 1. **`version` on `load_skill` and `read_skill_file`.** The header names the approved content hash, and a continuation carrying an older one is refused. Without it, a new approval in the middle of a long read would join parts of two versions into one text. 2. **`skill_access` rows are administrator-only.** A row names the id its caller asked for, which can be a held skill on a server another token can see. The plan had them filtered by server reach. 3. **A damaged stored copy answers `skill not found`**, like every other reason. The reason is in the activity row (`damaged`) and on the skill's record. The first draft had a separate message. 4. **The output sanitisation policy is applied to the whole file, then the file is cut into parts.** Offsets are positions in the text as served. A file larger than 4 MiB is withheld under a policy that blocks or redacts (the detector needs seconds per MiB). 5. **Names, descriptions and file names pass the same policy.** Under a blocking policy a word with a critical secret is replaced by a marker. A skill whose path or address the policy would change is left out of listings. 6. **`tool_response_limit` does not shrink a skill part.** A part has its own bound and can be continued; the truncation of tool output cannot. 7. **Records of skills a server no longer names are bounded** (200 per server, oldest dropped, blocked ones kept). A server that renames its skills on every listing could otherwise grow the store. 8. **Server edition:** a non-administrator user session is still refused on every skills endpoint. A user's reach over shared and personal servers is not defined for skills yet. 9. **Reserved names on single-server endpoints.** On `/mcp/s/<server>` an upstream tool that the server itself calls `load_skill` stays that server's tool; no built-in skill tool exists there. FR-023b now says so. ## Not in this change - Review queue and attention list entries for held skills, and the macOS tray labels for the two skills activity types (rest of task T031). - Web UI (PR-4) and the native skills extension on `/mcp/s/<server>` (PR-5). - The tool-result path keeps the secret detector it was started with (none when no blocking or redacting policy was configured at start). Skills use their own, built from the live settings. Making tool results follow a reload the same way is a separate change. ## CI fixes carried by this change - `internal/oauth`: `reserveLoopbackPort` could return the same port twice on the Windows runner, which failed `TestPinnedPortKeepsStaticCredentials`. A port is now returned once per test process. - `unit-tests.yml`: the package timeout of the Windows and Unix unit test steps goes from 40m to 60m. `internal/server` takes 2116-2206s on Windows on main; with the skills tests (about 110s more) one run hit the 40m bound. ## Review Cross-model review with opencode `gpt-6.1-sol`, four chunks (index and runtime; scoped REST; the tools; registration and activity), eight rounds until every chunk was clean (registration and activity after three, index and REST after five, the tools after eight). Fixed on the way, each with a test: - search: one shared index let skills outside a caller's reach move the order of its results; a total could count a skill held behind the index's back; an index could be built from an old configuration and stamped as current; - output policy: a secret could be fetched in two halves across parts; header words, search metadata and the spotlight fence bypassed it; scoped REST reads bypassed it; a blocking policy scanned only the first 1 MiB, and later sized its scan from the setting, not from the detector's own limit; a policy switched on after start found no detector, and detection settings changed by a reload did not reach skills; - visibility: access rows could show a held skill's name to another token; a damaged copy had its own answer; - robustness: a failed read could mark a newer, healthy approval unusable; records of unlisted skills and the per-server record scan were unbounded; - activity: REST reads by agent tokens, invalid calls and early returns were not recorded. Declined, with the reason in the spec or contract: tenant sessions on the skills routes; upstream tool names on single-server endpoints; a server outside reach is refused by the server-scope guard and is not a skill access. ## Tests All run locally on the final tree: - `go test -race` on `internal/skills/...`, `storage`, `httpapi` (both editions), `serveredition`, `contracts`, `cliclient`, `config`, `security`, `cmd/mcpproxy`, `internal/runtime/...`, and `internal/server/...` with the CI skip list; - `TestE2E_SkillsOverMCP`: a real MCP client session against 25 fixture skills (`tools/list`, search, load, read, switch off and on); the largest search answer is 1,762 tokens (SC-003: under 2,000); - tests against the real catalog: a change held and re-approved, every unavailability reason answering the same refusal, a damaged copy, a multi-part read joined back to the approved bytes, scope by token, profile and pinned profile; - `golangci-lint` v2 bare and `--build-tags server`; `make swagger-verify`; `scripts/check-upstream-write-sites.sh`; `scripts/check-no-unquarantine-callers.sh`; - frontend type check and unit tests; the docs site build; `./scripts/test-api-e2e.sh`. Not done: no check against a real skills server this time (the tools read only the store; PR-2 checked ingestion against `https://huggingface.co/mcp`), and no check in a real MCP client such as Claude Code or Cursor.
Dumbris
added a commit
that referenced
this pull request
Nov 21, 2026
…PR-4a) (#1950) Related #1895 (spec 125, PR-4a of 5). Builds on #1921, #1923, #1928. ## What this adds A **Skills** tab on the server page of the Web UI, for administrators. It is shown when the server's skills listing says the feature is on and the server supports skills (or has skill records); never for a server-edition tenant user and never for an agent-token listing. - List with state chips (Awaiting review, Changed, Approved, Blocked, Unusable) and whether agents are offered the skill. - File list, and a viewer for text files of the current or the approved copy, read in parts (Load more). Binary files are listed, never shown. - Changes since the approved copy: added / removed / changed files by digest, and a line diff of one changed text file (unchanged runs collapsed, output capped). A removed file, or an approved text file now replaced by a binary one, can still be opened from the approved copy. - Scan verdict, completeness and findings. - Approve, Block, Unblock, Refresh. Live reload on `skills.changed`. ## Review binding - Approve sends the hash and server incarnation of the version the reviewer **opened**. If the skill changes while it is open (a reload with a new hash, a 409 `review_out_of_date` / `server_replaced`, or a viewer part with another digest), the review is marked stale at once, Approve is disabled, and only re-opening the new version enables it again, even if the follow-up reload fails. A live `skills.changed` turns Approve off until a reload for the server applies (unchanged hash → back on; moved hash → stale). The approve/block routes send `server_replaced` in the message only (no `error_code`), so the UI reads the code from the message prefix. A 409 is never retried. - Every part the viewer and the diff read must carry the digest and offset listed for that file and copy; parts of two versions are never joined. - Upstream-written text (names, descriptions, file names, file text, finding evidence) is rendered as text only; a test fails on any `v-html` in the skills components. - Late or out-of-order answers (server switch, skill switch, file or copy switch, a refresh overtaken by a newer load, an unmounted view) never replace newer state or write another view's URL. - The success notice says whether agents are offered the skill, from the listing after the approve. ## QA handoff **Fixture.** `cmd/skillsfixture` — a loopback-only skills upstream (refuses a non-loopback `-addr` and a foreign `Host`; `POST /_fixture/mutate?skill=&file=` needs `X-Skills-Fixture: mutate` and refuses any `Origin`). Three skills: `plain`, `with-files` (`notes.txt` + binary `logo.bin`), `big` (`data/large.txt`, 150 KiB, read in parts). **Exact commands** (from the repo root, on the checked commit): ```bash ./scripts/run-skills-tab-sweep.sh --self-test-first --out tmp/skills-sweep --report-html tmp/skills-sweep/report.html ``` By default the script builds the frontend and the core from the checkout itself (`npm ci` if needed, `npm run build`, copies the build into `web/frontend/dist`, `go build ./cmd/mcpproxy` into its scratch dir) and builds `cmd/skillsfixture`. To test a given binary instead (the release gate does this), set `MCPPROXY_BINARY_PATH=<path to mcpproxy>` and optionally `SKILLS_FIXTURE_BINARY`. It then starts the fixture and a throwaway core on free loopback ports with a scratch data dir and a clean environment (`env -i`: no `MCPPROXY_*` of yours reaches it; a data dir under `~/.mcpproxy` is refused), approves the server, runs `e2e/web-ui-sweep/skills-tab.spec.ts`, reads the skill records back after each action, writes `skills-sweep-results.json`, redacts the throwaway key and local paths from everything it writes or prints (including npm, go, Playwright output), stops exactly the processes it started, and exits non-zero on any failure. Offline: set `PW_CHROMIUM` to a local Chrome. `--self-test` alone checks isolation, cleanup and redaction without a browser. **Checked commit.** `459a4d274` (clean tree; evidence committed in the commit after it). Evidence committed in `specs/125-skills-over-mcp/verification/` (`skills-sweep-results.json`, `report.html` without screenshots). All 8 scenarios passed on the first attempt: 1. the Skills tab lists the fixture skills as awaiting review 2. views SKILL.md, pages a large file (every part checked for the listed digest and contiguous offsets), does not offer a binary file 3. approve turns the chip to Approved 4. an upstream change plus Refresh shows Changed with a file diff and a line diff 5. a pending skill changed while open is stale, with Approve disabled until re-opened 6. a refresh through the REST API marks the open review stale by the live event alone 7. block and unblock 8. the tab survives a reload through `?tab=skills`, no page error **Approved / blocked results** (read back from `GET /api/v1/servers/skillsfx/skills`, incarnation 1 throughout): | After | plain | with-files | big | |---|---|---|---| | approve | approved, offered to agents, current = approved `b23404c9` | pending, not offered | pending, not offered | | approve-changed | approved, offered to agents, current = approved `03097acd` | pending, not offered | pending, not offered | | block | approved, offered to agents, current = approved `03097acd` | pending, blocked, not offered | pending, not offered | | unblock | approved, offered to agents, current = approved `03097acd` | pending, not offered | pending, not offered | `with-files` and `big` change upstream during scenarios 5 and 6, so their current hashes move; neither is ever offered to agents. **Release gate.** The sweep runs on every tag as the advisory entry `advisory/skills-tab-sweep` in the `web-ui-sweep` job (through `release-gate run-suite --advisory`, with `--self-test-first`), so a failure shows in the verdict's advisory failures and never blocks a tag. The job timeout goes from 20 to 35 minutes for the two sweeps. Blocking entries and the verdict rules are unchanged. ## Decisions taken without asking 1. PR-4 is split: this tab now, review queue + Home attention rows + macOS labels in PR-4b (separate PR), so each merges on its own. 2. The API client keeps a failure's `error_code` (`errorCode`, additive; other callers unchanged). 3. Approve is offered for pending and changed skills that are not blocked; the scan result is shown above it and does not gate it (the server's trust mode decides, as for tools). 4. The line diff only runs when both copies are text and at most 256 KiB; unchanged runs collapse to 3 lines of context; more than 5,000 output lines reports "too large". 5. Refresh errors follow what the backend sends (`refresh_superseded`, `skills_not_supported`, `skills_disabled`, `server_replaced`); the REST contract line that named `refresh_in_progress` (never sent) is corrected. ## Known limitation A hot-reloaded `enable_skills` toggle publishes no `skills.changed`, so the tab appears or disappears on the next page load or navigation. The backend enforces the switch either way. ## Review Nine rounds, each with a fresh-context Opus 5.5 reviewer and opencode `gpt-6.1-sol` (four chunks), every finding verified against the code and fixed test-first. The main ones: Approve could follow a silent reload to a hash the reviewer never read; parts of two versions could be joined; live events never reached the tab (SSE frame shape); a vitest file exited 1 on an unhandled rejection; the sweep core could inherit the operator's `MCPPROXY_DATA_DIR` / audit-log path, printed the key under `DEBUG=1`, orphaned its processes, and printed local paths; the fixture's mutate endpoint accepted cross-site writes. ## Tests - `cd frontend && npm run type-check && npx vitest run` — exit 0, 330 files, 2958 tests. - `go test ./internal/skills/... ./cmd/skillsfixture/... ./cmd/release-gate/... ./internal/gatereport/...` — exit 0; `go vet` clean; golangci-lint v2 (`--new-from-rev=origin/main`) 0 issues. - `bash -n` / `shellcheck scripts/run-skills-tab-sweep.sh` clean; `./scripts/run-skills-tab-sweep.sh --self-test` exit 0. - The browser sweep above (8/8, exit 0) and `--self-test` (exit 0). Not checked: the advisory gate step on a GitHub runner (it runs on tags), and the tab against a real skills server (PR-2 checked ingestion against `https://huggingface.co/mcp`).
1 task done
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.
Related #1895 (spec 125, PR-2 of 5). Builds on #1921.
What this adds
The approval gate for skills read from upstream servers. Skills are still visible to administrators only and offered to no agent;
enable_skillsstays off by default.One status rule (
decideSkill,internal/runtime/skills_quarantine.go), applied on every refresh:manualscan(default)auto, orquarantine_enabled: falseA skill whose content equals its approved hash is approved again without review. An unusable skill (failed check,
dynamicfile list) can never be approved. The blocked mark is set and cleared only by a person and survives everything else.Scan (
skills_scan.go):SKILL.mdand every other text file go through the offline scanner in chunks of at most 48 KiB. The result (verdict, completeness, findings per file and offset) is stored with the skill and belongs to one content hash.Decisions of a person (
skills_approval.go): approve is bound to the content hash the reviewer saw and to the server incarnation; a mismatch refuses the whole request and writes nothing. Block and unblock set the mark.REST:
POST /api/v1/servers/{id}/skills/approve|block|unblock, administrator only.409 review_out_of_date(withchangedandunreviewed),409 server_replaced,422 skill_unusable. The listing gainsincarnation,approved_by,approved_at,approved_filesand the scan fields.CLI:
mcpproxy skills approve <server>:<skill>…(or--server <name> --all),skills block,skills unblock,skills show --diff.approveprints what it is about to approve and sends exactly those hashes.Activity: every approval (person, scan, auto), every hold of changed content, block and unblock is a
skill_quarantine_changerow with the actor and the hashes before and after. These rows and their SSE event are administrator-only on every activity read door.Docs:
docs/features/skills.md"Reviewing skills", a section indocs/features/security-quarantine.md, REST and CLI references.Checked against a real server
Scratch core,
https://huggingface.co/mcp, trust modescan: 25 skills, 1.5 MB of text.detect.secret.embedded×19 (paths such as~/.aws/…),detect.capability.mismatch×6,detect.directive.imperative×2,detect.payload.reconstructed×1. These look like false positives on instruction text, which the plan expected; inscanmode they only mean the skill waits for a person.409 review_out_of_date, nothing written. Approve with the listed hash, block, unblock: as specified. 18 activity rows.Decisions taken without asking
Each is the maintainer's to overrule.
time_limit).size_capand the skill waits for a person inscanmode.scanmode, shown as "not scanned".unreviewed; there is no unbound approval.skills.changedand the activity rows are emitted after the approval lock is released, as for tools.-o yamlshows control and direction characters as visible escapes;-o jsonescapes them as\uXXXXand still decodes to the exact text.Not in this change
GET /api/v1route with a scoped token and a held skill and finds it nowhere.skill_quarantine_changeyet (the Web UI has one).Review
Cross-model review with opencode
gpt-6.1-sol, four chunks (decision and scan; decisions of a person and activity; REST; CLI), five rounds until every chunk was clean. Fixed on the way, each with a test:One point was not changed: activity rows are written from the runtime event bus, which drops an event when a subscriber's buffer is full. Every activity row is produced that way, tool approvals included; making the activity log transactional is a separate change.
Tests
go test -raceoninternal/skills,storage,runtime,httpapi(both editions),contracts,cliclient,cmd/mcpproxy,internal/server(CI skip list);golangci-lintv2 bare and--build-tags server;scripts/check-upstream-write-sites.sh;make swagger-verify; the docs site build; frontend type check and unit tests;./scripts/test-api-e2e.sh.