npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

cursor-ai-sdk-provider

v0.0.1

Published

Community AI SDK provider for Cursor SDK agents.

Readme

Cursor AI SDK Provider

Status: quick proof of concept. This package has not been published to npm yet, and the API may change.

Community AI SDK provider for the Cursor SDK public beta. This is an unofficial community package and is not affiliated with Cursor or Vercel.

This package adapts Cursor agents to the AI SDK language model interface, so you can call Cursor models with generateText and streamText.

import { generateText } from 'ai';
import { cursor } from 'cursor-ai-sdk-provider';

const result = await generateText({
  model: cursor('composer-2'),
  prompt: 'Summarize this repository.',
});

console.log(result.text);

Install

This package requires Node.js 18 or newer.

After publishing to npm:

bun add cursor-ai-sdk-provider ai @cursor/sdk

Set CURSOR_API_KEY, or pass apiKey to createCursor.

export CURSOR_API_KEY="your-key"

Repository examples also load .env.local, so this works too:

CURSOR_API_KEY="your-key"

Local Agents

By default, calls create a local Cursor agent against process.cwd(). Your workspace files are read from your machine, and the model/runtime calls are authenticated through Cursor with CURSOR_API_KEY. This does not create a Cursor cloud VM unless you pass cloud options.

import { createCursor } from 'cursor-ai-sdk-provider';

const cursor = createCursor({
  local: { cwd: '/path/to/repo' },
});

Examples

Runnable examples live in examples/. From this repository, run them through the package scripts:

bun run example:check
bun run example:basic
bun run example:streaming
bun run example:tool-streaming

These scripts use Node through tsx. Running the files directly with Bun's TypeScript runtime can fail because the Cursor SDK uses Node HTTP/2 transport internals. They load .env.local before running.

Cloud Agents

Pass Cursor cloud options to run in Cursor-hosted or self-hosted cloud environments.

const cursor = createCursor({
  cloud: {
    repos: [
      { url: 'https://github.com/your-org/your-repo', startingRef: 'main' },
    ],
    autoCreatePR: true,
  },
});

Model Parameters

Use Cursor.models.list() from @cursor/sdk to discover valid model IDs and parameters. Pass default params when creating the model, or per call through AI SDK provider options.

await generateText({
  model: cursor('composer-2'),
  prompt: 'Plan this refactor.',
  providerOptions: {
    cursor: {
      params: [{ id: 'thinking', value: 'high' }],
    },
  },
});

Cursor Tools

AI SDK function tools are not forwarded to Cursor. Use Cursor MCP servers and subagents instead.

const cursor = createCursor({
  mcpServers: {
    docs: {
      type: 'http',
      url: 'https://example.com/mcp',
    },
  },
  agents: {
    'code-reviewer': {
      description: 'Reviews code for bugs and regressions.',
      prompt: 'Review the code carefully and report concrete findings.',
      model: 'inherit',
    },
  },
});

Cursor tool activity is exposed as provider-executed AI SDK tool events.

For streaming calls, textStream only includes assistant text. Use fullStream to observe tool calls and results:

import { streamText } from 'ai';
import { cursor } from 'cursor-ai-sdk-provider';

const result = streamText({
  model: cursor('composer-2'),
  prompt: 'Inspect this repository and summarize package.json.',
});

for await (const part of result.fullStream) {
  if (part.type === 'tool-call') {
    console.log('Tool call:', part.toolName, part.input);
  }

  if (part.type === 'tool-result') {
    console.log('Tool result:', part.toolName, part.output);
  }
}

For non-streaming generateText(), tool calls and results are available after the run finishes through the AI SDK result content and tool fields, while result.text remains assistant text only.

const result = await generateText({
  model: cursor('composer-2'),
  prompt: 'Inspect this repository and summarize package.json.',
});

console.log(result.text);
console.log(result.toolCalls);
console.log(result.toolResults);

Limitations

  • Language models only. Cursor does not expose embeddings or image generation through this provider.
  • Each AI SDK call creates, runs, and disposes one Cursor agent unless you pass a stable agentId.
  • AI SDK sampling settings such as temperature, topP, and stopSequences are reported as unsupported warnings because the Cursor SDK agent API does not expose them directly.
  • JSON response format is implemented as a prompt instruction, not native constrained decoding.