Cairn
What it does
Persistent memory for AI agents and humans. Store, search, and discover patterns.
- Connects 在你的电脑上运行
- Account or key Needs CAIRN_DB_HOST, CAIRN_DB_PASS
- Category 搜索与 AI 记忆
安装
选择你使用的 AI 应用,然后复制设置。
通过 2/3 项检查 · 在你的电脑上运行
第一步:你用哪个 AI?
选择你用的应用,步骤会显示在下方。
可连接 Claude,但需要先准备
需要 Cairn 的密钥(在开发者网站创建) · 需要先在电脑上安装 Docker(只需一次) · 仅限电脑上的 Claude 应用(Windows 或 Mac),网页和手机不可用
打开电脑版 Claude 应用的设置文件
SettingsDeveloperEdit Config
粘贴这些设置并保存文件
{ "mcpServers": { "cairn": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "CAIRN_DB_HOST", "-e", "CAIRN_DB_PASS", "-e", "CAIRN_TRANSPORT", "-e", "CAIRN_LLM_BACKEND", "ghcr.io/jasondostal/cairn-mcp:0.21.2" ], "env": { "CAIRN_DB_HOST": "your-value", "CAIRN_DB_PASS": "your-value", "CAIRN_TRANSPORT": "your-value", "CAIRN_LLM_BACKEND": "your-value" } } } }只把密钥粘贴到应用的输入框里,不要粘贴到聊天中或发给任何人
退出 Claude 再重新打开
试一试
用 Cairn 告诉我你能帮我做什么,然后做一件给我看✓ 如果 Claude 说正在使用 Cairn,或回答中出现 Cairn 的工具名称,就表示连接成功
菜单名称已于 2026年11月11日 对照 Anthropic 帮助页面核实 · 你的界面可能因版本略有不同
ChatGPT 暂时无法连接 Cairn
Cairn 需要安装在你的电脑上,而 ChatGPT 只能连接在网上运行的服务器
你可以改用这些方式
A · 使用能连接 Cairn 的应用
- 需要 Cairn 的密钥(在开发者网站创建) · 需要先在电脑上安装 Docker(只需一次) · 仅限电脑上的 Claude 应用(Windows 或 Mac),网页和手机不可用
- 需要 Cairn 的密钥(在开发者网站创建) · 需要先在电脑上安装 Docker(只需一次)
- 需要 Cairn 的密钥(在开发者网站创建) · 需要先在电脑上安装 Docker(只需一次)
- 需要 Cairn 的密钥(在开发者网站创建) · 需要先在电脑上安装 Docker(只需一次)
B · 搜索与 AI 记忆 类中能连接 ChatGPT 的其他服务器
从同类中使用较多的里挑选,仅限用地址即可连接、无需密钥的
- Context7✓ ChatGPT
- AIHOT✓ ChatGPT
- Sui Knowledge Base (kapa.ai)✓ ChatGPT
可连接 Claude Code,但需要先准备
需要 Cairn 的密钥(在开发者网站创建) · 需要先在电脑上安装 Docker(只需一次)
注册并创建 Cairn 的密钥
打开开发者网站,注册账户并创建 API 密钥,下一步要用。价格和免费方案请看开发者网站。
获取密钥的方法见下方开发者的 README
打开终端
Mac:按 Command+空格,输入 Terminal · Windows:打开 PowerShell
粘贴这条命令并按 Enter
claude mcp add --scope user cairn --env CAIRN_DB_HOST=your-value --env CAIRN_DB_PASS=your-value --env CAIRN_TRANSPORT=your-value --env CAIRN_LLM_BACKEND=your-value -- docker run -i --rm -e CAIRN_DB_HOST -e CAIRN_DB_PASS -e CAIRN_TRANSPORT -e CAIRN_LLM_BACKEND ghcr.io/jasondostal/cairn-mcp:0.21.2按 Enter 前,把“your-value”改成你的密钥
只把密钥粘贴到应用的输入框里,不要粘贴到聊天中或发给任何人
在 Claude Code 中输入 /mcp
应能看到 Cairn 在列表中并显示已连接
试一试
用 Cairn 告诉我你能帮我做什么,然后做一件给我看✓ 如果 Claude Code 说正在使用 Cairn,或回答中出现 Cairn 的工具名称,就表示连接成功
菜单名称已于 2026年11月11日 对照 Anthropic 帮助页面核实 · 你的界面可能因版本略有不同
可连接 Cursor,但需要先准备
需要 Cairn 的密钥(在开发者网站创建) · 需要先在电脑上安装 Docker(只需一次)
注册并创建 Cairn 的密钥
打开开发者网站,注册账户并创建 API 密钥,下一步要用。价格和免费方案请看开发者网站。
获取密钥的方法见下方开发者的 README
填写你的密钥
在 Cairn 的设置中,CAIRN_DB_HOST, CAIRN_DB_PASS, CAIRN_TRANSPORT, CAIRN_LLM_BACKEND 还是空的,填入你的密钥并保存
只把密钥粘贴到应用的输入框里,不要粘贴到聊天中或发给任何人
在 Cursor 中以 Agent 模式打开 AI 聊天
试一试
用 Cairn 告诉我你能帮我做什么,然后做一件给我看✓ 如果 Cursor 说正在使用 Cairn,或回答中出现 Cairn 的工具名称,就表示连接成功
菜单名称已于 2026年11月11日 对照 Cursor 帮助页面核实 · 你的界面可能因版本略有不同
可连接 VS Code,但需要先准备
需要 Cairn 的密钥(在开发者网站创建) · 需要先在电脑上安装 Docker(只需一次)
注册并创建 Cairn 的密钥
打开开发者网站,注册账户并创建 API 密钥,下一步要用。价格和免费方案请看开发者网站。
获取密钥的方法见下方开发者的 README
填写你的密钥
在 Cairn 的设置中,CAIRN_DB_HOST, CAIRN_DB_PASS, CAIRN_TRANSPORT, CAIRN_LLM_BACKEND 还是空的,填入你的密钥并保存
只把密钥粘贴到应用的输入框里,不要粘贴到聊天中或发给任何人
在 VS Code 中以 Agent 模式打开 AI 聊天
试一试
用 Cairn 告诉我你能帮我做什么,然后做一件给我看✓ 如果 VS Code 说正在使用 Cairn,或回答中出现 Cairn 的工具名称,就表示连接成功
菜单名称已于 2026年11月11日 对照 VS Code 帮助页面核实 · 你的界面可能因版本略有不同
开发者专用:终端命令和 JSON 设置
安装在电脑上
Claude Code
claude mcp add --scope user cairn --env CAIRN_DB_HOST=your-value --env CAIRN_DB_PASS=your-value --env CAIRN_TRANSPORT=your-value --env CAIRN_LLM_BACKEND=your-value -- docker run -i --rm -e CAIRN_DB_HOST -e CAIRN_DB_PASS -e CAIRN_TRANSPORT -e CAIRN_LLM_BACKEND ghcr.io/jasondostal/cairn-mcp:0.21.2Claude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"cairn": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"CAIRN_DB_HOST",
"-e",
"CAIRN_DB_PASS",
"-e",
"CAIRN_TRANSPORT",
"-e",
"CAIRN_LLM_BACKEND",
"ghcr.io/jasondostal/cairn-mcp:0.21.2"
],
"env": {
"CAIRN_DB_HOST": "your-value",
"CAIRN_DB_PASS": "your-value",
"CAIRN_TRANSPORT": "your-value",
"CAIRN_LLM_BACKEND": "your-value"
}
}
}
}Cursor (~/.cursor/mcp.json)
{
"mcpServers": {
"cairn": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"CAIRN_DB_HOST",
"-e",
"CAIRN_DB_PASS",
"-e",
"CAIRN_TRANSPORT",
"-e",
"CAIRN_LLM_BACKEND",
"ghcr.io/jasondostal/cairn-mcp:0.21.2"
],
"env": {
"CAIRN_DB_HOST": "your-value",
"CAIRN_DB_PASS": "your-value",
"CAIRN_TRANSPORT": "your-value",
"CAIRN_LLM_BACKEND": "your-value"
}
}
}
}VS Code (mcp.json)
{
"servers": {
"cairn": {
"type": "stdio",
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"CAIRN_DB_HOST",
"-e",
"CAIRN_DB_PASS",
"-e",
"CAIRN_TRANSPORT",
"-e",
"CAIRN_LLM_BACKEND",
"ghcr.io/jasondostal/cairn-mcp:0.21.2"
],
"env": {
"CAIRN_DB_HOST": "your-value",
"CAIRN_DB_PASS": "your-value",
"CAIRN_TRANSPORT": "your-value",
"CAIRN_LLM_BACKEND": "your-value"
}
}
}
}需要你填写的值
CAIRN_DB_HOST必填 envPostgreSQL host (pgvector)CAIRN_DB_PASS机密 必填 envPostgreSQL passwordCAIRN_TRANSPORTenvTransport mode: stdio or httpCAIRN_LLM_BACKENDenvLLM backend for enrichment: bedrock or ollama
这些设置是根据作者在注册中心的条目生成的。如果 README 的写法不同,请以 README 为准。
一览
哪些应用可以使用它
依据这个服务器的连接方式和各应用自己的文档,检查于 2026年11月10日。
在你的电脑上运行,适用于
ClaudeGooseLM StudioMsty StudioCherry StudioCursorVS Code + GitHub CopilotVisual StudioWindsurf (Devin Desktop)ZedKiroClineContinueJetBrains AI AssistantClaude CodeCodex CLIGemini CLIOpenCodenodecodeWarpLibreChatRaycast
它能做什么
它在你的电脑上运行;安装后,工具列表会显示在你的 AI 应用中。
基础检查i
我们检查的是任何人都能看到的信息;我们没有阅读代码。不适用的检查项不计入总数。 · 检查于 2026年11月12日
- ✓ 通过
作者与仓库一致
注册名称已通过 GitHub 账户 jasondostal 验证,该账户拥有此仓库
- ✕ 未通过
仍在维护
超过一年没有代码更新,或仓库已归档
- ✓ 通过
有许可证
使用 GPL-3.0
- – 不适用
端点有响应
它在你的电脑上运行,没有互联网端点
- – 不适用
使用 OAuth 登录
在你的电脑上运行,改用本地设置
- … 尚未检查
工具描述中没有隐藏指令
它在你的电脑上运行;我们只能读取互联网端点的工具列表
讨论
提问、分享技巧或报告无法使用。按“有帮助”数量排序。
用户评价
还没有评价
与“搜索与 AI 记忆”中的其他服务器比较i
- 星标数多于此分类中其他 5998 个服务器的 90%
- 发布到注册中心的时间比此分类中其他 5998 个服务器的 2% 更新
- 基础检查结果等于或优于此分类中其他 5998 个服务器的 48%
与注册中心里这个分类中所有活跃的服务器比较。只有当发布者拥有该仓库时,星标数才计入。
常见问题
Cairn 安全吗?
它在 3 项适用的基础检查中通过了 2 项。我们没有阅读代码。在添加密钥或令牌之前,请先看看这个服务器要求哪些权限,并使用只具备所需权限的密钥。
它需要哪些密钥或代码?
你需要填写:CAIRN_DB_HOST, CAIRN_DB_PASS
它在我的电脑上运行还是在云端?
它在你的电脑上运行。你的 AI 应用会在需要时启动它,数据不会经过作者的服务器(除非它自己调用在线服务)。
它还在维护吗?
GitHub 仓库最后更新于5个月前,最新版本(0.21.2)于9个月前进入注册中心。
哪些应用可以使用它?
支持 MCP 的应用,例如 Claude Desktop、Claude Code、Cursor 和 VS Code。你的电脑上还需要有 Docker。
有什么可以替代它?
同一分类中有:Context7, Codebase Memory, Ruflo
同类别的其他选择
同一分类中其他作者的服务器,按星标数排序。
如何看卡片:↓ 每周下载量i★ GitHub 星标i三大支柱:评价 · 检查 · 使用情况i更新 = 最新版本发布到注册中心的时间i
Codebase Memory
Codebase knowledge graph for AI agents — 162 languages, sub-ms queries, 99% fewer tokens.
作者的 README
打开 README
按原文从作者的仓库复制。PopNx MCP 没有审查或背书其内容。HTML、图片和脚本已被移除。链接会离开本站。
[!IMPORTANT]
Cairn is retired, and this repository is archived (read-only).
Its successor is [rill](https://github.com/jasondostal/rill) — a faster, leaner,
MCP-native memory server written in Go that learned from everything Cairn got right
(and the things it got wrong). Cairn was the first; rill is where the work continues.
This repo stays up as a read-only archive — explore it, fork it, but new development
lives in rill.
A self-hosted persistent memory platform for AI agents and humans. Store something once, find it later, across sessions, across projects. Four containers. docker compose up. Done.
Cairn is the memory brain. Your agent runtime handles execution — Cairn handles knowing. What decisions were made, what facts are known, what patterns emerge across projects.
It's built for the systems person. The curious. The t-shaped. The ones who need a memory that works the way they do, across everything, all at once.
Quick Start
1. Pull and run
curl -O https://raw.githubusercontent.com/jasondostal/cairn-mcp/main/docker-compose.yml
docker compose up -d
Four containers start:
- cairn on port 8000 (MCP server + REST API)
- cairn-ui on port 3000 (web dashboard)
- cairn-db (PostgreSQL 16 + pgvector)
- cairn-graph (Neo4j 5, knowledge graph)
Migrations run on first boot. Ready in about a minute.
2. Connect your IDE
Add this to your MCP config:
{
"mcpServers": { "cairn": { "type": "http", "url": "http://localhost:8000/mcp" } } }
Where that goes:
| IDE | Config file |
|---|---|
| Claude Code | .mcp.json in your project root |
| Cursor | .cursor/mcp.json |
| Windsurf | .windsurf/mcp.json |
| Cline | MCP settings panel in VS Code |
| Continue | .continue/config.yaml |
| PiClaw | .pi/mcp.json |
Or run the setup wizard — it walks you through everything: LLM backend, database, embeddings, auth, and IDE configuration:
git clone https://github.com/jasondostal/cairn-mcp.git && ./cairn-mcp/scripts/setup.sh
Pick a tier (local dev, recommended, enterprise, or custom) and the wizard collects only what that tier needs. Supports --dry-run and --non-interactive for CI.
3. Use it
Tell your agent to remember something:
"Remember that we chose PostgreSQL for storage because it handles hybrid search without a separate vector DB."
Search for it later:
"What did we decide about the storage layer?"
That's it. 11 tools available. The ones you'll use most:
| Tool | What it does |
|---|---|
store | Save a memory with auto-enrichment. Supports event_at and valid_until for bi-temporal tracking |
search | Find memories (vector + keyword + recency + tags). Temporal filters: as_of, event_after, event_before |
recall | Get full content for specific memory IDs |
orient | Boot a session with rules, recent activity, beliefs, and open work |
rules | Load behavioral guardrails (global or per-project) |
beliefs | Durable epistemic state — crystallize, challenge, retract knowledge with confidence tracking |
work_items | Create, claim, and complete tasks with dependencies and gates |
working_memory | Capture ephemeral thoughts — hypotheses, questions, tensions — with salience decay |
projects | Manage project docs (briefs, PRDs, plans) |
code_query | Structural queries: dependents, impact, callers, callees, dead code, complexity, hotspots |
arch_check | Validate architecture boundary rules against imports |
The rest: modify, insights, think, status, consolidate, ingest.
What's in the box
Memory that persists across sessions. Your agent makes a decision at 2am. Next morning, different session, it finds that decision. That's the core. Bi-temporal tracking separates when something happened (event_at) from when you learned it (created_at). Memories that go unaccessed decay naturally; important ones are protected. Related memories get consolidated into higher-order insights automatically.
Beliefs. Durable epistemic state — knowledge held with confidence. Crystallize hypotheses into beliefs, challenge them with counter-evidence, retract them when wrong. Beliefs surface in session boot alongside rules and memories, giving agents a clear picture of what the organization knows and how confident it is.
Search that fuses signals. Vector similarity, recency, access frequency, keyword matching, and tag overlap blended via Reciprocal Rank Fusion. Filter by project, type, or time range. Temporal queries: "what did we know as of Tuesday?" via as_of, "what happened last week?" via event_after/event_before.
Knowledge graph. Entities and facts get extracted into a Neo4j graph that connects memories through shared people, places, projects, and concepts. Optional, but powerful when you're working across domains.
Thinking sequences. Structured deliberation — start with a goal, add thoughts (observations, hypotheses, analysis, alternatives), conclude. Both humans and agents contribute. The exploration itself becomes searchable memory.
Work management. Hierarchical work items with dependency tracking, gates that pause for human decisions, and activity logging. Experimental — evolving as we learn what works.
Web dashboard. Browse memories with OKLCH-colored toggle filters, score gradient bars, and shareable URL state. Explore the knowledge graph and entity relationships. View analytics, manage work items. Port 3000.
Memory growth by type, token usage tracking, and the full nav.
Code intelligence. A standalone worker indexes codebases with tree-sitter (30 languages) and builds a code graph in Neo4j. The server queries the graph without ever touching source files. Ask structural questions — "what depends on this file?", "who calls this function?", "what's the blast radius?" — and get answers from the code graph. Call graph extraction, cyclomatic complexity, dead code detection. Enforce architecture boundaries with YAML rules. Works across projects.
Supported languages (30)
| Category | Languages |
|---|---|
| Systems | C, C++, Rust, Go, Zig |
| JVM | Java, Scala, Kotlin, Groovy |
| .NET | C# |
| Scripting | Python, Ruby, PHP, Lua, Bash |
| Web | TypeScript/TSX, HTML, CSS |
| Apple | Swift, Objective-C |
| ML/Scientific | OCaml, MATLAB |
| Config & Data | JSON, YAML, TOML, HCL (Terraform), Dockerfile, Makefile, SQL, Markdown |
Multi-user authentication and RBAC. Off by default, zero to enterprise in one command. ./scripts/setup.sh includes auth configuration, or run ./scripts/setup-auth.sh standalone. Auth mode selection (none / local JWT / OIDC SSO), JWT secret generation, OIDC provider validation. Personal Access Tokens for machine clients, stdio identity for MCP. Three roles, project-level scoping, first-user-becomes-admin. Groups with OIDC sync. See the [Authentication Guide](docs/authentication.md).
Disaster recovery. Cron-friendly scripts for PostgreSQL dump and Neo4j graph export with configurable retention. Tested restore procedures with migration safety checks. See the [Backup Guide](docs/backup.md).
Do I need an LLM?
No. Store, search, recall, and rules work without one. You lose auto-enrichment (summaries, tags, importance scoring), knowledge extraction, and thinking.
If you want enrichment:
| Backend | Setup |
|---|---|
| Ollama (default) | Install Ollama, pull a model. Cairn connects to host.docker.internal:11434. |
| AWS Bedrock | Set CAIRN_LLM_BACKEND=bedrock, export AWS creds. |
| Google Gemini | Set CAIRN_LLM_BACKEND=gemini, add CAIRN_GEMINI_API_KEY. Free tier available. |
| OpenAI-compatible | Set CAIRN_LLM_BACKEND=openai, add key. Works with OpenAI, Groq, Together, LM Studio, vLLM. |
Configuration
All via environment variables. The ones that matter:
| Variable | Default | What it does |
|---|---|---|
CAIRN_PROFILE | *(empty)* | Preset: vector, enriched, knowledge, enterprise. Sets capability defaults. |
CAIRN_LLM_BACKEND | ollama | LLM provider: ollama, bedrock, gemini, openai |
CAIRN_DB_PASS | cairn-dev-password | Database password. Change this for anything beyond local. |
CAIRN_AUTH_ENABLED | false | Multi-user authentication (JWT, PATs, OIDC/SSO) |
CAIRN_AUTH_JWT_SECRET | *(empty)* | JWT signing secret (required when auth enabled) |
CAIRN_OIDC_ENABLED | false | OIDC/SSO integration (any OIDC-compliant provider) |
CAIRN_MCP_OAUTH_ENABLED | false | OAuth2 Authorization Server for remote MCP clients (Claude.ai, mobile) |
CAIRN_GRAPH_BACKEND | *(disabled)* | Set to neo4j to enable knowledge graph |
CAIRN_KNOWLEDGE_EXTRACTION | false | Entity/statement extraction on store |
CAIRN_EMBEDDING_BACKEND | local | local (MiniLM, 384-dim) or bedrock (Titan V2, 1024-dim) |
CAIRN_INGEST_DIR | /data/ingest | Staging directory for file-path ingestion of large documents |
CAIRN_CODE_DIR | /data/code | Root directory for code intelligence indexing (mount codebases here) |
Full reference is in docker-compose.yml. Every variable has a sensible default.
Authentication
Off by default. The fastest way to enable it is through the setup wizard:
./scripts/setup.sh # includes auth as step 2
./scripts/setup-auth.sh # or run auth setup standalone
Three modes — no auth, local JWT, or OIDC/SSO. Generates secrets, validates your identity provider's discovery endpoint, writes .env. Provider-specific URL hints for Authentik, Keycloak, Auth0, Okta, and Azure AD. Both scripts support --dry-run and --non-interactive for CI.
First user to register becomes admin. Role-based access control enforces permissions across REST API, MCP HTTP, and the web UI. Personal Access Tokens for machine clients, groups with OIDC sync.
See the [Authentication Guide](docs/authentication.md) for the full reference covering all auth modes, OIDC provider configuration, and MCP client examples.
Security note: Cairn's auth system is functional and production-tested but
has not been independently audited. For network-exposed deployments, add TLS
termination and network-level access controls.
Remote MCP Access (Claude.ai, Mobile)
Connect Cairn to Claude.ai, the Claude mobile app, or any OAuth2-capable MCP client. Cairn acts as an OAuth2 Authorization Server, delegating user authentication to your existing OIDC identity provider.
Prerequisites: Auth enabled (CAIRN_AUTH_ENABLED=true), OIDC configured (CAIRN_OIDC_ENABLED=true), and a public URL set (CAIRN_PUBLIC_URL).
Enable it:
CAIRN_MCP_OAUTH_ENABLED=true
Connect from Claude.ai:
- Go to Claude.ai Settings > Integrations > Add custom MCP
- Enter your Cairn URL:
https://your-cairn-domain.com/mcp - Claude.ai discovers the OAuth2 endpoints automatically
- You'll be redirected to your identity provider to log in
- After login, Clau