Skip to content

tui: MCP server dialogs show an empty list #36580

Closed

Description

@mwikala

Summary

The TUI's MCP server picker and status modal both report no MCP servers even though the same project has multiple registered servers and opencode2 mcp list reports their connection states correctly.

Environment

  • opencode version: opencode2 v0.0.0-next-15385
  • OS: Linux 7.1.3-arch1-1 x86_64
  • Terminal: Ghostty (TERM=xterm-256color, COLORTERM=truecolor)
  • Shell: /usr/bin/zsh
  • Install/channel: V2 next beta, installed globally via npm

Reproduction

  1. Configure global and project MCP servers using the native V2 mcp.servers configuration.
  2. Start opencode2 from the project directory.
  3. Confirm that opencode2 mcp list displays the configured servers and their statuses.
  4. In the TUI, press ctrl+p and open MCP Servers.
  5. Observe that the list is empty.
  6. Press ctrl+x, then s to open the status modal.
  7. Observe that it says No MCP Servers.

Expected Behavior

Both TUI dialogs should list the same MCP servers and connection states reported by opencode2 mcp list.

Actual Behavior

The MCP Servers list is empty, and the status modal says No MCP Servers. The CLI command correctly lists connected, disabled, and authentication-required servers.

Additional Context

The issue is consistently reproducible. The background service is healthy at http://127.0.0.1:4096, and /api/health reports version 0.0.0-next-15385.

opencode2 mcp list reports 12 configured servers across connected, disabled, and authentication-required states. Server logs also confirm successful MCP connections and show the project location as the active directory.

This started after migrating global and project configuration from V1 to native V2 configuration.

Activity

  1. opencode-agent commented on Jul 13, 2026

    @opencode-agent
    Contributor

    I traced both paths. The TUI does not derive this list from its loaded config; both dialogs render sync.data.mcp, populated by the SDK's GET /mcp call during non-blocking bootstrap. That call currently does not use throwOnError or inspect result.error:

    sdk.client.mcp.status({ workspace }).then((x) =>
      setStore("mcp", reconcile(x.data ?? {})),
    )

    So any fulfilled API error/missing data is converted to {}, after which the picker looks empty and Status says “No MCP Servers.” By contrast, opencode2 mcp list loads config/MCP state directly in its own process. This makes the leading hypotheses:

    1. /mcp is returning an error that the TUI masks as an empty successful response; or
    2. the TUI request and mcp list are resolving different directory/workspace/server contexts.

    Could you provide the following from the same project directory? Please redact server names, command arguments, paths, URLs, headers, and tokens as needed.

    1. Output (including HTTP/API error detail) of:
      opencode2 api get /mcp
    2. Whether this reproduces with:
      opencode2 --standalone
    3. The exact command used to start the TUI, and whether --server, --port, OPENCODE_SERVER, or experimental workspaces are involved.
    4. Relevant redacted role=cli and role=server log lines from one launch/reproduction, especially any tui bootstrap failed, /mcp, workspace-routing, or instance-loading errors.

    One subtlety: depending on this build/launch mode, the TUI may use an embedded worker/private server rather than the healthy service at 127.0.0.1:4096, so the health check alone does not establish that mcp list, api get /mcp, and the TUI share the same instance.

    The masking behavior is now tracked broadly in #36582, but the output above should identify the underlying failure for this report.

  2. mwikala commented on Jul 13, 2026

    @mwikala
    Author

    The MCP servers are now appearing in the TUI. This may have been caused by the TUI or background service retaining stale state after the V1-to-V2 configuration migration; reloading the shell and restarting/reconnecting the service appears to have resolved it. I can no longer reproduce the original issue, so I’m closing this report.

  3. mwikala commented on Jul 13, 2026

    @mwikala
    Author

    Nevermind, I thought this was a one off but I keep seeing it happen. Sometimes I see my MCPs listed in the TUI, but more often they're not.

    At all times though, the MCPs are available to the agent. I do keep seeing it do a search though instead of just calling the MCP directly:

    Image
  4. entrptaher commented on Jul 14, 2026

    @entrptaher

    Facing same issue.

    Image

    Tried with cloning the v2 directly and running, no avail.

  5. entrptaher commented on Jul 14, 2026

    @entrptaher

    I think I fixed the thing.

    Image

    The issue was that mcp.server.refresh() and mcp.resource.refresh() were passing locationQuery(ref) which returns undefined when called during bootstrap (no argument), instead of locationQuery(ref ?? defaultLocation()) like all other location refresh methods do.

    This caused MCP data to be stored under a key derived from the server's process.cwd() while DialogMcp reads from the key derived from the client's defaultLocation(), different keys, so nothing showed up.

  6. opencode-agent commented on Jul 30, 2026

    @opencode-agent
    Contributor

    Addressed by commit 2508a74 and the current location-scoped TUI data API. MCP server and resource sync now key both the request and store update from ref ?? defaultLocation(), using the authoritative location returned by the server; dialogs read from that same location key. This removes the bootstrap mismatch identified in the issue where MCP data was stored under process cwd but read under the client default location. Closing as resolved.

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions