|
| 1 | +--- |
| 2 | +title: Agent Client Protocol (ACP) |
| 3 | +description: Use mux as an ACP agent in editors like Zed |
| 4 | +--- |
| 5 | + |
| 6 | +`mux acp` starts an **Agent Client Protocol (ACP)** agent over **stdio**. |
| 7 | + |
| 8 | +It acts as a thin bridge to a running mux **HTTP/WebSocket API server**, so editors that support ACP (like Zed) can drive mux workspaces. |
| 9 | + |
| 10 | +## Prerequisites |
| 11 | + |
| 12 | +You need a mux API server running locally: |
| 13 | + |
| 14 | +- **Mux Desktop**: the API server is typically started automatically (unless disabled). |
| 15 | +- **Standalone**: run `mux server`. |
| 16 | + |
| 17 | +Server discovery order: |
| 18 | + |
| 19 | +1. `--server-url` / `--server-token` |
| 20 | +2. `MUX_SERVER_URL` / `MUX_SERVER_AUTH_TOKEN` |
| 21 | +3. `~/.mux/server.lock` |
| 22 | + |
| 23 | +If none are available, `mux acp` will exit with an error. |
| 24 | + |
| 25 | +## Zed setup |
| 26 | + |
| 27 | +Zed can run any ACP agent as a subprocess via `agent_servers`. |
| 28 | + |
| 29 | +Add this to your Zed `settings.json`: |
| 30 | + |
| 31 | +```json |
| 32 | +{ |
| 33 | + "agent_servers": { |
| 34 | + "Mux": { |
| 35 | + "command": "mux", |
| 36 | + "args": ["acp"], |
| 37 | + "env": {} |
| 38 | + } |
| 39 | + } |
| 40 | +} |
| 41 | +``` |
| 42 | + |
| 43 | +Then in Zed, create a new external agent thread and select **Mux**. |
| 44 | + |
| 45 | +### Using a specific mux server |
| 46 | + |
| 47 | +If you want to connect to a specific server instance, add args/env: |
| 48 | + |
| 49 | +```json |
| 50 | +{ |
| 51 | + "agent_servers": { |
| 52 | + "Mux (custom server)": { |
| 53 | + "command": "mux", |
| 54 | + "args": ["acp", "--server-url", "http://127.0.0.1:3000", "--server-token", "<token>"], |
| 55 | + "env": {} |
| 56 | + } |
| 57 | + } |
| 58 | +} |
| 59 | +``` |
| 60 | + |
| 61 | +## Notes |
| 62 | + |
| 63 | +- `mux acp` reserves **stdout** for the ACP protocol. Logs go to **stderr**. |
| 64 | +- By default, mux uses the **local** runtime (project directory directly). |
| 65 | + - For `--runtime worktree|ssh`, you must also pass `--trunk-branch`. |
| 66 | + |
| 67 | +## Troubleshooting |
| 68 | + |
| 69 | +### "No running mux API server found" |
| 70 | + |
| 71 | +- Start mux desktop (ensure API server is enabled), or run: |
| 72 | + |
| 73 | +```bash |
| 74 | +mux server |
| 75 | +``` |
| 76 | + |
| 77 | +- Or explicitly set `MUX_SERVER_URL` / `MUX_SERVER_AUTH_TOKEN`. |
| 78 | + |
| 79 | +### Zed shows no output / agent immediately disconnects |
| 80 | + |
| 81 | +Open Zed’s ACP debug logs (Command Palette: `dev: open acp logs`) and look for: |
| 82 | + |
| 83 | +- JSON parsing errors (often means something wrote to stdout) |
| 84 | +- Connection/auth errors to the mux server |
0 commit comments