anomalyco / anomalyco/opencode

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

Open
#38,993 6 comments 0 reactions 1 assignee View on GitHub

@kommander is already working on this.

Since Jul 26, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.