Skip to content

Add opt-in MCP tool-metadata enforcement (injection refuse) - #112

Merged
KangaKode merged 2 commits into
mainfrom
feat/mcp-tool-metadata-enforcement
Aug 2, 2026
Merged

Add opt-in MCP tool-metadata enforcement (injection refuse)#112
KangaKode merged 2 commits into
mainfrom
feat/mcp-tool-metadata-enforcement

Conversation

@KangaKode

Copy link
Copy Markdown
Owner

Summary

  • High-tier opt-in MCP metadata enforcement: MCP_TOOL_METADATA_ENFORCEMENT_ENABLED (default off) rebuilds per-server blocked_tools after a successful list_tools screen (health today), omits injection-flagged tools from listings, and refuses call_tool with stable error_code=tool_refused_metadata_injection before transport.
  • Fold in enabled=False → invoke 404 byte-identical to missing; drift stays detect-only; never auto-mutates enabled. Outer screen failure: list fail-open + prior blocks still refuse.
  • Design artifacts under docs/designs/mcp-tool-metadata-enforcement/ (REV 2); GOVERNANCE / SECURITY_MAPPING ASI02 / OPERATIONS runbook / PLATFORM_GUIDE / .env.example honesty updates.

Risk tier

High — opt-in enforcement on MCP discovery/execution. Plan + four artifacts APPROVED by security, SRE, and template-DX (REV 2).

Test plan

  • tests/test_mcp_tool_metadata_enforcement.py.jinja (default-off, enforce-on omit+refuse, drift, atomicity, outer fail, legacy load, enrichment, cross-tenant, health tools_refused, API 404/200 pins)
  • Replaced source-string guard in test_mcp_tool_screen.py.jinja
  • bash scripts/validate_generated.sh — all four profiles PASSED (266 checks, 0 warnings on defaults)
  • Bugbot + post-diff Security/SRE/DX review

Made with Cursor

Default remains detect-only; MCP_TOOL_METADATA_ENFORCEMENT_ENABLED
filters list_tools and refuses call_tool for injection-flagged tools
after a successful health screen, with honest Non-Claims and ops docs.

Co-authored-by: Cursor <cursoragent@cursor.com>
@cursor

cursor Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

Bugbot: a rebuild that dropped unscanned prior injection blocks could
re-admit poisoned tools; keep the block until the tool is re-verified.

Co-authored-by: Cursor <cursoragent@cursor.com>
@KangaKode

Copy link
Copy Markdown
Owner Author

Bugbot follow-up

Fixed: per-tool scanner exceptions no longer clear a prior metadata_injection block on end-of-screen rebuild (test_per_tool_scan_fail_preserves_prior_block). Design pin updated in ARCHITECTURE_MAP REV 2.

@KangaKode
KangaKode merged commit e49d68e into main Aug 2, 2026
6 checks passed
@KangaKode
KangaKode deleted the feat/mcp-tool-metadata-enforcement branch August 2, 2026 19:25
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.

1 participant