@pi-stef/cursor
Cursor AI editor as a native Pi stream provider — OAuth login, protobuf/HTTP2 protocol, tool-call recovery
Package details
Install @pi-stef/cursor from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@pi-stef/cursor- Package
@pi-stef/cursor- Version
0.1.3- Published
- Jun 20, 2026
- Downloads
- 297/mo · 297/wk
- Author
- sfiorini
- License
- MIT
- Types
- extension
- Size
- 785.1 KB
- Dependencies
- 7 dependencies · 2 peers
Pi manifest JSON
{
"extensions": [
"./extensions"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
@pi-stef/cursor
Cursor AI editor as a native Pi stream provider — OAuth login, protobuf/HTTP2 protocol, tool-call recovery.
Overview
This package registers Cursor as a Pi provider named cursor. It enables Pi to use Cursor models (Claude, GPT, Gemini, Grok) through Cursor OAuth and Cursor's native agent protocol.
Key features:
- OAuth PKCE authentication with Cursor
- Protobuf/HTTP2 protocol for efficient streaming
- Three-tier bridge recovery for tool-call continuity
- Exact model routing (no invented reasoning-effort suffixes)
- Dynamic agent endpoint resolution
Install
pi install npm:@pi-stef/cursor
Then open Pi and run:
/login cursor
Usage
After installing and logging in, ask Pi to use Cursor-backed models:
"Use the cursor provider for this session and compare the failing test output with the latest diff."
"Use Cursor MAX mode through the cursor provider for this larger refactor."
"Use the cursor provider with the exact gemini-3.1-pro model; do not force a reasoning level unless Cursor advertises one."
Remove
pi remove @pi-stef/cursor
Update
pi update @pi-stef/cursor
Endpoint And Model Routing
Cursor model discovery and streaming use Cursor's agent endpoint. The provider resolves that endpoint in this order:
PI_CURSOR_AGENT_URLCURSOR_AGENT_URL- Cursor CLI config at
~/.cursor/cli-config.json, fromserverConfigCache.agentUrlConfig.agentnUrlorserverConfigCache.agentUrlConfig.agentUrl - Fallback
https://agentn.us.api5.cursor.sh
Use an environment override only when Cursor has moved your account or region to a different agent endpoint:
PI_CURSOR_AGENT_URL="https://agentn.us.api5.cursor.sh" pi
The provider sends exact Cursor model ids without inventing reasoning-effort suffixes. If a model is listed as an exact non-effort model, a Pi reasoning request such as high is omitted instead of turning gemini-3.1-pro into a fake gemini-3.1-pro-high route. Reasoning effort is forwarded only when Cursor model metadata advertises effort support or provides an explicit mapping.
Parameterized and MAX variants still route through Cursor metadata. Native agent model discovery uses the resolved agent endpoint; legacy parameterized model discovery is used only when Cursor's older available-models endpoint returns it.
Architecture
Bridge Recovery
The provider implements three-tier bridge recovery for tool-call continuity:
- Tier 1: Resume from existing bridge connection
- Tier 2: Rebuild from checkpoint/blob state
- Tier 3: Full history rebuild from Pi request context
See bridge recovery docs for details.
Protocol
The provider uses protobuf over HTTP/2 for efficient communication with Cursor's agent endpoint. See protocol docs for details.
Configuration
Environment Variables
PI_CURSOR_AGENT_URL— Override Cursor agent endpointCURSOR_AGENT_URL— Alternative agent endpoint overridePI_CURSOR_PROVIDER_DEBUG=1— Enable debug loggingPI_CURSOR_STREAM_IDLE_TIMEOUT_MS— Stream idle timeout (default: 120000ms)PI_CURSOR_STREAM_IDLE_MAX_RETRIES— Max idle retries (default: 3)PI_CURSOR_RESUME_IDLE_TIMEOUT_MS— Resume stream timeout (default: 240000ms)
Debug Logging
PI_CURSOR_PROVIDER_DEBUG=1 pi
Debug summaries redact token-like values and image payload bytes. Logs are intended for protocol debugging, not for sharing outside a trusted workspace.
Troubleshooting
Authentication Fails
Remove the package and reinstall after updating Pi:
pi remove @pi-stef/cursor
pi install npm:@pi-stef/cursor
Provider Starts Offline
If the provider starts offline, it registers bundled fallback models and retries live model discovery after successful OAuth login or refresh.
Stream Idle Timeout
Native streams retry in place when Cursor stops sending upstream data. The default idle timeout is 2 minutes, outbound heartbeat frames do not extend it, and the provider retries 3 times before returning a final error. The default can spend up to 8 minutes on a fully silent turn, and each retry may repeat upstream Cursor work.
Live Verification
The repo tests do not require Cursor credentials. To smoke-test with a real account after installing:
- Start Pi.
- Run
/login cursor. - Select a Cursor model from
/model. - Send a simple text prompt.
- Send a prompt with a small PNG/JPEG if image support is needed.
Upstream Attribution
This package adapts ndraiman/pi-cursor-provider PR #8 at pinned commit 06c894e76989cb961c65c6b48914d12fe26cf90b, authored by Matthew Leong. The upstream repo is by Netanel Draiman and is MIT licensed.
Additional protocol and model-quality references:
sudosubin/pi-frontierby Subin Kimnetandreus/pi-cursor-providerby Andreykenryu42/pi-cursor-oauth