`beforeMCPExecution` hook does not respect `ask` permission

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

Hey @camball, your setup is fine. Right now the "ask" answer from a beforeMCPExecution hook isn’t applied to MCP calls, only "deny" is, so when Auto-review decides the call is safe it runs without a prompt. This is a known issue the team is aware of. (The beforeShellExecution case from the thread you linked has been fixed since, the MCP side hasn’t caught up yet.)

In the meantime, two ways to keep execute_sql in front of you:

  1. To stay in Auto-review, add this to ~/.cursor/permissions.json. It steers Auto-review toward asking you first, but it’s best-effort, not a hard rule:
{
  "autoRun": {
    "block_instructions": [
      "Every call to the postgres MCP server's execute_sql tool should go through approval first."
    ]
  }
}
  1. For a hard guarantee, have the hook return "deny" for execute_sql (the agent gets your message and can hand you the query to run), or use Allowlist mode with that tool left off the MCP allowlist, which always prompts for it.