Skip to content

How to enable/disable mcp server per project #5013

Closed

Description

@meatballs

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.

Activity

  1. atkr commented on Dec 3, 2025

    @atkr

    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.

  2. meatballs commented on Dec 3, 2025

    @meatballs
    Author

    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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions