pkm-mcp-server 1.4.2 → 1.5.1

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/CHANGELOG.md CHANGED
@@ -6,6 +6,33 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [1.5.1] - 2026-03-21
10
+
11
+ ### Fixed
12
+ - Init wizard failed to copy `stop-sweep.js` — hook file references still pointed to the old `stop-sweep.sh` filename from before the v1.5.0 bash-to-Node conversion. Updated all references and removed stop-sweep from shell patching (it auto-detects MCP config).
13
+
14
+ ## [1.5.0] - 2026-03-21
15
+
16
+ ### Changed
17
+ - **Passive sweep hook upgraded to "PKM librarian"** — replaces inbox dumping with structured note creation in the correct project directory. Creates properly templated notes (tasks, ADRs, research notes, troubleshooting logs) with wikilinks to related notes via `vault_suggest_links`.
18
+ - Passive sweep: Haiku → Sonnet, 5 → 15 max turns, 3 → 17 tools
19
+ - Capture handler: Sonnet → Opus, 25 → 30 max turns, 8 → 17 tools
20
+ - Both hook agents now get all vault tools except `vault_trash` and `vault_capture`
21
+ - Capture handler prompt now includes `vault_suggest_links` for graph linking and `vault_search` for duplicate detection
22
+ - Stop hook converted from bash (`stop-sweep.sh`) to Node.js (`stop-sweep.js`) for direct `resolveProject()` import and cleaner prompt construction
23
+
24
+ ### Added
25
+ - Auto-detection of repo vs installed location for MCP config — `stop-sweep.js` checks for `../index.js` (repo) and falls back to `npx pkm-mcp-server@latest` (installed). Eliminates need for text replacement during hook installation.
26
+ - `OPENAI_API_KEY` passthrough in both hook agents' MCP config when set, enabling `vault_semantic_search` and `vault_suggest_links`
27
+
28
+ ### Fixed
29
+ - Sweep log files were empty due to pipe-based logging — parent process owned the FDs and exited before child could write. Now uses `openSync` FDs owned directly by the child process.
30
+ - Missing `child.on("error")` handler in sweep agent — spawn failures (e.g., `claude` not on PATH) now logged gracefully instead of crashing.
31
+
32
+ ### Removed
33
+ - `hooks/stop-sweep.sh` — superseded by `hooks/stop-sweep.js`
34
+ - Inbox capture pattern (`00-Inbox/captures-{date}.md`) — all captures now go to project-specific typed notes
35
+
9
36
  ## [1.4.2] - 2026-03-21
10
37
 
11
38
  ### Fixed
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { spawn } from "node:child_process";
4
- import { appendFileSync, closeSync, mkdirSync, openSync } from "node:fs";
4
+ import { appendFileSync, closeSync, existsSync, mkdirSync, openSync } from "node:fs";
5
5
  import { access } from "node:fs/promises";
6
6
  import { dirname, join } from "node:path";
7
7
  import { fileURLToPath } from "node:url";
@@ -63,19 +63,18 @@ async function main() {
63
63
  const { projectPath, error } = await resolveProject(cwd, VAULT_PATH);
64
64
  if (error || !projectPath) return;
65
65
 
66
- // Build MCP config
67
- const indexPath = join(__dirname, "..", "index.js");
66
+ // Build MCP config — auto-detect repo (../index.js exists) vs installed (use npx)
67
+ const localIndex = join(__dirname, "..", "index.js");
68
+ const useLocal = existsSync(localIndex);
68
69
  const mcpEnv = { VAULT_PATH };
69
70
  if (process.env.OPENAI_API_KEY) {
70
71
  mcpEnv.OPENAI_API_KEY = process.env.OPENAI_API_KEY;
71
72
  }
72
73
  const mcpConfig = JSON.stringify({
73
74
  mcpServers: {
74
- "obsidian-pkm": {
75
- command: "node",
76
- args: [indexPath],
77
- env: mcpEnv,
78
- },
75
+ "obsidian-pkm": useLocal
76
+ ? { command: "node", args: [localIndex], env: mcpEnv }
77
+ : { command: "npx", args: ["-y", "pkm-mcp-server@latest"], env: mcpEnv },
79
78
  },
80
79
  });
81
80
 
package/init.js CHANGED
@@ -212,7 +212,7 @@ export function patchMcpConfig(scriptContent, installType) {
212
212
  return patched.join("\n");
213
213
  }
214
214
 
215
- const PKM_HOOK_BASENAMES = new Set(["session-start.js", "stop-sweep.sh", "capture-handler.sh"]);
215
+ const PKM_HOOK_BASENAMES = new Set(["session-start.js", "stop-sweep.js", "capture-handler.sh"]);
216
216
 
217
217
  /**
218
218
  * Detect if a hook entry is a PKM hook (by path substring or script basename).
@@ -257,7 +257,7 @@ export function buildHookEntries(vaultPath, hooksDir, enabledHooks) {
257
257
  entries.Stop = [{
258
258
  hooks: [{
259
259
  type: "command",
260
- command: `VAULT_PATH="${vaultPath}" ${path.join(hooksDir, "stop-sweep.sh")}`,
260
+ command: `VAULT_PATH="${vaultPath}" node ${path.join(hooksDir, "stop-sweep.js")}`,
261
261
  async: true,
262
262
  timeout: 10,
263
263
  }],
@@ -326,8 +326,8 @@ export async function mergeHooksIntoSettings(settingsPath, hookEntries, disabled
326
326
  return {};
327
327
  }
328
328
 
329
- const HOOK_FILES = ["session-start.js", "resolve-project.js", "load-context.js", "stop-sweep.sh", "capture-handler.sh"];
330
- const SHELL_HOOKS = new Set(["stop-sweep.sh", "capture-handler.sh"]);
329
+ const HOOK_FILES = ["session-start.js", "resolve-project.js", "load-context.js", "stop-sweep.js", "capture-handler.sh"];
330
+ const SHELL_HOOKS = new Set(["capture-handler.sh"]);
331
331
 
332
332
  /**
333
333
  * Copy hook scripts to destination, patching shell scripts with correct MCP config.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pkm-mcp-server",
3
- "version": "1.4.2",
3
+ "version": "1.5.1",
4
4
  "description": "MCP server for Obsidian vault integration with Claude Code — 19 tools for notes, search, and graph traversal",
5
5
  "main": "cli.js",
6
6
  "exports": {