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
cli: mcp/plugin/debug subcommands reject --standalone and spawn a detached service #53878
mcp list/auth/logout, plugin list/inventory and debug agents/config do not take --standalone/--server. They always start opencode serve --service (ppid 1), which keeps running after the command exits.
Thanks for the clear report. I reproduced this on 2.0.24 (on Linux):
opencode mcp list --standalone prints usage with Unrecognized flag: --standalone in command opencode mcp list. mcp auth, mcp logout, plugin list, debug agents and debug config reject it the same way. opencode session list --standalone accepts it.
With a service.json pinning port 47391, a plain opencode mcp list leaves a detached opencode serve --service (ppid 1) listening on :47391 after the command exits.
On the latest v2 commit (93afa91) the flag is still rejected, and these handlers still call ServerConnection.resolve() with no arguments, as you pointed out.
and their specs in packages/cli/src/commands/commands.ts declare no params, so --standalone / --server are rejected as unrecognized flags and every run falls through to the managed service — starting a detached opencode serve --service that outlives the command. The commands that already work (auth, models, reload, session …) declare ...ServerParams and pass the parsed values into resolve.
Planned fix:
add ...ServerParams to the affected subcommand specs (mcp list/auth/logout, plugin list, debug agents/config), matching how auth and models do it;
thread the flags into resolve({ server: Option.getOrUndefined(input.server), standalone: input.standalone }) in each handler;
check whether plugin check / plugin update need the same treatment, since they reach the same argument-less resolve() through inspect() in plugin/inventory.ts:19 (that helper is also called by the updater, which has its own service context, so I'll only change the command paths);
add a CLI test asserting the flags are accepted and reach resolve.
Scope stays on these commands; I won't touch the subcommands that already forward the flags.
All eight commands now declare the shared ...ServerParams and thread { server: Option.getOrUndefined(input.server), standalone: input.standalone } into ServerConnection.resolve, matching what auth …, models, reload and session … already do:
plugin/inventory.ts's inspect() is shared by plugin check and plugin update, so it now takes (args, selected?) and forwards the args; services/updater.ts does not call it, so nothing outside the command surface moved.
Verified with a new packages/cli/test/server-params.test.ts: a --help case over all eight paths asserting both flags are advertised, and a functional case driving mcp list --server <url> against a local Bun.serve that asserts exit 0, /api/mcp reached, and noservice-local.json written. On the unmodified tree that case fails with the reported Unrecognized flag: --server in command opencode mcp list; it passes with the change. The ten neighbouring CLI suites are 65 pass / 0 fail, tsgo -b --force is clean and oxlint reports nothing.
On macOS with @opencode/cli 2.1.1, opencode plugin check --help and opencode plugin update --help still offer neither --standalone nor --server as flags.
My use case is a maintenance script that runs plugin check <package> followed by plugin update <package>. I rarely use OpenCode otherwise, so I would like to update plugins without leaving a shared service running.
#54166 appears to cover this. @argszero, I saw your note about closing it because of the open PR limit. Could it be reopened for review?
Activity
opencode-agent commentedon Oct 8, 2026
Thanks for the clear report. I reproduced this on 2.0.24 (on Linux):
opencode mcp list --standaloneprints usage withUnrecognized flag: --standalone in command opencode mcp list.mcp auth,mcp logout,plugin list,debug agentsanddebug configreject it the same way.opencode session list --standaloneaccepts it.service.jsonpinning port 47391, a plainopencode mcp listleaves a detachedopencode serve --service(ppid 1) listening on :47391 after the command exits.On the latest
v2commit (93afa91) the flag is still rejected, and these handlers still callServerConnection.resolve()with no arguments, as you pointed out.argszero commentedon Oct 9, 2026
I'd like to work on this.
Confirmed the mechanism on
v2. These subcommands resolve their server throughServerConnection.resolve()with no arguments:packages/cli/src/commands/handlers/mcp/list.ts:12,mcp/auth.ts:24,mcp/logout.ts:15packages/cli/src/commands/handlers/plugin/list.ts:19packages/cli/src/commands/handlers/debug/agents.ts:12,debug/config.ts:13and their specs in
packages/cli/src/commands/commands.tsdeclare no params, so--standalone/--serverare rejected as unrecognized flags and every run falls through to the managed service — starting a detachedopencode serve --servicethat outlives the command. The commands that already work (auth,models,reload,session …) declare...ServerParamsand pass the parsed values intoresolve.Planned fix:
...ServerParamsto the affected subcommand specs (mcp list/auth/logout,plugin list,debug agents/config), matching howauthandmodelsdo it;resolve({ server: Option.getOrUndefined(input.server), standalone: input.standalone })in each handler;plugin check/plugin updateneed the same treatment, since they reach the same argument-lessresolve()throughinspect()inplugin/inventory.ts:19(that helper is also called by the updater, which has its own service context, so I'll only change the command paths);resolve.Scope stays on these commands; I won't touch the subcommands that already forward the flags.
argszero commentedon Oct 9, 2026
Opened #54166 with the fix.
All eight commands now declare the shared
...ServerParamsand thread{ server: Option.getOrUndefined(input.server), standalone: input.standalone }intoServerConnection.resolve, matching whatauth …,models,reloadandsession …already do:mcp list,mcp auth,mcp logout,plugin list,plugin check,plugin update,debug agents,debug configplugin/inventory.ts'sinspect()is shared byplugin checkandplugin update, so it now takes(args, selected?)and forwards the args;services/updater.tsdoes not call it, so nothing outside the command surface moved.Verified with a new
packages/cli/test/server-params.test.ts: a--helpcase over all eight paths asserting both flags are advertised, and a functional case drivingmcp list --server <url>against a localBun.servethat asserts exit 0,/api/mcpreached, and noservice-local.jsonwritten. On the unmodified tree that case fails with the reportedUnrecognized flag: --server in command opencode mcp list; it passes with the change. The ten neighbouring CLI suites are 65 pass / 0 fail,tsgo -b --forceis clean andoxlintreports nothing.szafranski commentedon Oct 20, 2026
On macOS with @opencode/cli 2.1.1,
opencode plugin check --helpandopencode plugin update --helpstill offer neither--standalonenor--serveras flags.My use case is a maintenance script that runs
plugin check <package>followed byplugin update <package>. I rarely use OpenCode otherwise, so I would like to update plugins without leaving a shared service running.#54166 appears to cover this. @argszero, I saw your note about closing it because of the open PR limit. Could it be reopened for review?