Skip to content

[FEATURE]: Provider/Model-specific MCP servers #6024

@ramarivera

Description

@ramarivera

Describe the enhancement you want to request

Currently, OpenCode loads all configured MCP servers globally, regardless of which model or provider is selected. This creates several challenges:

Problem Examples

  1. MiniMax Coding Plan MCP (https://platform.minimax.io/docs/guides/coding-plan-mcp-guide) - These MCPs provide MiniMax-specific capabilities that are only useful when using MiniMax models

  2. GLM/Z.AI Coding Plan MCP (https://docs.z.ai/devpack/mcp/vision-mcp-server) - Vision MCP servers that are only relevant for models that explicitly support vision capabilities

  3. Duplication and Pollution - When switching between providers, users end up with unnecessary MCP servers active, causing tool pollution in the context window, unnecessary resource usage, and confusion about which tools are actually relevant

Proposed Solution

Allow MCP servers to be conditionally enabled based on the selected model or provider:

{
  "mcp": {
    "minimax-coding-plan": {
      "type": "local",
      "command": ["minimax-mcp", "serve"],
      "when": {
        "provider": ["minimax"]
      }
    },
    "zai-vision-mcp": {
      "type": "remote",
      "url": "https://mcp.example.com",
      "when": {
        "provider": ["zai-coding-plan"],
        "model": ["glm-*-vision"]
      }
    }
  }
}

Benefits

  1. Cleaner tool environment - Only relevant MCPs are active per model
  2. Reduced context pollution - Smaller tool list improves model performance
  3. Resource optimization - No unnecessary MCP server connections
  4. Better user experience - Clearer tool availability per model

Implementation Notes

  • Support glob patterns for model names (e.g., "glm-*-vision")
  • Support array of providers for servers that work across multiple providers
  • Default to current behavior (all MCPs enabled) if "when" is not specified for backward compatibility

Thank you for considering this enhancement!

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