Skip to content

feat(opencode): add mcp remove command - #44233

Open
Neelesh2512 wants to merge 2 commits into
anomalyco:devfrom
Neelesh2512:mcp-remove-update
Open

feat(opencode): add mcp remove command#44233
Neelesh2512 wants to merge 2 commits into
anomalyco:devfrom
Neelesh2512:mcp-remove-update

Conversation

@Neelesh2512

@Neelesh2512 Neelesh2512 commented Aug 22, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #4570

Type of change

  • New feature

What does this PR do?

#4570 asked for a way to remove MCP servers from the CLI. Right now the only option is editing opencode.json by hand. That issue was closed as completed but the command never landed.

This adds opencode mcp remove [name]:

  • Removes the server entry from opencode.json
  • Comments in the file are kept as they are
  • Also deletes saved OAuth tokens for that server if any exist
  • Running without a name shows a picker list

To support this, some config path lookup code already used by mcp add is now shared between the two commands.

How did you verify your code works?

  • Added subprocess tests in test/cli/mcp-remove.test.ts: removal works, other servers and comments stay intact, missing server exits with an error
  • Updated the help text snapshot
  • typecheck, lint and format pass, full test/cli and test/mcp suites pass (432 tests)
  • Ran it manually against a config file with comments, only the named server was removed

Screenshots / recordings

image
image

Checklist

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

Adds an `opencode mcp remove [name]` subcommand so MCP servers can be
removed from the CLI instead of hand-editing opencode.json (anomalyco#4570).

The delete runs through jsonc-parser so surrounding comments and
formatting survive. The defining file is located by checking project
config paths before global ones, matching config precedence. Stored
OAuth tokens for the removed server are cleaned up when present.
Config path lookup helpers are now shared between add and remove.
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Aug 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@Neelesh2512

Copy link
Copy Markdown
Author

Hi @rekram1-node ,
Could you please take a look at this PR?
Or please help me redirect to right person.

Thanks!

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]:MCP with delete and update

1 participant