GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: Allow disabling failed MCP servers & persist the toggle by VlexWest · Pull Request #56452 · anomalyco/opencode

Conversation

@VlexWest

@VlexWest VlexWest commented Oct 17, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Issue for this PR

Closes #56451
Related: #62868 (fixes the toggle half; losing a stateful process on eviction is separate)

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Space in /mcps now disables a server in any state (failed, pending, connected). On a disabled server it enables it again. Before, failed servers could only be retried & pending ones ignored space.

The toggle is saved now. Disconnect writes "disabled": true (or "enabled": false for v1 entries) into the config file that defines the server, connect removes it. Edits go through jsonc-parser, so comments & formatting stay. Servers without a config file (runtime add, remote config) or defined by managed config keep the old runtime-only behavior.

  • core: Config.setMcpDisabled finds the highest-priority json/jsonc file with the server & edits it
  • core: disconnect interrupts a running connect attempt, so disabling a pending server is immediate instead of waiting for the startup timeout
  • server: connect/disconnect call it; connect still connects after the edit, so a server that the merged config keeps disabled doesn't end up as a silent no-op
  • tui: toggle logic & labels (enable / disable)

I know #17833 got pushback for writing to opencode.json. This only writes when the user toggles a server & only touches that one key, same as Claude Code does.

