Skip to content

feat(skills): offer approved skills to agents through three built-in tools (spec 125, PR-3) - #1928

Merged
Dumbris merged 23 commits into
mainfrom
125-skills-pr3-agent-tools
Nov 18, 2026
Merged

Dumbris merged 23 commits into
mainfrom
125-skills-pr3-agent-tools

Conversation

@Dumbris

@Dumbris Dumbris commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

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.

A scoped agent token with the server in its reach now reads the approved copy
of available skills through GET /servers/{id}/skills and .../skills/content,
and learns nothing about any other skill. Refresh, approve, block and unblock
stay administrator-only.

Related #1895
…ch cost

- A shared full-text index let skills outside a caller's reach move the
  order of the caller's own results (term statistics). Each reach now has
  its own index of exactly its servers' available skills.
- The index generation is read before the configuration and the records,
  so a build from an old configuration is never stamped as current.
- A search reads one record per returned hit by its key and takes the
  match total from the index; the query is cut to 512 bytes.
- Records of skills a server no longer lists are bounded (200 per server,
  oldest dropped, blocked ones kept), so a server that renames its skills
  cannot grow the store.

Related #1895
…ools (spec 125, PR-3)

Three read-only built-in tools over the approved skill copy held by the
runtime, offered while enable_skills is on:

- retrieve_skills: search, metadata only, total counts what the caller can reach
- load_skill / read_skill_file: provenance header, byte paging with a version
  guard, UTF-8 safe chunks, output sanitisation and sensitive-data scan
- one refusal text ("skill not found: <id>") for every unavailable reason
- caller reach from the retrieve_tools chain; tool policy is not consulted

RefreshSkillsAvailability makes the default registry, call-tool,
code-execution and direct surfaces follow the live switch (nothing on
/mcp/s/<server>, nothing callable from code_execution), and the REST tool
call routes them under the same switch.

Every search, load and read is a skill_access activity row (sizes and hash,
never text). The row names the origin server of a load or read the caller
reaches, and no server otherwise, so scoped activity reads and SSE hide it.

The runtime half (catalog, search index) is a stub for now:
internal/runtime/skills_agent_stub.go.

Related #1895
… in the default instructions

- A scoped caller's REST list and content read write a skill_access row
  (source api), like the agent tools. An administrator's read does not.
- The default MCP instructions and `mcpproxy agent-instructions` gain a
  skills line, only while the skill tools are offered.

Related #1895
… file

- Block, redact and strip are applied to the whole file before it is cut
  into parts, so a secret cannot be fetched in two harmless halves. Offsets
  are positions in the text as served. The result is remembered per file
  and policy.
- The upstream-written words of the header (skill name, file names) pass
  the same policy; the lines mcpproxy writes (version, byte range) do not.
- The spotlight fence is built from cleaned names and cannot be closed or
  forged by a skill name.
- A call with unusable parameters writes a skill_access row (invalid).

Related #1895
…ch and record bounds

- skill_access rows and their SSE event are administrator-only on every
  activity door: a row names the id its caller asked for, which may be a
  held skill on a server another scoped reader can see.
- A search whose returned hit was gone is repeated on a rebuilt index, so
  the total never counts a held skill that was not among the hits.
- The records a listing did not name are bounded whatever their listed
  mark says (a listing cut short unlists nothing), and the index build
  resolves paths in one pass.

Related #1895
…usal for a damaged copy

- A scoped REST read goes through the output policy the agent tools apply
  (whole file, then paged; 403 output_blocked), its text is scanned for
  sensitive data, and every outcome including a bad request is recorded.
- Names and descriptions in a search answer and in the scoped REST list
  pass the policy; under a blocking policy a word with a critical secret
  is withheld. The spotlight fence uses the cleaned name.
- A stored copy that fails verification is refused with the one not-found
  answer on both doors; the reason is in the administrator's activity row
  and on the record.
- Spec: FR-023b says where the reserved names apply.

Related #1895
…ns are recorded

- A search checks every match against its record before counting it (at
  most 1,000 per search), so a skill held behind the index's back is never
  counted, returned or not.
- A scoped REST read that ends at the handler's own checks (feature off,
  unknown server, internal failure) writes its access row.
- A skill whose path the output policy would change is left out of search
  answers and of the scoped REST list.

Related #1895
…amage is bound to the approved file

- The detector reads at most its payload limit of one input. A blocking
  policy now scans a skill file in overlapping windows, and a file larger
  than 4 MiB is withheld under a policy that has to read it.
- A failed read marks a skill unusable only when the record still approves
  that very file and its stored bytes still fail under the approval lock;
  a read that raced a new approval is repeated from the new record.
- A server's skill records are read by key prefix, not by walking every
  server's records.
- A skill whose address the output policy would change is left out of
  listings, like one whose path it would change.

Related #1895
… detector

The proxy builds its secret detector at start, only when a blocking or
redacting policy is configured then. Skills read the live policy, so a
policy switched on later found no detector and let skill text through.
Skills now build a detector on first need.

Related #1895
…'s own limit

The scan windows were sized from the live setting, while the detector
keeps the limit it was built with: after the setting was raised, most of
each window went unread. A window the detector did not read whole is now
halved and scanned again, and a text that cannot be read whole counts as
critical. A configuration reload forgets the served texts and the detector
skills built for themselves.

Related #1895
…e detection settings

Skills used the detector the proxy builds at start whenever there was one,
so detection settings changed by a reload (a new custom pattern, another
payload limit) did not reach skill text. Skills now always use their own
detector, built on first need and again after every configuration reload.

Related #1895
@cloudflare-workers-and-pages

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

Copy link
Copy Markdown

Deploying mcpproxy-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: eb763e0
Status: ✅  Deploy successful!
Preview URL: https://e73716cf.mcpproxy-docs.pages.dev
Branch Preview URL: https://125-skills-pr3-agent-tools.mcpproxy-docs.pages.dev

View logs

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

📦 Build Artifacts

Workflow Run: View Run
Branch: 125-skills-pr3-agent-tools

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 (29 MB)
  • installer-dmg-darwin-arm64 (26 MB)
  • smart-mcp-proxymcpproxy-goYFM4F2.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 44176598983 --repo smart-mcp-proxy/mcpproxy-go

Note: Artifacts expire in 14 days.

@codecov-commenter

codecov-commenter commented Nov 17, 2026 •

Copy link
Copy Markdown

reserveLoopbackPort listened on ":0", closed the listener and returned the
port. The system can give that port to the next ":0" listen, so a test that
takes two ports and requires them to differ could get one number twice.
TestPinnedPortKeepsStaticCredentials failed this way on the Windows runner
("Should not be: 54926").

The helper now returns a port only once per test process, and tries again
while the earlier listeners are still open.

Related #1895
…t steps

internal/server takes 2116-2206s on the Windows runner on main (three runs
measured on 2026-11-17), against a 40m (2400s) bound. The skills tests of this
change add about 110s there: one run passed at 2228s and the next one hit the
bound at 2401s ("panic: test timed out after 40m0s").

The bound for the two unit test steps is now 60m. The shuffle and
server-edition steps are well below their bound and are not changed.

Related #1895
@Dumbris
Dumbris merged commit 6370f1f into main Nov 18, 2026
97 of 100 checks passed
Dumbris added a commit that referenced this pull request Nov 18, 2026
…imeline

Both sides added activity types (upstream_event here, skill_access on
main): the CLI system view test and the Web UI type lists keep both.
NewMCPProxyServer keeps both start-up calls. unit-tests.yml takes main's
60m timeouts (#1928 raised them too). ROADMAP.md and the swagger files
are regenerated.

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