MCP server
Use Klent from any Model Context Protocol client (Claude Desktop, Cursor, custom hosts) without writing code.
@klent/mcp-server is a stdio MCP server that exposes Klent's policy gate
to any Model Context Protocol client.
The four tools mirror @klent/sdk directly:
| Tool | Purpose |
|---|---|
klent_start_execution | Open one tracked agent run. Subsequent calls reference its execution_id. |
klent_evaluate_action | Evaluate a proposed tool call: allow / deny / modify / approve / steer. |
klent_log_event | Append an event (e.g. error) to the timeline. |
klent_get_pending_action | Read a pending HITL action, optionally long-polling until a human resolves it. |
Decisions, events, and pending actions land at
https://app.klent.dev/executions/<execution_id> exactly the same way they
do for SDK-driven agents.
When to use the MCP server vs the SDK
Use the SDK (@klent/sdk for TS, klent-sdk for Python) when you
control the agent code. Wrap each tool call with runTool (or call
evaluateAction + logEvent manually) and you get the full surface.
Use the MCP server when you don't control the agent — for example:
- The agent runs inside Claude Desktop, Cursor, or another MCP host.
- You want to gate tool calls declaratively without redeploying agent code.
- You're prototyping policies against a live LLM session.
It's a thin wrapper. The SDK is the source of truth for behavior.
Setup
You need a Klent API key. Mint one at
https://app.klent.dev/api-keys (per-project).
Claude Desktop
Edit your config (~/Library/Application Support/Claude/claude_desktop_config.json
on macOS):
{
"mcpServers": {
"klent": {
"command": "npx",
"args": ["-y", "@klent/mcp-server"],
"env": {
"KLENT_API_KEY": "kk_live_…"
}
}
}
}Restart Claude Desktop. The four klent_* tools appear in the MCP
indicator.
Cursor
Settings → MCP → add a server entry:
{
"klent": {
"command": "npx",
"args": ["-y", "@klent/mcp-server"],
"env": {
"KLENT_API_KEY": "kk_live_…"
}
}
}Custom MCP clients
Anything that speaks the MCP stdio JSON-RPC protocol works. Spawn the
binary with KLENT_API_KEY set in the environment; the server initializes
with a single execution-scoped KlentClient and stays online for the
duration of the parent process.
Configuration
| Env var | Required | Default | Notes |
|---|---|---|---|
KLENT_API_KEY | yes | — | Per-project key from /api-keys. |
KLENT_API_URL | no | https://api.klent.dev/v1 | Reserved for the future Enterprise VPC tier. Leave default. |
Example flow
A typical interactive session in Claude Desktop:
- User: "Send a launch announcement email to [email protected] using my internal email tool."
- Claude: calls
klent_start_executionwithagent_id: "claude-desktop". - Claude: calls
klent_evaluate_actionwithtool: "send_email",input: { to, subject, body }. - Klent's policy engine evaluates. Suppose a HITL policy matches — the
response carries
decision: "approve"and apending_action_id. - Claude: calls
klent_get_pending_actionwithwait_ms: 30000, blocking until you click Approve in the dashboard or in the email. - On approve, Claude proceeds to send the email; on reject, surfaces the reviewer's note as a tool error.
Every step is visible at
https://app.klent.dev/executions/<execution_id> with full event history.
Source & docs
- Package: @klent/mcp-server on npm
- Source:
packages/mcp-serverin klent-sdk-ts - License: Apache-2.0