Skip to content

Pass the workspace's .mcp.json servers to ACP agents - #8454

Merged
ymichael merged 2 commits into
mainfrom
bb/7998-acp-pass-the-workspace-s-mcp-servers-to-the-thr_izeyn5agpb
Dec 1, 2026
Merged

ymichael merged 2 commits into
mainfrom
bb/7998-acp-pass-the-workspace-s-mcp-servers-to-the-thr_izeyn5agpb

Conversation

@ymichael

@ymichael ymichael commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

ACP threads only received bb's own bb-bridge MCP server in session/new. bb never read the workspace's .mcp.json. Claude Code loads that file itself through its SDK setting sources, but Antigravity and the other ACP agents rely on the client to pass servers in mcpServers, so a workspace's MCP servers never started for them (#7998).

What changed

  • New packages/provider-bridge-acp/src/bridge/workspace-mcp-servers.ts reads <cwd>/.mcp.json (Claude Code's format) with zod and turns each entry into an ACP McpServer:
    • ${VAR} and ${VAR:-default} expand from the agent's environment. A server that references an unset variable with no default is skipped.
    • Relative or bare stdio commands resolve against the workspace and PATH (resolvePortableCommand), because ACP needs an absolute path. A path-like command the lookup can't find (for example an extensionless script on Windows) is resolved against the workspace folder, so it isn't sent relative.
    • stdio servers are always passed. http and sse servers are passed only when the agent advertises mcpCapabilities.http or .sse, since an agent can reject the whole session over one entry it doesn't support.
    • A server named bb-bridge is skipped.
  • bridge.ts: buildSessionMcpServers now sends bb-bridge followed by the workspace servers. It does this for session/new, load/resume and fork. It runs after initialize, so capabilities are known.
  • Skipped servers, invalid JSON and unreadable files appear in the thread as provider warnings (acp/warning). Previously they would have been invisible.
  • Docs: the acp-provider skill and docs/configuration.md (Custom ACP Agents).
  • No server/daemon wire change: the bridge already runs on the host, so HOST_DAEMON_PROTOCOL_VERSION is unchanged.

Not covered: servers declared per agent in bb settings (#2471), reading .mcp.json from parent folders, and an approval prompt like Claude Code's project-server approval.

How you verified

  • New test in bridge.test.ts: "passes the workspace .mcp.json servers alongside bb-bridge at session/new". It covers a relative stdio command with expanded args and env, an http server the agent advertises, an sse server it doesn't, an unset variable, and the reserved bb-bridge name. It checks the mcpServers the fake agent receives and the three warnings. Before this change, only bb-bridge was sent.
  • pnpm exec turbo run typecheck lint test --filter=@bb/provider-bridge-acp --filter=bb-plugin-provider-acp: 13/13 tasks; 633 passed and 4 skipped, plus 83 passed.
  • Manual check with Antigravity (agy acp) on a pnpm start:worktree instance, using a workspace whose .mcp.json declares a stdio server with a get_secret_word tool:
    • Before: the agent saw only bb-bridge and replied "NO SECRET TOOL".
    • After: the agent listed secret/get_secret_word, called it, and replied "The secret word is PERIWINKLE-7998".
    • A server that needs an unset variable shows the thread warning Skipped MCP server "needs-token" from …/.mcp.json: environment variable QA_7998_UNSET_TOKEN is not set.

Fixes #7998

AGENT GENERATED

🤖 Generated with Claude Code

@blacksmith-sh

This comment has been minimized.

ymichael and others added 2 commits November 30, 2026 20:35
ACP threads only received bb's own bb-bridge server at session/new, so
servers declared in the workspace's .mcp.json, which Claude Code loads on
its own, were missing for Antigravity and every other ACP agent.

The ACP bridge now reads <cwd>/.mcp.json when it starts, resumes, or forks
a session and passes its servers next to bb-bridge. ${VAR} and
${VAR:-default} expand from the agent's environment, relative commands
resolve against the workspace and PATH, and http/sse servers are passed
only when the agent advertises that transport. Skipped servers show as a
provider warning in the thread.

Fixes #7998

Co-Authored-By: Claude Opus 5.5 <[email protected]>
ACP requires an absolute stdio command. When a path-like command such as
./tools/server cannot be found as an executable (on Windows, a file
without a PATHEXT extension), it was sent unchanged and the agent
resolved it against its own working directory. Resolve it against the
workspace instead, as Claude Code does when it starts the server there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael force-pushed the bb/7998-acp-pass-the-workspace-s-mcp-servers-to-the-thr_izeyn5agpb branch from bd6fc3c to 3ef4c05 Compare December 1, 2026 04:36
@ymichael
ymichael merged commit eee7ed9 into main Dec 1, 2026
52 checks passed
@ymichael
ymichael deleted the bb/7998-acp-pass-the-workspace-s-mcp-servers-to-the-thr_izeyn5agpb branch December 1, 2026 04:49
scowalt pushed a commit to scowalt/bb that referenced this pull request Dec 1, 2026
## Human comments

## What was wrong

ACP threads only received bb's own `bb-bridge` MCP server in
`session/new`. bb never read the workspace's `.mcp.json`. Claude Code
loads that file itself through its SDK setting sources, but Antigravity
and the other ACP agents rely on the client to pass servers in
`mcpServers`, so a workspace's MCP servers never started for them
(get-bb#7998).

## What changed

- New `packages/provider-bridge-acp/src/bridge/workspace-mcp-servers.ts`
reads `<cwd>/.mcp.json` (Claude Code's format) with zod and turns each
entry into an ACP `McpServer`:
- `${VAR}` and `${VAR:-default}` expand from the agent's environment. A
server that references an unset variable with no default is skipped.
- Relative or bare stdio commands resolve against the workspace and
`PATH` (`resolvePortableCommand`), because ACP needs an absolute path. A
path-like command the lookup can't find (for example an extensionless
script on Windows) is resolved against the workspace folder, so it isn't
sent relative.
- stdio servers are always passed. http and sse servers are passed only
when the agent advertises `mcpCapabilities.http` or `.sse`, since an
agent can reject the whole session over one entry it doesn't support.
  - A server named `bb-bridge` is skipped.
- `bridge.ts`: `buildSessionMcpServers` now sends `bb-bridge` followed
by the workspace servers. It does this for `session/new`, load/resume
and fork. It runs after `initialize`, so capabilities are known.
- Skipped servers, invalid JSON and unreadable files appear in the
thread as provider warnings (`acp/warning`). Previously they would have
been invisible.
- Docs: the `acp-provider` skill and `docs/configuration.md` (Custom ACP
Agents).
- No server/daemon wire change: the bridge already runs on the host, so
`HOST_DAEMON_PROTOCOL_VERSION` is unchanged.

Not covered: servers declared per agent in bb settings (get-bb#2471), reading
`.mcp.json` from parent folders, and an approval prompt like Claude
Code's project-server approval.

## How you verified

- New test in `bridge.test.ts`: "passes the workspace .mcp.json servers
alongside bb-bridge at session/new". It covers a relative stdio command
with expanded args and env, an http server the agent advertises, an sse
server it doesn't, an unset variable, and the reserved `bb-bridge` name.
It checks the `mcpServers` the fake agent receives and the three
warnings. Before this change, only `bb-bridge` was sent.
- `pnpm exec turbo run typecheck lint test
--filter=@bb/provider-bridge-acp --filter=bb-plugin-provider-acp`: 13/13
tasks; 633 passed and 4 skipped, plus 83 passed.
- Manual check with Antigravity (`agy acp`) on a `pnpm start:worktree`
instance, using a workspace whose `.mcp.json` declares a stdio server
with a `get_secret_word` tool:
  - Before: the agent saw only `bb-bridge` and replied "NO SECRET TOOL".
- After: the agent listed `secret/get_secret_word`, called it, and
replied "The secret word is PERIWINKLE-7998".
- A server that needs an unset variable shows the thread warning
`Skipped MCP server "needs-token" from …/.mcp.json: environment variable
QA_7998_UNSET_TOKEN is not set`.

Fixes get-bb#7998

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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.

ACP: pass the workspace's MCP servers to the agent in session/new

1 participant