Skip to content

Enable/Disable MCP server by Mode #1101

@jaredbarranco

Description

@jaredbarranco

The ability to create custom modes is super powerful, but I'd like to limit the MCP servers available to a specific mode.

For example, I prefer to do my git operations myself (commit, open PRs, etc) for Plan/Build. But I do want to have a "Review" mode that will have access to Pull Request, team member, and Atlassian data. This is context only needed on the Review mode, and not Plan or Build mode.

I would imagine that the mode definition would be extended to support something like:

{
  "$schema": "https://opencode.ai/config.json",
  "mode": {
    "review": {
      "prompt": "{file:./prompts/review.txt}",
      "tools": {
        "write": false,
        "edit": true,
        "bash": true,
        "read": true,
        "grep": true,
        "glob": true
      },
      "mcp": {
        "enabled": true, // global enable all mcp servers
        "github": {
          "enabled": true, // enable github, but limit to my specified tools
          "tools": {
            "get_me": true,
            "create_pull_request": true,
            "get_pull_request": true,
            "list_pull_request": true,
            "search_users": true
          }
        },
        "atlassian": {
          "enabled": false // disable atlassian mcp (for example)
        }
      }
    }
  }
}

It would be up to the opencode configuration to define which mcp tools are available to the mode. It could get verbose, but an easy task for an llm model to update/customize if needed.

Metadata

Metadata

Assignees

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