[FEATURE]: Allow to enable MCP on a per-agent basis #3471

Closed
opened 2026-02-16 17:40:15 -05:00 by yindo · 12 comments
Owner

Originally created by @lcswillems on GitHub (Dec 11, 2025).

Originally assigned to: @rekram1-node on GitHub.

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

I'm using Playwright MCP server. I'd like this MCP server to only appear in the context of my scrap agent (and only be usable by my scrap agent too).

I can enable / disable a MCP server globally but I can't enable / disable a MCP server on a per-agent basis.

By default, I'd like the playwright MCP server to be disabled for all my agents (i.e. the MCP server is not in the context at all), and then for my agent scrap, I'd like to enable the playwright MCP server.

I know that there is a "tools" setting globally and per-agent, but this won't disable the MCP server meaning that even though the agent can't use it, it still appears in the context.

Originally created by @lcswillems on GitHub (Dec 11, 2025). Originally assigned to: @rekram1-node on GitHub. ### Feature hasn't been suggested before. - [x] I have verified this feature I'm about to request hasn't been suggested before. ### Describe the enhancement you want to request I'm using Playwright MCP server. I'd like this MCP server to only appear in the context of my `scrap` agent (and only be usable by my `scrap` agent too). I can enable / disable a MCP server globally but I can't enable / disable a MCP server on a per-agent basis. By default, I'd like the playwright MCP server to be disabled for all my agents (i.e. the MCP server is not in the context at all), and then for my agent `scrap`, I'd like to enable the playwright MCP server. I know that there is a "tools" setting globally and per-agent, but this won't disable the MCP server meaning that **even though the agent can't use it, it still appears in the context**.
yindo added the discussion label 2026-02-16 17:40:15 -05:00
yindo closed this issue 2026-02-16 17:40:15 -05:00
Author
Owner

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

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

  • #5013: How to enable/disable mcp server per project (similar per-project/per-context MCP configuration request)

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Dec 11, 2025): This issue might be a duplicate of existing issues. Please check: - #5013: How to enable/disable mcp server per project (similar per-project/per-context MCP configuration request) Feel free to ignore if none of these address your specific case.
Author
Owner

@SamirSaidani commented on GitHub (Dec 11, 2025):

https://opencode.ai/docs/mcp-servers/#per-agent
Is it helpful ?

@SamirSaidani commented on GitHub (Dec 11, 2025): https://opencode.ai/docs/mcp-servers/#per-agent Is it helpful ?
Author
Owner

@rekram1-node commented on GitHub (Dec 11, 2025):

I know that there is a "tools" setting globally and per-agent, but this won't disable the MCP server meaning that even though the agent can't use it, it still appears in the context.

Uh that's not true

If the tool is disabled it will NOT appear in context

@rekram1-node commented on GitHub (Dec 11, 2025): > I know that there is a "tools" setting globally and per-agent, but this won't disable the MCP server meaning that even though the agent can't use it, it still appears in the context. Uh that's not true If the tool is disabled it will NOT appear in context
Author
Owner

@paralin commented on GitHub (Dec 12, 2025):

#5339

@paralin commented on GitHub (Dec 12, 2025): #5339
Author
Owner

@lcswillems commented on GitHub (Dec 12, 2025):

@paralin How is your PR addressing the issue? It seems the flag is just equivalent to setting the tools in the config, no? Doesn't seem to address the concern with the config. And personally, I would prefer config over flags.

@lcswillems commented on GitHub (Dec 12, 2025): @paralin How is your PR addressing the issue? It seems the flag is just equivalent to setting the tools in the config, no? Doesn't seem to address the concern with the config. And personally, I would prefer config over flags.
Author
Owner

@lcswillems commented on GitHub (Dec 12, 2025):

@rekram1-node I missed your message. When I turn the playwright tools off, the context size reported by OpenCode doesn't decrease. It is only when I disable the MCP that it decreases.

@lcswillems commented on GitHub (Dec 12, 2025): @rekram1-node I missed your message. When I turn the playwright tools off, the context size reported by OpenCode doesn't decrease. It is only when I disable the MCP that it decreases.
Author
Owner

@lcswillems commented on GitHub (Dec 12, 2025):

@rekram1-node I've just tried again:

If I add the playwright MCP in the global config with "enabled": false, then I can't enable the Playwright tools in my local project. So only way is to enable the playwright MCP in my global config, but now if I disable the tools, the MCP server still gets loaded in the context...

Or maybe I'm misunderstanding something.

@lcswillems commented on GitHub (Dec 12, 2025): @rekram1-node I've just tried again: If I add the playwright MCP in the global config with `"enabled": false`, then I can't enable the Playwright tools in my local project. So only way is to enable the playwright MCP in my global config, but now if I disable the tools, the MCP server still gets loaded in the context... Or maybe I'm misunderstanding something.
Author
Owner

@lcswillems commented on GitHub (Dec 12, 2025):

@rekram1-node Another option would be:

Allow me to set the Playwright MCP server in the global config with enabled: false. And then in my local configs, allow me to set it to enabled: true. (without having to set the other fields type and command)

@lcswillems commented on GitHub (Dec 12, 2025): @rekram1-node Another option would be: Allow me to set the Playwright MCP server in the global config with `enabled: false`. And then in my local configs, allow me to set it to `enabled: true`. (without having to set the other fields `type` and `command`)
Author
Owner

@rekram1-node commented on GitHub (Dec 12, 2025):

Allow me to set the Playwright MCP server in the global config with enabled: false. And then in my local configs, allow me to set it to enabled: true. (without having to set the other fields type and command)

If this is all you are asking for we have a separate issue tracking this and itll be added soon

@rekram1-node commented on GitHub (Dec 12, 2025): > Allow me to set the Playwright MCP server in the global config with enabled: false. And then in my local configs, allow me to set it to enabled: true. (without having to set the other fields type and command) If this is all you are asking for we have a separate issue tracking this and itll be added soon
Author
Owner

@lcswillems commented on GitHub (Dec 13, 2025):

@rekram1-node Do you have the link of this other issue? So I could confirm whether it is the same? 🙏

@lcswillems commented on GitHub (Dec 13, 2025): @rekram1-node Do you have the link of this other issue? So I could confirm whether it is the same? 🙏
Author
Owner

@rekram1-node commented on GitHub (Dec 16, 2025):

Issue:
https://github.com/sst/opencode/issues/4525

there is an Open PR for it that should be merged soon

@rekram1-node commented on GitHub (Dec 16, 2025): Issue: https://github.com/sst/opencode/issues/4525 there is an Open PR for it that should be merged soon
Author
Owner

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

Check out #6306. This is a configuration issue. It works, you just need wildcards.

@eXamadeus commented on GitHub (Dec 31, 2025): Check out #6306. This is a configuration issue. It works, you just need wildcards.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3471