Files
skillshare/tests
Willie 6cc790965a feat(mcp): pin tool definitions in mcp check --live and warn when they change (#560)
* feat(mcp): pin tool definitions in mcp check --live and warn when they change

An Agent reads a server's tool names and descriptions as instructions,
and a server can change them after the user reviewed it (a "rug pull").
The MCP spec 2026-07-28 local-server security guide notes the protocol
does nothing about this and advises clients that re-prompt on a changed
definition; most clients do not.

`mcp check --live` now records one SHA-256 per tool over name,
description and inputSchema the first time a server answers, in
mcp/tool-pins.json of the state directory, keyed by scope and server.
Later probes report a changed or new tool as a `tool-change` warning and
a removed one as info, until `--accept-tools` (only with --live) records
the current definitions. Without --live the pins are never read or
written. An unreadable pin file is never rewritten, since it may hold
other servers' pins. The dashboard words both warnings in every locale.

* fix(mcp): keep schema numbers exact, name the scope to accept in, and log acceptance

Codex review on #560:

- Tool definitions were decoded through float64 before hashing, so a
  schema bound changed from 9007199254740992 to 9007199254740993 hashed
  the same and raised no warning. Numbers now keep their literal text.
- The suggested accept command left out -g/-p; run from inside a project
  after a global check, it would accept the project's server instead.
  It now names the scope of the check that warned.
- Accepting changed tool definitions approves a possible rug pull, but
  left no record. --accept-tools now writes an operations log entry with
  the servers it accepted.

* fix(mcp): log a tool acceptance only when its baseline was saved

Codex review on #560: when comparing succeeded but writing tool-pins.json
failed (lock held, state directory unwritable), the report kept its
"accepted" finding, so the operations log listed the server as accepted
with status ok although its old pins remained. Such a server is now
logged under `failed` and the entry's status is error.

* fix(mcp): log first pins as accepted and report errors in the accept entry

Codex review on #560:

- A check that accepted one server but found an error on another still
  logged status ok, while the command itself exited 1. A server with an
  error is now listed under `failed` and the entry's status is error.
- --accept-tools on a server's first probe records its baseline, but the
  finding says "pinned", so the entry listed nothing as accepted. A first
  pin counts as accepted now.

* chore(release): request version 0.25.11

The MCP pin checks (#559, #560) and the backup staging fix (#558) ship
as 0.25.11 instead of the computed 0.26.0, per maintainer decision.

Release-As: 0.25.11
2026-10-13 23:22:57 +08:00
..