Repository navigation
Description
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_PROGRAMnot set - Shell: /bin/zsh
- Install/channel: latest (release)
- Active plugins: superpowers@git+https://github.com/obra/superpowers.git
Reproduction
- Configure an MCP server whose name contains a hyphen, e.g.
mcp-atlassian(local stdio server). - 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" } - Invoke any tool of that server (tested through Code Mode
execute, e.g. a Confluence page update). - No permission prompt appears; the tool executes under the base allow policy.
- 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}/permissionshows:{ "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.updatedevent, rules present inGET /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
opencodejr commentedon Nov 12, 2026
Thanks for the clear write-up and the API output, @tetesh.
I checked the code for 2.2.7. Keeping the hyphen looks intentional:
normalizedNameinpackages/core/src/tool/runtime.ts, which runsreplace(/[^a-zA-Z0-9_-]/g, "_").namespaceinpackages/core/src/tool/mcp.ts).So letters, digits,
_and-count as supported and are kept, andmcp-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:
askrules falling back toallow, even when the action name matches