cpa-plugin-cursor-agent
Unofficial CLIProxyAPI provider plugin for the private Cursor Agent v1 Connect transport.
This is not the official @cursor/sdk product. The official-SDK gateway is a separate repository (cursor-sdk2api, CPA type 62). Do not mix the two.
What this plugin does
It registers a CPA auth_provider + executor + model catalog under provider id cursor-agent-v1.
CLIProxyAPI hosts then expose their usual Chat / Messages / Responses surfaces. BeefAPI production compile-imports the same Go library (cursoragentv1) inside its CPA sidecar; clients do not call a second public Cursor gateway.
Requirements
- Go 1.26+
- CGO (to build the
.so / .dylib plugin)
- A Cursor API key that can mint an Agent v1 access token (
key_...)
Build the native plugin
make plugin
This writes dist/cursor-agent-v1.dylib (macOS) or dist/cursor-agent-v1.so (Linux). CPA identifies a plugin by that file name.
Copy the file into the host plugin directory, then point CLIProxyAPI at it. Plugin-owned config:
plugins:
configs:
cursor-agent-v1:
state_dir: /var/lib/cliproxy-cursor-agent-v1
state_dir may also come from CURSOR_AGENT_V1_STATE_DIR. If neither is set, the plugin uses ~/.cliproxy-cursor-agent-v1.
Auth file
There is no interactive login in v0.1. Drop a JSON file into the CPA auth directory:
{
"type": "cursor-agent-v1",
"api_key": "key_...",
"access_token": "",
"account_id": "",
"email": ""
}
api_key is required. access_token and account_id are filled on refresh when the host asks the plugin to refresh.
Use as a Go library
import "github.com/Sunnyender-org/cpa-plugin-cursor-agent/cursoragentv1"
exec, err := cursoragentv1.NewExecutor(absoluteStateDir)
NewExecutor requires an absolute state directory. This is the path BeefAPI's CPA sidecar uses; it does not dlopen the shared plugin.
Verify
make test
make proto # needs protoc and protoc-gen-go v1.34.1
Live probes under cursoragentv1/*probe*_test.go stay compiled but skip unless their env flags are set.
License
MIT. Third-party notices: NOTICE. The vendored Agent v1 proto is MIT from can1357/oh-my-pi; see cursoragentv1/proto/LICENSE.