Skip to content

feat(skills): read upstream skills into an administrator-only catalog (spec 125, PR-1) - #1921

Merged
Dumbris merged 24 commits into
mainfrom
125-skills-pr1-ingestion
Nov 17, 2026
Merged

Dumbris merged 24 commits into
mainfrom
125-skills-pr1-ingestion

Conversation

@Dumbris

@Dumbris Dumbris commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Summary

First of five pull requests for Skills over MCP (spec 125, #1919): MCPProxy reads the skills that upstream servers expose through io.modelcontextprotocol/skills (SEP-2640) into its own catalog, verifies them, and shows them to administrators. Nothing is offered to agents in this change, and the feature is off by default (enable_skills).

Related #1895

What it does

  • Reads skills in. For a connected server that announces the extension: skills/list (paged), then every file through resources/read. Each file is checked against the listed size and SHA-256, and the SKILL.md frontmatter against the listing. A skill that fails a check is stored as unusable with the reason; the others are unaffected.
  • Keeps its own verified copy. Text files are stored in bbolt (skill_files, content-addressed per server) next to one record per skill (skill_approvals). Both buckets are in the purge set: removing a server removes its skills.
  • Bounds everything a server can make it do. 512 files and 16 MiB per skill, 200 skills and 64 MiB of stored text per server, 16 MiB per listing, 256 MiB read per refresh, display fields cut before they are stored. On streamable HTTP a response is cut off before it is buffered when it is larger than its listed size allows.
  • Shows them to administrators only. GET /api/v1/servers/{id}/skills, GET …/skills/content, POST …/skills/refresh, and mcpproxy skills list|show|refresh. A scoped agent token is refused on all three and never receives the skills.changed event. Every skill is pending (or unusable); the review and approve step is the next pull request.
  • Two switches, both hot-reloaded: enable_skills (default false) and per-server expose_skills. With the feature off no skill request reaches any upstream.

Structure

Area Files
Pure rules (wire types, address rules, verification, sk1- content hash, limits) internal/skills
Test upstream (raw JSON-RPC, no public server in any test) internal/skills/skillstest
Upstream reads, per-request response limit internal/upstream/{core,managed}/skills.go, manager_skills.go, internal/transport/response_limit.go
Storage internal/storage/skills.go, purge set
Catalog (single-flight refresh, budgets, capture ordering, shutdown join) internal/runtime/skills_catalog.go
REST, CLI, docs internal/httpapi/skills.go, cmd/mcpproxy/skills_cmd.go, docs/features/skills.md

No new dependencies. The upstream handshake and the protocol pin are unchanged.

Verification

  • Unit and integration tests for every layer against the fixture upstream, with -race; the full internal/runtime, internal/upstream, internal/storage, internal/httpapi, internal/server (CI skip list) and cmd/mcpproxy suites; both golangci-lint runs; make swagger-verify; vue-tsc.
  • Live, with a throwaway core, scratch data directory and high port, against https://huggingface.co/mcp: 25 skills read in 25 s, all pending, none available to agents, none unusable, 158 files verified (1 binary); hf-cli/SKILL.md has the digest recorded in the spec's research (sha256:a60115f0…); skills list, skills show and the paged content endpoint work.
  • With enable_skills off, a test asserts that no skill request reaches the upstream and nothing is stored.

Review

Cross-model review with opencode gpt-6.1-sol, in four chunks (rules and upstream reads; storage and catalog; REST and CLI; config wiring), repeated until clean. Findings fixed on the way, each with a test: two addresses deriving one skill path; a same-digest file skipping its own size check; size sums that could wrap; switches not re-checked during a running refresh or a paged listing; the entry cap ignoring undecodable entries; number comparison in frontmatter; terminal escape sequences in CLI output and errors; a caller's cancelled request cancelling a shared refresh; unbounded display metadata; a refresh superseded by a reconnect reported as a failure; a per-server config change not triggering a refresh.

Two reviewer points were not changed, on purpose:

  • stdio and SSE responses are not bounded before buffering. They arrive on a stream shared with every other message, so they cannot be cut off per request; the length is checked afterwards. This is the exposure any tool result from the same server already has. Documented in docs/features/skills.md.
  • The administrator gate runs after the server-reach check. A scoped caller gets 403 only for a server already inside its own reach, which it can list anyway. The server-edition form of this point was real and is fixed: a tenant session reached the two skills GET routes through the per-server allowlist, so tenantSessionAllowlist now refuses everything under skills (TestTenantSessionSkillsRoutesAreRefused).

Not in this change

Approval states and scanning (PR-2), agent tools (PR-3), Web UI (PR-4), the native extension on /mcp/s/<server> (PR-5).

…ification, content hash)

