Skip to content

/ command list blocks on all MCP servers connecting (multi-second delay before file-based commands show up) #48629

Closed

Description

@luochen1990

Problem

GET /command (the data source for the TUI / autocomplete) waits for every enabled MCP server to finish connecting before returning anything, because Command.init awaits mcp.prompts() alongside config/skill loading, and the MCP InstanceState init blocks on all servers settling (30s timeout each).

With a handful of MCP servers configured, the / menu lacks file-based commands and prompts for several seconds after startup, even though the commands themselves come from local files.

Numbers

Measured with opencode serve + time curl /command (9 MCP servers enabled, cold instance):

  • as-is: 5.6s (slowest chain: an npx-launched server + a heavy node CLI)
  • with all MCP disabled: 0.65s — file commands + 56 skills load entirely within this budget

So the file-based command listing itself is sub-second; the entire remaining delay is MCP connect waiting.

Expected

File-based commands should be available immediately; MCP prompts can join the list asynchronously once their servers connect (e.g. via an event that lets clients re-fetch).

One trade-off worth naming: a client that fetches /command exactly once without subscribing to events would miss MCP prompts from its first response during the connection window — fine for autocomplete, but it should be a stated decision rather than an accident.

Happy to send a PR if this direction sounds right — I have a working implementation with tests.

Activity

  1. github-actions commented on Sep 12, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If your issue is distinct enough (e.g. you want async loading rather than just graceful degradation), feel free to clarify. Otherwise, adding your benchmarks and PR offer to #36288 would be very helpful.

  2. neriousy commented on Oct 20, 2026

    @neriousy
    Member

    Thanks for measuring the delay and explaining how slow MCP connections block local slash commands. This is fixed in v2: MCP servers connect in the background, command listing reads currently available prompts without waiting, and commands refresh as MCP prompts arrive. v1 now receives only critical fixes; please upgrade with npm i -g @opencode/cli@latest. If local commands still wait for MCP connections on v2, please open a new issue with your version and timings.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions