You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Disabling MCPs doesn't persist across sessions #13763
I've 5 MCPs configured in OpenCode. If I disable them, when I restart opencode the MCPs are enabled again. I would expect the status to persist across sessions.
Plugins
No response
OpenCode version
1.2.5
Steps to reproduce
/mcps
press to toggle an mcp
close opencode
re-open opencode
/mcps -> the previously disabled mcp has been enabled again
Screenshot and/or share link
No response
Operating System
No response
Terminal
No response
Reacted by dawidbednarczyk, micheldenario, Kaixi Luo and blfernandezGit
+1 — This is a significant pain point for users with many MCP servers configured.
Use case
I run 8+ MCP servers (RADKit, Webex RAG, CDETS, Topic Search, GitHub Enterprise, Chrome DevTools, etc.). In a 128k context window, MCP tool definitions alone consume ~40k tokens — a third of available context before any conversation begins. Being able to start lean and enable MCPs on-demand was a killer workflow in Claude Code, where the disable state persisted across sessions.
With OpenCode, the toggle resets every restart, so I ended up permanently removing servers from config instead of just disabling them — which means re-adding them later when I need them. That's exactly the wrong tradeoff.
Technical root cause
After reading the source, the gap is clear:
Model selection persists to Global.Path.state/model.json via Filesystem.writeJson (local.tsx L123-151)
MCP toggle only updates in-memory Instance.state (mcp/index.ts L554-564) — no filesystem write
The pattern already exists for models; MCPs just need the same treatment.
Suggested implementation
The lowest-friction approach: save toggle state to Global.Path.state/mcp-state.json (mirroring model.json), and read it back during MCP initialization in state(). The local.tsx model persistence pattern is a clean template.
Prior art
Claude Code has persistent MCP disable at the UI level. See also anthropics/claude-code#10447 where users calculated ~65K tokens lost per session to unused MCP tool definitions — a compelling argument for start-lean-enable-on-demand workflows.
Second this, I will also like this to persist across sessions like vscode does, I don't want MCP's to be auto-enabled unless I activate them when I need them. I have big mcp tools that can consume a lot of tokens if activated.
I've conducted an exhaustive investigation into why MCPs cannot be effectively disabled in OpenCode, and I believe your issue (#13763) touches on a symptom of a deeper architectural problem that may not be fully solved by simply persisting toggle state.
Key finding: at least two MCPs — chrome-devtools and morphllm-fast-apply — are hardcoded into the opencode binary itself. They spawn automatically on every startup (visible in logs as service=mcp key=chrome-devtools type=local found) even when the user's opencode.json contains no reference to them.
This means:
Persisting /mcps toggle state will help user-defined MCPs, but it will not give users a way to turn off these binary-bundled defaults.
Attempting to add "chrome-devtools": { "enabled": false } to opencode.json currently produces a fatal schema validation error (Invalid input mcp.chrome-devtools) in the session attach path.
The public JSON schema (https://opencode.ai/config.json) does not even declare an mcp property; validation is handled by an internal zod schema that rejects built-in names.
I've opened a dedicated feature request (#22188) specifically requesting an official mechanism to disable built-in MCP servers. It may be worth considering that fix alongside toggle persistence so that users can actually opt out of all MCPs, not just the ones they manually configured.
Key finding: at least two MCPs — chrome-devtools and morphllm-fast-apply — are hardcoded into the opencode binary itself. They spawn automatically on every startup (visible in logs as service=mcp key=chrome-devtools type=local found) even when the user's opencode.json contains no reference to them.
Activity
dawidbednarczyk commentedon Feb 25, 2026
+1 — This is a significant pain point for users with many MCP servers configured.
Use case
I run 8+ MCP servers (RADKit, Webex RAG, CDETS, Topic Search, GitHub Enterprise, Chrome DevTools, etc.). In a 128k context window, MCP tool definitions alone consume ~40k tokens — a third of available context before any conversation begins. Being able to start lean and enable MCPs on-demand was a killer workflow in Claude Code, where the disable state persisted across sessions.
With OpenCode, the toggle resets every restart, so I ended up permanently removing servers from config instead of just disabling them — which means re-adding them later when I need them. That's exactly the wrong tradeoff.
Technical root cause
After reading the source, the gap is clear:
Global.Path.state/model.jsonviaFilesystem.writeJson(local.tsx L123-151)Instance.state(mcp/index.ts L554-564) — no filesystem writeThe pattern already exists for models; MCPs just need the same treatment.
Suggested implementation
The lowest-friction approach: save toggle state to
Global.Path.state/mcp-state.json(mirroringmodel.json), and read it back during MCP initialization instate(). Thelocal.tsxmodel persistence pattern is a clean template.Prior art
Claude Code has persistent MCP disable at the UI level. See also anthropics/claude-code#10447 where users calculated ~65K tokens lost per session to unused MCP tool definitions — a compelling argument for start-lean-enable-on-demand workflows.
Related issues
--no-mcp)micheldenario commentedon Mar 2, 2026
Second this, I will also like this to persist across sessions like vscode does, I don't want MCP's to be auto-enabled unless I activate them when I need them. I have big mcp tools that can consume a lot of tokens if activated.
iMaxTomas commentedon Apr 12, 2026
I've conducted an exhaustive investigation into why MCPs cannot be effectively disabled in OpenCode, and I believe your issue (#13763) touches on a symptom of a deeper architectural problem that may not be fully solved by simply persisting toggle state.
Key finding: at least two MCPs —
chrome-devtoolsandmorphllm-fast-apply— are hardcoded into theopencodebinary itself. They spawn automatically on every startup (visible in logs asservice=mcp key=chrome-devtools type=local found) even when the user'sopencode.jsoncontains no reference to them.This means:
/mcpstoggle state will help user-defined MCPs, but it will not give users a way to turn off these binary-bundled defaults."chrome-devtools": { "enabled": false }toopencode.jsoncurrently produces a fatal schema validation error (Invalid input mcp.chrome-devtools) in the session attach path.https://opencode.ai/config.json) does not even declare anmcpproperty; validation is handled by an internal zod schema that rejects built-in names.I've opened a dedicated feature request (#22188) specifically requesting an official mechanism to disable built-in MCP servers. It may be worth considering that fix alongside toggle persistence so that users can actually opt out of all MCPs, not just the ones they manually configured.
Evidence summary: #22188
rekram1-node commentedon May 22, 2026
This is NOT true
rekram1-node commentedon May 22, 2026
Currently /mcps is only for toggling on/off on the fly not for persisting but yeah prolly should
github-actions commentedon Jul 22, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.