@mauricio.wolff/mcp-obsidian 0.7.5 → 0.8.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 +283 -25
- package/dist/server.js +79 -16
- package/dist/src/filesystem.js +131 -8
- package/dist/src/filesystem.test.js +218 -1
- package/dist/src/frontmatter.js +26 -0
- package/dist/src/frontmatter.test.js +34 -2
- package/dist/src/integration.test.js +0 -93
- package/dist/src/pathfilter.js +19 -5
- package/dist/src/pathfilter.test.js +18 -0
- package/dist/src/search.js +94 -38
- package/dist/src/search.test.js +212 -0
- package/package.json +4 -5
package/README.md
CHANGED
|
@@ -23,16 +23,16 @@ A universal AI bridge for Obsidian vaults using the Model Context Protocol (MCP)
|
|
|
23
23
|
|
|
24
24
|
</div>
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
26
|
## Universal Compatibility
|
|
29
|
-
|
|
27
|
+
|
|
28
|
+
Works with any MCP-compatible AI assistant including Claude Desktop, Claude Code, ChatGPT Desktop (Enterprise+), OpenCode, Gemini CLI, OpenAI Codex, IntelliJ IDEA 2025.1+, Cursor IDE, Windsurf IDE, and future AI platforms that adopt the MCP standard.
|
|
30
29
|
|
|
31
30
|
https://github.com/user-attachments/assets/657ac4c6-1cd2-4cc3-829f-fd095a32f71c
|
|
32
31
|
|
|
33
32
|
## Quick Start (5 minutes)
|
|
34
33
|
|
|
35
34
|
1. **Install Node.js runtime:**
|
|
35
|
+
|
|
36
36
|
```bash
|
|
37
37
|
# Download from https://nodejs.org (v18.0.0 or later)
|
|
38
38
|
# or use a package manager like nvm, brew, apt, etc.
|
|
@@ -41,6 +41,7 @@ https://github.com/user-attachments/assets/657ac4c6-1cd2-4cc3-829f-fd095a32f71c
|
|
|
41
41
|
2. **Test the server:**
|
|
42
42
|
|
|
43
43
|
If using the published package:
|
|
44
|
+
|
|
44
45
|
```bash
|
|
45
46
|
npx @modelcontextprotocol/inspector npx @mauricio.wolff/mcp-obsidian@latest /path/to/your/vault
|
|
46
47
|
```
|
|
@@ -48,6 +49,7 @@ https://github.com/user-attachments/assets/657ac4c6-1cd2-4cc3-829f-fd095a32f71c
|
|
|
48
49
|
3. **Configure your AI client:**
|
|
49
50
|
|
|
50
51
|
**Claude Desktop** - Copy this to `claude_desktop_config.json`:
|
|
52
|
+
|
|
51
53
|
```json
|
|
52
54
|
{
|
|
53
55
|
"mcpServers": {
|
|
@@ -60,6 +62,7 @@ https://github.com/user-attachments/assets/657ac4c6-1cd2-4cc3-829f-fd095a32f71c
|
|
|
60
62
|
```
|
|
61
63
|
|
|
62
64
|
**Claude Code** - Copy this to `~/.claude.json`:
|
|
65
|
+
|
|
63
66
|
```json
|
|
64
67
|
{
|
|
65
68
|
"mcpServers": {
|
|
@@ -72,6 +75,24 @@ https://github.com/user-attachments/assets/657ac4c6-1cd2-4cc3-829f-fd095a32f71c
|
|
|
72
75
|
}
|
|
73
76
|
```
|
|
74
77
|
|
|
78
|
+
**OpenCode** - Copy this to `~/.config/opencode/opencode.json`
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"mcp": {
|
|
83
|
+
"obsidian": {
|
|
84
|
+
"type": "local",
|
|
85
|
+
"command": [
|
|
86
|
+
"npx",
|
|
87
|
+
"@mauricio.wolff/mcp-obsidian@latest",
|
|
88
|
+
"/path/to/your/vault/"
|
|
89
|
+
],
|
|
90
|
+
"enabled": true
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
75
96
|
Replace `/path/to/your/vault` with your actual Obsidian vault path.
|
|
76
97
|
|
|
77
98
|
For other platforms, see [detailed configuration guides](#ai-client-configuration) below.
|
|
@@ -86,24 +107,27 @@ https://github.com/user-attachments/assets/657ac4c6-1cd2-4cc3-829f-fd095a32f71c
|
|
|
86
107
|
## Why MCP-Obsidian?
|
|
87
108
|
|
|
88
109
|
### Universal AI Compatibility
|
|
110
|
+
|
|
89
111
|
Built on the open Model Context Protocol standard, MCP-Obsidian is not locked to any single AI provider. As more AI assistants adopt MCP, your investment in this tool grows more valuable. Today it works with Claude and ChatGPT - tomorrow it will work with whatever AI tools emerge.
|
|
90
112
|
|
|
91
113
|
### Future-Proof Your Knowledge Base
|
|
114
|
+
|
|
92
115
|
Instead of waiting for each AI company to build Obsidian integrations, MCP-Obsidian provides a universal adapter that works with any MCP-compatible assistant. One tool, endless possibilities.
|
|
93
116
|
|
|
94
117
|
### Open Standard, No Lock-in
|
|
118
|
+
|
|
95
119
|
MCP is an open protocol. You're not tied to any specific vendor or platform. Your notes remain yours, accessible through any compatible AI assistant.
|
|
96
120
|
|
|
97
121
|
## Features
|
|
98
122
|
|
|
99
123
|
- ✅ Safe frontmatter parsing and validation using gray-matter
|
|
100
124
|
- ✅ Path filtering to exclude `.obsidian` directory and other system files
|
|
101
|
-
- ✅ **Complete MCP toolkit**:
|
|
102
|
-
- File operations: `read_note`, `write_note`, `delete_note`, `move_note`
|
|
125
|
+
- ✅ **Complete MCP toolkit**: 14 methods covering all vault operations
|
|
126
|
+
- File operations: `read_note`, `write_note`, `patch_note`, `delete_note`, `move_note`, `move_file`
|
|
103
127
|
- Directory operations: `list_directory`
|
|
104
128
|
- Batch operations: `read_multiple_notes`
|
|
105
|
-
- Search: `search_notes` with
|
|
106
|
-
- Metadata: `get_frontmatter`, `update_frontmatter`, `get_notes_info`
|
|
129
|
+
- Search: `search_notes` with multi-word matching and BM25 relevance reranking
|
|
130
|
+
- Metadata: `get_frontmatter`, `update_frontmatter`, `get_notes_info`, `get_vault_stats`
|
|
107
131
|
- Tag management: `manage_tags` (add, remove, list)
|
|
108
132
|
- ✅ Write modes: `overwrite`, `append`, `prepend` for flexible content editing
|
|
109
133
|
- ✅ Tag management: add, remove, and list tags in notes
|
|
@@ -119,7 +143,7 @@ MCP is an open protocol. You're not tied to any specific vendor or platform. You
|
|
|
119
143
|
## Prerequisites
|
|
120
144
|
|
|
121
145
|
- [Node.js](https://nodejs.org) runtime (v18.0.0 or later)
|
|
122
|
-
- An Obsidian vault (local directory with `.md` files)
|
|
146
|
+
- An Obsidian vault (local directory with `.md`, `.markdown`, `.txt`, `.base`, or `.canvas` files)
|
|
123
147
|
- MCP-compatible AI client (Claude Desktop, ChatGPT Desktop, Claude Code, etc.)
|
|
124
148
|
|
|
125
149
|
## Installation
|
|
@@ -132,24 +156,31 @@ No installation needed! Use `npx` to run directly:
|
|
|
132
156
|
npx @mauricio.wolff/mcp-obsidian@latest /path/to/your/obsidian/vault
|
|
133
157
|
```
|
|
134
158
|
|
|
159
|
+
If you omit the vault path, the server uses your current working directory as the vault root.
|
|
160
|
+
|
|
135
161
|
### For Developers
|
|
136
162
|
|
|
137
163
|
1. Clone this repository
|
|
138
164
|
2. Use the correct Node.js version:
|
|
165
|
+
|
|
139
166
|
```bash
|
|
140
167
|
nvm use # Uses Node 24 from .nvmrc
|
|
141
168
|
```
|
|
169
|
+
|
|
142
170
|
3. Install dependencies with npm:
|
|
171
|
+
|
|
143
172
|
```bash
|
|
144
173
|
npm install # Corepack automatically uses npm 10.9.0
|
|
145
174
|
```
|
|
146
175
|
|
|
147
176
|
4. Test locally with MCP inspector:
|
|
177
|
+
|
|
148
178
|
```bash
|
|
149
179
|
npx @modelcontextprotocol/inspector npm start /path/to/your/vault
|
|
150
180
|
```
|
|
151
181
|
|
|
152
182
|
**Pro tip:** Use MCP Inspector to test all server functionality before configuring with AI clients:
|
|
183
|
+
|
|
153
184
|
```bash
|
|
154
185
|
# Install globally for easier access
|
|
155
186
|
npm install -g @modelcontextprotocol/inspector
|
|
@@ -163,13 +194,19 @@ mcp-inspector npx @mauricio.wolff/mcp-obsidian@latest /path/to/your/vault
|
|
|
163
194
|
### Running the Server
|
|
164
195
|
|
|
165
196
|
**End users:**
|
|
197
|
+
|
|
166
198
|
```bash
|
|
199
|
+
npx @mauricio.wolff/mcp-obsidian@latest
|
|
167
200
|
npx @mauricio.wolff/mcp-obsidian@latest /path/to/your/obsidian/vault
|
|
201
|
+
npx @mauricio.wolff/mcp-obsidian@latest ./Vault
|
|
168
202
|
```
|
|
169
203
|
|
|
170
204
|
**Developers:**
|
|
205
|
+
|
|
171
206
|
```bash
|
|
207
|
+
npm start
|
|
172
208
|
npm start /path/to/your/obsidian/vault
|
|
209
|
+
npm start ./Vault
|
|
173
210
|
```
|
|
174
211
|
|
|
175
212
|
### AI Client Configuration
|
|
@@ -179,39 +216,51 @@ npm start /path/to/your/obsidian/vault
|
|
|
179
216
|
Add to your Claude Desktop configuration file:
|
|
180
217
|
|
|
181
218
|
**Single Vault:**
|
|
219
|
+
|
|
182
220
|
```json
|
|
183
221
|
{
|
|
184
222
|
"mcpServers": {
|
|
185
223
|
"obsidian": {
|
|
186
224
|
"command": "npx",
|
|
187
|
-
"args": [
|
|
225
|
+
"args": [
|
|
226
|
+
"@mauricio.wolff/mcp-obsidian@latest",
|
|
227
|
+
"/Users/yourname/Documents/MyVault"
|
|
228
|
+
]
|
|
188
229
|
}
|
|
189
230
|
}
|
|
190
231
|
}
|
|
191
232
|
```
|
|
192
233
|
|
|
193
234
|
**Multiple Vaults:**
|
|
235
|
+
|
|
194
236
|
```json
|
|
195
237
|
{
|
|
196
238
|
"mcpServers": {
|
|
197
239
|
"obsidian-personal": {
|
|
198
240
|
"command": "npx",
|
|
199
|
-
"args": [
|
|
241
|
+
"args": [
|
|
242
|
+
"@mauricio.wolff/mcp-obsidian@latest",
|
|
243
|
+
"/Users/yourname/Documents/PersonalVault"
|
|
244
|
+
]
|
|
200
245
|
},
|
|
201
246
|
"obsidian-work": {
|
|
202
247
|
"command": "npx",
|
|
203
|
-
"args": [
|
|
248
|
+
"args": [
|
|
249
|
+
"@mauricio.wolff/mcp-obsidian@latest",
|
|
250
|
+
"/Users/yourname/Documents/WorkVault"
|
|
251
|
+
]
|
|
204
252
|
}
|
|
205
253
|
}
|
|
206
254
|
}
|
|
207
255
|
```
|
|
208
256
|
|
|
209
257
|
**Configuration File Locations:**
|
|
258
|
+
|
|
210
259
|
- **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
211
260
|
- **Windows:** `C:\Users\{username}\AppData\Roaming\Claude\claude_desktop_config.json`
|
|
212
261
|
- **Linux:** `~/.config/Claude/claude_desktop_config.json`
|
|
213
262
|
|
|
214
|
-
|
|
263
|
+
_You can also access this through Claude Desktop → Settings → Developer → Edit Config_
|
|
215
264
|
|
|
216
265
|
#### ChatGPT Desktop
|
|
217
266
|
|
|
@@ -223,7 +272,7 @@ ChatGPT uses MCP through Deep Research and developer mode. Configuration is done
|
|
|
223
272
|
2. Configure MCP servers through the built-in MCP client
|
|
224
273
|
3. Create custom connectors for your organization
|
|
225
274
|
|
|
226
|
-
|
|
275
|
+
_Note: ChatGPT Desktop's MCP integration is currently limited to enterprise subscriptions and uses a different setup process than file-based configuration._
|
|
227
276
|
|
|
228
277
|
#### Claude Code
|
|
229
278
|
|
|
@@ -231,6 +280,7 @@ Claude Code uses `.claude.json` configuration file:
|
|
|
231
280
|
|
|
232
281
|
**User-scoped (recommended):**
|
|
233
282
|
Edit `~/.claude.json`:
|
|
283
|
+
|
|
234
284
|
```json
|
|
235
285
|
{
|
|
236
286
|
"mcpServers": {
|
|
@@ -245,6 +295,7 @@ Edit `~/.claude.json`:
|
|
|
245
295
|
|
|
246
296
|
**Project-scoped:**
|
|
247
297
|
Edit `.claude.json` in your project or add to the projects section:
|
|
298
|
+
|
|
248
299
|
```json
|
|
249
300
|
{
|
|
250
301
|
"projects": {
|
|
@@ -261,6 +312,7 @@ Edit `.claude.json` in your project or add to the projects section:
|
|
|
261
312
|
```
|
|
262
313
|
|
|
263
314
|
**Using Claude Code CLI:**
|
|
315
|
+
|
|
264
316
|
```bash
|
|
265
317
|
claude mcp add obsidian --scope user npx @mauricio.wolff/mcp-obsidian /path/to/your/vault
|
|
266
318
|
```
|
|
@@ -276,6 +328,7 @@ npx @mauricio.wolff/mcp-obsidian@latest /path/to/your/vault
|
|
|
276
328
|
#### Other MCP-Compatible Clients (2025)
|
|
277
329
|
|
|
278
330
|
**Confirmed MCP Support:**
|
|
331
|
+
|
|
279
332
|
- **IntelliJ IDEA 2025.1+** - Native MCP client support
|
|
280
333
|
- **Cursor IDE** - Built-in MCP compatibility
|
|
281
334
|
- **Windsurf IDE** - Full MCP integration
|
|
@@ -287,11 +340,13 @@ Most modern MCP clients use similar JSON configuration patterns. Refer to your s
|
|
|
287
340
|
### Examples
|
|
288
341
|
|
|
289
342
|
#### Ask your AI assistant about your notes:
|
|
343
|
+
|
|
290
344
|
- "What files are in my Obsidian vault?"
|
|
291
345
|
- "Read my note called 'project-ideas.md'"
|
|
292
346
|
- "Show me all notes with 'AI' in the title"
|
|
293
347
|
|
|
294
348
|
#### Have your AI assistant help with note management:
|
|
349
|
+
|
|
295
350
|
- "Create a new note called 'meeting-notes.md' with today's date in the frontmatter"
|
|
296
351
|
- "Append today's journal entry to my daily note"
|
|
297
352
|
- "Prepend an urgent task to my todo list"
|
|
@@ -302,6 +357,7 @@ Most modern MCP clients use similar JSON configuration patterns. Refer to your s
|
|
|
302
357
|
- "Delete the old draft note 'draft-ideas.md' (with confirmation)"
|
|
303
358
|
|
|
304
359
|
#### Advanced Use Cases:
|
|
360
|
+
|
|
305
361
|
- **Knowledge Synthesis**: "Summarize all my research notes tagged with 'machine-learning' from the last month"
|
|
306
362
|
- **Project Management**: "Update the status in all project notes to 'completed' and add today's date"
|
|
307
363
|
- **Content Analysis**: "Find all notes that mention 'API design' and create a comprehensive guide"
|
|
@@ -312,22 +368,27 @@ Most modern MCP clients use similar JSON configuration patterns. Refer to your s
|
|
|
312
368
|
### Common Issues
|
|
313
369
|
|
|
314
370
|
#### "command not found: npx"
|
|
371
|
+
|
|
315
372
|
- **Solution:** Install Node.js runtime from [nodejs.org](https://nodejs.org)
|
|
316
373
|
- **Alternative:** Use global install: `npm install -g @mauricio.wolff/mcp-obsidian`
|
|
317
374
|
|
|
318
|
-
#### "
|
|
319
|
-
|
|
320
|
-
- **
|
|
375
|
+
#### "File not found" when paths look correct
|
|
376
|
+
|
|
377
|
+
- **Cause:** The server is using the wrong vault root
|
|
378
|
+
- **Solution:** Either run the command from your vault directory or pass the vault path explicitly
|
|
321
379
|
|
|
322
380
|
#### "Permission denied" errors
|
|
381
|
+
|
|
323
382
|
- **Cause:** Insufficient file system permissions
|
|
324
383
|
- **Solution:** Ensure the vault directory is readable/writable by your user
|
|
325
384
|
|
|
326
385
|
#### "Path traversal not allowed"
|
|
386
|
+
|
|
327
387
|
- **Cause:** Trying to access files outside the vault
|
|
328
388
|
- **Solution:** All file paths must be relative to the vault root
|
|
329
389
|
|
|
330
390
|
#### AI client not recognizing the server
|
|
391
|
+
|
|
331
392
|
1. Check the configuration file path is correct for your OS
|
|
332
393
|
2. Ensure JSON syntax is valid (use a JSON validator)
|
|
333
394
|
3. Restart your AI client after configuration changes
|
|
@@ -335,12 +396,14 @@ Most modern MCP clients use similar JSON configuration patterns. Refer to your s
|
|
|
335
396
|
5. Verify your AI client supports MCP (Model Context Protocol)
|
|
336
397
|
|
|
337
398
|
#### ".obsidian files still showing up"
|
|
399
|
+
|
|
338
400
|
- **Expected:** The path filter automatically excludes `.obsidian/**` patterns
|
|
339
401
|
- **If still seeing them:** The filter is working as designed for security
|
|
340
402
|
|
|
341
403
|
### Debug Mode
|
|
342
404
|
|
|
343
405
|
Run with error logging:
|
|
406
|
+
|
|
344
407
|
```bash
|
|
345
408
|
npx @mauricio.wolff/mcp-obsidian /path/to/vault 2>debug.log
|
|
346
409
|
```
|
|
@@ -354,6 +417,7 @@ npx @mauricio.wolff/mcp-obsidian /path/to/vault 2>debug.log
|
|
|
354
417
|
## Testing
|
|
355
418
|
|
|
356
419
|
Run the test suite:
|
|
420
|
+
|
|
357
421
|
```bash
|
|
358
422
|
npm test
|
|
359
423
|
```
|
|
@@ -361,9 +425,11 @@ npm test
|
|
|
361
425
|
## API Methods
|
|
362
426
|
|
|
363
427
|
### `read_note`
|
|
428
|
+
|
|
364
429
|
Read a note from the vault with parsed frontmatter.
|
|
365
430
|
|
|
366
431
|
**Request:**
|
|
432
|
+
|
|
367
433
|
```json
|
|
368
434
|
{
|
|
369
435
|
"name": "read_note",
|
|
@@ -375,11 +441,20 @@ Read a note from the vault with parsed frontmatter.
|
|
|
375
441
|
```
|
|
376
442
|
|
|
377
443
|
**Response (optimized for tokens):**
|
|
444
|
+
|
|
378
445
|
```json
|
|
379
|
-
{
|
|
446
|
+
{
|
|
447
|
+
"fm": {
|
|
448
|
+
"title": "Project Ideas",
|
|
449
|
+
"tags": ["projects", "brainstorming"],
|
|
450
|
+
"created": "2023-01-15T10:30:00.000Z"
|
|
451
|
+
},
|
|
452
|
+
"content": "# Project Ideas\n\n## AI Tools\n- MCP server for Obsidian\n- Voice note transcription\n\n## Web Apps\n- Task management system"
|
|
453
|
+
}
|
|
380
454
|
```
|
|
381
455
|
|
|
382
456
|
**Response (with prettyPrint: true):**
|
|
457
|
+
|
|
383
458
|
```json
|
|
384
459
|
{
|
|
385
460
|
"fm": {
|
|
@@ -392,14 +467,17 @@ Read a note from the vault with parsed frontmatter.
|
|
|
392
467
|
```
|
|
393
468
|
|
|
394
469
|
### `write_note`
|
|
470
|
+
|
|
395
471
|
Write a note to the vault with optional frontmatter and write mode.
|
|
396
472
|
|
|
397
473
|
**Write Modes:**
|
|
474
|
+
|
|
398
475
|
- `overwrite` (default): Replace entire file content
|
|
399
476
|
- `append`: Add content to the end of existing file
|
|
400
477
|
- `prepend`: Add content to the beginning of existing file
|
|
401
478
|
|
|
402
479
|
**Request (Overwrite):**
|
|
480
|
+
|
|
403
481
|
```json
|
|
404
482
|
{
|
|
405
483
|
"name": "write_note",
|
|
@@ -417,6 +495,7 @@ Write a note to the vault with optional frontmatter and write mode.
|
|
|
417
495
|
```
|
|
418
496
|
|
|
419
497
|
**Request (Append):**
|
|
498
|
+
|
|
420
499
|
```json
|
|
421
500
|
{
|
|
422
501
|
"name": "write_note",
|
|
@@ -429,16 +508,61 @@ Write a note to the vault with optional frontmatter and write mode.
|
|
|
429
508
|
```
|
|
430
509
|
|
|
431
510
|
**Response:**
|
|
511
|
+
|
|
432
512
|
```json
|
|
433
513
|
{
|
|
434
514
|
"message": "Successfully wrote note: meeting-notes.md (mode: overwrite)"
|
|
435
515
|
}
|
|
436
516
|
```
|
|
437
517
|
|
|
518
|
+
### `patch_note`
|
|
519
|
+
|
|
520
|
+
Efficiently replace an exact string inside an existing note without rewriting the full file.
|
|
521
|
+
|
|
522
|
+
**Request:**
|
|
523
|
+
|
|
524
|
+
```json
|
|
525
|
+
{
|
|
526
|
+
"name": "patch_note",
|
|
527
|
+
"arguments": {
|
|
528
|
+
"path": "meeting-notes.md",
|
|
529
|
+
"oldString": "- Next milestones",
|
|
530
|
+
"newString": "- Next milestones (owner: Alex)",
|
|
531
|
+
"replaceAll": false
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
**Response (success):**
|
|
537
|
+
|
|
538
|
+
```json
|
|
539
|
+
{
|
|
540
|
+
"success": true,
|
|
541
|
+
"path": "meeting-notes.md",
|
|
542
|
+
"message": "Successfully replaced 1 occurrence",
|
|
543
|
+
"matchCount": 1
|
|
544
|
+
}
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
**Response (multiple matches with replaceAll=false):**
|
|
548
|
+
|
|
549
|
+
```json
|
|
550
|
+
{
|
|
551
|
+
"success": false,
|
|
552
|
+
"path": "meeting-notes.md",
|
|
553
|
+
"message": "Found 3 occurrences of the string. Use replaceAll=true to replace all occurrences, or provide a more specific string to match exactly one occurrence.",
|
|
554
|
+
"matchCount": 3
|
|
555
|
+
}
|
|
556
|
+
```
|
|
557
|
+
|
|
438
558
|
### `list_directory`
|
|
559
|
+
|
|
439
560
|
List files and directories in the vault.
|
|
440
561
|
|
|
562
|
+
Note: this includes non-note filenames (for example `pdf`, `png`, `jpg`) so AI assistants can see vault structure, but note tools like `read_note` and `write_note` still operate on note files only (`.md`, `.markdown`, `.txt`, `.base`, `.canvas`).
|
|
563
|
+
|
|
441
564
|
**Request:**
|
|
565
|
+
|
|
442
566
|
```json
|
|
443
567
|
{
|
|
444
568
|
"name": "list_directory",
|
|
@@ -450,14 +574,20 @@ List files and directories in the vault.
|
|
|
450
574
|
```
|
|
451
575
|
|
|
452
576
|
**Response (optimized):**
|
|
577
|
+
|
|
453
578
|
```json
|
|
454
|
-
{
|
|
579
|
+
{
|
|
580
|
+
"dirs": ["AI-Tools", "Web-Development"],
|
|
581
|
+
"files": ["project-template.md", "roadmap.md"]
|
|
582
|
+
}
|
|
455
583
|
```
|
|
456
584
|
|
|
457
585
|
### `delete_note`
|
|
586
|
+
|
|
458
587
|
Delete a note from the vault (requires confirmation for safety).
|
|
459
588
|
|
|
460
589
|
**Request:**
|
|
590
|
+
|
|
461
591
|
```json
|
|
462
592
|
{
|
|
463
593
|
"name": "delete_note",
|
|
@@ -469,6 +599,7 @@ Delete a note from the vault (requires confirmation for safety).
|
|
|
469
599
|
```
|
|
470
600
|
|
|
471
601
|
**Response (Success):**
|
|
602
|
+
|
|
472
603
|
```json
|
|
473
604
|
{
|
|
474
605
|
"success": true,
|
|
@@ -478,6 +609,7 @@ Delete a note from the vault (requires confirmation for safety).
|
|
|
478
609
|
```
|
|
479
610
|
|
|
480
611
|
**Response (Confirmation Failed):**
|
|
612
|
+
|
|
481
613
|
```json
|
|
482
614
|
{
|
|
483
615
|
"success": false,
|
|
@@ -489,9 +621,11 @@ Delete a note from the vault (requires confirmation for safety).
|
|
|
489
621
|
**⚠️ Safety Note:** The `confirmPath` parameter must exactly match the `path` parameter to proceed with deletion. This prevents accidental deletions.
|
|
490
622
|
|
|
491
623
|
### `get_frontmatter`
|
|
624
|
+
|
|
492
625
|
Extract only the frontmatter from a note without reading the full content.
|
|
493
626
|
|
|
494
627
|
**Request:**
|
|
628
|
+
|
|
495
629
|
```json
|
|
496
630
|
{
|
|
497
631
|
"name": "get_frontmatter",
|
|
@@ -503,14 +637,21 @@ Extract only the frontmatter from a note without reading the full content.
|
|
|
503
637
|
```
|
|
504
638
|
|
|
505
639
|
**Response (optimized, returns frontmatter directly):**
|
|
640
|
+
|
|
506
641
|
```json
|
|
507
|
-
{
|
|
642
|
+
{
|
|
643
|
+
"title": "Project Ideas",
|
|
644
|
+
"tags": ["projects", "brainstorming"],
|
|
645
|
+
"created": "2023-01-15T10:30:00.000Z"
|
|
646
|
+
}
|
|
508
647
|
```
|
|
509
648
|
|
|
510
649
|
### `manage_tags`
|
|
650
|
+
|
|
511
651
|
Add, remove, or list tags in a note. Tags are managed in the frontmatter and inline tags are detected.
|
|
512
652
|
|
|
513
653
|
**Request (List Tags):**
|
|
654
|
+
|
|
514
655
|
```json
|
|
515
656
|
{
|
|
516
657
|
"name": "manage_tags",
|
|
@@ -522,6 +663,7 @@ Add, remove, or list tags in a note. Tags are managed in the frontmatter and inl
|
|
|
522
663
|
```
|
|
523
664
|
|
|
524
665
|
**Request (Add Tags):**
|
|
666
|
+
|
|
525
667
|
```json
|
|
526
668
|
{
|
|
527
669
|
"name": "manage_tags",
|
|
@@ -534,6 +676,7 @@ Add, remove, or list tags in a note. Tags are managed in the frontmatter and inl
|
|
|
534
676
|
```
|
|
535
677
|
|
|
536
678
|
**Request (Remove Tags):**
|
|
679
|
+
|
|
537
680
|
```json
|
|
538
681
|
{
|
|
539
682
|
"name": "manage_tags",
|
|
@@ -546,6 +689,7 @@ Add, remove, or list tags in a note. Tags are managed in the frontmatter and inl
|
|
|
546
689
|
```
|
|
547
690
|
|
|
548
691
|
**Response:**
|
|
692
|
+
|
|
549
693
|
```json
|
|
550
694
|
{
|
|
551
695
|
"path": "research-notes.md",
|
|
@@ -557,9 +701,11 @@ Add, remove, or list tags in a note. Tags are managed in the frontmatter and inl
|
|
|
557
701
|
```
|
|
558
702
|
|
|
559
703
|
### `search_notes`
|
|
560
|
-
|
|
704
|
+
|
|
705
|
+
Search for notes in the vault by content or frontmatter with multi-word matching and BM25 relevance reranking.
|
|
561
706
|
|
|
562
707
|
**Request:**
|
|
708
|
+
|
|
563
709
|
```json
|
|
564
710
|
{
|
|
565
711
|
"name": "search_notes",
|
|
@@ -575,21 +721,35 @@ Search for notes in the vault by content or frontmatter.
|
|
|
575
721
|
```
|
|
576
722
|
|
|
577
723
|
**Response (optimized with minified field names):**
|
|
724
|
+
|
|
578
725
|
```json
|
|
579
|
-
[
|
|
726
|
+
[
|
|
727
|
+
{
|
|
728
|
+
"p": "ai-research.md",
|
|
729
|
+
"t": "AI Research Notes",
|
|
730
|
+
"ex": "...machine learning...",
|
|
731
|
+
"mc": 2,
|
|
732
|
+
"ln": 15,
|
|
733
|
+
"uri": "obsidian://open?vault=MyVault&file=ai-research.md"
|
|
734
|
+
}
|
|
735
|
+
]
|
|
580
736
|
```
|
|
581
737
|
|
|
582
738
|
**Field names:**
|
|
739
|
+
|
|
583
740
|
- `p` = path
|
|
584
741
|
- `t` = title
|
|
585
742
|
- `ex` = excerpt (21 chars context)
|
|
586
743
|
- `mc` = match count
|
|
587
744
|
- `ln` = line number
|
|
745
|
+
- `uri` = Obsidian deep link for quick opening
|
|
588
746
|
|
|
589
747
|
### `move_note`
|
|
590
|
-
|
|
748
|
+
|
|
749
|
+
Move or rename a note in the vault (`.md`, `.markdown`, `.txt`, `.base`, `.canvas`).
|
|
591
750
|
|
|
592
751
|
**Request:**
|
|
752
|
+
|
|
593
753
|
```json
|
|
594
754
|
{
|
|
595
755
|
"name": "move_note",
|
|
@@ -602,6 +762,7 @@ Move or rename a note in the vault.
|
|
|
602
762
|
```
|
|
603
763
|
|
|
604
764
|
**Response:**
|
|
765
|
+
|
|
605
766
|
```json
|
|
606
767
|
{
|
|
607
768
|
"success": true,
|
|
@@ -611,10 +772,44 @@ Move or rename a note in the vault.
|
|
|
611
772
|
}
|
|
612
773
|
```
|
|
613
774
|
|
|
775
|
+
### `move_file`
|
|
776
|
+
|
|
777
|
+
Move or rename any file in the vault with binary-safe file operations (file-only; not recursive directory moves). For safety, this tool requires confirmation of both source and destination paths.
|
|
778
|
+
|
|
779
|
+
**Request:**
|
|
780
|
+
|
|
781
|
+
```json
|
|
782
|
+
{
|
|
783
|
+
"name": "move_file",
|
|
784
|
+
"arguments": {
|
|
785
|
+
"oldPath": "Miro/attachments/Pasted image 20250812140124.png",
|
|
786
|
+
"newPath": "assets/images/Pasted image 20250812140124.png",
|
|
787
|
+
"confirmOldPath": "Miro/attachments/Pasted image 20250812140124.png",
|
|
788
|
+
"confirmNewPath": "assets/images/Pasted image 20250812140124.png",
|
|
789
|
+
"overwrite": false
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
```
|
|
793
|
+
|
|
794
|
+
**Response:**
|
|
795
|
+
|
|
796
|
+
```json
|
|
797
|
+
{
|
|
798
|
+
"success": true,
|
|
799
|
+
"oldPath": "Miro/attachments/Pasted image 20250812140124.png",
|
|
800
|
+
"newPath": "assets/images/Pasted image 20250812140124.png",
|
|
801
|
+
"message": "Successfully moved file from Miro/attachments/Pasted image 20250812140124.png to assets/images/Pasted image 20250812140124.png"
|
|
802
|
+
}
|
|
803
|
+
```
|
|
804
|
+
|
|
805
|
+
**Safety Note:** `confirmOldPath` must exactly match `oldPath`, and `confirmNewPath` must exactly match `newPath`, otherwise the move is rejected.
|
|
806
|
+
|
|
614
807
|
### `read_multiple_notes`
|
|
808
|
+
|
|
615
809
|
Read multiple notes in a batch (maximum 10 files).
|
|
616
810
|
|
|
617
811
|
**Request:**
|
|
812
|
+
|
|
618
813
|
```json
|
|
619
814
|
{
|
|
620
815
|
"name": "read_multiple_notes",
|
|
@@ -628,18 +823,31 @@ Read multiple notes in a batch (maximum 10 files).
|
|
|
628
823
|
```
|
|
629
824
|
|
|
630
825
|
**Response (optimized, shortened field names):**
|
|
826
|
+
|
|
631
827
|
```json
|
|
632
|
-
{
|
|
828
|
+
{
|
|
829
|
+
"ok": [
|
|
830
|
+
{
|
|
831
|
+
"path": "note1.md",
|
|
832
|
+
"frontmatter": { "title": "Note 1" },
|
|
833
|
+
"content": "# Note 1\n\nContent here..."
|
|
834
|
+
}
|
|
835
|
+
],
|
|
836
|
+
"err": [{ "path": "note2.md", "error": "File not found" }]
|
|
837
|
+
}
|
|
633
838
|
```
|
|
634
839
|
|
|
635
840
|
**Field names:**
|
|
841
|
+
|
|
636
842
|
- `ok` = successful reads
|
|
637
843
|
- `err` = failed reads
|
|
638
844
|
|
|
639
845
|
### `update_frontmatter`
|
|
846
|
+
|
|
640
847
|
Update frontmatter of a note without changing content.
|
|
641
848
|
|
|
642
849
|
**Request:**
|
|
850
|
+
|
|
643
851
|
```json
|
|
644
852
|
{
|
|
645
853
|
"name": "update_frontmatter",
|
|
@@ -655,6 +863,7 @@ Update frontmatter of a note without changing content.
|
|
|
655
863
|
```
|
|
656
864
|
|
|
657
865
|
**Response:**
|
|
866
|
+
|
|
658
867
|
```json
|
|
659
868
|
{
|
|
660
869
|
"message": "Successfully updated frontmatter for: research-note.md"
|
|
@@ -662,9 +871,11 @@ Update frontmatter of a note without changing content.
|
|
|
662
871
|
```
|
|
663
872
|
|
|
664
873
|
### `get_notes_info`
|
|
874
|
+
|
|
665
875
|
Get metadata for notes without reading full content.
|
|
666
876
|
|
|
667
877
|
**Request:**
|
|
878
|
+
|
|
668
879
|
```json
|
|
669
880
|
{
|
|
670
881
|
"name": "get_notes_info",
|
|
@@ -676,8 +887,49 @@ Get metadata for notes without reading full content.
|
|
|
676
887
|
```
|
|
677
888
|
|
|
678
889
|
**Response (optimized, returns array directly):**
|
|
890
|
+
|
|
891
|
+
```json
|
|
892
|
+
[
|
|
893
|
+
{
|
|
894
|
+
"path": "note1.md",
|
|
895
|
+
"size": 1024,
|
|
896
|
+
"modified": 1695456000000,
|
|
897
|
+
"hasFrontmatter": true
|
|
898
|
+
}
|
|
899
|
+
]
|
|
900
|
+
```
|
|
901
|
+
|
|
902
|
+
### `get_vault_stats`
|
|
903
|
+
|
|
904
|
+
Get high-level vault statistics without reading note contents.
|
|
905
|
+
|
|
906
|
+
**Request:**
|
|
907
|
+
|
|
908
|
+
```json
|
|
909
|
+
{
|
|
910
|
+
"name": "get_vault_stats",
|
|
911
|
+
"arguments": {
|
|
912
|
+
"recentCount": 5,
|
|
913
|
+
"prettyPrint": false
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
```
|
|
917
|
+
|
|
918
|
+
**Response (optimized):**
|
|
919
|
+
|
|
679
920
|
```json
|
|
680
|
-
|
|
921
|
+
{
|
|
922
|
+
"notes": 1248,
|
|
923
|
+
"folders": 76,
|
|
924
|
+
"size": 18349210,
|
|
925
|
+
"recent": [
|
|
926
|
+
{
|
|
927
|
+
"path": "Daily/2026-02-27.md",
|
|
928
|
+
"modified": 1772188800000,
|
|
929
|
+
"size": 2814
|
|
930
|
+
}
|
|
931
|
+
]
|
|
932
|
+
}
|
|
681
933
|
```
|
|
682
934
|
|
|
683
935
|
## Security Considerations
|
|
@@ -685,27 +937,32 @@ Get metadata for notes without reading full content.
|
|
|
685
937
|
This MCP server implements several security measures to protect your Obsidian vault:
|
|
686
938
|
|
|
687
939
|
### Path Security
|
|
940
|
+
|
|
688
941
|
- **Path Traversal Protection:** All file paths are validated to prevent access outside the vault
|
|
689
942
|
- **Relative Path Enforcement:** Paths are normalized and restricted to the vault directory
|
|
690
943
|
- **Symbolic Link Safety:** Resolved paths are checked against vault boundaries
|
|
691
944
|
|
|
692
945
|
### File Filtering
|
|
946
|
+
|
|
693
947
|
- **Automatic Exclusions:** `.obsidian`, `.git`, `node_modules`, and system files are filtered
|
|
694
|
-
- **Extension Whitelist:** Only `.md`, `.markdown`, and `.
|
|
948
|
+
- **Extension Whitelist:** Only `.md`, `.markdown`, `.txt`, `.base`, and `.canvas` files are accessible by default
|
|
695
949
|
- **Hidden File Protection:** Dot files and system directories are automatically excluded
|
|
696
950
|
|
|
697
951
|
### Content Validation
|
|
952
|
+
|
|
698
953
|
- **YAML Frontmatter Validation:** Frontmatter is parsed and validated before writing
|
|
699
954
|
- **Function/Symbol Prevention:** Dangerous JavaScript objects are blocked from frontmatter
|
|
700
955
|
- **Data Type Checking:** Only safe data types (strings, numbers, arrays, objects) allowed
|
|
701
956
|
|
|
702
957
|
### Best Practices
|
|
958
|
+
|
|
703
959
|
- **Least Privilege:** Server only accesses the specified vault directory
|
|
704
960
|
- **Read-Only by Default:** Consider running with read-only permissions for sensitive vaults
|
|
705
961
|
- **Backup Recommended:** Always backup your vault before using write operations
|
|
706
962
|
- **Network Isolation:** Server uses stdio transport (no network exposure)
|
|
707
963
|
|
|
708
964
|
### What's NOT Protected
|
|
965
|
+
|
|
709
966
|
- **File Content:** The server can read/write any allowed file content
|
|
710
967
|
- **Vault Structure:** Directory structure is visible to AI assistants
|
|
711
968
|
- **File Metadata:** Creation times, file sizes, etc. are accessible
|
|
@@ -719,6 +976,7 @@ This MCP server implements several security measures to protect your Obsidian va
|
|
|
719
976
|
- `src/filesystem.ts` - Safe file operations with path validation
|
|
720
977
|
- `src/pathfilter.ts` - Directory and file filtering
|
|
721
978
|
- `src/search.ts` - Note search functionality with content and frontmatter support
|
|
979
|
+
- `src/uri.ts` - Obsidian URI generation for deep links
|
|
722
980
|
- `src/types.ts` - TypeScript type definitions
|
|
723
981
|
|
|
724
982
|
## Contributing
|