High-quality OpenCode provider plugin that brings Cursor models into OpenCode through OAuth, model discovery, and a local OpenAI-compatible proxy.
Designed for real-world agent usage: streaming, tool calls, long conversations, and robust continuation behavior.
- OAuth login with automatic token refresh
- Cursor model discovery directly from API
- OpenAI-compatible
/v1/chat/completionsproxy for OpenCode runtime compatibility - Stable streaming with tool-calling continuation
- MCP-first tool execution flow for practical agent environments
- Conversation-state handling built for long and tool-heavy sessions
- Production-ready smoke test coverage
- Native feel in OpenCode: Cursor models are exposed as a regular provider flow in OpenCode.
- Reliable tool loops: Tool call handoff and continuation are engineered for iterative agent workflows.
- Operationally practical: Focused on reducing common runtime failure modes around streaming, tool calls, and conversation state.
- Simple integration surface: Works with standard OpenCode plugin configuration and auth flow.
npm install -g @otto-assistant/opencode-cursor-oauthThen add this to ~/.config/opencode/opencode.json:
git clone https://github.com/otto-assistant/opencode-cursor.git
cd opencode-cursor
bun install
bun run build
npm install -g .Use the same OpenCode config shown above.
opencode auth login --provider cursorThis opens Cursor OAuth in your browser. Tokens are stored in ~/.local/share/opencode/auth.json and refreshed automatically.
- Start OpenCode.
- Select provider
cursor. - Choose a Cursor model.
- Send prompts as usual; the plugin starts the local proxy on demand.
OpenCode
-> /v1/chat/completions
-> Bun.serve proxy
-> Node HTTP/2 bridge (h2-bridge.mjs)
-> Cursor gRPC API (api2.cursor.sh)
1) Model receives tool definitions via request context
2) Model emits tool call
3) Proxy maps tool call into OpenCode-compatible stream events
4) OpenCode executes tool
5) Tool result is sent back
6) Proxy resumes Cursor stream continuation
bun install
bun run build
bun run test- OpenCode plugin runtime
- Bun runtime
- Node.js >= 18 (HTTP/2 bridge process)
- Active Cursor subscription
- Conversation state is managed to support continuation across multi-turn tool usage.
- Streaming and bridge lifecycle handling are designed to minimize stuck sessions.
- Tool execution path is optimized for MCP-based environments.
Usually no. OpenCode can install npm plugins automatically when configured.
This repository publishes under @otto-assistant/opencode-cursor-oauth. If npm install fails, verify that the latest GitHub release workflow completed successfully.
This project is released under the MIT license (declared in package metadata).
MIT
{ "$schema": "https://opencode.ai/config.json", "plugin": [ "@otto-assistant/opencode-cursor-oauth" ], "provider": { "cursor": { "name": "Cursor" } } }