feat(acp): accept extra MCP servers via BUZZ_ACP_EXTRA_MCP_COMMANDS - #6651
Open
BradGroux wants to merge 3 commits into
Open
feat(acp): accept extra MCP servers via BUZZ_ACP_EXTRA_MCP_COMMANDS#6651BradGroux wants to merge 3 commits into
BradGroux wants to merge 3 commits into
Conversation
Desktop-managed Buzz agents could only use one MCP server (buzz-dev-mcp). Users who wanted web search or other third-party MCP tools alongside the built-in local tools had no way to add them — the desktop flow hardcodes a single MCP command and build_mcp_servers() always returned a vec of one entry. Added BUZZ_ACP_EXTRA_MCP_COMMANDS, a comma-separated env var where each entry is split on whitespace into command + args. build_mcp_servers() appends each as a separate McpServer after the primary server. Extra servers do not receive Buzz relay credentials (BUZZ_RELAY_URL, BUZZ_PRIVATE_KEY) or auth tags — they are third-party tools, not Buzz-native MCP servers. The primary mcp_command short-circuit is preserved: if it is empty, no servers are returned at all, even when extra commands are configured. This is option 1 from issue block#6023. It unblocks the web-search use case (e.g. npx -y mcp-remote https://mcp.tavily.com/mcp/...) without desktop UI changes. Closes block#6023 Signed-off-by: dm-builder <f01486f036641ccb52c11bb1e0ff2346ea89a8b4e3b49cd772249948f6fcbae6@digitalmeld.communities.buzz.xyz> Co-authored-by: Brad Groux <bradgroux@users.noreply.github.com> Signed-off-by: Brad Groux <bradgroux@users.noreply.github.com>
Two correctness issues in the extra MCP server path: 1. Server names derived only from the executable stem collided for common multi-server configurations. Two wrappers like 'npx -y first-mcp' and 'npx -y second-mcp' both became 'npx', tripping McpRegistry's duplicate check at spawn. Now disambiguate with a numeric suffix (npx, npx-2). 2. split_whitespace() corrupted quoted executable paths and arguments containing spaces. Replace with shlex::split, which handles standard shell quoting. Malformed entries are skipped with a warning instead of being silently reinterpreted. Also update the config doc comment to document the delimiter/quoting contract. Addresses themiguelamador's review feedback. Co-authored-by: Brad Groux <brad@digitalmeld.com> Signed-off-by: Brad Groux <brad@digitalmeld.com>
…e sanitization Four issues from wesbillman/Carl's review: P0 — Extra MCP processes received Buzz identity credentials despite the PR's isolation claim. build_mcp_servers gave extras an empty per-server env, but buzz-agent's spawn_one cleared and repopulated every MCP child's environment from PASSTHROUGH_ENV, which includes BUZZ_PRIVATE_KEY, BUZZ_RELAY_URL, and BUZZ_AUTH_TAG. Added a trusted flag to McpServer and McpServerStdio; spawn_one now withholds identity credentials from untrusted servers. The primary buzz-dev-mcp server is trusted; extras are not. P1 — BUZZ_ACP_EXTRA_MCP_COMMANDS was absent from Desktop's reserved env key list, allowing a portable persona or per-agent env to inject an arbitrary command. Added to reserved_env_keys.rs and its test. P1 — Malformed quoting logged the raw command (which may contain an embedded API key) and silently skipped the entry. Now fails closed with only the entry index; the raw command is never echoed. P1 — Generated names used the executable stem verbatim, violating McpRegistry's ASCII alphanumeric/hyphen and 128-byte contract. Added sanitize_mcp_name to replace non-conforming characters with hyphens, strip leading/trailing hyphens, and truncate to 128 bytes. Co-authored-by: Brad Groux <brad@digitalmeld.com> Signed-off-by: Brad Groux <brad@digitalmeld.com>
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What users saw
Desktop-managed Buzz agents could receive only the built-in
buzz-dev-mcpserver. Operators had no process-level way to attach additional MCP servers to the ACP session.What changed
BUZZ_ACP_EXTRA_MCP_COMMANDSfor comma-separated extra MCP server commands..env.example.Example:
BUZZ_ACP_EXTRA_MCP_COMMANDS='npx -y first-mcp,"/opt/MCP Servers/second" --stdio'Verification
just cicargo test -p buzz-acp --quiet(786 unit tests and 9 lifecycle tests)cargo clippy -p buzz-acp --all-targets -- -D warningsNon-goals
Closes #6023