pkm-mcp-server 1.2.1 → 1.3.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 +20 -0
- package/README.md +41 -43
- package/cli.js +26 -0
- package/index.js +458 -451
- package/init.js +570 -0
- package/package.json +7 -6
- package/sample-project/CLAUDE.md +15 -0
- package/templates/note.md +7 -0
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,26 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [1.3.1] - 2026-03-21
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
- `pkm-mcp-server init` now correctly registers the MCP server with Claude Code via `claude mcp add` instead of writing to the wrong config file (`~/.claude/settings.json`). Previously, the server appeared to register successfully but was never visible to Claude Code.
|
|
13
|
+
|
|
14
|
+
## [1.3.0] - 2026-03-19
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
- `pkm-mcp-server init` — interactive onboarding wizard that walks users through vault setup, template installation, folder structure, OpenAI API key configuration, and Claude Code registration in a single session
|
|
18
|
+
- `cli.js` — new CLI dispatcher with `init` and `--version` subcommands; existing MCP server behavior unchanged when run without arguments
|
|
19
|
+
- `templates/note.md` — minimal generic note template for users who prefer to define their own templates
|
|
20
|
+
- 36 unit tests for init wizard helpers
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
- `index.js` refactored to export `startServer()` for CLI dispatcher (backward compatible — `node index.js` still works)
|
|
24
|
+
- Entry point updated from `index.js` to `cli.js` in package.json (`bin`, `main`, `exports`)
|
|
25
|
+
|
|
26
|
+
### Dependencies
|
|
27
|
+
- Added `@inquirer/prompts` for interactive CLI prompts
|
|
28
|
+
|
|
9
29
|
## [1.2.1] - 2026-03-17
|
|
10
30
|
|
|
11
31
|
### Added
|
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
[](https://nodejs.org/)
|
|
6
6
|
[](https://github.com/AdrianV101/Obsidian-MCP/actions/workflows/ci.yml)
|
|
7
7
|
|
|
8
|
-
An MCP (Model Context Protocol) server that gives Claude Code full read/write access to your Obsidian vault.
|
|
8
|
+
An MCP (Model Context Protocol) server that gives Claude Code full read/write access to your Obsidian vault. 19 tools for note CRUD, full-text search, semantic search, graph traversal, metadata queries, session activity tracking, and passive knowledge capture. Published on npm as [`pkm-mcp-server`](https://www.npmjs.com/package/pkm-mcp-server).
|
|
9
9
|
|
|
10
10
|
## Why
|
|
11
11
|
|
|
@@ -42,6 +42,7 @@ https://github.com/user-attachments/assets/58ad9c9b-d987-4728-89e7-33de20b73a38
|
|
|
42
42
|
| `vault_trash` | Soft-delete to `.trash/` (Obsidian convention), warns about broken incoming links |
|
|
43
43
|
| `vault_move` | Move/rename files with automatic wikilink updating across vault |
|
|
44
44
|
| `vault_update_frontmatter` | Atomic YAML frontmatter updates (set, create, remove fields; validates enum fields by note type) |
|
|
45
|
+
| `vault_capture` | Signal a PKM-worthy capture (decision, task, research, bug); returns immediately, background hook creates the note |
|
|
45
46
|
|
|
46
47
|
### Fuzzy Path Resolution
|
|
47
48
|
|
|
@@ -55,7 +56,7 @@ vault_read({ path: "devlog.md" })
|
|
|
55
56
|
// Same result — .md extension is optional
|
|
56
57
|
|
|
57
58
|
vault_links({ path: "alpha" })
|
|
58
|
-
// Works on vault_links, vault_neighborhood, vault_suggest_links too
|
|
59
|
+
// Works on vault_peek, vault_links, vault_neighborhood, vault_suggest_links too
|
|
59
60
|
```
|
|
60
61
|
|
|
61
62
|
Folder-scoped tools accept partial folder names:
|
|
@@ -81,69 +82,59 @@ Ambiguous matches return an error listing candidates. Exact paths always work un
|
|
|
81
82
|
|
|
82
83
|
## Quick Start
|
|
83
84
|
|
|
84
|
-
### 1. Install
|
|
85
|
+
### 1. Install and Set Up
|
|
85
86
|
|
|
86
87
|
**From npm** (recommended):
|
|
87
88
|
|
|
88
89
|
```bash
|
|
89
90
|
npm install -g pkm-mcp-server
|
|
91
|
+
pkm-mcp-server init
|
|
90
92
|
```
|
|
91
93
|
|
|
94
|
+
The setup wizard walks you through:
|
|
95
|
+
1. Vault path (existing or new)
|
|
96
|
+
2. Note templates (full set, minimal, or skip)
|
|
97
|
+
3. PARA folder structure
|
|
98
|
+
4. OpenAI API key for semantic search (optional)
|
|
99
|
+
5. Automatic registration with Claude Code
|
|
100
|
+
|
|
101
|
+
Restart Claude Code after setup. The server provides all tools except semantic search out of the box.
|
|
102
|
+
|
|
92
103
|
**From source:**
|
|
93
104
|
|
|
94
105
|
```bash
|
|
95
106
|
git clone https://github.com/AdrianV101/Obsidian-MCP.git
|
|
96
107
|
cd Obsidian-MCP
|
|
97
108
|
npm install
|
|
109
|
+
node cli.js init
|
|
98
110
|
```
|
|
99
111
|
|
|
100
|
-
### 2.
|
|
101
|
-
|
|
102
|
-
Add to `~/.claude/settings.json`:
|
|
112
|
+
### 2. Manual Registration (alternative)
|
|
103
113
|
|
|
104
|
-
|
|
114
|
+
If you prefer to skip the wizard, register directly with the Claude CLI:
|
|
105
115
|
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
"mcpServers": {
|
|
109
|
-
"obsidian-pkm": {
|
|
110
|
-
"command": "npx",
|
|
111
|
-
"args": ["-y", "pkm-mcp-server"],
|
|
112
|
-
"env": {
|
|
113
|
-
"VAULT_PATH": "/absolute/path/to/your/obsidian/vault"
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
116
|
+
```bash
|
|
117
|
+
claude mcp add -s user -e VAULT_PATH=/absolute/path/to/your/vault obsidian-pkm -- npx -y pkm-mcp-server
|
|
118
118
|
```
|
|
119
119
|
|
|
120
|
-
|
|
120
|
+
For a source install:
|
|
121
121
|
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
"mcpServers": {
|
|
125
|
-
"obsidian-pkm": {
|
|
126
|
-
"command": "node",
|
|
127
|
-
"args": ["/absolute/path/to/index.js"],
|
|
128
|
-
"env": {
|
|
129
|
-
"VAULT_PATH": "/absolute/path/to/your/obsidian/vault"
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
122
|
+
```bash
|
|
123
|
+
claude mcp add -s user -e VAULT_PATH=/absolute/path/to/your/vault obsidian-pkm -- node /absolute/path/to/cli.js
|
|
134
124
|
```
|
|
135
125
|
|
|
136
|
-
|
|
126
|
+
Verify with `claude mcp list` — you should see `obsidian-pkm: ... - Connected`.
|
|
137
127
|
|
|
138
128
|
### 3. Enable Semantic Search (optional)
|
|
139
129
|
|
|
140
|
-
|
|
130
|
+
If you didn't set this up during `init`, add your OpenAI API key by re-registering:
|
|
141
131
|
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
132
|
+
```bash
|
|
133
|
+
claude mcp remove obsidian-pkm
|
|
134
|
+
claude mcp add -s user \
|
|
135
|
+
-e VAULT_PATH=/absolute/path/to/your/vault \
|
|
136
|
+
-e OPENAI_API_KEY=sk-... \
|
|
137
|
+
obsidian-pkm -- npx -y pkm-mcp-server
|
|
147
138
|
```
|
|
148
139
|
|
|
149
140
|
This enables `vault_semantic_search` and `vault_suggest_links`. Uses `text-embedding-3-large` with a SQLite + sqlite-vec index stored at `.obsidian/semantic-index.db`. The index rebuilds automatically — delete the DB file to force a full re-embed.
|
|
@@ -279,7 +270,9 @@ All paths passed to tools are relative to vault root. The server includes path s
|
|
|
279
270
|
|
|
280
271
|
**Graph exploration** resolves `[[wikilinks]]` to file paths (handling aliases, headings, and ambiguous basenames), then does BFS traversal to return notes grouped by hop distance.
|
|
281
272
|
|
|
282
|
-
**Activity logging** records every tool call with timestamps and session IDs, enabling Claude to recall what happened in previous conversations.
|
|
273
|
+
**Activity logging** records every tool call (except `vault_activity` itself) with timestamps and session IDs, enabling Claude to recall what happened in previous conversations.
|
|
274
|
+
|
|
275
|
+
**Passive capture** uses `vault_capture` to signal that something is worth persisting (a decision, task, research finding, or bug). The tool returns immediately — a PostToolUse hook spawns a background agent that creates the structured vault note. Combined with the Stop hook (which sweeps each session for un-captured decisions and tasks), this keeps the vault up to date without interrupting the coding flow.
|
|
283
276
|
|
|
284
277
|
## Troubleshooting
|
|
285
278
|
|
|
@@ -287,13 +280,16 @@ All paths passed to tools are relative to vault root. The server includes path s
|
|
|
287
280
|
You need C++ build tools. See [Prerequisites](#prerequisites) for your platform. On Linux, `sudo apt install build-essential python3` usually fixes it.
|
|
288
281
|
|
|
289
282
|
**Server starts but all tool calls fail with ENOENT**
|
|
290
|
-
Your `VAULT_PATH` is wrong or missing. The server
|
|
283
|
+
Your `VAULT_PATH` is wrong or missing. The server validates this at startup and exits with a clear error. Re-register with the correct path: `claude mcp remove obsidian-pkm && claude mcp add -s user -e VAULT_PATH=/correct/path obsidian-pkm -- npx -y pkm-mcp-server`
|
|
291
284
|
|
|
292
285
|
**`vault_write` says "no templates available"**
|
|
293
|
-
|
|
286
|
+
Run `pkm-mcp-server init` to install templates, or copy the `templates/` files from this repo into your vault's `05-Templates/` directory. The server loads templates from there at startup.
|
|
294
287
|
|
|
295
288
|
**Semantic search not appearing in tool list**
|
|
296
|
-
Set `OPENAI_API_KEY` in your
|
|
289
|
+
Set `OPENAI_API_KEY` in your MCP server registration. See [Enable Semantic Search](#3-enable-semantic-search-optional). Without it, `vault_semantic_search` and `vault_suggest_links` are hidden entirely.
|
|
290
|
+
|
|
291
|
+
**Server not showing up in Claude Code after install**
|
|
292
|
+
Run `claude mcp list` to check. If `obsidian-pkm` is missing, register it with `claude mcp add` (see [Manual Registration](#2-manual-registration-alternative)). Note: editing `~/.claude/settings.json` directly does **not** register MCP servers — use the CLI.
|
|
297
293
|
|
|
298
294
|
**Semantic index not updating after file changes**
|
|
299
295
|
Check your Node version with `node -v`. The file watcher uses `fs.watch({ recursive: true })` which requires Node.js >= 18.13 on Linux.
|
|
@@ -302,6 +298,8 @@ Check your Node version with `node -v`. The file watcher uses `fs.watch({ recurs
|
|
|
302
298
|
|
|
303
299
|
Contributions are welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, code style guidelines, and the pull request process before submitting changes.
|
|
304
300
|
|
|
301
|
+
See [CHANGELOG.md](CHANGELOG.md) for release history and [SECURITY.md](SECURITY.md) to report vulnerabilities.
|
|
302
|
+
|
|
305
303
|
## License
|
|
306
304
|
|
|
307
305
|
MIT
|
package/cli.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { createRequire } from "module";
|
|
4
|
+
|
|
5
|
+
const subcommand = process.argv[2];
|
|
6
|
+
|
|
7
|
+
try {
|
|
8
|
+
if (subcommand === "init") {
|
|
9
|
+
const { runInit } = await import("./init.js");
|
|
10
|
+
await runInit();
|
|
11
|
+
} else if (subcommand === "--version" || subcommand === "-v") {
|
|
12
|
+
const require = createRequire(import.meta.url);
|
|
13
|
+
const { version } = require("./package.json");
|
|
14
|
+
console.log(`pkm-mcp-server v${version}`);
|
|
15
|
+
} else if (!subcommand) {
|
|
16
|
+
const { startServer } = await import("./index.js");
|
|
17
|
+
await startServer();
|
|
18
|
+
} else {
|
|
19
|
+
console.error(`Unknown command: ${subcommand}`);
|
|
20
|
+
console.error("Usage: pkm-mcp-server [init]");
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
} catch (e) {
|
|
24
|
+
console.error(`Fatal: ${e.message}`);
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|