Skip to content

[Feature]: Self-host daemon: opt-in flag to inherit MCP servers from ~/.claude.json #2532

Description

@JulienMicrofacto

Deployment type

Self-hosted

What do you want and why?

Related issues

Use case

I run a self-hosted Multica instance (single-user, dev machine). My MCP servers (Linear, etc.) are already configured in ~/.claude.json via claude mcp add — they work fine in interactive Claude Code sessions on the same machine. When I trigger an agent from the Multica UI that depends on one of those MCPs, the spawned claude runs with --strict-mcp-config and no --mcp-config, so the agent sees zero MCPs.

I traced this through server/pkg/agent/claude.go and the mcp_config plumbing in server/internal/daemon/daemon.go. The capability is wired end-to-end on the backend: the per-agent mcp_config field exists, and if populated, the daemon passes it correctly to claude --mcp-config . The CLI/UI exposure of that field is the gap #2385 addresses.

Why per-agent mcp_config doesn’t fully solve my case

For a self-host single-user setup, the same person owns the machine, the ~/.claude.json, and every agent in the workspace. Mirroring an already-working MCP config into per-agent JSON for each agent that needs it duplicates the source of truth:

If I add a new MCP server, I have to update ~/.claude.json and every agent’s mcp_config.
If I rotate a token (e.g. a Linear API key), I have to update it in both places.
If I create a new agent, I have to remember to copy the relevant MCPs over.
The natural place for the MCP set, on a self-host daemon that I own end-to-end, is the local file I already maintain. The daemon should be allowed to look at it — provided I explicitly say so.

Proposed solution (optional)

Add an opt-in at daemon start time:

multica daemon start --inherit-local-mcp
# or
MULTICA_DAEMON_INHERIT_LOCAL_MCP=1 multica daemon start

Semantics

  • Default: unchanged. --strict-mcp-config keeps being passed, agents stay isolated.
  • When opt-in is on AND agent's mcp_config is empty: the daemon does not add --strict-mcp-config to the claude invocation, letting claude inherit the daemon machine's ~/.claude.json.
  • When opt-in is on AND agent's mcp_config is populated: per-agent config still wins. --mcp-config <path> --strict-mcp-config are emitted, exactly as today. The opt-in is a fallback for unconfigured agents, not an override.

Implementation sketch

  • Flag wired in server/cmd/multica/cmd_daemon.go (alongside existing --agent-timeout, --max-concurrent-tasks, etc.).
  • New field on daemon.Config propagated to the agent backend layer.
  • In server/pkg/agent/claude.go, the existing conditional that appends --strict-mcp-config alongside --mcp-config stays; the path with no per-agent config gates on the new flag.
  • Tests in server/pkg/agent/claude_test.go cover both modes.

Estimated size: ~50-100 lines + tests, no DB migration, no API change, no UI change.

Security posture

The trust boundary is preserved. The flag is opt-in by the daemon owner — the same person whose ~/.claude.json would be exposed to spawned agents. It's their machine, their MCPs, their decision. No cloud/managed runtime is affected (the flag would only have meaning on a daemon the operator controls). For multi-user shared runtimes the default-off behavior continues to apply.

Out of scope for this issue

Happy to take this on

If a maintainer is not opposed to this direction, I'd be happy to prepare the PR.

Screenshots / mockups (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions