mirror of
https://github.com/mksglu/context-mode.git
synced 2026-09-19 03:27:16 +08:00
7dc26dd4a8
Extends PR #532's external-MCP routing protection to Cursor. Adds `MCP:(?!ctx_)` to the preToolUse matcher (Cursor's MCP wire shape is `MCP:<tool>`, with own tools at `MCP:ctx_*` — verified via tests/fixtures/cursor/pretooluse-mcp.json and hooks/cursor/posttooluse.mjs). Also extends `routing.mjs` `isExternalMcpTool` to recognise the `MCP:` prefix shape so the routing branch returns external-MCP guidance instead of silently passing through. The shared detection function now classifies Cursor `MCP:*`, Claude `mcp__*`, and Kiro `@*/` tools uniformly. - src/adapters/cursor/hooks.ts: export EXTERNAL_MCP_MATCHER_PATTERN, append to PRE_TOOL_USE_MATCHERS - hooks/core/routing.mjs: extend isExternalMcpTool to detect `MCP:` (cursor) prefix - configs/cursor/hooks.json, hooks/cursor/hooks.json: mirror runtime matcher - tests/adapters/cursor-external-mcp-routing.test.ts: 6-test vertical slice covering matcher regex, adapter config, and routing.mjs integration