Skip to content

MCP filesystem tools bypass plan mode edit: deny permission rule #30291

Closed as not planned

Description

@jpravetz

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

  1. Configure an agent with "edit": "deny" (e.g., the default plan agent or a custom plan agent):
    "plan": {
      "mode": "primary",
      "permission": {
        "edit": "deny",
        ...
      }
    }
  2. 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).
  3. Enter plan mode and ask the agent to modify a file.
  4. 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

Activity

  1. github-actions commented on Jun 1, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of or closely related to existing issues not listed above. Please check:

  2. jpravetz commented on Jun 1, 2026

    @jpravetz
    Author

    Should I not be using the filesystem mcp that I am using? opencode probably has it's own filesystem APIs and doesn't need this mcp?

    • Thought: 2.6s
      That's exactly right. Opencode has built-in equivalents for all the standard filesystem MCP tools (filesystem_read_file, filesystem_write_file, filesystem_edit_file, filesystem_create_directory, filesystem_list_directory, filesystem_search_files, filesystem_get_file_info, etc.) — and they respect the permission system (plan mode's edit: deny, read rules, etc.).
      The MCP filesystem server is redundant and actively harmful because it creates a backdoor around permissions. I'd recommend removing it from your MCP config and relying on opencode's native filesystem tools.
  3. rekram1-node commented on Jul 3, 2026

    @rekram1-node
    Contributor

    We recommend adjust plan agent permissions to get around this, autodetecting what ur mcps will do isnt exactly easy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions