buzz-acp: add structured MCP server configuration
Summary
This gives Buzz one versioned MCP launch document instead of separate formats for each adapter and transport. buzz-acp accepts multiple named stdio and Streamable HTTP servers, preserves their resolved configuration, checks the runtime's transport capability, and sends the same ordered list through every ACP session. The existing BUZZ_ACP_MCP_COMMAND path remains the first compatibility input.
Desktop and Project Connections can resolve approved tools into this boundary without teaching the runtime about personas, templates, or project state. Launchers can evolve while the ACP handoff stays stable.
Boundary
This document is resolved launch input. Personas, templates, and Projects remain authoring state and are not passed directly to a runtime.
The JSON contract is strict and bounded. Remote servers require HTTPS; literal loopback HTTP is allowed only without credentials. Server names are checked across structured and legacy inputs, protected Buzz credentials cannot be overridden, and MCP arguments, environment values, URLs, and headers are redacted from logs and observer output.
The adapter still inherits the harness environment, so this is explicit configuration rather than process isolation. Before unattended launch, the launcher must also establish the adapter's tool authorization policy. Transport support and permission to call a tool are separate gates.
Validation
just cicargo test -p buzz-core -p buzz-acp -p buzz-agent --no-fail-fastcargo clippy -p buzz-core -p buzz-acp -p buzz-agent --all-targets -- -D warningscargo fmt --all -- --check- Real-process regression: two stdio MCP children initialize, list, and execute tools across two fresh ACP sessions
- Mixed-transport regression: the legacy Buzz companion and HTTP server reach
session/newtogether with capability, URL, header, collision, and redaction coverage
Fixes #4154.
#4301 now describes the broader portable-agent lifecycle using Buzz's existing agent, template, connection, version and snapshot concepts. This PR remains the first narrow slice: structured, named MCP configuration in buzz-acp.
@tlongwell-block @wpfleger96, @custard-pirate and I agree on the MCP split: #4164 owns the versioned document and stdio transport; #4271 adds HTTP to that schema. #4480 can then use the same document for live changes instead of adding a third config format.
That leaves Buzz with one MCP configuration surface and one compatibility input. Could one of you confirm this ownership split? If so, I will keep #4164 at that boundary and help adapt #4271 to it.
@tlongwell-block @wpfleger96, I have replaced the repair history with four reviewable commits on current main. #4271 is already adapting HTTP to this document, so review of the shared config boundary would unblock both transports.
Local tests, Clippy, formatting and the real two-server, two-session proof are green. CI is running.
The HTTP v1 extension and wolfyy970 review fixes are ready to fold into this branch. This account cannot push to wolfyy970/feat/acp-structured-mcp-servers (GitHub returns 403), so the fast-forward handoff is the two signed commits 3204b925970a38265d96bfb5a54c11736832e814 and 749ef0c628e3e8923fe8e9bd12a74ee7f72e795c from custard-pirate/agent/acp-http-mcp-servers. Validation: buzz-core 257 tests, buzz-acp 737 tests, config_env, fmt, clippy -D warnings, and diff check all pass. Once these are applied here, #4271 can be closed as superseded.
@custard-pirate, I folded your two signed HTTP commits into this branch and rebased the full six-commit series onto current main. Thanks for carrying the schema into HTTP and hardening it after review.
The PR now owns one v1 handoff for named stdio and Streamable HTTP servers, so #4271 can close as superseded. The focused suites and full just ci pass.
@tlongwell-block @wpfleger96, this is ready for review as the shared MCP configuration boundary.
@codex review
@codex review
@codex review
Follow-up review caught four issues after the HTTP handoff: argument and short-value redaction, stale v1 documentation, and HTTP header syntax validation. I fixed all four and resolved the threads. The 259 core tests, 738 ACP tests, formatting, and strict Clippy pass at 9556cdc1a. This is back to reviewer-ready.
Reviewed the full diff (17 files, +3619/-179) across buzz-core, buzz-acp, buzz-agent, buzz-persona, and the desktop managed-agents layer. This is a well-structured change — here's the context I see and a few things worth confirming before merge.
What this PR does well
Clean boundary design. The versioned McpLaunchConfigDocument in buzz-core/src/mcp_config.rs is the right abstraction — a single strict JSON contract that both a launcher and the harness can agree on, separate from persona authoring state. The deny_unknown_fields serde attribute and the strict version gate (MCP_CONFIG_VERSION = 1) mean a future v2 can add transports without silently breaking v1 consumers.
Credential scoping is solid. The legacy BUZZ_ACP_MCP_COMMAND companion keeps its privileged Buzz credentials (BUZZ_PRIVATE_KEY, BUZZ_AUTH_TAG, BUZZ_RELAY_URL), while structured servers receive only their declared env. The PROTECTED_MCP_ENV_NAMES list prevents a structured server from injecting those keys case-insensitively. The git_origin_mcp_server_index change ensures session metadata (channel ID, agent name) is injected only into the privileged companion, not leaked to every structured server.
Redaction is thorough. The SensitiveMcpValueMatcher with three tiers (exact, bounded, substring via Aho-Corasick) catches short credentials that a naive length threshold would miss, while the COMMON_MCP_VALUES denylist prevents false positives on ordinary diagnostics. Debug impls redact env values, header values, and URLs. Wire logs and observer events are scrubbed. The Codex review caught and the author fixed all four P1/P2 issues: serialized request echoes, argument registration, short-value redaction, and HTTP header syntax validation.
File security is appropriately strict. The read_mcp_config function rejects symlinks (O_NOFOLLOW), non-regular files, group/world-readable permissions (mode & 0o077 != 0), non-owner-owned files, and non-absolute paths. The 64 KiB size limit with take(MCP_CONFIG_MAX_BYTES + 1) prevents memory exhaustion. The config_env.rs integration test confirms that an empty BUZZ_ACP_MCP_CONFIG env var is normalized to unset before Clap parsing.
Test coverage is comprehensive. The config tests cover order preservation, literal values (spaces, commas, quotes, Unicode, shell metacharacters), HTTP transport loading, public HTTP rejection, loopback credential rejection, name collisions (structured + legacy), file permission/symlink/size rejections, argument and env limits, protected keys, duplicate env names, NUL bytes, and debug output redaction. The buzz-agent/tests/regressions.rs end-to-end test proves two MCP servers initialize, list tools, execute calls across two sessions, and spawn separate processes. The mcp_capability_startup_tests verify that HTTP-incapable adapters are rejected at both pool init and respawn.
Points to confirm before merge
-
nixdependency widened touserfeature. Thenixcrate gains theuserfeature forUid::effective()in the file ownership check. This is a minimal, well-scoped addition — just confirming it's intentional and the workspace is fine with it. -
aho-corasickandzeroizeadded tobuzz-acp.aho-corasickpowers the substring redaction matcher;zeroizewraps theZeroizingwrapper around sensitive values. Both are well-established crates. Thehttpcrate is added to the workspace forHeaderName/HeaderValuevalidation. No concerns, just noting the dependency surface grew. -
prepare_process_env()replacespropagate_legacy_env_vars(). The call site inrun()is updated. The empty-value normalization forBUZZ_ACP_MCP_CONFIG(removing the env var when it's an empty string) is a pragmatic fix for deployment templates that render optional values as empty strings. Worth noting in release notes that this behavior is now applied at the process level before Tokio starts. -
RespawnResulttuple grew from 3 to 4 elements. Thehttp_mcp_supportedboolean is threaded throughspawn_and_init,initialize_agent_pool, andOwnedAgent. The capability validation runs on both the initial pool startup path and every respawn, which is correct — a respawned agent should re-verify HTTP MCP capability. -
Persona pack spec honesty. The
PERSONA_PACK_SPEC.mdchanges are refreshingly honest — they now explicitly state that persona MCP declarations are parsed but not yet wired to the ACP launch path, and that a future resolver must bridge them. This sets correct expectations for anyone reading the spec today. -
Merge state. The PR is
MERGEABLEagainstmain, all three CI checks pass (DCO, Semgrep, zizmor), and there are no merge conflicts. TheBLOCKEDmerge state is from branch protection (review requirement), not a technical conflict.
Suggestion
This is ready for maintainer review. The only thing I'd ask the maintainers to confirm is whether the 16-server limit and 128-argument/128-env-entry limits per server are the right ceilings for real-world deployments — they seem reasonable but that's a product call. The code, tests, and documentation are thorough and internally consistent.
@wesbillman The requested short-secret fix is on current main at 637b1cdc5. The direct six-byte path now proves both the returned error and observer output stay redacted, and the full just ci gate passes at this head. Could you re-review when you have a moment?
Hi — this is directly in the same problem space we have been working on, so I wanted to cross-link a related PR for visibility: #5321.
It introduces crates/buzz-runtime-config: a runtime-agnostic, read-only model of external agent frameworks' MCP server configuration (structs + serde), with read-only adapters for Hermes (~/.hermes/config.yaml, mcp_servers) and Kimi Code (~/.kimi-code/mcp.json, mcpServers). It is deliberately a thin, backend-only foundation slice — no write paths, no desktop changes — aimed at letting Buzz one day manage Skills/MCP of different agent frameworks from a single place.
I noticed wolfyy970 has been driving this structured-MCP-config direction; happy to align the model with whatever shape this issue converges on, or adapt buzz-runtime-config if parts of it are useful groundwork. This PR is really a pathfinding slice to validate the direction — feedback on the modeling choices (esp. enabled: Option<bool>, stdio-only vs url transport) is very welcome.
Thanks. I reviewed #5321. The adapters are useful target-side discovery; the clean join is native Hermes or Kimi config, then a target-owned resolver, then #4164's versioned launch document. I left two concrete changes there so raw environment values stay private and Buzz does not end up with a second MCP configuration authority.
@wesbillman, the requested short-value leak is fixed at the current head. The matcher now protects every configured value, including short punctuation and Unicode values, and switches to fail-closed redaction at its resource cap. The direct wire regression covers both the returned error and observer output.
The branch is mergeable with current main. The full ACP library suite passes 741 tests, and formatting, strict Clippy and the full local CI gate are green. Could you re-review 637b1cdc5e72?
I am replacing this PR with smaller changes that can be reviewed and landed independently. The first extracts only the strict, stdio-only launch document needed by #5321: #5349.
The remaining work here is still useful, but it should land separately: ACP consumption, diagnostic redaction and HTTP transport. HTTP will use a later schema version rather than changing v1 under existing readers.