-
Notifications
You must be signed in to change notification settings - Fork 14.8k
[FEATURE]: Provider/Model-specific MCP servers #6024
Description
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
-
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
-
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
-
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:
Benefits
- Cleaner tool environment - Only relevant MCPs are active per model
- Reduced context pollution - Smaller tool list improves model performance
- Resource optimization - No unnecessary MCP server connections
- 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!
{ "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"] } } } }