Cursor
Cursor IDE adapter contract
Overview
@stax/cursor is the canonical stax adapter for Cursor IDE.
Cursor is a VS Code fork with AI-native features. Its agent configuration uses .cursor/rules/ for rules, .cursor/mcp.json for MCP servers, .cursor/skills/ for skills, and supports AGENTS.md for instructions.
This adapter targets the documented Cursor file contract described in 17 — Runtime File Contracts.
Scope model
| Scope | Typical files |
|---|---|
| Project | .cursor/rules/*.mdc, .cursor/mcp.json, .cursor/skills/**, .cursor/hooks.json, AGENTS.md |
| User | ~/.cursor/rules/*.mdc, ~/.cursor/mcp.json, ~/.cursor/skills/**, ~/.cursor/hooks.json |
| Legacy | .cursorrules (project root, deprecated in favor of .cursor/rules/) |
In stax 1.0.0, @stax/cursor SHOULD default to project scope.
Adapter interface
interface CursorAdapterOptions {
model?: string;
modelParams?: Record<string, unknown>;
scope?: "project" | "user";
exact?: boolean;
writeRules?: boolean; // default: true
writeMcp?: boolean; // default: true
writeSkills?: boolean; // default: true
writeInstructions?: boolean; // default: true
legacyCursorrules?: boolean; // default: false — emit .cursorrules instead of .cursor/rules/
config?: Record<string, unknown>; // Cursor-specific settings
}The compiled adapter config SHOULD use:
{
"type": "cursor",
"runtime": "cursor",
"adapterVersion": "1.0.0"
}Exact target mapping
Project scope
| stax source | Target |
|---|---|
surfaces/instructions.md or composed prompt | AGENTS.md |
| rules | .cursor/rules/*.mdc |
| MCP layer | .cursor/mcp.json |
| skills | .cursor/skills/ |
User scope
| stax source | Target |
|---|---|
surfaces/instructions.md or composed prompt | ~/.cursor/rules/stax-instructions.mdc |
| rules | ~/.cursor/rules/*.mdc |
| MCP layer | ~/.cursor/mcp.json |
| skills | ~/.cursor/skills/ |
AGENTS.md generation
Cursor supports AGENTS.md at the project root and subdirectories as always-on instruction files.
The adapter SHOULD choose the first available source in this order:
surfaces/instructions.mdprompt- synthesized composition
In exact mode, if composition is required because no exact source document exists, the consumer MUST warn or fail according to policy.
Rules mapping
Cursor uses .mdc or .md files in .cursor/rules/ with YAML frontmatter.
Rule translation
Each canonical stax rule SHOULD be translated to a .cursor/rules/<rule-id>.mdc file with the following frontmatter mapping:
| stax rule field | Cursor frontmatter field |
|---|---|
scope: 'always' | alwaysApply: true |
scope: 'auto' | alwaysApply: false + description (required) |
scope: 'glob' | globs array |
scope: 'manual' | alwaysApply: false, no globs, no description |
globs | globs |
id | filename stem |
Example output
---
description: "Enforce TypeScript naming conventions"
globs: ["**/*.ts", "**/*.tsx"]
alwaysApply: false
---
Use PascalCase for types and interfaces.
Use camelCase for variables and functions.Lossy translations
- stax
priorityandseverityhave no Cursor equivalent and MUST be dropped with a warning - stax
triggershave no Cursor equivalent and MUST be dropped with a warning
MCP mapping
Cursor uses .cursor/mcp.json for both project and user scope.
Output format
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "..."
}
},
"remote-server": {
"url": "https://mcp.example.com/mcp",
"headers": {}
}
}
}Mapping rules
- stdio servers map to
command,args, and optionalenv - remote servers map to
urland optionalheaders - secret values MUST NOT be written directly; environment-variable references MAY be used
- the
disabledfield MAY be set totruefor MCP servers marked as optional - unsupported canonical MCP fields MUST trigger warnings
Skills mapping
Cursor supports skills in .cursor/skills/<name>/SKILL.md, compatible with the stax skill format.
- target directory:
.cursor/skills/or~/.cursor/skills/ - each top-level skill directory MUST be preserved
SKILL.mdcontent SHOULD be preserved byte-for-byte- Cursor also reads
.claude/skills/and.agents/skills/as compatible paths
Legacy .cursorrules support
When legacyCursorrules: true is set, the adapter SHOULD:
- compose all rules and instructions into a single
.cursorrulesfile at the project root - warn that this is a deprecated path
- not emit
.cursor/rules/files
This mode exists for backwards compatibility with older Cursor versions.
Feature map
{
"prompt": "native",
"persona": "embedded",
"rules": "translated",
"skills": "native",
"mcp": "translated",
"surfaces": "embedded",
"secrets": "consumer-only",
"toolPermissions": "unsupported",
"modelConfig": "unsupported",
"exactMode": true
}What the adapter MUST NOT own
~/Library/Application Support/Cursor/(app state, caches, auth).vscode/settings.json(editor settings, not agent config).cursor/hooks.json(lifecycle hooks are runtime-specific)- auth tokens, credential files, or API keys
- caches, logs, session state
Exactness requirements
An implementation claiming exact Cursor support SHOULD:
- write
.cursor/rules/*.mdcwith correct frontmatter - write
.cursor/mcp.jsonwithmcpServersroot key - preserve skill directory structure exactly
- write
AGENTS.mdwhen source instructions exist - avoid writing state, auth, or editor-level settings
- warn or fail when lossy translations occur in
exactmode