Risk overrides Phase 2: REST + GUI surface for per-tool MCP risk - #461
Open
kayeungadrian-tam wants to merge 1 commit into
Open
Risk overrides Phase 2: REST + GUI surface for per-tool MCP risk#461kayeungadrian-tam wants to merge 1 commit into
kayeungadrian-tam wants to merge 1 commit into
Conversation
The RiskOverrideStore existed and was wired into every engine, but nothing
could write it — no endpoint, no UI — so MCP's conservative default (every
tool prompts as external) could only be relaxed by hand-editing
risk_overrides.json, and live engines would not notice anyway (rules loaded
once at engine build).
- overrides.py: mtime-watched lazy reload, so REST writes through the
manager's store instance are seen immediately by the per-engine instances
captured in live PermissionEngines — no rebuild; adds remove_rule/rules
- manager: shared store, list/set/delete methods, and /v1/mcp/{name}/tools
rows enriched with full_name + effective/default risk + overridden flag
- app.py: GET/POST/DELETE /v1/risk-overrides (user-local trust decisions;
personas still cannot reach this path — no-self-grant preserved)
- GUI: tool chips on the MCP server row show asks/read/auto and toggle a
read override per tool (click to trust, click to restore approval)
- tests: reload propagation across instances, REST round-trip incl.
validation, remove/list; e2e for the chip toggle flow
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
What was broken
RiskOverrideStore(coworker/overrides.py) is annotated as the Phase 2 relaxation path for MCP's conservative default, andbuild_enginealready wires it into everyPermissionEngine— but nothing could ever write it. There was no REST endpoint and no UI, so every MCP tool prompted asexternalforever: a read-onlyget_statuscall gated exactly like a destructive write, on every single call. Hand-editingrisk_overrides.jsondidn't help live sessions either, because rules loaded once at engine build.Found while running a real deployment: a heatstroke-monitoring automation calling a read-only MCP status tool every 10 minutes — each poll parked an approval.
What this adds
overrides.py: mtime-watched lazy reload — a REST write through the manager's store instance is seen immediately by the per-engine instances captured in livePermissionEngines (no rebuild, no reload endpoint); plusremove_rule()/rules().list/set/deletemethods, and/v1/mcp/{name}/toolsrows enriched withfull_name, effectiverisk,default_risk, andoverridden.GET/POST/DELETE /v1/risk-overrideswith risk-class validation. User-local trust decisions only — the persona/no-self-grant boundary is untouched (personas still cannot reach this path).asks/read/auto; clicking a tool trusts it as read-only for this machine, clicking again restores approval.How it looks
get_statushas an active override (runs without asking);set_valuekeeps the conservative default.Verification
pytest tests -q: 1108 passed, no new failures (the 7test_bedrock_providerfailures reproduce identically on cleanmainin a venv without thebedrockextra)npm run build: clean ·npm test: no new failurese2e/mcp-tool-risk.spec.ts(chip toggle round-trip) plus the four adjacent MCP specs, all green🤖 Generated with Claude Code