Where does the bug appear (feature/product)?
Cursor IDE
Describe the Bug
End goal: use “Auto-Review (with Sandbox)” mode for agent execution, but never allow a specific MCP tool to be auto-reviewed (postgres-mcp’s execute_sql). When using hooks to accomplish this goal, "permission": "ask" does not ask the user for approval; it allows. I know the setup works, as "permission": "deny" and "permission": "allow" work properly.
Appears that other users have experienced the same thing with other hooks: beforeShellExecution
Steps to Reproduce
Contents of ~/.cursor/hooks.json:
{
"hooks": {
"beforeMCPExecution": [
{
"command": "./hooks/mcp-approval.sh",
"failClosed": true
}
]
},
"version": 1
}
Contents of ~/.cursor/hooks/mcp-approval.sh:
#!/bin/bash
set -euo pipefail
jq -ce '
if (.mcp_server_name | type) != "string"
or (.tool_name | type) != "string" then
{"permission": "deny"}
elif .mcp_server_name == "postgres"
and .tool_name == "execute_sql" then
{
"permission": "ask",
"user_message": "SQL execution requires manual approval."
}
else
{"permission": "allow"}
end
'
Connect to a database per postgres-mcp’s setup (any MCP server should work, but this is my exact steps to reproduce), then ask the agent to invoke a tool that should trigger ask. Agent will run the tool. I got it to execute SQL SELECT 1.
Expected Behavior
I expect the agent to ask me for MCP tool execution when ask is the permission level. deny and allow work as expected.
Operating System
MacOS
Version Information
Version: 3.31.15 (Universal)
VS Code Extension API: 1.128.0
Commit: 3eb8c13390837371c7c2f2013dc57fdbc802c750
Date: 2026-11-20T19:25:18.309Z
Layout: Agent Window
Build Type: Stable
Release Track: Default
Electron: 43.8.9
Chromium: 150.0.7871.250
Node.js: 24.22.1
V8: 15.0.245.31-electron.0
xterm.js: 6.1.0-beta.291
OS: Darwin arm64 27.2.0
Does this stop you from using Cursor
No - Cursor works, but with this issue