Cursor (IDE + Agent CLI)

Wire KYA into Cursor so tool calls the agent routes through Shield’s MCP gate pass Shield’s evaluate first and are recorded. Cursor’s built-in tools do not go through the gate and are not evaluated or recorded. Allow runs, Deny stops, Hold waits for a person. The Cursor IDE and the Cursor Agent CLI share the same MCP config, so one wiring covers both.

Setup

Two commands do the same job. Pick one:

kya connect cursor   # writes ~/.cursor/mcp.json directly
kya start            # shows a plan, asks once, then wires .cursor/mcp.json (only when Cursor is installed)

For a per-project setup instead of global:

kya connect cursor --project   # writes ./.cursor/mcp.json

No restart: Cursor watches mcp.json and starts new stdio servers automatically. That holds whether you wired with kya connect cursor or kya start.

Two other paths, if you prefer them: merge the repo-root .mcp.json by hand, or install the shipped .cursor-plugin/ (plugin.json + a wrap skill) for a plugin-managed setup.

What KYA reports

Each tool call Cursor routes through Shield’s MCP gate lands on the receipt: tool id, decision (Allow / Deny / Hold), timestamp, and a clipped, redacted preview of what would change. Open it with kya receipt --open, or check Cursor’s MCP panel in Settings.

Files written

Scope Path
Global ~/.cursor/mcp.json
Project ./.cursor/mcp.json

Connect merges. Your other MCP servers and settings stay as they were. If the existing file doesn’t parse as JSON, connect stops and tells you. It never overwrites a config it cannot read.

Verify

  1. Watch Settings → MCP. shield-kya turns green on its own.
  2. Open Settings → MCP and confirm shield-kya is connected with three tools: kya.policy_evaluate, kya.session_ingest, kya.request_approval.
  3. Offline smoke, no cloud needed:

    kya wrap --offline --tool-id Write --irreversible --args '{"path":"x.ts","content":"hi"}'
    

    Expect a REQUIRE_APPROVE row in the record (trail) (--irreversible without a policy never auto-allows).

Uninstall

Edit ~/.cursor/mcp.json and delete the shield-kya entry under mcpServers. Nothing else is installed: no daemon, no background process. (kya connect cursor --force rewires the entry if you only want to refresh it.)

Troubleshooting

Honesty note

Cursor decides which tools go through MCP, and its own approval modes can run tools outside it. KYA gates MCP calls only. A Cursor action executed natively is outside the gate. Do not treat this setup as full coverage of the agent.

Wrap fallback

Works with or without MCP, and it’s the right choice for the Cursor Agent CLI in scripts and CI:

kya wrap --offline -- cursor-agent run "fix the failing test"

Wrap evaluates the command itself before it runs and records a row in the record.