How did you verify your code works?

  • new core test: native & v1 entries, jsonc comments kept, enable removes the flag
  • new core test: disconnect on a server that never answers returns right away & ends disabled (times out on the old code)
  • new server test: failed local server gets disabled over HTTP & ends up disabled in config & status
  • new server test: a disabled v1 server stays disabled after /api/location/reload, which rebuilds the Location like an idle eviction (MCP servers disabled with /mcps reconnect after an idle Location eviction #62868)
  • new tui tests for failed, pending, connected & disabled, they fail on the old code
  • bun typecheck in core, server, tui, protocol
  • tried it locally with bun run dev:live on a failing server

Screenshots / recordings

1 2 3

Checklist

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

kfunigeneral reacted with thumbs up emoji eriktisme reacted with rocket emoji
All reactions
  • 👍 1 reaction
  • 🚀 1 reaction
@github-actions

github-actions Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@opencode-agent opencode-agent Bot mentioned this pull request Oct 17, 2026
Can't disable an MCP server that failed or is stuck connecting #56451
Open
opencode-agent[bot]
opencode-agent Bot reviewed Oct 17, 2026
View reviewed changes

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as described. In /mcps, space on a failed server now goes to Disabled (on the base it stayed Failed and only offered retry), and the core/server tests show the flag written to and removed from the defining config file with comments kept. I checked it by driving the TUI on the base and on this branch, and by running the core, server and tui tests plus typecheck for core, server, tui and protocol.

Public API: no new routes or fields, but the meaning of POST /api/experimental/mcp/{server}/connect and /disconnect changes. They now also write disabled: true / enabled: false into (or remove it from) the config file that defines the server. The desktop/web app (packages/app, gui-extensions) call these endpoints too, so their toggles will now save to config as well. The request and response shapes are unchanged. Config.Interface gains an optional setMcpDisabled.

Concerns:

  • packages/server typecheck and the new server test fail: test/mcp-toggle.test.ts imports jsonc-parser, which isn't a dependency of packages/server. JSON.parse is enough there.
  • The toggle can write to admin-managed config, and connect can silently do nothing (see inline comments).
  • Writing to user config files at all is a maintainer call, given the earlier pushback on #17833.

Before

After

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/server/test/mcp-toggle.test.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread packages/core/src/config.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread packages/server/src/handlers/mcp.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

VlexWest added 6 commits October 17, 2026 19:50
@VlexWest
Add MCP disabled flag to config
6335416
- add Config.setMcpDisabled for native and v1 MCP entries
- add test for jsonc comments and enable/disable roundtrip
@VlexWest
Change MCP connect & disconnect to persist
cc37c50
- change connect to clear the disabled flag in config
- change disconnect to set the disabled flag in config
- change route descriptions
- add test for a failed server
@VlexWest
Fix disabling failed MCP servers
b0c36e3
- change space to disable failed, pending and connected servers
- change space to enable disabled servers
- add tests for every status
@VlexWest
Fix disabling pending MCP servers
bdb2805
- change disconnect to interrupt a running connect attempt
- change interrupted connect to skip the failed status
- add test for a server that never answers
@VlexWest
Fix MCP toggle on managed config
67d4fe3
- change setMcpDisabled to stay runtime-only when managed config defines the server
- add test for a managed server
@VlexWest
Fix connect after enabling MCP
2132536
- change connect to start the server even after a config edit
- change toggle test to JSON.parse
@VlexWest
VlexWest force-pushed the mcp-disable-failed branch from d40ca8f to 2132536 Compare October 17, 2026 17:51
@VlexWest VlexWest mentioned this pull request Oct 17, 2026
feat(tui): explore a more capable MCP modal #36303
Open
7 tasks
@VlexWest VlexWest changed the title fix: Allow disabling failed MCP servers & persist the toggle feat: Allow disabling failed MCP servers & persist the toggle Oct 17, 2026
@VlexWest
Merge branch 'dev' into mcp-disable-failed
f4c044e
@opencode-agent opencode-agent Bot mentioned this pull request Oct 18, 2026
[FEATURE]: Desktop: add quick access to MCP server toggles #56837
Open
1 task done
VlexWest added 2 commits October 20, 2026 11:10
@VlexWest
Merge branch 'dev' into mcp-disable-failed
0211422
@VlexWest
Merge branch 'dev' into mcp-disable-failed
331cb54
@opencode-agent opencode-agent Bot mentioned this pull request Oct 23, 2026
Desktop v2.1.3: MCP toggle in Settings does nothing — server stays connected, config not updated #58392
Closed
@eriktisme

eriktisme commented Nov 5, 2026

Copy link
Copy Markdown

@VlexWest Do you mind taking this PR over the finish line? 🙏

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@VlexWest
Merge branch 'dev' into mcp-disable-failed
4d70898
- fix conflicts with the MCP connection refactor
- change disconnect to interrupt pending starts through startConnection
- add pooled variant of the pending disconnect test
@VlexWest

VlexWest commented Nov 5, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Author

@eriktisme Done, merged dev & fixed the conflicts, should be good to go now.

Now let's hope a maintainer sees & merges it 🙂 (@rekram1-node @kitlangton)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@opencodejr opencodejr Bot mentioned this pull request Nov 9, 2026
MCP servers disabled with /mcps reconnect after an idle Location eviction #62868
Open
@kfunigeneral

kfunigeneral commented Nov 9, 2026

Copy link
Copy Markdown

@VlexWest I think this would also fix the V2 location-eviction path in #62868.

On 2.2.6 and dev, MCP.disconnect only sets status: "disabled" in memory. After a location services evicted sweep, the Location rebuilds from config and the server reconnects with a new connectionID, so the /mcps choice is silently undone. Writing the flag into the defining config file is what's missing for config-defined servers; mine use the V1 mcp. shape, so enabled: false is the relevant path. It also survives /reload, unlike the runtime toggle.

This covers the toggle half of #62868. Would you mind mentioning it in the description as Related: #62868 (rather than Fixes), since the stateful-process loss is separate? It would also be good to add a regression test for the eviction path: disable via the mcp.disconnect endpoint, call LocationServiceMap.invalidate, boot the Location again, and assert the server is still disabled and the config still has the flag. I'm happy to help with that, or open a follow-up test-only PR after this lands if you'd rather keep this one more focused.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

VlexWest added 2 commits November 9, 2026 18:04
@VlexWest
Merge branch 'dev' into mcp-disable-failed
33cd92f
- fix conflict in the MCP dialog test fixture
@VlexWest
Add MCP eviction test
a769bb0
- add test that a disabled V1 server stays disabled after a location reload
- change toggle tests to share one setup
@VlexWest

VlexWest commented Nov 9, 2026

Copy link
Copy Markdown
Author

@kfunigeneral Ah yes, good catch, thanks! I've added "Related: #62868" to the description & a regression test: a disabled v1 server (mcp.) stays disabled after the Location is being rebuild + the config keeps enabled: false.

kfunigeneral reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kfunigeneral

kfunigeneral commented Nov 9, 2026

Copy link
Copy Markdown

@kfunigeneral Ah yes, good catch, thanks! I've added "Related: #62868" to the description & a regression test: a disabled v1 server (mcp.) stays disabled after the Location is being rebuild + the config keeps enabled: false.

Thanks, that's the exact test I was after. The test shape matches my config.

VlexWest reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@VlexWest
Merge branch 'dev' into mcp-disable-failed
7674092
@github-actions

github-actions Bot commented Nov 17, 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.

VlexWest reacted with thumbs down emoji
All reactions
  • 👎 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot closed this Nov 17, 2026
@github-actions github-actions Bot added the automated-pr-cleanup label Nov 17, 2026
@VlexWest

VlexWest commented Nov 24, 2026

Copy link
Copy Markdown
Author

This was closed by the cleanup bot, not by a review. I'm still actively working on it: it's up to date with dev (merged it again on Nov 9), conflict-free & has a regression test for #62868 that @kfunigeneral asked for. Could a maintainer reopen it? @rekram1-node

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

Reviewers

@opencode-agent opencode-agent[bot] opencode-agent[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

automated-pr-cleanup

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Can't disable an MCP server that failed or is stuck connecting

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@VlexWest @eriktisme @kfunigeneral
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.