Skip to content

permissions: MCP action names keep hyphens, docs say they are normalized to underscores #63555

Done

Description

@tetesh

Summary

The permissions documentation says MCP tool actions are named <server>_<tool> and that "unsupported characters in both names become _". In v2.2.7 hyphens in the server name are preserved (e.g. mcp-atlassian_confluence_update_page), so ask/deny rules written per the docs with underscore-normalized names (mcp_atlassian_*) silently never match and the base allow policy applies. Permission gates configured exactly as documented fail open without any warning.

Environment

  • opencode version: 2.2.7
  • OS: macOS, Darwin 25.6.0 arm64
  • Terminal: OpenCode desktop app (OpenCode.app); TERM_PROGRAM not set
  • Shell: /bin/zsh
  • Install/channel: latest (release)
  • Active plugins: superpowers@git+https://github.com/obra/superpowers.git

Reproduction

  1. Configure an MCP server whose name contains a hyphen, e.g. mcp-atlassian (local stdio server).
  2. Following https://opencode.ai/docs/permissions (Actions table: "<server>_<tool> … unsupported characters in both names become _"), add a global permission rule:
    { "action": "mcp_atlassian_*", "resource": "*", "effect": "ask" }
  3. Invoke any tool of that server (tested through Code Mode execute, e.g. a Confluence page update).
  4. No permission prompt appears; the tool executes under the base allow policy.
  5. Change the rule's action to the hyphenated form mcp-atlassian_* and invoke a tool again. A permission request is now created; GET /api/session/{sessionID}/permission shows:
    { "action": "mcp-atlassian_confluence_check_content_permissions", "resources": ["*"] }

Expected Behavior

Per the documented normalization, the underscore pattern mcp_atlassian_* should match MCP tool actions of the mcp-atlassian server, and the ask rule should prompt before the call.

Actual Behavior

The permission action keeps the hyphen (mcp-atlassian_…), the underscore pattern never matches, and the call is allowed by the base policy with no prompt. Code Mode argument-validation errors also refer to the tool as mcp-atlassian_confluence_check_content_permissions, confirming the hyphenated internal name. Server names without special characters (e.g. confluence) behave as documented.

Additional Context

  • Reproducible: consistently.
  • Workaround: use the literal server name (with hyphen) in action patterns, e.g. mcp-atlassian_*, http-proxy_http_request.
  • Verified via API that the config was loaded and reloaded (config.updated event, rules present in GET /api/config) and that no saved approvals existed (GET /api/permission/saved → empty), ruling out other causes.
  • Either the docs or the normalization implementation should be fixed. The security-relevant part is the silent fail-open: users following the docs believe mutations are gated when they are not.

Activity

  1. opencodejr commented on Nov 12, 2026

    @opencodejr
    Contributor

    Thanks for the clear write-up and the API output, @tetesh.

    I checked the code for 2.2.7. Keeping the hyphen looks intentional:

    • Tool names go through normalizedName in packages/core/src/tool/runtime.ts, which runs replace(/[^a-zA-Z0-9_-]/g, "_").
    • The MCP server name goes through the same function (namespace in packages/core/src/tool/mcp.ts).

    So letters, digits, _ and - count as supported and are kept, and mcp-atlassian_* is the pattern that matches, as you found. The Actions table only says "unsupported characters in both names become _" and never says which characters those are. It's easy to read that as hyphens being replaced, and the result is a rule that never matches and fails open, as you showed.

    I'm leaving this open as a request to make the docs say which characters are kept. It could also ask for a warning when a permission rule's action matches no known tool. Maintainers will decide what to change. Until then, your workaround is right: use the server name exactly as configured, hyphens included.

    Related but different issues:

  2. added
    area/core
    type/feature
    version/v2
    on Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/coreplatform/macostype/featureversion/v2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions