Skip to content

feat: Add Cursor CLI provider support #268

@jellydn

Description

@jellydn

What

Add support for Cursor CLI as a new CLIProxy provider in CCS, similar to the existing codex, gemini, and agy profiles.

Why

User Value:

  • Cursor CLI (released August 2025) is a popular AI-powered CLI that provides coding assistance directly from the terminal
  • Supports multiple AI models: GPT-5, Claude 4 Sonnet/Opus, Gemini 2.5 Pro
  • Offers both interactive and non-interactive modes for automation/CI/CD
  • Users want seamless switching between Cursor and other providers via CCS

Alignment with CCS Goals:

  • Fits CCS's mission: "CLI wrapper for instant switching between multiple Claude accounts and alternative models"
  • Cursor CLI is a natural fit alongside existing CLIProxy providers (gemini, codex, agy, qwen, iflow, kiro, ghcp)
  • Leverages existing OAuth infrastructure and zero-config profile mechanism

How

Proposed Implementation

1. Add cursor to CLIProxy provider types

Files to update:

  • src/cliproxy/types.ts - Add 'cursor' to CLIProxyProvider type
  • src/config/unified-config-types.ts - Add to provider union types
  • config/reserved-names.ts - Add 'cursor' to reserved names

2. Create base configuration

Create config/base-cursor.settings.json:

{
  "env": {
    "ANTHROPIC_BASE_URL": "http://127.0.0.1:8317/api/provider/cursor",
    "ANTHROPIC_AUTH_TOKEN": "ccs-internal-managed",
    "ANTHROPIC_MODEL": "cursor-default-model",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "cursor-opus-model",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "cursor-sonnet-model",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "cursor-haiku-model"
  }
}

3. Add OAuth configuration

Update src/cliproxy/auth/auth-types.ts:

  • Add OAuth callback port (similar to gemini:8085, codex:1455, agy:51121)
  • Add OAuth flow configuration
  • Add token file prefix pattern for detection

4. Update model catalog

Update src/cliproxy/model-catalog.ts:

  • Add Cursor model mappings
  • Define default models for Opus/Sonnet/Haiku tiers

5. Update account manager

Update src/cliproxy/account-manager.ts:

  • Add 'cursor' to providers array
  • Add token prefix detection logic

6. Update CLI and help text

Update src/ccs.ts, lib/ccs, lib/ccs.ps1:

  • Add cursor usage examples
  • Update help text to include ccs cursor command

7. Add to remote auth fetcher

Update src/cliproxy/remote-auth-fetcher.ts:

  • Add cursor provider mapping
  • Add display name for UI

Unknowns (Need Investigation)

  1. Cursor CLI OAuth Endpoint: What is Cursor's OAuth authorization URL and callback port?
  2. Model IDs: What are the exact model IDs for Cursor's supported models?
  3. Token Format: How does Cursor store OAuth tokens? (File format, location, structure)
  4. API Compatibility: Is Cursor CLI compatible with CLIProxyAPI, or does it need custom handling?

Reference Implementation

Use codex profile as reference (already implemented):

  • Configuration: config/base-codex.settings.json
  • OAuth port: 1455
  • Model catalog: src/cliproxy/model-catalog.ts (see codex entry)

Testing Checklist

  • ccs cursor launches and authenticates via OAuth
  • Model selection works (ccs cursor --config)
  • Session isolation (concurrent cursor + other providers)
  • Dashboard shows Cursor profile
  • Token refresh works (if applicable)
  • Help text updated (ccs --help)
  • Reserved name validation prevents conflicts
  • Migration path if token format changes

Acceptance Criteria

  1. User can run ccs cursor and authenticate via browser OAuth
  2. Cursor CLI is accessible through standard Claude CLI commands
  3. Concurrent usage works: ccs cursor in one terminal, ccs codex in another
  4. Dashboard displays Cursor profile with correct provider name/logo
  5. All validation checks pass (format, lint, typecheck, tests)

Priority: Medium (user request, but requires OAuth endpoint investigation)

Estimated Complexity: Medium (follows existing pattern, OAuth details unknown)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions