Skip to content

mecatui: option to honor static mcp.servers (settings/--mcp-server) in embedded mode, default off #658

Closed

Description

@jbeda

Summary

mecatui in embedded (bare-local) mode silently ignores static MCP servers configured via the operator settings file (~/.config/mecatl/settings.yaml → mcp.servers) — and exposes no --mcp-server flag. On a host without a working ToolHive container runtime, the result is MCP DISABLED (no servers resolved from any source) even though the user has a valid server configured. Nothing in the log points at why.

Reported by a user who had a valid mcp.servers entry that never activated, and lost time tracing it.

Root cause

app.Build only folds the operator-tier mcp: settings block into cfg.MCPServers when a MCPProfileLoader is installed (internal/app/build.go:1314). The three server-head command roots install it:

  • cmd/mecated/main.go:1117 — MCPProfileLoader: cliconfig.NewMCPProfileResolver(cfg.mcpServers, os.LookupEnv)
  • cmd/mecak8s/flags.go:527 — same
  • cmd/mecatequi/flags.go:410 — same

cmd/mecatui installs no MCPProfileLoader and registers no --mcp-server flag (embeddedConfig at cmd/mecatui/main.go only sets ToolHiveEnabled: true, MCPResourceTools: true, MCPPrompts: true). The 2026-06-02 wiring comment is explicit that "Static --mcp-server stays off (heavier opt-in)" — mecatui's embedded MCP story was deliberately ToolHive-centric and predates the operator-settings profile seam. That seam was never back-fitted to mecatui, so the settings-half is now a silent no-op there.

LoadMCPProfiles(nil-legacy) already handles the no---mcp-server-flag case cleanly, so the seam itself needs no new code.

Why this hurts

  • A user with settings-file MCP servers gets static=0, no error, no deepwiki/server mention — the loader fails soft by design, so there's zero diagnostic signal that the config was parsed and dropped.
  • ToolHive is not a fallback on a laptop with no container runtime (No available runtime found in the diagnostic), so for that population the TUI's only MCP source is the settings file — which is exactly the one that's skipped.
  • The user-docs MCP page describes the settings-file + mecated mcp login flow without noting it doesn't apply to embedded mecatui.

Proposal

  1. Add an opt-in that lets embedded mecatui honor static MCP config (settings-file mcp.servers and/or --mcp-server), wired via MCPProfileLoader: cliconfig.NewMCPProfileResolver(cfg.mcpServers, os.LookupEnv) on the embedded path. Suggested surface: a --mcp-static (or --mcp-server) flag; ToolHiveEnabled stays as-is and composes freely.

  2. Default OFF — preserves the current posture and the 2026-06 design intent ("heavier opt-in"). No behavior change for existing launches.

  3. Warn when config is present but unused. When the loader is NOT installed but resolver.OperatorMCP() (or the parsed mcp: block) is non-empty, emit a single one-line WARN naming the count, e.g.:
    mcp: N static server(s) configured in settings.yaml are NOT loaded in embedded mecatui without --mcp-static; see docs
    so the next person sees the config was seen and deliberately not used, instead of silent darkness.

Acceptance

  • mecatui --mcp-static (or equivalent) with a valid settings mcp.servers entry logs MCP servers connected ... servers=N and exposes mcp__<name>__* tools.
  • Without the flag, behavior is byte-identical to today except the one WARN line above.
  • mecated/mecak8s/mecatequi behavior unchanged.
  • A regression test pins that the embedded config surfaces the configured server when the opt-in is set, and emits the WARN when it isn't.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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