Leaf package internal/skills: Entry/FileRef decoding for skills/list and
skills/get, skill URI and file-path validation, Entry.Validate with the
unusable reason codes, VerifyFile, SKILL.md frontmatter parsing and
comparison, the sk1- content hash, and the shared limits. A test guards
that it imports no other package of this module.

Related #1895
internal/skills/skillstest answers initialize, tools/list, skills/list
(optional pagination), skills/get and resources/read over httptest, with
knobs for wrong digest or size, frontmatter mismatch, dynamic resources,
blob files, oversized bodies, a failing listing and slow answers, plus a
request log for asserting that nothing was sent.

Related #1895
…esh apply

Adds skill_approvals and skill_files buckets, CRUD, ApplySkillRefresh,
CollectUnreferencedSkillFiles, and both buckets in the removal purge set.

Related #1895
Adds transport.WithResponseLimit and a round-tripper link that fails a
response body once it exceeds the limit carried by the request context.

Related #1895
…manager

SupportsSkills, ListSkills, GetSkill and ReadSkillFile on the core client
(raw JSON-RPC with string ids, bounded paging, response-limited), capture
stamped listing in the managed client, and per-server access in the manager
that never reconnects on use.

Related #1895
Global enable_skills (default off, hot-reloadable) and per-server tri-state
expose_skills, wired at every point expose_prompts is: config, merge/copy,
contracts, runtime maps, REST and MCP upstream_servers, oauth mask table,
generated TS types, docs, OpenAPI and the tools-list goldens.

Related #1895
Related #1895

The core client takes the per-server value at connect time and on every
config swap, so excluding a server stops skill requests without a
reconnect.
…ets and capture-ordered apply

Reads each server's skills, verifies files against the listed digest and size,
stages text blobs, applies records in one transaction and publishes
skills.changed. Refresh is triggered on connect, on the periodic sweep and when
enable_skills or expose_skills turn on; never inside tool discovery.

Related #1895
…atch

The core client's length check returned a plain error, which the catalog could
only record as read_failed.

Related #1895
Related #1895

The storage field canary requires every ServerConfig field to be mapped;
without this, excluding a server from skills was lost on restart.
…verified binaries

Related #1895

- Runtime.Close waits for in-flight skill refreshes before storage stops,
  and no refresh starts once it has; they write BBolt from their own
  goroutines.
- A binary file is never stored, so a refresh had to download it again on
  every sweep to learn nothing new. A file whose address, digest and size
  equal what an earlier refresh verified on a usable record is not read
  again.
…erver's skills

Adds GET /api/v1/servers/{id}/skills, GET .../skills/content and
POST .../skills/refresh behind the administrator gate, the controller
methods they need, and keeps skills.changed away from scoped SSE callers.

Related #1895
Daemon-only administrator commands over the new skills REST endpoints,
with client methods in internal/cliclient.

Related #1895
Related #1895

- Two skill addresses that derive one path (skill://x/pdf, https://x/pdf)
  are both unusable and addressed by their full address; a lookup by path
  prefers the listed record when an unlisted one shares it.
- A file taken from a same-digest file of the same skill is still verified
  against its own listed size.
- Size sums and budget checks compare by subtraction, so a size near the
  int64 limit cannot wrap them.
- A refresh re-checks the live switches before every upstream request and
  before it writes, so turning skills off or excluding the server stops a
  refresh that is already running.
- The per-server entry cap counts entries that do not decode.
- Frontmatter numbers are compared by exact value (1 equals 1.0, and two
  integers that differ beyond float64 precision do not); the content hash
  uses the same canonical encoding.
- Docs and comments state that responses are bounded before buffering on
  streamable HTTP only.
…how picks the listed record

Related #1895

- Frontmatter numbers: whole numbers that fit 64 bits are exact, everything
  else is compared as a float64 on both sides, so 0.1 in the listing equals
  0.1 in SKILL.md and every spelling of one value has one form. The earlier
  exact-rational comparison rejected ordinary decimals.
- A listing asks its caller's continue check before every page, so a
  multi-page listing stops when skills are switched off.
- skills show resolves a path the way the content endpoint does: the listed
  record wins over an unlisted one, any other overlap is refused.
…witch-off

Related #1895

- SKILL.md frontmatter is read node by node, so a decimal keeps its
  digits; listing and file numbers compare by exact decimal value in every
  spelling. Aliases are followed within a node budget; duplicate keys, merge
  keys and non-string keys are refused.
- A refresh that stops because skills were switched off returns no error
  and records no failure, also when the listing fails or times out after
  the switch.
- REST refresh answers 409 refresh_superseded when the server reconnected
  during the refresh, and 409 skills_disabled when the feature was turned
  off while it ran.
…uperseded listings

Related #1895

- Only a scalar YAML reads as exactly its decimal text takes the exact
  decimal path; 012 (octal), 0x1F, binary and timestamps are compared as
  the YAML library decodes them, which is what a listing built from the
  same file holds.
- A listing that fails on a connection since retired or replaced is a
  superseded refresh, not a failure.
- Any error of a refresh whose server has skills off by then is dropped,
  including a request that was in flight when the switch changed.
…ely, bound stored metadata

Related #1895

- mcpproxy skills prints upstream text (names, descriptions, paths,
  reasons, file bodies) with control, direction and invisible-format
  characters as visible escapes; -o json|yaml stays exact.
- skills show refuses chunks that belong to different versions of a file.
- A shared refresh runs on the runtime's lifetime context; a caller's
  context only bounds that caller's wait, so one closed request cannot
  cancel the refresh under the callers that joined it.
- One listing has a 16 MiB budget across its pages; names, descriptions,
  reasons and file lists are cut to display sizes before they are stored,
  and an entry whose address is too long is counted and not stored.
…ked is not empty

Related #1895

- Errors returned by the skills commands are escaped like the rest of
  their output (an upstream chooses the text of its JSON-RPC errors) and
  still unwrap to the original error.
- The refresh trigger for enable_skills and expose_skills turning on runs
  after every published config commit, so a REST or MCP change to one
  server triggers it like a file reload does.
- A listing that was not sent (no extension, or excluded on the
  connection) returns skills.ErrNotServed instead of an empty listing, so
  earlier records cannot be marked unlisted by it.
- cutText keeps its result within the stated bound, marker included.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Deploying mcpproxy-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: db50d4e
Status: ✅  Deploy successful!
Preview URL: https://e839f524.mcpproxy-docs.pages.dev
Branch Preview URL: https://125-skills-pr1-ingestion.mcpproxy-docs.pages.dev

View logs

…a docs link

Related #1895

- The raw skills/list and skills/get requests go out through a helper in
  core/gate.go, the one place that touches the client's transport, and the
  response limiter no longer falls back to the process-default transport
  (Spec 116 FR-024a, the Upstream Write Sites check).
- docs/features/skills.md linked a page the docs site does not publish;
  the two fields are now listed on the published Configuration File page.
@github-actions

Copy link
Copy Markdown
Contributor

📦 Build Artifacts

Workflow Run: View Run
Branch: 125-skills-pr1-ingestion

Available Artifacts

  • archive-darwin-amd64 (33 MB)
  • archive-darwin-arm64 (29 MB)
  • archive-linux-amd64 (20 MB)
  • archive-linux-arm64 (18 MB)
  • archive-windows-amd64 (32 MB)
  • archive-windows-arm64 (29 MB)
  • frontend-dist-pr (0 MB)
  • installer-dmg-darwin-amd64 (28 MB)
  • installer-dmg-darwin-arm64 (26 MB)
  • smart-mcp-proxymcpproxy-goO688DG.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 43960405596 --repo smart-mcp-proxy/mcpproxy-go

Note: Artifacts expire in 14 days.

Related #1895

The tenant-session allowlist admits every GET under /servers/{id}/ unless a
route is named. The skills catalog is administrator-only, so its routes are
named there and a tenant session gets the fixed 403 before any handler
runs, for plain and percent-encoded server names (the Server Edition
route-walk test).
@Dumbris
Dumbris merged commit 93d81a4 into main Nov 17, 2026
118 of 122 checks passed
Dumbris added a commit that referenced this pull request Nov 17, 2026
…, PR-2) (#1923)

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_skills` stays off by default.

- **One status rule** (`decideSkill`,
`internal/runtime/skills_quarantine.go`), applied on every refresh:

  | Trust mode | New skill | Changed skill |
  |---|---|---|
  | `manual` | held | held |
| `scan` (default) | approved after a clean and complete scan of every
text file; otherwise held | held, whatever the scan says |
  | `auto`, or `quarantine_enabled: false` | approved | approved |

A skill whose content equals its approved hash is approved again without
review. An unusable skill (failed check, `dynamic` file 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.md` and 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` (with `changed` and
`unreviewed`), `409 server_replaced`, `422 skill_unusable`. The listing
gains `incarnation`, `approved_by`, `approved_at`, `approved_files` and
the scan fields.
- **CLI**: `mcpproxy skills approve <server>:<skill>…` (or `--server
<name> --all`), `skills block`, `skills unblock`, `skills show --diff`.
`approve` prints 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_change` row
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 in
`docs/features/security-quarantine.md`, REST and CLI references.

## Checked against a real server

Scratch core, `https://huggingface.co/mcp`, trust mode `scan`: 25
skills, 1.5 MB of text.

- All 25 scanned within about two minutes (three refreshes).
- 15 clean and complete: approved by the scan. 10 held with findings,
all low or medium: `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; in `scan` mode they only mean the skill waits for a person.
- Approve with a wrong hash: `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.

1. **The scan runs after the reads, with its own time budget.** The
scanner needs about one second per 48 KiB (it runs every bundle
signature over the text). Inside the two-minute refresh timeout a larger
server would never finish and would lose every scan with the refresh.
One refresh now starts scans for 45 seconds; a follow-up refresh
continues after a 10-second pause until every skill has been scanned
once. A scan of one skill stops after two minutes (`time_limit`).
2. **The scan cap is 1 MiB of text per skill, not the plan's 2 MiB.**
Beyond it the scan is `size_cap` and the skill waits for a person in
`scan` mode.
3. **A skill that is not scanned yet is held in `scan` mode**, shown as
"not scanned".
4. **Approve requires an expected hash for every named skill.** A
missing one is reported as `unreviewed`; there is no unbound approval.
5. **`skills.changed` and the activity rows are emitted after the
approval lock is released**, as for tools.
6. **`-o yaml` shows control and direction characters as visible
escapes**; `-o json` escapes them as `\uXXXX` and still decodes to the
exact text.

## Not in this change

- **Review queue and attention list entries for held skills** (the rest
of task T031). They change the Web and macOS parity contract, so they
get their own PR. What T031 asks for on visibility is here: a test walks
every `GET /api/v1` route with a scoped token and a held skill and finds
it nowhere.
- **macOS tray**: no label or filter entry for `skill_quarantine_change`
yet (the Web UI has one).
- **Re-holding a scan-approved skill when a new signature bundle would
flag it.** The tool re-protection sweep does not revoke either.

## 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:

- a degraded scan counted as progress and could keep follow-up refreshes
going forever; later a degraded scan could starve the skills listed
after it, and then leave them without a follow-up;
- a configuration change arriving during a refresh joined a refresh that
had already decided;
- the refresh answer could pair old records with a replaced server's
incarnation;
- a hold of changed content was logged only for the first change after
an approval;
- CLI: text of a later refresh could be shown under the listed hash; a
file not in the listing was read unbound; structured output let
direction overrides reach the terminal; an approval was sent although
the review could not be written; a skill name could change the exit
code.

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 -race` on `internal/skills`, `storage`, `runtime`, `httpapi`
(both editions), `contracts`, `cliclient`, `cmd/mcpproxy`,
`internal/server` (CI skip list); `golangci-lint` v2 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`.
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 18, 2026
The zero-calls check counted every request the fake upstream received.
Clients left by earlier tests keep sending DELETE / close requests to
closed ports, and when the kernel reuses one for this fixture the check
failed (seen on #1921 and #1918). Count only non-DELETE requests to the
configured /mcp endpoint, which every dial by the core starts with, and
log the ignored ones.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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`).
@Dumbris Dumbris mentioned this pull request Nov 24, 2026
1 task done
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