Skip to content

Custom agent's mcp.enabled: false override doesn't disable the runtime MCP proxy #211

Description

@jhrozek

Summary

Found during review of #210. A custom (bring-your-own) agent can set mcp.enabled: false in its config override, and this is correctly reflected in bbox agents inspect and the agents add/doctor JSON receipt (both compute mcpDisabled from override.MCP.Enabled). However, the actual runtime MCP proxy wiring in cmd/bbox/main.go's applyCustomAgentAuthzDefault path is only reached inside the block gated by the global MCP toggle (--no-mcp / cfg.MCP.Enabled) — it never consults the per-agent override.MCP.Enabled field.

Net effect: a custom agent that declares mcp.enabled: false for itself does not actually get the MCP proxy disabled at VM start time when MCP is globally enabled. The CLI's own display/diagnostic surfaces (inspect, doctor receipt) show the agent as MCP-disabled, but the runtime behavior disagrees.

Where to look

  • cmd/bbox/main.go — the MCP proxy setup path (applyCustomAgentAuthzDefault and its caller, gated by the global mcpEnabled check), around main.go:850-900ish (line numbers as of PR Add bbox agents add/init scaffolding (#201) #210; verify current location).
  • cmd/bbox/agents.gorenderInspect, which correctly computes mcpDisabled from override.MCP.Enabled for display purposes.
  • cmd/bbox/agents_receipt.gobuildReceiptAgent, same per-agent mcpDisabled computation for the JSON receipt.
  • pkg/domain/config — the per-agent MCP override resolution (ResolveMCPConfig or similar) may already have the right logic for the display path; the gap is that the runtime wiring in main.go doesn't call the same resolution before deciding whether to start the proxy for a given agent.

Suggested fix direction

Ensure the runtime MCP proxy setup consults the same effective per-agent mcp.enabled resolution that inspect/doctor already use, so a custom agent declaring mcp.enabled: false actually skips proxy wiring for that agent's VM, not just its displayed status.

Context

Surfaced by a go-architect review agent while scoping a refactor to deduplicate custom-agent default-resolution logic (MCP authz profile / egress profile) across cmd/bbox/main.go, cmd/bbox/agents.go, and cmd/bbox/agents_receipt.go. That refactor itself was deferred as lower priority; this bug is separate and was split out to track independently.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triageIssue needs initial triage by a maintainer

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions