Skip to content

Commit d07e2d7

Browse files
committed
feat: add mux acp stdio bridge subcommand
Change-Id: I50480960bbcd75e811f496421dd45b87c9d58820 Signed-off-by: Thomas Kosiewski <tk@coder.com>
1 parent d52e599 commit d07e2d7

File tree

11 files changed

+1011
-38
lines changed

11 files changed

+1011
-38
lines changed

bun.lock

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"": {
66
"name": "mux",
77
"dependencies": {
8+
"@agentclientprotocol/sdk": "^0.12.0",
89
"@ai-sdk/amazon-bedrock": "^3.0.61",
910
"@ai-sdk/anthropic": "^2.0.47",
1011
"@ai-sdk/deepseek": "^1.0.31",
@@ -177,6 +178,8 @@
177178

178179
"@adobe/css-tools": ["@adobe/css-tools@4.4.4", "", {}, "sha512-Elp+iwUx5rN5+Y8xLt5/GRoG20WGoDCQ/1Fb+1LiGtvwbDavuSk0jhD/eZdckHAuzcDzccnkv+rEjyWfRx18gg=="],
179180

181+
"@agentclientprotocol/sdk": ["@agentclientprotocol/sdk@0.12.0", "", { "peerDependencies": { "zod": "^3.25.0 || ^4.0.0" } }, "sha512-V8uH/KK1t7utqyJmTA7y7DzKu6+jKFIXM+ZVouz8E55j8Ej2RV42rEvPKn3/PpBJlliI5crcGk1qQhZ7VwaepA=="],
182+
180183
"@ai-sdk/amazon-bedrock": ["@ai-sdk/amazon-bedrock@3.0.65", "", { "dependencies": { "@ai-sdk/anthropic": "2.0.53", "@ai-sdk/provider": "2.0.0", "@ai-sdk/provider-utils": "3.0.18", "@smithy/eventstream-codec": "^4.0.1", "@smithy/util-utf8": "^4.0.0", "aws4fetch": "^1.0.20" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-E5KJv9OvLJitwPo6GnTgYdssTjEbwVW08TXqaQE2C6hfpg6XdwMXc7BJvQ97eXogGETAyFSS0irDYsbA90rB+g=="],
181184

182185
"@ai-sdk/anthropic": ["@ai-sdk/anthropic@2.0.53", "", { "dependencies": { "@ai-sdk/provider": "2.0.0", "@ai-sdk/provider-utils": "3.0.18" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-ih7NV+OFSNWZCF+tYYD7ovvvM+gv7TRKQblpVohg2ipIwC9Y0TirzocJVREzZa/v9luxUwFbsPji++DUDWWxsg=="],

docs/acp.mdx

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
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

docs/cli.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,16 @@ Options:
8484
- `--auth-token <token>` - Optional bearer token for authentication
8585
- `--add-project <path>` - Add and open project at the specified path
8686

87+
## `mux acp`
88+
89+
Start an ACP (Agent Client Protocol) stdio agent for editor integrations (e.g. Zed):
90+
91+
```bash
92+
mux acp
93+
```
94+
95+
For setup details, see the **Agent Client Protocol (ACP)** docs.
96+
8797
## `mux desktop`
8898

8999
Launch the desktop app. This is automatically invoked when running the packaged app or via `electron .`:

docs/docs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
},
4949
"plan-mode",
5050
"vscode-extension",
51+
"acp",
5152
"models",
5253
{
5354
"group": "Keyboard Shortcuts",

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"postinstall": "sh scripts/postinstall.sh"
4646
},
4747
"dependencies": {
48+
"@agentclientprotocol/sdk": "^0.12.0",
4849
"@ai-sdk/amazon-bedrock": "^3.0.61",
4950
"@ai-sdk/anthropic": "^2.0.47",
5051
"@ai-sdk/deepseek": "^1.0.31",

0 commit comments

Comments
 (0)