Skip to main content

Overview

@kavachos/client is a typed HTTP client for the KavachOS REST API. It covers agents, authorization, delegations, audit logs, and MCP server registration.
Zero dependencies. No Node.js builtins. Works in browser, Node.js, Deno, and Bun, anywhere the Fetch API is available.

Installation

Creating a client

string
Base URL for the KavachOS API, without a trailing slash.
string
default:"undefined"
Bearer token sent as Authorization: Bearer <token> on every request.
default:"{}"
Extra headers merged into every request. Useful for API gateways that require custom headers.

Agents

Authorization

Two paths: by agent ID (when you manage the agent directly) or by raw bearer token (when the token comes in from an HTTP request).

Delegations

Audit log

Error handling

All methods throw KavachApiError when the server returns a non-2xx response or the network call fails.
KavachApiError also covers network errors: if fetch itself throws, you get code: 'NETWORK_ERROR' and status: 0.
client.agents.get and client.mcp.get return null for 404 rather than throwing. All other methods throw KavachApiError on any error response.

MCP servers

Next steps

Agent identity

Understand the agent model before building integrations.

Audit log

Querying and exporting the audit trail.

Delegation chains

How delegated permissions work.
Last modified on April 29, 2026