Skip to content

feat(acp): accept extra MCP servers via BUZZ_ACP_EXTRA_MCP_COMMANDS - #6651

Open
BradGroux wants to merge 3 commits into
block:mainfrom
BradGroux:agent/extra-mcp-servers
Open

feat(acp): accept extra MCP servers via BUZZ_ACP_EXTRA_MCP_COMMANDS#6651
BradGroux wants to merge 3 commits into
block:mainfrom
BradGroux:agent/extra-mcp-servers

Conversation

@BradGroux

Copy link
Copy Markdown
Contributor

Note: This is a replacement for PR #6031, which was accidentally closed when branches were force-pushed after a commit identity rewrite. The changes are identical, rebased onto the latest main.

What users saw

Desktop-managed Buzz agents could receive only the built-in buzz-dev-mcp server. Operators had no process-level way to attach additional MCP servers to the ACP session.

What changed

  • Adds BUZZ_ACP_EXTRA_MCP_COMMANDS for comma-separated extra MCP server commands.
  • Parses each command with shell-aware quoting and preserves quoted paths and empty arguments.
  • Fails startup before connecting to the relay when quoting is malformed, without echoing the command in the error.
  • Generates deterministic, unique MCP server names that satisfy the agent name validator.
  • Keeps Buzz relay credentials out of extra MCP server environments.
  • Reserves the setting from portable persona and per-agent environment overrides because it is a code-execution surface.
  • Documents configuration, quoting, security boundaries, and an example in the ACP README and .env.example.

Example:

BUZZ_ACP_EXTRA_MCP_COMMANDS='npx -y first-mcp,"/opt/MCP Servers/second" --stdio'

Verification

  • just ci
  • cargo test -p buzz-acp --quiet (786 unit tests and 9 lifecycle tests)
  • cargo clippy -p buzz-acp --all-targets -- -D warnings
  • Focused Desktop reserved-environment-key test

Non-goals

  • No dedicated Desktop configuration UI.
  • No config-file format.
  • No Buzz credential forwarding to extra MCP servers.

Closes #6023

BradGroux and others added 3 commits August 23, 2026 19:58
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>
@BradGroux

Copy link
Copy Markdown
Contributor Author

This is a replacement for #6031, which was accidentally closed when branches were force-pushed after a commit identity rewrite. Prior review comments and feedback are preserved on the old PR:

#6031

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No way to add web search or other third-party MCP servers to a desktop-managed agent

1 participant