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
- Watch Settings → MCP.
shield-kyaturns green on its own. - Open Settings → MCP and confirm
shield-kyais connected with three tools:kya.policy_evaluate,kya.session_ingest,kya.request_approval. -
Offline smoke, no cloud needed:
kya wrap --offline --tool-id Write --irreversible --args '{"path":"x.ts","content":"hi"}'Expect a
REQUIRE_APPROVErow in the record (trail) (--irreversiblewithout 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
- Server shows red in Settings → MCP. Cursor hot-reloads stdio servers, so give it a few seconds after saving. Remote/HTTP servers can stick; toggle the server off/on in the panel.
command not founderrors. Connect wiresnode …/cli.js serve-mcp --stdiofrom the install you ran it from. If you connected via a tempnpxcache and later cleared it, rerunkya connect cursor --forcefrom a real install (npm i -g @shield-agent/kya).- Wired but the agent ignores it. Check Cursor’s tool-approval settings. If the agent is set to run tools without MCP, those calls never reach evaluate. See the honesty note.
- Decisions need a key. The wired env sets
KYA_OFFLINE=1, so the server starts keyless and sample-evaluates. Against an authenticated control plane, setKYA_API_KEYin the entry’senvblock.
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.