Classify the tool registry so read-only MCP can reach read-only tools
The read-only MCP tool refused the whole `seal-use tool <name>` area, because the 98-entry internal tool registry had no read/write classification. Now it does: SEAL_READ_ONLY_TOOLS (66) and SEAL_MUTATING_TOOLS (32), exported from src/domains/seal/tools.ts, with the policy delegating `tool` to them. The two sets are exhaustive by construction — a test asserts they partition sealTools exactly — so a newly added tool fails the suite until it is classified, rather than silently defaulting into one bucket. Classifying by inspection was not enough. Cross-checking mechanically (every exported function in src/domains/seal that performs a mutating HTTP call, mapped to the tools that invoke it) caught a real mistake shipped in #115: `analytics analyze` was allow-listed as read-only, but it calls seal_insight_record_analyze, which issues a POST and starts an analysis server-side. Removed from the CLI allow-list; a comment records why it is absent, since the name reads like a query. `approval-runs pick` went the other way into read-only: it dispatches to seal_approval_run_pick, which is a query over approval runs rather than a local-state mutation. Read-only means: reads tenant state, or writes only a local file. Anything that creates, updates, deletes, publishes, pushes, replays, uploads, activates or mints a credential counts as mutating. `seal_webhook_material_pack` is mutating because push mode sends the pack even though preview mode does not; `seal_approval_runs_export` and `seal_insight_export` are read-only because they only write a local workbook.
This commit is contained in:
1 parent
81504df98d
commit
11b8cfce39
7 files changed
+278
-115
No files matched your search
+3
-2
@@ -131,7 +131,8 @@ describe("seal-use MCP server", () => {
|
||||
"seal-use webhook replay",
|
||||
"seal-use update",
|
||||
"seal-use mcp",
|
||||
"seal-use tool seal_approval_search --json '{}'",
|
||||
"seal-use tool seal_approval_rule_create --json '{}'",
|
||||
"seal-use tool seal_webhook_replay --json '{}'",
|
||||
"seal-use totally-unknown-area list",
|
||||
""
|
||||
]) {
|
||||
@@ -141,7 +142,7 @@ describe("seal-use MCP server", () => {
|
||||
|
||||
// Read-only commands must get past the policy; `version` is a top-level command with no
|
||||
// registry row, and `corp` is an area alias the CLI dispatches as `corps`.
|
||||
for (const command of ["seal-use version", "seal-use corps list", "seal-use corp list"]) {
|
||||
for (const command of ["seal-use version", "seal-use corps list", "seal-use corp list", "seal-use tool seal_approval_search --json '{}'"]) {
|
||||
const allowed = await callRead(command);
|
||||
expect({ command, refusedByPolicy: allowed.text.includes("only runs read-only commands") }).toEqual({
|
||||
command,
|
||||
|
||||
Reference in new issue
Block a user