SDK

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:

ToolPurpose
klent_start_executionOpen one tracked agent run. Subsequent calls reference its execution_id.
klent_evaluate_actionEvaluate a proposed tool call: allow / deny / modify / approve / steer.
klent_log_eventAppend an event (e.g. error) to the timeline.
klent_get_pending_actionRead 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 varRequiredDefaultNotes
KLENT_API_KEYyesPer-project key from /api-keys.
KLENT_API_URLnohttps://api.klent.dev/v1Reserved for the future Enterprise VPC tier. Leave default.

Example flow

A typical interactive session in Claude Desktop:

  1. User: "Send a launch announcement email to [email protected] using my internal email tool."
  2. Claude: calls klent_start_execution with agent_id: "claude-desktop".
  3. Claude: calls klent_evaluate_action with tool: "send_email", input: { to, subject, body }.
  4. Klent's policy engine evaluates. Suppose a HITL policy matches — the response carries decision: "approve" and a pending_action_id.
  5. Claude: calls klent_get_pending_action with wait_ms: 30000, blocking until you click Approve in the dashboard or in the email.
  6. 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