Skip to content

bug(tui): MCP tool count stuck at fixed value when some servers fail to connect #2277

@bug-ops

Description

@bug-ops

Problem

The TUI's MCP Tools panel always shows the same total tool count regardless of how many MCP servers are configured in the config. Specifically, when some servers fail to connect (OAuth timeout, Docker not running), only the tools from successfully-connected servers are counted — but this is not communicated to the user.

Observed Behavior

With 3 MCP servers configured (mcpls stdio, playwright docker, todoist OAuth), the TUI shows a fixed tool count (e.g. 75) that reflects only mcpls tools. Adding or removing todoist/playwright from the config does not change the displayed count because those servers never connect.

Root Cause

mcp_tool_count in MetricsSnapshot is set once during startup from connect_all() results and updated only on /mcp add|remove commands or tools/list_changed events. Failed servers contribute 0 tools and there is no indication in the TUI that some configured servers did not connect.

  • crates/zeph-core/src/agent/builder.rs:841mcp_tool_count set at build time
  • crates/zeph-tui/src/widgets/skills.rs:72-75MCP Tools (active/total) widget shows only totals, no per-server status

Expected Behavior

  • TUI should show per-server connection status (connected / failed / pending OAuth)
  • TUI should indicate when a configured server failed to connect (with reason: OAuth required, Docker unavailable, timeout, etc.)
  • OR at minimum: the Resources panel should show N/M servers connected instead of only the aggregate tool count

Related

This bug is largely a symptom of #2276 (OAuth blocks startup): todoist tools are always 0 because OAuth never completes, making the total appear stuck.

Files

  • crates/zeph-tui/src/widgets/resources.rs:130-135 — MCP server/tool count display
  • crates/zeph-tui/src/widgets/skills.rs:61-78 — MCP Tools panel
  • crates/zeph-core/src/metrics.rs:172-173mcp_server_count, mcp_tool_count fields (no per-server status)

Metadata

Metadata

Assignees

Labels

P2High value, medium complexitybugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions