Skip to content

[FEATURE]: Load MCP servers asynchronously to not block startup #20755

Closed as not planned

Description

@ccfontes

Problem

MCP clients (especially remote ones like exa, grep_app, context7) are loaded synchronously during OpenCode startup, blocking the UI from appearing. Users wait 2-3+ seconds before seeing anything.

Solution

Load MCP clients asynchronously after the main UI is ready, rather than blocking startup. If an MCP client is not yet connected when a tool is used, it should either:

  1. Connect lazily when first needed, OR
  2. Show a "connecting..." status and not block the UI

Startup delay data (from logs)

  • exa (remote): ~2s (OAuth discovery + connection)
  • grep_app (remote): ~624ms
  • context7 (remote): ~471ms

Workaround

Users can disable remote MCP clients in config, but this defeats the purpose of having them installed.

Related issues

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    perfIndicates a performance issue or need for optimization
    on Apr 2, 2026
  2. github-actions commented on Apr 2, 2026

    @github-actions
    Contributor

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • No issue template was used. Please resubmit using one of the three required templates: Bug Report, Feature Request (title must start with [FEATURE]:), or Question. This issue appears to be either a bug report or a feature request — please pick the appropriate template and fill in the required fields.

    Please edit this issue to address the above within 2 hours, or it will be automatically closed.


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

    If you believe this was flagged incorrectly, please let a maintainer know.

  3. ccfontes commented on Apr 2, 2026

    @ccfontes
    Author

    opencode created this issue on its own initiative ^^' but i guess it's fine..

  4. changed the title [-]MCP servers block startup - should load asynchronously[/-] [+][FEATURE]: Load MCP servers asynchronously to not block startup[/+] on Apr 2, 2026
  5. github-actions commented on Apr 2, 2026

    @github-actions
    Contributor

    Thanks for updating the issue! It now meets our contributing guidelines — great write-up with the specific timing data. The feature request is clear and well-structured.

  6. removed
    perfIndicates a performance issue or need for optimization
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  7. Arcadi4 commented on May 27, 2026

    @Arcadi4
    Contributor

    One concern is that async / lazy load might affect stability and cache rates as MCP servers injects instructions and tool definitions to the agent. It is the best to start a session with all MCPs loaded. I think lately they made a partial fix by showing a spinner at start up. At least the UX is better.

  8. added a commit that references this issue on May 29, 2026
  9. github-actions commented on Jul 27, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

  10. devinder-augur commented on Sep 27, 2026

    @devinder-augur

    Hi is there a workaround for this? It takes 18s of coldstart sometimes

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