There is no post-execution hook that can both (a) tell which MCP server produced a tool result and (b) act on it. The two halves live on two different hooks.
Detail
At the MCP tool-call site, two hooks fire back to back:
afterMCPExecutionreceivesmcp_server_nameandmcp_server_url, but its return value is discarded.postToolUsehonorsupdated_mcp_tool_output(replaces the result the model sees), but its payload carries no MCP server fields — onlytool_name,tool_input,tool_output,duration,tool_use_id.
From cursor-agent 2026.07.23-e383d2b:
// payload `i` spreads `b` = { mcp_server_name, mcp_server_url }
yield this.hookExecutor.executeHookForStep(u._E.afterMCPExecution, i); // return value not assigned
const a = yield this.firePostToolUse(e, l, f, p, n, s, d, h);
if (void 0 !== a?.updated_mcp_tool_output) { /* result is substituted */ }
firePostToolUse builds its payload as {...t, tool_name, tool_input, tool_output, duration, tool_use_id} — b, which holds the server fields, is not spread in.
beforeMCPExecution has both halves (it gets mcp_server_name / mcp_server_url / url / command and honors permission: "deny"), so the gap is only on the post-execution side.
Why this matters
Policy about MCP tool results is per-server: whether a result is acceptable depends on which server returned it. A tool result is also an injection vector into the model’s context, so the moment before the model reads it is where that policy has to apply. Today the decision can be made on afterMCPExecution but not enforced, or enforced on postToolUse but not made.
To be clear, this is not a request to un-run the call — it has already executed and that can’t be reversed. It is only about withholding or replacing the result before the model reads it, which postToolUse already supports.
Either change closes the gap
- Honor
updated_mcp_tool_outputfromafterMCPExecution’s return value, aspostToolUsealready does; or - Add
mcp_server_name/mcp_server_urlto thepostToolUsepayload for MCP tools.
(2) looks like the smaller change.
Environment
cursor-agent 2026.07.23-e383d2b, macOS.
Also filed at Hooks: `afterMCPExecution` return value is discarded, and `postToolUse` carries no MCP server identity · Issue #50 · cursor/cookbook · GitHub for visibility.