block / block/buzz

Agent config panel lists MCP servers from hardcoded ~/.claude.json, ignoring per-agent CLAUDE_CONFIG_DIR

Open
#3,493 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
32.7k
Forks
4.3k
Avg merge
1d 13h
Merged PRs (30d)
253

Description

**Describe the bug**

When a managed agent is given its own `CLAUDE_CONFIG_DIR` (via Agents → Agent defaults, or per-agent env vars) in order to isolate it from the operator's personal Claude Code configuration, the agent config panel still lists the MCP servers from the operator's `~/.claude.json` and labels them "mcp enabled". The list is identical for every agent regardless of that agent's environment.

The runtime itself *is* isolated — only the panel is wrong. But the panel is the only place an operator can check, so it reads as "the isolation did not work", which is alarming when the personal config contains mail/drive/database connectors.

**Steps to reproduce**

1. Have one or more MCP servers configured at user scope in `~/.claude.json`.
2. Create an isolated config dir, e.g. `/claude-config`, containing `.claude.json` with `{"mcpServers": {}}` and `settings.json` with `{"disableClaudeAiConnectors": true}`; authenticate it once with `CLAUDE_CONFIG_DIR=/claude-config claude auth login`.
3. Set `CLAUDE_CONFIG_DIR=/claude-config` in Agent defaults (or per-agent env vars) and restart the agents.
4. Open the config panel for any agent.

**Expected behavior**

The MCP Servers section reflects the configuration the agent will actually load — empty for an isolated agent — and the "From config file (…)" attribution points at that file.

**Actual behavior**

The section lists every server from the operator's `~/.claude.json`.

Independent checks confirming the runtime is genuinely isolated:

- `ps eww` on `buzz-acp` and on its `claude-agent-acp` child both show `CLAUDE_CONFIG_DIR=/claude-config`
- `CLAUDE_CONFIG_DIR=/claude-config claude mcp list` → `No MCP servers configured`
- asking the agent to list tools named `mcp__*` → none

**Cause**

`desktop/src-tauri/src/managed_agents/config_bridge/claude.rs`:

```rust
pub(super) fn read_config_file() -> Option {
let home = dirs::home_dir()?;
let settings_path = home.join(".claude").join("settings.json");
let mcp_path = home.join(".claude.json");
```

The path is derived from `$HOME` unconditionally; the agent's effective environment (global / persona / per-agent `env_vars`) is never consulted. The same applies to the attribution path in `config_bridge/reader.rs`:

```rust
"claude" => Some(resolve_tilde("~/.claude.json")),
```

Code path is unchanged on `main` at the time of writing.

**Suggested fix**

Resolve the Claude config directory from the agent's effective env — `CLAUDE_CONFIG_DIR` when set, `~/.claude` otherwise — and pass it into `read_config_file()`, so both the MCP list and the "From config file (…)" attribution describe the file the agent will actually read. Honoring `disableClaudeAiConnectors` from the resolved `settings.json` when rendering the list would make the panel accurate for account-scoped claude.ai connectors too.

**Version and platform**

- Buzz version: 0.4.26
- OS: macOS 26.5.2
- Runtime: `claude` / `@agentclientprotocol/claude-agent-acp` 0.62.0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.