Kimi Code CLI
Wire KYA into Kimi Code so every tool call the agent makes passes Shield’s evaluate first. Allow runs, Deny stops, Hold waits for a person.
Setup
kya connect kimi
That writes a shield-kya entry into ~/.kimi-code/mcp.json under mcpServers. For a per-project setup instead:
kya connect kimi --project # writes ./.kimi-code/mcp.json
No app restart: open a new session to load shield-kya. Kimi Code registers MCP servers at session start.
Prefer editing by hand? Copy kimi/mcp.example.json into place and merge the mcpServers section yourself.
What KYA reports
Every tool call Kimi routes through MCP 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.
Files written
| Scope | Path |
|---|---|
| Global | ~/.kimi-code/mcp.json |
| Project | ./.kimi-code/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
- Open a new Kimi Code session.
- Ask the agent to list its MCP tools.
kya.policy_evaluate,kya.session_ingest,kya.request_approvalshould appear. -
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 ~/.kimi-code/mcp.json and delete the shield-kya entry under mcpServers. Nothing else is installed: no daemon, no background process. (kya connect kimi --force rewires the entry if you only want to refresh it.)
Troubleshooting
- Server not listed in Kimi. MCP servers register at session start. If you added it mid-session, existing sessions never see it. Open a new session.
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 kimi --forcefrom a real install (npm i -g @shield-agent/kya).- Tools silently bypass the gate. KYA only sees calls that go through MCP. A tool Kimi runs natively without MCP never reaches evaluate; see the honesty note below.
- 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
Kimi decides which tools go through MCP. KYA gates the ones that do. A tool Kimi executes outside MCP is outside the gate. Do not treat this setup as full coverage of the agent.
Wrap fallback
Works with or without MCP:
kya wrap --offline -- kimi "summarize this repo"
Wrap evaluates the command itself before it runs and records a row in the record. Use it for hosts, shells, or scripts that never speak MCP.