Skip to content
PeterBookerPublic

About

Self hosted, agent agnostic, artifacts service.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Kazari

Kazari is a self-hosted artifact host for pages written by LLMs. It lets a team's AI agents, in the cloud or self-hosted, publish HTML pages, dashboards and small sites on the team's own domain, signed in through its own identity provider, without handing the content to a third party.

One Go binary serves every artifact as its own static site at <slug>.<base> under a single wildcard certificate. It takes new artifacts and versions over a REST API, an MCP server and a CLI. Pages nobody needs any more are retired through a reversible lifecycle: stale, then soft-deleted, then purged.

Kazari (飾り) is Japanese for a decoration set out on display, like the dolls and New Year pieces that are brought out for a season and then put away. Kazari does the same for pages: it puts them on show for as long as they are wanted, then retires them.

The documentation and guides are at https://kazari.io/docs/.

Features

  • One origin per artifact. demo.art.example.com serves the published version, and demo--v3.art.example.com pins version 3 forever. Each artifact is its own browser origin, so one page cannot read another's storage.
  • Immutable, content-addressed versions. Every publish is a new version, and files are stored once by SHA-256. Stage a version for signed-in reviewers before it goes live, roll back or forward with one call, and prune old versions by hand or on a schedule; expected_version and If-Match stop lost updates.
  • Three ways in, one service layer. REST (api.<base>/v1), MCP over Streamable HTTP (mcp.<base>/, nineteen tools) and the kazari CLI all call the same code. Over MCP, results are trimmed to what a model needs next.
  • Edits in place. Agents change a page with exact or line-anchored edits instead of resending whole files. Whitespace-tolerant matches are reported, and stale anchors are refused before anything is written.
  • Copies of existing pages. import_page fetches a page with its stylesheets, fonts and images onto the instance, removes its scripts and reports an outline of its sections for the edits that follow, so an agent whose own fetch returns text can start from a real page. Any publish can name a URL for a file instead of sending its bytes.
  • A skill per instance. The server generates an Agent Skill with its own limits and CSP. It serves the skill over MCP (skill://kazari/SKILL.md, the Skills extension), through a tool, and as kazari skill. Hosts that support MCP Apps show published pages as a preview card.
  • Members-only pages and share links. A members page opens only for people who sign in to the instance in their browser, on every version's host too. A share link with an expiry opens it for someone outside, and one call revokes it. Each host gets its own HttpOnly cookie through a single-use handshake with the sign-in host, so no cookie spans artifacts.
  • Large bundles. Inline JSON for small pages, multipart with a tar.gz bundle for sites, chunked uploads for MCP clients with no shell, and a one-time archive URL for agents with a shell but no key.
  • Lifecycle. Mark an artifact stale with a grace period. When the grace period lapses the artifact is soft-deleted, it is purged after the retention period, and its slug is freed after the tombstone period. Every step is reversible until the purge and lands in the audit log.
  • Sign-in your way. An OAuth 2.1 authorization server for MCP clients (PKCE, Dynamic Client Registration, Client ID Metadata Documents, refresh-token rotation, issuer identification (RFC 9207)) federates to one OpenID Connect provider: Microsoft Entra ID, Google Workspace, Okta, Keycloak, Authentik and others. Without a provider, people sign in with built-in accounts: a password each, set through an invite link, with no email server needed, and passkeys and recovery codes they add themselves. API keys work everywhere too.
  • A dashboard. An admin runs the instance day to day from a browser on the admin host: people and invites, pages and the bin, page views and who opened a members-only page, the activity log, health checks, jobs and a backup download. It does nothing the kazari admin commands cannot.
  • An account page. Each member finds the connector address there with the steps for their agent, and changes their own pages in a browser: who can open them, share links, versions and the bin.
  • Keys for one job. An API key can be restricted to the artifacts whose slug matches a pattern, issued without the right to share or delete, and given an expiry, so a scheduled agent holds no more than its task needs. People issue and rotate their own keys, and the same key can stand behind an OAuth connection.
  • Operations built in. Wildcard certificates by ACME DNS-01 through Cloudflare, Route 53, Hetzner, DigitalOcean, Gandi, OVH, Namecheap or DuckDNS, certificate files with hot reload, or a reverse proxy in front. kazari check tests the DNS records, the DNS token, the ports and the identity provider before the first start, and kazari admin ready checks a running server. SQLite and a blob directory are the only state: kazari admin backup writes both as one archive, and kazari admin restore-backup puts it back. OpenTelemetry traces, metrics and logs over OTLP, Prometheus metrics, structured logs, an admin API, quotas and rate limits are included.

Quick start

To try Kazari on your own machine, with no domain or certificate, run the image with serve --local and create a user over the admin socket inside the container:

docker run -d --name kazari -p 127.0.0.1:8080:8080 -e KAZARI_LISTEN_HTTP=:8080 \
  ghcr.io/peterbooker/kazari:latest serve --local
docker exec kazari kazari admin users create ana --role admin
docker exec kazari kazari admin keys issue ana --label laptop      # prints kzk_... once

Pages appear at http://<slug>.kazari.localhost:8080/, the API at http://api.kazari.localhost:8080/ and the MCP server at http://mcp.kazari.localhost:8080/. The quick start goes on to publish a first page from an agent, curl or the CLI.

To run it for a team on art.example.com, you need the DNS records art.example.com and *.art.example.com pointing at the host and an API token for the DNS provider. Two short files configure it, whether under Docker Compose, from a .deb/.rpm package or from the binary:

curl -fsSLO https://kazari.io/deploy/compose.yml
curl -fsSLO https://kazari.io/deploy/kazari.yaml                     # edit: your domain, email and DNS provider
curl -fsSL https://kazari.io/deploy/kazari.env.example -o .env       # edit: the DNS provider's token
docker compose up -d
docker compose logs kazari       # prints the setup link that creates the first admin

The installation guide has every path, the preflight check, the first admin and the first publish, and DNS and certificates the records, the providers and the proxy configurations.

Configuration at a glance

kazari.yaml names the domain and the DNS provider; everything else has a default. A file for ACME certificates through Cloudflare and sign-in through Microsoft Entra ID looks like this:

base_domain: art.example.com

tls:
  dns_provider: cloudflare
  dns:
    api_token: ${KAZARI_TLS_DNS_API_TOKEN}

auth:
  oidc:
    issuer: https://login.microsoftonline.com/<tenant-id>/v2.0
    client_id: "..."
    client_secret: ${KAZARI_AUTH_OIDC_CLIENT_SECRET}

Secrets stay out of the file. Kazari replaces each ${NAME} with the environment variable NAME, read from the process environment or from a dotenv file (kazari.env beside kazari.yaml, .env beside compose.yml), and a secret can also come from a file through KAZARI_<KEY>_FILE.

Every key can also be set directly as KAZARI_<SECTION>_<KEY>. The configuration reference lists every key, and deploy/kazari.reference.yaml shows every default.

Connecting an agent

Kazari works with any agent that can use a remote MCP server over Streamable HTTP, whether it runs in the cloud or on your own machine. The server is at https://mcp.art.example.com/.

Cloud agents

Add a custom connector with the URL https://mcp.art.example.com/. The agent discovers the authorization server, sends you to sign in and shows Kazari's consent page. You sign in at your organisation's identity provider or, with none configured, with the password of your built-in account; an API key works in its place.

In claude.ai, for example, custom connectors are under Settings → Connectors.

Self-hosted agents

Add the server to the agent's configuration with an API key. Many agents take a JSON entry along these lines:

{
  "mcpServers": {
    "kazari": {
      "url": "https://mcp.art.example.com/",
      "headers": { "Authorization": "Bearer kzk_..." }
    }
  }
}

Leave out headers to sign in through OAuth instead, if your agent supports it.

Claude Code, for example, adds the server with one command:

claude mcp add --transport http kazari https://mcp.art.example.com/

To use a key instead of OAuth, add --header "Authorization: Bearer kzk_..." to that command.

The MCP server reference covers the tools, resources and authoring conventions, and sign-in and identity covers sign-in. For agents that read skills, examples/kazari/SKILL.md is the skill an instance with the default settings serves.

CLI

The kazari binary is also the client. Install it on a laptop with curl -fsSL https://kazari.io/install.sh | sh, then sign in with a key from your account page. The commands you need most often:

kazari login --url https://api.art.example.com               # save the address and your key
kazari publish ./site --slug q3-report --name "Q3 report"   # create version 1
kazari deploy ./site --slug q3-report --label "fix chart"    # version 2 holds exactly ./site
kazari get q3-report                                          # record and versions
kazari rollback q3-report 1                                   # serve version 1 again
kazari versions prune q3-report --keep 20                     # delete all but the 20 newest versions
kazari stale q3-report --grace 3d                             # retire in three days
kazari list --mine any --stale exclude                        # what you created or updated, not stale
kazari --json me                                              # your account, as JSON

On the server, sudo kazari admin ... administers the instance over its socket with no token, and the dashboard at https://admin.art.example.com/ does the same from a browser. The CLI reference lists every command and flag.

Developing Kazari

To run the development server, the tests and the checks CI runs:

go run ./cmd/kazari serve --local                       # http://<slug>.kazari.localhost:8080/, data in ./.data
go run ./cmd/kazari admin users create peter --role admin   # over the socket in ./.data, no token
docker compose up --build                               # the same server from the Docker image
go test -race ./...                                     # tests with the race detector
test -z "$(gofmt -l .)" && go vet ./...                 # formatting and vet
go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest run   # lint

Developing Kazari has the rest: building a stamped binary, releasing, and building the website.

Documentation

The documentation, with guides for publishing with an agent and from code, is published at https://kazari.io/docs/. Its reference pages are the files in docs/:

Page Contents
Installing Kazari Compose, packages, the binary, the preflight check, the first admin
DNS and certificates DNS records, DNS-01 providers, other providers, proxy examples
Configuration YAML keys, ${} references, dotenv files, overrides, validation
Operating Kazari Data layout, backup, upgrades, logs, metrics, tracing, jobs, abuse
Dashboard The web dashboard: people, pages, views, activity and system
REST API REST reference for the user and admin APIs
MCP server MCP tools, resources, prompt and chunked uploads
CLI The kazari server and client commands
Identity and sign-in Built-in accounts, OAuth, OpenID Connect providers and provisioning
Developing Kazari Running from source, tests, releases, the website

Status

v1 is in development. The server, REST API, MCP server, OAuth and CLI are implemented. Expect breaking changes until v1.0.0 is tagged.

Licence

Kazari is released under the MIT licence.

About

Self hosted, agent agnostic, artifacts service.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages