Skip to content

feat(tui): add/remove MCP servers from /mcps dialog - #40309

Open
abhirampuranik wants to merge 8 commits into
anomalyco:devfrom
abhirampuranik:dynamic-mcp-servers
Open

feat(tui): add/remove MCP servers from /mcps dialog#40309
abhirampuranik wants to merge 8 commits into
anomalyco:devfrom
abhirampuranik:dynamic-mcp-servers

Conversation

@abhirampuranik

@abhirampuranik abhirampuranik commented Aug 3, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #38993

Type of change

  • New feature

What does this PR do?

This PR introduces adding and deleting MCP dynamically in a given OpenCode session in /mcps dialog in the TUI..
Currently the /mcps dialog box is read-only view, but personally I was feeling a hassle every time to change opencode.json file to add and remove MCP I use for my day-to-day analysis activities.

This adds two keybinds to the MCP dialog:

ctrl+o - add a new MCP server (prompts for name, type, and connection details)
ctrl+d - remove the selected server

  • Addition and deletion will only affect the local opencode.json file and not the global values at ~/.config/opencode/opencode.json
  • Advanced fields (headers, environment, cwd, timeout, oauth) can be configured by editing opencode.json directly. A future iteration could prompt for these in the TUI.
  • This opens a toast for success/failure of MCP addition/deletion.

How did you verify your code works?

Built the TUI binary, launched it, opened /mcps, added both local and remote servers via ctrl+o, confirmed they appeared and connected, removed them via ctrl+d, confirmed they disappeared from the dialog and were removed from opencode.json. Also verified the optimistic loading state shows while the server is connecting.

Screenshots / recordings

Recording of the changes, adding remote and local MCP during the conversation and checking whether tools calls are available. Checked if the MCP calls are unavailable when MCP is removed.

recording.mp4

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions Bot mentioned this pull request Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant