@misterhuydo/cairn-mcp 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -239,21 +239,28 @@ cairn_resume()
239
239
  2. cairn_search → continue where you left off
240
240
  ```
241
241
 
242
- ---
243
-
244
- ## Custom DB path
245
-
246
- By default the index is stored at `.cairn/index.db` in your project directory. Override with an env variable:
242
+ ## Complete session lifecycle
247
243
 
248
- ```json
249
- {
250
- "mcpServers": {
251
- "cairn": {
252
- "command": "cairn-mcp",
253
- "env": { "CAIRN_DB_PATH": "/your/custom/path/index.db" }
254
- }
255
- }
256
- }
244
+ ```
245
+ ─── START OF SESSION ──────────────────────────────────────────
246
+ You: "Hey Claude, please resume and continue"
247
+ Claude: cairn_resume
248
+ "Last session: adding multi-currency to checkout.
249
+ PaymentStep.vue was modified since checkpoint (2 files changed, re-indexed).
250
+ Notes: CurrencyService expects ISO 4217 codes. PaymentStep EUR bug not fixed yet.
251
+ Ready to continue."
252
+
253
+ ─── DURING SESSION ────────────────────────────────────────────
254
+ Claude uses: cairn_search, cairn_bundle, cairn_code_graph, cairn_security
255
+ as needed — all reading from .cairn/index.db in cwd
256
+
257
+ ─── END OF SESSION ────────────────────────────────────────────
258
+ You: "Ok let's stop here for today"
259
+ Claude: cairn_checkpoint
260
+ message="Fixed EUR formatting in PaymentStep, multi-currency complete"
261
+ active_files=["src/components/checkout/PaymentStep.vue"]
262
+ notes=["Still need to add JPY — no decimal places", "QA needs to test AED"]
263
+ → "Session saved. Resume anytime with cairn_resume."
257
264
  ```
258
265
 
259
266
  ---
package/how-to-use.md CHANGED
@@ -24,36 +24,73 @@ Add to `~/.claude/config.json` (create it if it doesn't exist):
24
24
 
25
25
  > If you already have other MCP servers, just add `"cairn": { ... }` inside the existing `"mcpServers"` block.
26
26
 
27
- Restart Claude Code. You should see 6 cairn tools available.
27
+ Restart Claude Code. You should see 8 cairn tools available.
28
28
 
29
- ## 3. Index your repos
29
+ ## 3. Index your project
30
+
31
+ Run Claude Code from your project root, then:
30
32
 
31
33
  ```
32
34
  cairn_maintain
33
- roots: ["/path/to/repo1", "/path/to/repo2"]
34
35
  ```
35
36
 
36
- Run this once at the start of each session (or whenever code changes significantly).
37
+ No paths needed Cairn works like git and finds your project from the current directory. The index is stored in `.cairn/index.db` inside your project.
38
+
39
+ Run this once at the start of each session (or use `cairn_resume` to pick up where you left off).
37
40
 
38
41
  ## 4. Tools at a glance
39
42
 
40
43
  | Tool | What to use it for |
41
44
  |---|---|
42
- | `cairn_maintain` | Index repos (run first) |
45
+ | `cairn_maintain` | Index the current project (run at session start) |
43
46
  | `cairn_search` | Find classes, functions, components by name or concept |
44
47
  | `cairn_describe` | Summarize what a folder/module does |
45
48
  | `cairn_code_graph` | Check instability, health, or cycles before refactoring |
46
49
  | `cairn_security` | Scan for vulnerabilities (XSS, SQLi, hardcoded secrets, etc.) |
47
50
  | `cairn_bundle` | Package source files into a minified snapshot for Claude to read |
51
+ | `cairn_checkpoint` | Save what you're working on so the next session can resume |
52
+ | `cairn_resume` | Restore the last checkpoint + incremental re-index of changed files |
48
53
 
49
54
  ## 5. Typical session
50
55
 
56
+ **Starting fresh:**
57
+ ```
58
+ 1. cairn_maintain → index the project
59
+ 2. cairn_search → find what you need
60
+ 3. cairn_bundle → get a readable snapshot of relevant files
61
+ 4. cairn_describe → understand a module before modifying it
62
+ 5. cairn_security → check for issues before a PR
63
+ 6. cairn_checkpoint → save your progress before ending the session
64
+ ```
65
+
66
+ **Resuming work:**
67
+ ```
68
+ 1. cairn_resume → restore last checkpoint + re-index only changed files
69
+ 2. cairn_search → continue where you left off
70
+ ```
71
+
72
+ ## 6. Complete session lifecycle
73
+
51
74
  ```
52
- 1. cairn_maintain → index all repos
53
- 2. cairn_search → find what you need
54
- 3. cairn_bundle → get a readable snapshot of relevant files
55
- 4. cairn_describe understand a module before modifying it
56
- 5. cairn_security → check for issues before a PR
75
+ ─── START OF SESSION ──────────────────────────────────────────
76
+ You: "Hey Claude, please resume and continue"
77
+ Claude: cairn_resume
78
+ "Last session: adding multi-currency to checkout.
79
+ PaymentStep.vue was modified since checkpoint (2 files changed, re-indexed).
80
+ Notes: CurrencyService expects ISO 4217 codes. PaymentStep EUR bug not fixed yet.
81
+ Ready to continue."
82
+
83
+ ─── DURING SESSION ────────────────────────────────────────────
84
+ Claude uses: cairn_search, cairn_bundle, cairn_code_graph, cairn_security
85
+ as needed — all reading from .cairn/index.db in cwd
86
+
87
+ ─── END OF SESSION ────────────────────────────────────────────
88
+ You: "Ok let's stop here for today"
89
+ Claude: cairn_checkpoint
90
+ message="Fixed EUR formatting in PaymentStep, multi-currency complete"
91
+ active_files=["src/components/checkout/PaymentStep.vue"]
92
+ notes=["Still need to add JPY — no decimal places", "QA needs to test AED"]
93
+ → "Session saved. Resume anytime with cairn_resume."
57
94
  ```
58
95
 
59
96
  ---
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@misterhuydo/cairn-mcp",
3
- "version": "1.1.0",
4
- "description": "Persistent polyglot knowledge graph MCP server for Claude Code. Index once, query forever — across Java, TypeScript, Vue, Python, SQL and more.",
3
+ "version": "1.1.2",
4
+ "description": "MCP server that gives Claude Code persistent memory across sessions. Index your codebase once, search symbols, bundle source, scan for vulnerabilities, and checkpoint/resume work — across Java, TypeScript, Vue, Python, SQL and more.",
5
5
  "type": "module",
6
6
  "main": "index.js",
7
7
  "bin": {
package/src/graph/db.js CHANGED
@@ -1,13 +1,7 @@
1
1
  import { DatabaseSync } from 'node:sqlite';
2
2
  import path from 'path';
3
- import fs from 'fs';
4
3
  import { getCairnDir } from './cwd.js';
5
4
 
6
- function getDbPath() {
7
- if (process.env.CAIRN_DB_PATH) return process.env.CAIRN_DB_PATH;
8
- return path.join(getCairnDir(), 'index.db');
9
- }
10
-
11
5
  const SCHEMA = `
12
6
  CREATE TABLE IF NOT EXISTS files (
13
7
  id INTEGER PRIMARY KEY,
@@ -61,9 +55,7 @@ const SCHEMA = `
61
55
  `;
62
56
 
63
57
  export function openDB() {
64
- const dbPath = getDbPath();
65
- const dir = path.dirname(dbPath);
66
- if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
58
+ const dbPath = path.join(getCairnDir(), 'index.db');
67
59
 
68
60
  const db = new DatabaseSync(dbPath);
69
61
  db.exec('PRAGMA journal_mode = WAL');