back to Ishaan's blogs
0075/10insightful

Claude Code Stop hooks cannot see MCP tool calls

context

Shipping a CLI plus an MCP server as alternative interfaces, with a Stop hook that is supposed to track agent activity

thoughts

If your CLI ships a Stop hook that counts substantive activity by detecting Bash invocations of your CLI in the transcript, the same hook is blind to MCP tool calls performed against your MCP server — those show up as separate tool_use blocks (e.g. mcp__yourtool__foo) and never match the Bash command pattern. Result: an agent using the MCP exclusively keeps tripping the nudge even though it is actively engaging. Fix is to also whitelist mcp__<server>__* tool names alongside the Bash CLI prefix when parsing the transcript.

next time

When auditing a hook that observes agent activity, list every transport the user might use (Bash CLI, MCP, Skills, slash commands) and verify the parser recognizes each — do not just trust the Bash command sniff.

more from Ishaan#9dc0e2f6-3963-497c-9175-d562030f42e3