Connect an IDE over ACP
The Agent Client Protocol (ACP) is an open standard that lets code editors (such as Zed) run an Agent subprocess and stream sessions, prompts, tool calls, and file edits over JSON-RPC.
Install bub-acp-server to connect Bub to ACP, so you can summon Bub directly in your everyday IDE for coding, refactoring, and troubleshooting.
Before you start
Section titled “Before you start”- Install the Bub app and configure a model.
- Install Zed (or another ACP client).
1. Install the plugin
Section titled “1. Install the plugin”Install the adapter plugin in the Python environment that contains Bub:
bub install bub-acp-server@mainbub acp --helpSeeing Usage: bub acp [OPTIONS] confirms installation. By default, bub acp communicates over stdio.
2. Configure Zed
Section titled “2. Configure Zed”In Zed, press Cmd+Shift+P (macOS) or Ctrl+Shift+P (Linux/Windows), run zed: open settings, and add agent_servers to settings.json.
Option A: Direct command
Section titled “Option A: Direct command”If you do not need to load a project .env file, point directly to bub (replace "bub" with the absolute path from command -v bub if Zed cannot find it):
{ "agent_servers": { "Bub": { "type": "custom", "command": "bub", "args": ["acp"], "env": {} } }}Option B: Wrapper script
Section titled “Option B: Wrapper script”If your API keys live in a workspace .env file or you use a project virtual environment, create a wrapper script at ~/.bub/bub-acp-wrapper:
#!/usr/bin/env bashset -euo pipefail
# 1. Optional: activate virtual environment# source /path/to/venv/bin/activate
# 2. Load workspace .env if presentif [ -f "$PWD/.env" ]; then set -a source "$PWD/.env" set +afi
# 3. Launch Bub ACP via absolute pathexec /path/to/your/bub acpMake it executable and reference it in Zed’s settings.json:
chmod +x ~/.bub/bub-acp-wrapper{ "agent_servers": { "Bub": { "type": "custom", "command": "/Users/yourname/.bub/bub-acp-wrapper", "args": [], "env": {} } }}3. Start a session in Zed
Section titled “3. Start a session in Zed”After saving the settings, restart Zed or reload the configuration:
- Press
Cmd+?(macOS) orCtrl+?(Linux/Windows) to open Zed’s Agent panel. - Select Bub from the agent menu.
- Send a test prompt:
Hello! Please introduce yourself.
- Bub streams the response, thinking process, and tool call steps into the panel.
4. Sessions and parameter sync
Section titled “4. Sessions and parameter sync”- New and restored threads: starting a new thread in Zed creates a new Tape; switching back to an earlier thread replays history from the Tape store. The session index is saved in
$BUB_HOME/acp-sessions.json—as long asBUB_HOMEand your workspace path stay the same, your session list remains intact across editor restarts. - Model and reasoning effort: changing the model or reasoning effort in the Zed UI updates subsequent requests in the active ACP session.
5. Remote mode (HTTP / WebSocket)
Section titled “5. Remote mode (HTTP / WebSocket)”For most local setups, stdio is the lightest, lowest-overhead choice. When Bub runs on a remote dev server or inside a Docker container, expose ACP over HTTP or WebSocket instead.
Run standalone
Section titled “Run standalone”bub acp --transport http# orbub acp --transport websocketListens on 127.0.0.1:28200 by default (http://127.0.0.1:28200/acp or ws://127.0.0.1:28200/acp).
Run as a gateway channel
Section titled “Run as a gateway channel”Gateway mode maintains the session pool and background connection together:
bub gateway --enable-channel acp-server| Environment variable | Default | Description |
|---|---|---|
BUB_ACP_SERVER_HOST |
127.0.0.1 |
Listen host IP (use 0.0.0.0 for external access) |
BUB_ACP_SERVER_PORT |
28200 |
Listen port |
BUB_ACP_SERVER_CERTFILE |
empty | TLS certificate path (required for HTTPS/WSS) |
BUB_ACP_SERVER_KEYFILE |
empty | TLS private key path |
Troubleshooting
Section titled “Troubleshooting”| Symptom | Fix |
|---|---|
| Zed cannot find the Agent server | Set command in settings.json to the absolute path from command -v bub |
| Startup fails or API key is missing | Use Option B to source your .env file |
| Inspect JSON-RPC traffic | Run dev: open acp logs from Zed’s command palette |
| Session history does not persist | Verify the user running Zed has read/write permissions on $BUB_HOME (~/.bub) |