Skip to content

feat(mcp): allow agent to self-modify its own MCP config #137

@justrach

Description

@justrach

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: featureBrand new functionality, features, pages, workflows, endpoints, etc.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions