How to enable/disable mcp server per project #3276

Open
opened 2026-02-16 17:39:28 -05:00 by yindo · 2 comments
Owner

Originally created by @meatballs on GitHub (Dec 3, 2025).

Question

I have an mcp server that only applies to some projects. I tried adding its config to my global config file but with it disabled by default so that I could override that at project level.

e.g.

my global config:

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "my-mcp-server": {
      "type": "local",
      "command": [...],
      "enabled": false
    },
    ...
}

and then in my project config:

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "my-mcp-server": {
      "enabled": true
    },
    ...
}

But opencode then won't start and tells me the config is invalid.

Have I misunderstood something? I thought I could override values this way.

Originally created by @meatballs on GitHub (Dec 3, 2025). ### Question I have an mcp server that only applies to some projects. I tried adding its config to my global config file but with it disabled by default so that I could override that at project level. e.g. my global config: ```json { "$schema": "https://opencode.ai/config.json", "mcp": { "my-mcp-server": { "type": "local", "command": [...], "enabled": false }, ... } ``` and then in my project config: ```json { "$schema": "https://opencode.ai/config.json", "mcp": { "my-mcp-server": { "enabled": true }, ... } ``` But opencode then won't start and tells me the config is invalid. Have I misunderstood something? I thought I could override values this way.
Author
Owner

@atkr commented on GitHub (Dec 3, 2025):

I'm assuming your project level config is considered invalid as you are missing the required keys in the my-mcp-server section.

Perhaps an easier way to achieve the same result would be to leave it enabled in your global config, but disabled/not allowed in the tool section. Then in your project config, enable/allow the tool to be used.

@atkr commented on GitHub (Dec 3, 2025): I'm assuming your project level config is considered invalid as you are missing the required keys in the `my-mcp-server` section. Perhaps an easier way to achieve the same result would be to leave it enabled in your global config, but disabled/not allowed in the tool section. Then in your project config, enable/allow the tool to be used.
Author
Owner

@meatballs commented on GitHub (Dec 3, 2025):

I just didn't bother showing the entire config. It's valid. If I enable that global config and get rid of the project config, it all works fine

@meatballs commented on GitHub (Dec 3, 2025): I just didn't bother showing the entire config. It's valid. If I enable that global config and get rid of the project config, it all works fine
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3276