opencode icon indicating copy to clipboard operation
opencode copied to clipboard

How to enable mcp tool approval dialog?

Open nitg16 opened this issue 1 month ago • 4 comments

Question

Currently mcp tools can be enabled or disabled. Is there a way to show approval dialog for mcp tools (similar to built-in tools)?

MCP tools are enabled by default, which is extremely risky. How to enable 'ask' mode globally for all mcp tools?

nitg16 avatar Nov 28 '25 05:11 nitg16

This issue might be a duplicate of existing issues. Please check:

  • #2748: Add Permission Control for MCP Tools - Addresses the exact same concern about MCP tools bypassing the permission system
  • #2899: How to specify permissions for mcp servers - Related question about MCP server permissions
  • #239: Implement permissions in TUI - General permission system request
  • #935: Feature Request: Add "ask before editing files" mode - Proposes an "ask" mode for tool execution (similar to what you're requesting)
  • #3205: Agent should request permission before reading or editing files - Related permission request for file operations

Feel free to ignore if none of these address your specific case.

github-actions[bot] avatar Nov 28 '25 05:11 github-actions[bot]

we need to expand permissions to work for all tools, currently not possible (unless you do this via plugin)

rekram1-node avatar Dec 02 '25 20:12 rekram1-node

How to do this via plugin? I arrived at this code after reading docs, but how to proceed further?

export const McpApproval = async ({ project, client, $, directory, worktree }) => {
  return {
    "tool.execute.before": async (input, output) => {
      if (input.tool.startsWith("mcp_")) {
        // What to do here? How to show approval dialog in TUI?
      }
    },
  }
}

nitg16 avatar Dec 05 '25 05:12 nitg16

I keep circling back to this need. I've been compensating with hyper specific agent access but it's imperfect and leave's me disabling some mcp tools permanently. I've got a local build running with a real slim quick permissions add for mcp that sits beside and works identically to bash permissions. I'll see how it tests out tomorrow. I'll be happy for a permanent fix though because this has defiantly been a pain point.

JeminiRiver avatar Dec 07 '25 08:12 JeminiRiver