MCP per-agent configuration ignored after global deactivation #4037

Closed
opened 2026-02-16 17:42:22 -05:00 by yindo · 4 comments
Owner

Originally created by @rom100main on GitHub (Dec 31, 2025).

Originally assigned to: @rekram1-node on GitHub.

Description

So for example if you configure opencode.json like this

    "tools": {
        "mcp-*": false
    },
    "agent": {
        "plan": {
            "tools": {
                "mcp-github": true,
                "mcp-context7": true,
                "mcp-ddg-search": true
            }
        },
    }

and then ask the agent ask his list of available MCP, it will say he has access to none
while the docs https://opencode.ai/docs/tools/#per-agent say otherwise

same if you deactivate MCP in opencode.json but reactivate them in agent/*.md files, MCP will not be accessible

OpenCode version

1.0.220

Steps to reproduce

  1. Edit the opencode.json file as described above.
  2. Ask the agent to list all of their available MCP.

Screenshot and/or share link

No response

Operating System

macOS 15.7.3

Terminal

Ghostty, Alacritty (Zed)

Originally created by @rom100main on GitHub (Dec 31, 2025). Originally assigned to: @rekram1-node on GitHub. ### Description So for example if you configure `opencode.json` like this ```json "tools": { "mcp-*": false }, "agent": { "plan": { "tools": { "mcp-github": true, "mcp-context7": true, "mcp-ddg-search": true } }, } ``` and then ask the agent `ask` his list of available MCP, it will say he has access to none while the docs https://opencode.ai/docs/tools/#per-agent say otherwise same if you deactivate MCP in `opencode.json` but reactivate them in `agent/*.md` files, MCP will not be accessible ### OpenCode version 1.0.220 ### Steps to reproduce 1. Edit the `opencode.json` file as described above. 2. Ask the agent to list all of their available MCP. ### Screenshot and/or share link _No response_ ### Operating System macOS 15.7.3 ### Terminal Ghostty, Alacritty (Zed)
yindo closed this issue 2026-02-16 17:42:23 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Dec 31, 2025):

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

  • #5373: [FEATURE]: Allow to enable MCP on a per-agent basis - Directly addresses per-agent MCP control
  • #4525: [FEATURE]: Allow per-project MCP enabled/disabled overrides - Discusses global vs per-agent configuration inheritance
  • #2888: Feature Request: Global default tools configuration for agents - Related to tool/MCP configuration hierarchy

Feel free to ignore if your case has specific differences from these issues.

@github-actions[bot] commented on GitHub (Dec 31, 2025): This issue might be a duplicate of existing issues. Please check: - #5373: [FEATURE]: Allow to enable MCP on a per-agent basis - Directly addresses per-agent MCP control - #4525: [FEATURE]: Allow per-project MCP enabled/disabled overrides - Discusses global vs per-agent configuration inheritance - #2888: Feature Request: Global default tools configuration for agents - Related to tool/MCP configuration hierarchy Feel free to ignore if your case has specific differences from these issues.
Author
Owner

@rom100main commented on GitHub (Dec 31, 2025):

My case is different than these issues

@rom100main commented on GitHub (Dec 31, 2025): My case is different than these issues
Author
Owner

@rom100main commented on GitHub (Dec 31, 2025):

Also, if you do something like this

    "agent": {
        "plan": {
            "tools": {
                "mcp-*": false,
                "mcp-github": true,
                "mcp-context7": true,
                "mcp-ddg-search": true
            }
        },
    }

or this

    "agent": {
        "plan": {
            "tools": {
                "mcp-github": true,
                "mcp-context7": true,
                "mcp-ddg-search": true,
                "mcp-*": false
            }
        },
    }

all MCPs will no be accessible by the model.

I think order should matter when you activate/deactivate MCP.
So in the first one all MCP should be deactivate except mcp-github, mcp-context7 and mcp-ddg-search.
In the second case, every one should be deactivate regardless if some are activated before "mcp-*": false.

@rom100main commented on GitHub (Dec 31, 2025): Also, if you do something like this ```json "agent": { "plan": { "tools": { "mcp-*": false, "mcp-github": true, "mcp-context7": true, "mcp-ddg-search": true } }, } ``` or this ```json "agent": { "plan": { "tools": { "mcp-github": true, "mcp-context7": true, "mcp-ddg-search": true, "mcp-*": false } }, } ``` all MCPs will no be accessible by the model. I think order should matter when you activate/deactivate MCP. So in the first one all MCP should be deactivate except `mcp-github`, `mcp-context7` and `mcp-ddg-search`. In the second case, every one should be deactivate regardless if some are activated before `"mcp-*": false`.
Author
Owner

@eXamadeus commented on GitHub (Dec 31, 2025):

This is not a bug, but a configuration issue. You need wildcards for the servers. Change it to this and it will work like you want:

    "tools": {
        "mcp-*": false
    },
    "agent": {
        "plan": {
            "tools": {
                // note the `*`'s
                "mcp-github*": true,
                "mcp-context7*": true,
                "mcp-ddg-search*": true
            }
        },
    }

The documentation was updated in #6306 to make this more clear.

@eXamadeus commented on GitHub (Dec 31, 2025): This is not a bug, but a configuration issue. You need wildcards for the servers. Change it to this and it will work like you want: ```jsonc "tools": { "mcp-*": false }, "agent": { "plan": { "tools": { // note the `*`'s "mcp-github*": true, "mcp-context7*": true, "mcp-ddg-search*": true } }, } ``` The documentation was updated in #6306 to make this more clear.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4037