Summary
The agent should be able to add, remove, and toggle MCP servers in its own config during a session — without the user having to manually edit JSON or exit the TUI.
Use cases
- Agent discovers it needs a tool (e.g., database MCP) and can add it on the fly
- Agent disables a noisy/slow MCP server that's not relevant to the current task
- Per-agent tool scoping: an agent enables only the MCP servers it needs
How opencode does it
Agents can enable/disable specific MCP tools within their agent config section. A server can be disabled globally but selectively enabled for a particular agent.
Proposed approach
- Expose MCP config modification as a built-in tool the agent can call
- Operations:
add_server, remove_server, enable_server, disable_server, list_servers
- Changes persist to the project's MCP config file
- Security: require user confirmation before adding new servers (arbitrary command execution risk)
Summary
The agent should be able to add, remove, and toggle MCP servers in its own config during a session — without the user having to manually edit JSON or exit the TUI.
Use cases
How opencode does it
Agents can enable/disable specific MCP tools within their agent config section. A server can be disabled globally but selectively enabled for a particular agent.
Proposed approach
add_server,remove_server,enable_server,disable_server,list_servers