Skip to content

[feature request]: ability to dynamic turn on mcp server for specific agent #2953

Closed

Description

@zelifish

Hope I'm not doing this wrong, but with this opencode config in version 0.11.1

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "graphql": {
      "type": "local",
      "enabled": false,
      "command": ["bunx", "mcp-graphql"],
      "environment": {
        "ENDPOINT": "http://localhost:13087/graphql"
      }
    }
  }
}

And this agent definition

---
description: test agaent
mode: primary
tools:
  graphql_*: true
---

This is a test agent

My agent can't actually see the graphql mcp tools. I tried various permutations of graphql, graphql*, graphql_*, etc.

Activity

  1. github-actions commented on Oct 3, 2025

    @github-actions
    Contributor

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

    Feel free to ignore if none of these address your specific case with disabled MCP servers not being accessible through agent tool configurations.

  2. rekram1-node commented on Oct 3, 2025

    @rekram1-node
    Collaborator

    @zelifish so here is what you need to do:

    {
      "$schema": "https://opencode.ai/config.json",
      "mcp": {
        "graphql": {
          "type": "local",
          "enabled": true,
          "command": ["bunx", "mcp-graphql"],
          "environment": {
            "ENDPOINT": "http://localhost:13087/graphql"
          }
        }
      },
      "tools": {
        "graphql*": false
      }
    }
    

    enabled being false means the MCP server won't ever turn on at all so it isn't possible to give to llm

  3. zelifish commented on Oct 3, 2025

    @zelifish
    Author

    Hmm, my motivation for this was to mitigate long startup times for tools that we only need when working on the front end portion of our repo. Is there a better way of doing that? My only other solution was to move my opencode configs down into the FE section but then I can't actually use them when working across the back and the front end having started opencode from a higher directory (or can I)?

    I guess I could explicitly pass the config in the opencode command but no one's going to obey my complicated instructions if that's what I make them do.

  4. rekram1-node commented on Oct 3, 2025

    @rekram1-node
    Collaborator

    @zelifish rn there isn't a better way of doing it tbh, in opentui version there will probably be a mechanism to enable and disable mcp servers on the fly but rn it isn't super easy

  5. changed the title [-]Can't enable a disabled mcp server in an agent markdown definition[/-] [+][feature request]: ability to dynamic turn on and off mcp server [/+] on Oct 3, 2025
  6. changed the title [-][feature request]: ability to dynamic turn on and off mcp server [/-] [+][feature request]: ability to dynamic turn on mcp server for specific agent[/+] on Oct 3, 2025
  7. benceferdinandy-signifyd commented on Oct 16, 2025

    @benceferdinandy-signifyd

    @rekram1-node do you have an estimate for opentui release?

  8. rekram1-node commented on Oct 16, 2025

    @rekram1-node
    Collaborator

    @benceferdinandy-signifyd if you need it specifically for this issue, i can't really give a timeline on when this will be addressed as it is a lower priority rn

    As for opentui version shipping in general id say next week probs

  9. benceferdinandy-signifyd commented on Oct 16, 2025

    @benceferdinandy-signifyd

    Just generally opentui, thanks!

  10. emilford commented on Nov 21, 2025

    @emilford

    @rekram1-node the suggested approach doesn't seem to work for me. I have the GitHub MCP server set up and enabled, tools in the global configuration includes "github*": false and the subagent markdown includes tools: "github*": true, but the agent doesn't have access to the tools. If I comment out the global tools line everything works. What am I missing? 🤔

    Edit:

    Ah, it looks like configuring the agent tools in opencode.js works in the way described above. Is this a markdown limitation?

      "tools": {
        "github*": false,
        ...
      },
      "agent": {
        "github": {
          "tools": {
            "github*": true
          }
        }
      }
    
  11. rekram1-node commented on Nov 24, 2025

    @rekram1-node
    Collaborator

    @emilford this is what it'd look like in markdown:

    ---
    description: ALWAYS use this when writing docs
    tools:
      "github*": false
    ---
    
  12. lcswillems commented on Dec 11, 2025

    @lcswillems

    @rekram1-node The issue is that the MCP server will appear in all sessions for all agents even though the agents are not allowed to use it...

    I've opened another issue that focuses on this context issue. This is very annoying...

    #5373

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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