You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This Next.js 15 application exposes the Headless Coder SDK through the [Agent Communication Protocol](https://agentcommunicationprotocol.dev/introduction/welcome) (ACP). It loads adapter availability from `acp.config.json`, registers the requested providers (Codex, Claude, Gemini), and serves ACP-compatible endpoints under `/api/acp/*` with NDJSON streaming support.
3
+
The **ACP Server** is a Next.js application that exposes the **Headless Coder SDK** via the [Agent Communication Protocol (ACP)](https://agentcommunicationprotocol.dev/introduction/welcome).
4
+
It dynamically loads available adapters from `acp.config.json`, registers enabled providers (**Codex**, **Claude**, **Gemini**), and exposes ACP-compatible REST + streaming endpoints under `/api/acp/*`.
4
5
5
-
## Prerequisites
6
-
- Node.js 20+
7
-
- The Headless Coder workspace dependencies installed (`pnpm install` or `npm install` at repo root)
8
-
- Optional: `ACP_TOKEN` environment variable to require bearer authentication
9
-
- Provider-specific credentials (Codex CLI, Claude agent, Gemini CLI) available to the underlying adapters
6
+
---
10
7
11
-
## Configuration
12
-
1. Review `packages/acp-server/acp.config.json` to enable/disable adapters and adjust default model/working directory/sandbox options. The file is validated against `acp.config.schema.json` at runtime.
13
-
2. Set `ACP_TOKEN` in `.env.local` (see `.env.local.example`) if you want the API to enforce authentication.
8
+
## ✨ Key Features
9
+
10
+
- ⚙️ **Dynamic provider configuration** using `acp.config.json`
11
+
- 🔄 **NDJSON streaming** for real-time AI-coder responses
12
+
- 🔐 Optional **Bearer token authentication** via `ACP_TOKEN`
13
+
- 🧠 **Structured output** support via JSON schemas
14
+
- 🧰 Unified interface across Codex, Claude, and Gemini adapters
15
+
- 🚀 Built with **Next.js (Node runtime)** — deploy anywhere
16
+
17
+
---
18
+
19
+
## 🧩 Prerequisites
20
+
21
+
-**Node.js 20+**
22
+
- Headless Coder SDK installed (`pnpm install` or `npm install` at repo root)
23
+
- Optional: environment variable `ACP_TOKEN` for authentication
24
+
- Provider-specific credentials available (e.g. Codex binary, Claude API key, Gemini CLI)
25
+
26
+
---
27
+
28
+
## ⚙️ Configuration
29
+
30
+
1. Open and edit `apps/acp-next/acp.config.json` to enable or disable adapters.
31
+
The config is validated against `acp.config.schema.json` at runtime.
32
+
33
+
**Example:**
34
+
```json
35
+
{
36
+
"enabledAgents": ["codex", "gemini"],
37
+
"defaults": {
38
+
"workingDirectory": ".",
39
+
"model": null,
40
+
"sandboxMode": "read-only"
41
+
}
42
+
}
43
+
```
44
+
45
+
2. (Optional) To enforce authentication, add an `ACP_TOKEN` variable in your environment:
46
+
```bash
47
+
ACP_TOKEN=my-secret-token
48
+
```
49
+
Copy `.env.local.example` → `.env.local` and fill in your desired values.
50
+
51
+
---
52
+
53
+
## ▶️ Running the Server
54
+
55
+
From the repository root:
14
56
15
-
## Running the server
16
-
From the monorepo root:
17
57
```bash
18
58
# Start the ACP server on port 8000
19
-
yarn workspace packages/acp-server dev # or npm/pnpm equivalent
59
+
pnpm --filter acp-next dev
60
+
# or
61
+
npm run dev --workspace acp-next
20
62
```
21
-
The API now serves:
22
-
-`GET /api/acp/agents` – returns enabled agents
23
-
-`POST /api/acp/sessions` – creates a new session/thread
24
-
-`POST /api/acp/messages?stream=true` – streams Headless Coder events as NDJSON frames
25
63
26
-
## Building the server
64
+
Once started, the API will serve the following routes:
65
+
66
+
| Method | Endpoint | Description |
67
+
|---------|-----------|-------------|
68
+
|**GET**|`/api/acp/agents`| Lists enabled agents defined in `acp.config.json`. |
69
+
|**POST**|`/api/acp/sessions`| Creates a new Headless Coder thread/session. |
70
+
|**POST**|`/api/acp/messages?stream=true`| Streams Headless Coder events as NDJSON frames. |
71
+
72
+
**Sample NDJSON stream output:**
73
+
```json
74
+
{"type":"delta","text":"Hello world!"}
75
+
{"type":"done"}
76
+
```
77
+
78
+
---
79
+
80
+
## 🏗️ Building and Deploying
81
+
27
82
```bash
28
-
yarn workspace packages/acp-server build
83
+
pnpm --filter acp-next build
84
+
pnpm --filter acp-next start
29
85
```
30
-
Then deploy with `yarn workspace packages/acp-server start` (or npm analog) pointing at the same configuration/credentials.
31
86
32
-
## Example client
33
-
A simple TypeScript client lives in `packages/acp-server/client`. It can be used as a template for your own integrations.
87
+
### Deployment options
88
+
-**Vercel** — ideal for quick serverless deployment (`runtime: nodejs` required).
89
+
-**Docker** — portable containerized deployment.
90
+
-**Render / Fly.io / AWS** — any Node 20+ runtime will work.
0 commit comments