cursor-agent-bridge 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +136 -16
- package/dist/cli.mjs +828 -5
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.mts +18 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{server-CuHDT_fJ.mjs → server-Bk7ol2lA.mjs} +275 -95
- package/dist/server-Bk7ol2lA.mjs.map +1 -0
- package/package.json +2 -2
- package/dist/server-CuHDT_fJ.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -1,29 +1,36 @@
|
|
|
1
1
|
# cursor-agent-bridge
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
OpenAI-compatible HTTP bridge for the Cursor Agent CLI.
|
|
4
4
|
|
|
5
|
-
`cursor-agent-bridge` lets Codex and OpenAI-compatible clients
|
|
5
|
+
`cursor-agent-bridge` lets Codex and other OpenAI-compatible clients talk to a
|
|
6
|
+
local Cursor Agent session at `http://127.0.0.1:4646/v1`. It supports the
|
|
7
|
+
Responses API used by Codex custom providers, plus Chat Completions for simpler
|
|
8
|
+
clients.
|
|
6
9
|
|
|
7
10
|
## Requirements
|
|
8
11
|
|
|
9
|
-
- Node.js
|
|
12
|
+
- Node.js 22.13+
|
|
10
13
|
- pnpm 11+
|
|
11
14
|
- Cursor Agent CLI installed and authenticated
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
Check Cursor Agent first:
|
|
14
17
|
|
|
15
18
|
```bash
|
|
19
|
+
# Install from https://cursor.com/install, then authenticate the CLI.
|
|
16
20
|
agent login
|
|
17
21
|
agent --list-models
|
|
18
22
|
```
|
|
19
23
|
|
|
20
24
|
## Install
|
|
21
25
|
|
|
26
|
+
Install the package globally, then confirm the command is on your `PATH`:
|
|
27
|
+
|
|
22
28
|
```bash
|
|
23
29
|
pnpm add -g cursor-agent-bridge
|
|
30
|
+
cursor-agent-bridge --version
|
|
24
31
|
```
|
|
25
32
|
|
|
26
|
-
|
|
33
|
+
For local development:
|
|
27
34
|
|
|
28
35
|
```bash
|
|
29
36
|
pnpm install
|
|
@@ -31,23 +38,107 @@ pnpm build
|
|
|
31
38
|
pnpm exec cursor-agent-bridge serve
|
|
32
39
|
```
|
|
33
40
|
|
|
41
|
+
## Upgrade
|
|
42
|
+
|
|
43
|
+
Check for updates:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
cursor-agent-bridge upgrade --check
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Install the latest published version:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
cursor-agent-bridge upgrade
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Options:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
cursor-agent-bridge upgrade --target 0.1.3
|
|
59
|
+
cursor-agent-bridge upgrade --manager npm
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`--check` compares your installed version with npm and exits `1` when a newer
|
|
63
|
+
version is available. The default command installs through pnpm when it manages
|
|
64
|
+
the global package, otherwise npm.
|
|
65
|
+
|
|
66
|
+
If you use the optional macOS LaunchAgent, reinstall it after upgrading so the
|
|
67
|
+
service picks up the new binary:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
cursor-agent-bridge launch-agent install
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
For local development from this repository, use `git pull`, `pnpm install`, and
|
|
74
|
+
`pnpm build` instead of `upgrade`.
|
|
75
|
+
|
|
34
76
|
## Run
|
|
35
77
|
|
|
78
|
+
Run the bridge in the foreground:
|
|
79
|
+
|
|
36
80
|
```bash
|
|
37
81
|
cursor-agent-bridge serve --host 127.0.0.1 --port 4646
|
|
38
82
|
```
|
|
39
83
|
|
|
40
|
-
|
|
84
|
+
Configuration:
|
|
41
85
|
|
|
42
86
|
```bash
|
|
43
87
|
HOST=127.0.0.1
|
|
44
88
|
PORT=4646
|
|
45
89
|
CURSOR_AGENT_PATH=agent
|
|
90
|
+
CURSOR_AGENT_MAX_CONCURRENT=1
|
|
91
|
+
CURSOR_AGENT_YOLO=1
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
By default, the bridge runs Cursor Agent with `--yolo` so Codex can use it as a
|
|
95
|
+
non-interactive provider. Set `CURSOR_AGENT_YOLO=0` to keep Cursor Agent's
|
|
96
|
+
normal confirmation behavior.
|
|
97
|
+
|
|
98
|
+
`CURSOR_AGENT_MAX_CONCURRENT` limits concurrent Cursor Agent subprocesses. The
|
|
99
|
+
default is `1`.
|
|
100
|
+
|
|
101
|
+
## macOS Background Service
|
|
102
|
+
|
|
103
|
+
Codex connects to the configured `base_url`; it does not start provider
|
|
104
|
+
processes. On macOS, you can install the optional LaunchAgent to start the
|
|
105
|
+
bridge at login and restart it after crashes:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
cursor-agent-bridge launch-agent install
|
|
46
109
|
```
|
|
47
110
|
|
|
111
|
+
Manage the service:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
cursor-agent-bridge launch-agent status
|
|
115
|
+
cursor-agent-bridge launch-agent uninstall
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
The LaunchAgent listens on `127.0.0.1:4646` by default. Skip it if you prefer to
|
|
119
|
+
run `cursor-agent-bridge serve` yourself before starting Codex.
|
|
120
|
+
|
|
48
121
|
## Codex Config
|
|
49
122
|
|
|
50
|
-
|
|
123
|
+
Create or update `~/.codex/cursor.config.toml`:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
cursor-agent-bridge config write
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Preview the generated profile without writing a file:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
cursor-agent-bridge config print
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Validate an existing profile:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
cursor-agent-bridge config check
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
The generated profile looks like this:
|
|
51
142
|
|
|
52
143
|
```toml
|
|
53
144
|
model_provider = "cursor"
|
|
@@ -59,13 +150,32 @@ base_url = "http://127.0.0.1:4646/v1"
|
|
|
59
150
|
wire_api = "responses"
|
|
60
151
|
```
|
|
61
152
|
|
|
62
|
-
Start Codex:
|
|
153
|
+
Start Codex with the profile:
|
|
63
154
|
|
|
64
155
|
```bash
|
|
65
156
|
codex --profile cursor
|
|
66
157
|
```
|
|
67
158
|
|
|
68
|
-
Use `/model` to
|
|
159
|
+
Use `/model` in Codex to pick a Cursor model. The model catalog comes from
|
|
160
|
+
`agent --list-models`.
|
|
161
|
+
|
|
162
|
+
## Troubleshooting
|
|
163
|
+
|
|
164
|
+
Run a full preflight before starting Codex:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
cursor-agent-bridge doctor
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
List available Cursor models without starting the HTTP server:
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
cursor-agent-bridge models
|
|
174
|
+
cursor-agent-bridge models --json
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
If `config write` finds a different `model_provider`, pass `--force` to switch
|
|
178
|
+
the profile to `cursor`.
|
|
69
179
|
|
|
70
180
|
## API
|
|
71
181
|
|
|
@@ -76,7 +186,17 @@ POST /v1/responses
|
|
|
76
186
|
POST /v1/chat/completions
|
|
77
187
|
```
|
|
78
188
|
|
|
79
|
-
`GET /v1/models` returns
|
|
189
|
+
`GET /v1/models` returns an OpenAI-style model list by default. When Codex calls
|
|
190
|
+
the same endpoint with `client_version`, the bridge returns the catalog shape
|
|
191
|
+
Codex expects for `/model`.
|
|
192
|
+
|
|
193
|
+
Model lists are cached briefly so the bridge does not spawn
|
|
194
|
+
`agent --list-models` for every request. Pass `refresh=1` to force a refresh.
|
|
195
|
+
|
|
196
|
+
The bridge accepts sampling and token limit fields such as `temperature`,
|
|
197
|
+
`top_p`, `max_tokens`, and `max_output_tokens` for OpenAI client compatibility.
|
|
198
|
+
Cursor Agent CLI does not expose stable equivalents for those fields, so the
|
|
199
|
+
bridge does not rewrite prompts or add local truncation.
|
|
80
200
|
|
|
81
201
|
## Examples
|
|
82
202
|
|
|
@@ -96,11 +216,13 @@ curl -sS http://127.0.0.1:4646/v1/chat/completions \
|
|
|
96
216
|
-d '{"model":"auto","messages":[{"role":"user","content":"Reply OK"}],"stream":false}'
|
|
97
217
|
```
|
|
98
218
|
|
|
99
|
-
## Security
|
|
219
|
+
## Security
|
|
100
220
|
|
|
101
|
-
|
|
221
|
+
Bind the bridge to `127.0.0.1` unless you intentionally expose it on a trusted
|
|
222
|
+
network.
|
|
102
223
|
|
|
103
|
-
|
|
224
|
+
The bridge does not forward client `Authorization` headers to Cursor Agent.
|
|
225
|
+
Cursor Agent uses local `agent login` state.
|
|
104
226
|
|
|
105
227
|
## Development
|
|
106
228
|
|
|
@@ -109,6 +231,4 @@ pnpm install
|
|
|
109
231
|
pnpm run ci
|
|
110
232
|
```
|
|
111
233
|
|
|
112
|
-
|
|
113
|
-
The publish workflow uses npm Trusted Publishing with GitHub OIDC, so it does
|
|
114
|
-
not require an `NPM_TOKEN` repository secret.
|
|
234
|
+
GitHub Actions publishes releases from `v*` tags.
|