Skip to content

[FEATURE]: Add and Remove MCP servers from the TUI dialog with config persistence #38993

Description

@abhirampuranik

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

#37712 exposed runtime MCP controls (add, remove, connect, disconnect) over HTTP but explicitly left the TUI surface out of scope:
"No TUI surface for add/remove yet; those are for programmatic clients."

This issue adds that missing TUI surface and makes runtime changes durable by persisting them to the project config file.

Related:

#37308 — core runtime MCP controls (merged)
#37712 — HTTP routes for MCP controls (merged)
#36303 — MCP modal exploration (open, broader scope)
#9871 — /reload slash command (open, complements this)

Problem

Adding or removing MCP servers currently requires editing opencode.json/opencode.jsonc by hand and restarting OpenCode. This is disruptive mid-conversation, if you're deep into a session and realize you need a new MCP server (e.g., you just spun up a local tool server, or you want to connect to a remote endpoint), you have to:

  • Exit or background OpenCode
  • Edit the config file manually
  • Restart OpenCode, losing your conversation flow and mental context

The TUI MCP dialog (accessed via /mcps slash command) currently only supports toggling existing servers on/off. There is no way to add a new server or remove a stale one without leaving the TUI.

Proposed Solution

Ctrl+a and Ctrl+d in the /mcps dialog will let users add and remove MCP servers. Add prompts for server type, name, and connection details. Persist changes to the project config file using jsonc-parser to preserve comments and formatting.

Acceptance Criteria

  • Ctrl+a in the /mcps dialog prompts for type, name, and connection details, then adds and connects the server immediately
  • Ctrl+d removes the selected server and cleans up its connection
  • Both operations persist to the project config file without destroying comments or formatting
  • The dialog refreshes status after add/remove
  • New servers are usable in the current session without restarting OpenCode

These changes are only for TUI

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