Description
When plan mode is configured with "edit": "deny" in opencode.json, MCP filesystem tools (e.g., filesystem_edit_file, filesystem_write_file) are not blocked. They execute successfully despite the explicit deny rule.
The "edit" permission rule appears to only gate opencode's native edit tools, not MCP tools that perform equivalent file-modification operations. Since MCP tools are dispatched through the MCP protocol with their own permission namespace (e.g., filesystem_edit_file), the "edit" deny rule never sees them.
Steps to Reproduce
- Configure an agent with
"edit": "deny" (e.g., the default plan agent or a custom plan agent):
"plan": {
"mode": "primary",
"permission": {
"edit": "deny",
...
}
}
- Ensure an MCP filesystem server is configured (e.g.,
@anthropic/claude-code's filesystem MCP or any MCP server providing filesystem_edit_file/filesystem_write_file tools).
- Enter plan mode and ask the agent to modify a file.
- The agent uses the MCP filesystem tool to write/edit the file successfully.
Expected Behavior
Plan mode with "edit": "deny" should block ALL file-modifying tools, including those provided by MCP servers. This is the core invariant of plan mode being read-only.
Actual Behavior
MCP filesystem tools bypass the "edit" deny rule because the permission system doesn't map MCP tool names to the edit permission key. The AI sees the MCP tools as available and uses them.
Environment
- opencode version: latest
- MCP filesystem server configured
- Plan mode active with
"edit": "deny"
Related Issues
Description
When plan mode is configured with
"edit": "deny"inopencode.json, MCP filesystem tools (e.g.,filesystem_edit_file,filesystem_write_file) are not blocked. They execute successfully despite the explicit deny rule.The
"edit"permission rule appears to only gate opencode's native edit tools, not MCP tools that perform equivalent file-modification operations. Since MCP tools are dispatched through the MCP protocol with their own permission namespace (e.g.,filesystem_edit_file), the"edit"deny rule never sees them.Steps to Reproduce
"edit": "deny"(e.g., the default plan agent or a custom plan agent):@anthropic/claude-code's filesystem MCP or any MCP server providingfilesystem_edit_file/filesystem_write_filetools).Expected Behavior
Plan mode with
"edit": "deny"should block ALL file-modifying tools, including those provided by MCP servers. This is the core invariant of plan mode being read-only.Actual Behavior
MCP filesystem tools bypass the
"edit"deny rule because the permission system doesn't map MCP tool names to theeditpermission key. The AI sees the MCP tools as available and uses them.Environment
"edit": "deny"Related Issues
edit: denyignored at agent level