Cairn

Cairn

Enables agents to assert and recall typed facts with idempotent writes, freshness, and assurance verdicts. Provides MCP tools for persistent memory across sessions via SQLite-backed storage.

Category
Visit Server

README

Cairn

Cairn is an append-only store of typed facts. An agent asserts a fact in one session and recalls it, with a freshness verdict, at the start of the next.

Facts persist in SQLite. The desk is optional. The work happens on JSON and MCP.

Install

npx cairn init --project
npx cairn dev

init --project creates .cairn/cairn.db, wires Cursor (.cursor/mcp.json), and wires Pi (.mcp.json).

Global install without a project file:

npx cairn init

Commands

Command Purpose
cairn init --project Database + Cursor + Pi MCP config in the current repo
cairn dev Desk and API on port 4721
cairn start Production server after npm run build
cairn mcp Stdio MCP server for agents
cairn recall Print live beliefs as JSON

Agent contract

Send JSON to POST /api/cairn or call MCP tools cairn_recall and cairn_request.

Every write carries an idempotencyKey. Replay the same key and body after a crash and Cairn returns the original result without writing twice.

Recall returns freshness and assurance on each belief. Branch on response.kind. Rejections include error.remedy.kind.

Example assert

curl -s http://127.0.0.1:4721/api/cairn \
  -H 'content-type: application/json' \
  -d '{
    "kind": "assert",
    "idempotencyKey": "s-021-deploy",
    "onConflict": "supersede",
    "draft": {
      "entity": "repo:acme/checkout",
      "attribute": "deploy.command",
      "value": { "kind": "text", "text": "bin/ship --env staging" },
      "provenance": {
        "kind": "observed",
        "command": "cat Makefile && bin/ship --help",
        "session": "s-021"
      },
      "validity": { "kind": "until-superseded" }
    }
  }'

Harness plugins

Cursor. After cairn init --project, .cursor/mcp.json includes a cairn server that runs npx cairn mcp.

Pi. The same init writes .mcp.json for Pi and other MCP clients. Pi reads .mcp.json and host imports such as cursor.

Desk and canvas

Open Desk (/) for the beliefs table and Agent API console. Open Canvas (/canvas) to see each agent or session as a draggable container with the facts they contributed.

Agents group by provenance.by for told facts and by provenance.session for observed or inferred facts. Drag pods to arrange the board; layout persists in .cairn/canvas.json.

Publish and install from npm

npm publish
npx cairn init --project
npx cairn dev

The published tarball ships the full desk, canvas, API, CLI, and MCP server. Requires Node 20+.

Development

npm install
npm test
npm run dev

Database path resolves to ./.cairn/cairn.db when that directory exists, otherwise ~/.cairn/cairn.db. Override with CAIRN_HOME or CAIRN_DB_PATH.

Release trailer (Remotion)

A ~30s product trailer for X lives in cairn-trailer/. Preview with npm run dev inside that folder, or render:

cd cairn-trailer
npx remotion render CairnTrailer out/cairn-v0.4-trailer.mp4

See cairn-trailer/x-post-draft.md for suggested post copy.

What Cairn refuses

Free-form JSON values. Semantic search. Editing facts in place. Waiting on a human mid-request.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured