Skip to content

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

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

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
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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