@mauricio.wolff/mcp-obsidian 0.7.4 → 0.8.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/README.md +272 -20
- package/dist/server.js +63 -5
- package/dist/src/filesystem.js +127 -3
- package/dist/src/filesystem.test.js +189 -1
- package/dist/src/integration.test.js +31 -0
- package/dist/src/pathfilter.js +20 -5
- package/dist/src/pathfilter.test.js +16 -0
- package/dist/src/search.js +117 -42
- package/package.json +2 -1
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
|
|
@@ -136,20 +160,25 @@ npx @mauricio.wolff/mcp-obsidian@latest /path/to/your/obsidian/vault
|
|
|
136
160
|
|
|
137
161
|
1. Clone this repository
|
|
138
162
|
2. Use the correct Node.js version:
|
|
163
|
+
|
|
139
164
|
```bash
|
|
140
165
|
nvm use # Uses Node 24 from .nvmrc
|
|
141
166
|
```
|
|
167
|
+
|
|
142
168
|
3. Install dependencies with npm:
|
|
169
|
+
|
|
143
170
|
```bash
|
|
144
171
|
npm install # Corepack automatically uses npm 10.9.0
|
|
145
172
|
```
|
|
146
173
|
|
|
147
174
|
4. Test locally with MCP inspector:
|
|
175
|
+
|
|
148
176
|
```bash
|
|
149
177
|
npx @modelcontextprotocol/inspector npm start /path/to/your/vault
|
|
150
178
|
```
|
|
151
179
|
|
|
152
180
|
**Pro tip:** Use MCP Inspector to test all server functionality before configuring with AI clients:
|
|
181
|
+
|
|
153
182
|
```bash
|
|
154
183
|
# Install globally for easier access
|
|
155
184
|
npm install -g @modelcontextprotocol/inspector
|
|
@@ -163,11 +192,13 @@ mcp-inspector npx @mauricio.wolff/mcp-obsidian@latest /path/to/your/vault
|
|
|
163
192
|
### Running the Server
|
|
164
193
|
|
|
165
194
|
**End users:**
|
|
195
|
+
|
|
166
196
|
```bash
|
|
167
197
|
npx @mauricio.wolff/mcp-obsidian@latest /path/to/your/obsidian/vault
|
|
168
198
|
```
|
|
169
199
|
|
|
170
200
|
**Developers:**
|
|
201
|
+
|
|
171
202
|
```bash
|
|
172
203
|
npm start /path/to/your/obsidian/vault
|
|
173
204
|
```
|
|
@@ -179,39 +210,51 @@ npm start /path/to/your/obsidian/vault
|
|
|
179
210
|
Add to your Claude Desktop configuration file:
|
|
180
211
|
|
|
181
212
|
**Single Vault:**
|
|
213
|
+
|
|
182
214
|
```json
|
|
183
215
|
{
|
|
184
216
|
"mcpServers": {
|
|
185
217
|
"obsidian": {
|
|
186
218
|
"command": "npx",
|
|
187
|
-
"args": [
|
|
219
|
+
"args": [
|
|
220
|
+
"@mauricio.wolff/mcp-obsidian@latest",
|
|
221
|
+
"/Users/yourname/Documents/MyVault"
|
|
222
|
+
]
|
|
188
223
|
}
|
|
189
224
|
}
|
|
190
225
|
}
|
|
191
226
|
```
|
|
192
227
|
|
|
193
228
|
**Multiple Vaults:**
|
|
229
|
+
|
|
194
230
|
```json
|
|
195
231
|
{
|
|
196
232
|
"mcpServers": {
|
|
197
233
|
"obsidian-personal": {
|
|
198
234
|
"command": "npx",
|
|
199
|
-
"args": [
|
|
235
|
+
"args": [
|
|
236
|
+
"@mauricio.wolff/mcp-obsidian@latest",
|
|
237
|
+
"/Users/yourname/Documents/PersonalVault"
|
|
238
|
+
]
|
|
200
239
|
},
|
|
201
240
|
"obsidian-work": {
|
|
202
241
|
"command": "npx",
|
|
203
|
-
"args": [
|
|
242
|
+
"args": [
|
|
243
|
+
"@mauricio.wolff/mcp-obsidian@latest",
|
|
244
|
+
"/Users/yourname/Documents/WorkVault"
|
|
245
|
+
]
|
|
204
246
|
}
|
|
205
247
|
}
|
|
206
248
|
}
|
|
207
249
|
```
|
|
208
250
|
|
|
209
251
|
**Configuration File Locations:**
|
|
252
|
+
|
|
210
253
|
- **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
211
254
|
- **Windows:** `C:\Users\{username}\AppData\Roaming\Claude\claude_desktop_config.json`
|
|
212
255
|
- **Linux:** `~/.config/Claude/claude_desktop_config.json`
|
|
213
256
|
|
|
214
|
-
|
|
257
|
+
_You can also access this through Claude Desktop → Settings → Developer → Edit Config_
|
|
215
258
|
|
|
216
259
|
#### ChatGPT Desktop
|
|
217
260
|
|
|
@@ -223,7 +266,7 @@ ChatGPT uses MCP through Deep Research and developer mode. Configuration is done
|
|
|
223
266
|
2. Configure MCP servers through the built-in MCP client
|
|
224
267
|
3. Create custom connectors for your organization
|
|
225
268
|
|
|
226
|
-
|
|
269
|
+
_Note: ChatGPT Desktop's MCP integration is currently limited to enterprise subscriptions and uses a different setup process than file-based configuration._
|
|
227
270
|
|
|
228
271
|
#### Claude Code
|
|
229
272
|
|
|
@@ -231,6 +274,7 @@ Claude Code uses `.claude.json` configuration file:
|
|
|
231
274
|
|
|
232
275
|
**User-scoped (recommended):**
|
|
233
276
|
Edit `~/.claude.json`:
|
|
277
|
+
|
|
234
278
|
```json
|
|
235
279
|
{
|
|
236
280
|
"mcpServers": {
|
|
@@ -245,6 +289,7 @@ Edit `~/.claude.json`:
|
|
|
245
289
|
|
|
246
290
|
**Project-scoped:**
|
|
247
291
|
Edit `.claude.json` in your project or add to the projects section:
|
|
292
|
+
|
|
248
293
|
```json
|
|
249
294
|
{
|
|
250
295
|
"projects": {
|
|
@@ -261,6 +306,7 @@ Edit `.claude.json` in your project or add to the projects section:
|
|
|
261
306
|
```
|
|
262
307
|
|
|
263
308
|
**Using Claude Code CLI:**
|
|
309
|
+
|
|
264
310
|
```bash
|
|
265
311
|
claude mcp add obsidian --scope user npx @mauricio.wolff/mcp-obsidian /path/to/your/vault
|
|
266
312
|
```
|
|
@@ -276,6 +322,7 @@ npx @mauricio.wolff/mcp-obsidian@latest /path/to/your/vault
|
|
|
276
322
|
#### Other MCP-Compatible Clients (2025)
|
|
277
323
|
|
|
278
324
|
**Confirmed MCP Support:**
|
|
325
|
+
|
|
279
326
|
- **IntelliJ IDEA 2025.1+** - Native MCP client support
|
|
280
327
|
- **Cursor IDE** - Built-in MCP compatibility
|
|
281
328
|
- **Windsurf IDE** - Full MCP integration
|
|
@@ -287,11 +334,13 @@ Most modern MCP clients use similar JSON configuration patterns. Refer to your s
|
|
|
287
334
|
### Examples
|
|
288
335
|
|
|
289
336
|
#### Ask your AI assistant about your notes:
|
|
337
|
+
|
|
290
338
|
- "What files are in my Obsidian vault?"
|
|
291
339
|
- "Read my note called 'project-ideas.md'"
|
|
292
340
|
- "Show me all notes with 'AI' in the title"
|
|
293
341
|
|
|
294
342
|
#### Have your AI assistant help with note management:
|
|
343
|
+
|
|
295
344
|
- "Create a new note called 'meeting-notes.md' with today's date in the frontmatter"
|
|
296
345
|
- "Append today's journal entry to my daily note"
|
|
297
346
|
- "Prepend an urgent task to my todo list"
|
|
@@ -302,6 +351,7 @@ Most modern MCP clients use similar JSON configuration patterns. Refer to your s
|
|
|
302
351
|
- "Delete the old draft note 'draft-ideas.md' (with confirmation)"
|
|
303
352
|
|
|
304
353
|
#### Advanced Use Cases:
|
|
354
|
+
|
|
305
355
|
- **Knowledge Synthesis**: "Summarize all my research notes tagged with 'machine-learning' from the last month"
|
|
306
356
|
- **Project Management**: "Update the status in all project notes to 'completed' and add today's date"
|
|
307
357
|
- **Content Analysis**: "Find all notes that mention 'API design' and create a comprehensive guide"
|
|
@@ -312,22 +362,27 @@ Most modern MCP clients use similar JSON configuration patterns. Refer to your s
|
|
|
312
362
|
### Common Issues
|
|
313
363
|
|
|
314
364
|
#### "command not found: npx"
|
|
365
|
+
|
|
315
366
|
- **Solution:** Install Node.js runtime from [nodejs.org](https://nodejs.org)
|
|
316
367
|
- **Alternative:** Use global install: `npm install -g @mauricio.wolff/mcp-obsidian`
|
|
317
368
|
|
|
318
369
|
#### "Usage: node server.ts /path/to/vault"
|
|
370
|
+
|
|
319
371
|
- **Cause:** No vault path provided
|
|
320
372
|
- **Solution:** Specify the full path to your Obsidian vault directory
|
|
321
373
|
|
|
322
374
|
#### "Permission denied" errors
|
|
375
|
+
|
|
323
376
|
- **Cause:** Insufficient file system permissions
|
|
324
377
|
- **Solution:** Ensure the vault directory is readable/writable by your user
|
|
325
378
|
|
|
326
379
|
#### "Path traversal not allowed"
|
|
380
|
+
|
|
327
381
|
- **Cause:** Trying to access files outside the vault
|
|
328
382
|
- **Solution:** All file paths must be relative to the vault root
|
|
329
383
|
|
|
330
384
|
#### AI client not recognizing the server
|
|
385
|
+
|
|
331
386
|
1. Check the configuration file path is correct for your OS
|
|
332
387
|
2. Ensure JSON syntax is valid (use a JSON validator)
|
|
333
388
|
3. Restart your AI client after configuration changes
|
|
@@ -335,12 +390,14 @@ Most modern MCP clients use similar JSON configuration patterns. Refer to your s
|
|
|
335
390
|
5. Verify your AI client supports MCP (Model Context Protocol)
|
|
336
391
|
|
|
337
392
|
#### ".obsidian files still showing up"
|
|
393
|
+
|
|
338
394
|
- **Expected:** The path filter automatically excludes `.obsidian/**` patterns
|
|
339
395
|
- **If still seeing them:** The filter is working as designed for security
|
|
340
396
|
|
|
341
397
|
### Debug Mode
|
|
342
398
|
|
|
343
399
|
Run with error logging:
|
|
400
|
+
|
|
344
401
|
```bash
|
|
345
402
|
npx @mauricio.wolff/mcp-obsidian /path/to/vault 2>debug.log
|
|
346
403
|
```
|
|
@@ -354,6 +411,7 @@ npx @mauricio.wolff/mcp-obsidian /path/to/vault 2>debug.log
|
|
|
354
411
|
## Testing
|
|
355
412
|
|
|
356
413
|
Run the test suite:
|
|
414
|
+
|
|
357
415
|
```bash
|
|
358
416
|
npm test
|
|
359
417
|
```
|
|
@@ -361,9 +419,11 @@ npm test
|
|
|
361
419
|
## API Methods
|
|
362
420
|
|
|
363
421
|
### `read_note`
|
|
422
|
+
|
|
364
423
|
Read a note from the vault with parsed frontmatter.
|
|
365
424
|
|
|
366
425
|
**Request:**
|
|
426
|
+
|
|
367
427
|
```json
|
|
368
428
|
{
|
|
369
429
|
"name": "read_note",
|
|
@@ -375,11 +435,20 @@ Read a note from the vault with parsed frontmatter.
|
|
|
375
435
|
```
|
|
376
436
|
|
|
377
437
|
**Response (optimized for tokens):**
|
|
438
|
+
|
|
378
439
|
```json
|
|
379
|
-
{
|
|
440
|
+
{
|
|
441
|
+
"fm": {
|
|
442
|
+
"title": "Project Ideas",
|
|
443
|
+
"tags": ["projects", "brainstorming"],
|
|
444
|
+
"created": "2023-01-15T10:30:00.000Z"
|
|
445
|
+
},
|
|
446
|
+
"content": "# Project Ideas\n\n## AI Tools\n- MCP server for Obsidian\n- Voice note transcription\n\n## Web Apps\n- Task management system"
|
|
447
|
+
}
|
|
380
448
|
```
|
|
381
449
|
|
|
382
450
|
**Response (with prettyPrint: true):**
|
|
451
|
+
|
|
383
452
|
```json
|
|
384
453
|
{
|
|
385
454
|
"fm": {
|
|
@@ -392,14 +461,17 @@ Read a note from the vault with parsed frontmatter.
|
|
|
392
461
|
```
|
|
393
462
|
|
|
394
463
|
### `write_note`
|
|
464
|
+
|
|
395
465
|
Write a note to the vault with optional frontmatter and write mode.
|
|
396
466
|
|
|
397
467
|
**Write Modes:**
|
|
468
|
+
|
|
398
469
|
- `overwrite` (default): Replace entire file content
|
|
399
470
|
- `append`: Add content to the end of existing file
|
|
400
471
|
- `prepend`: Add content to the beginning of existing file
|
|
401
472
|
|
|
402
473
|
**Request (Overwrite):**
|
|
474
|
+
|
|
403
475
|
```json
|
|
404
476
|
{
|
|
405
477
|
"name": "write_note",
|
|
@@ -417,6 +489,7 @@ Write a note to the vault with optional frontmatter and write mode.
|
|
|
417
489
|
```
|
|
418
490
|
|
|
419
491
|
**Request (Append):**
|
|
492
|
+
|
|
420
493
|
```json
|
|
421
494
|
{
|
|
422
495
|
"name": "write_note",
|
|
@@ -429,16 +502,61 @@ Write a note to the vault with optional frontmatter and write mode.
|
|
|
429
502
|
```
|
|
430
503
|
|
|
431
504
|
**Response:**
|
|
505
|
+
|
|
432
506
|
```json
|
|
433
507
|
{
|
|
434
508
|
"message": "Successfully wrote note: meeting-notes.md (mode: overwrite)"
|
|
435
509
|
}
|
|
436
510
|
```
|
|
437
511
|
|
|
512
|
+
### `patch_note`
|
|
513
|
+
|
|
514
|
+
Efficiently replace an exact string inside an existing note without rewriting the full file.
|
|
515
|
+
|
|
516
|
+
**Request:**
|
|
517
|
+
|
|
518
|
+
```json
|
|
519
|
+
{
|
|
520
|
+
"name": "patch_note",
|
|
521
|
+
"arguments": {
|
|
522
|
+
"path": "meeting-notes.md",
|
|
523
|
+
"oldString": "- Next milestones",
|
|
524
|
+
"newString": "- Next milestones (owner: Alex)",
|
|
525
|
+
"replaceAll": false
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
**Response (success):**
|
|
531
|
+
|
|
532
|
+
```json
|
|
533
|
+
{
|
|
534
|
+
"success": true,
|
|
535
|
+
"path": "meeting-notes.md",
|
|
536
|
+
"message": "Successfully replaced 1 occurrence",
|
|
537
|
+
"matchCount": 1
|
|
538
|
+
}
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
**Response (multiple matches with replaceAll=false):**
|
|
542
|
+
|
|
543
|
+
```json
|
|
544
|
+
{
|
|
545
|
+
"success": false,
|
|
546
|
+
"path": "meeting-notes.md",
|
|
547
|
+
"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.",
|
|
548
|
+
"matchCount": 3
|
|
549
|
+
}
|
|
550
|
+
```
|
|
551
|
+
|
|
438
552
|
### `list_directory`
|
|
553
|
+
|
|
439
554
|
List files and directories in the vault.
|
|
440
555
|
|
|
556
|
+
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`).
|
|
557
|
+
|
|
441
558
|
**Request:**
|
|
559
|
+
|
|
442
560
|
```json
|
|
443
561
|
{
|
|
444
562
|
"name": "list_directory",
|
|
@@ -450,14 +568,20 @@ List files and directories in the vault.
|
|
|
450
568
|
```
|
|
451
569
|
|
|
452
570
|
**Response (optimized):**
|
|
571
|
+
|
|
453
572
|
```json
|
|
454
|
-
{
|
|
573
|
+
{
|
|
574
|
+
"dirs": ["AI-Tools", "Web-Development"],
|
|
575
|
+
"files": ["project-template.md", "roadmap.md"]
|
|
576
|
+
}
|
|
455
577
|
```
|
|
456
578
|
|
|
457
579
|
### `delete_note`
|
|
580
|
+
|
|
458
581
|
Delete a note from the vault (requires confirmation for safety).
|
|
459
582
|
|
|
460
583
|
**Request:**
|
|
584
|
+
|
|
461
585
|
```json
|
|
462
586
|
{
|
|
463
587
|
"name": "delete_note",
|
|
@@ -469,6 +593,7 @@ Delete a note from the vault (requires confirmation for safety).
|
|
|
469
593
|
```
|
|
470
594
|
|
|
471
595
|
**Response (Success):**
|
|
596
|
+
|
|
472
597
|
```json
|
|
473
598
|
{
|
|
474
599
|
"success": true,
|
|
@@ -478,6 +603,7 @@ Delete a note from the vault (requires confirmation for safety).
|
|
|
478
603
|
```
|
|
479
604
|
|
|
480
605
|
**Response (Confirmation Failed):**
|
|
606
|
+
|
|
481
607
|
```json
|
|
482
608
|
{
|
|
483
609
|
"success": false,
|
|
@@ -489,9 +615,11 @@ Delete a note from the vault (requires confirmation for safety).
|
|
|
489
615
|
**⚠️ Safety Note:** The `confirmPath` parameter must exactly match the `path` parameter to proceed with deletion. This prevents accidental deletions.
|
|
490
616
|
|
|
491
617
|
### `get_frontmatter`
|
|
618
|
+
|
|
492
619
|
Extract only the frontmatter from a note without reading the full content.
|
|
493
620
|
|
|
494
621
|
**Request:**
|
|
622
|
+
|
|
495
623
|
```json
|
|
496
624
|
{
|
|
497
625
|
"name": "get_frontmatter",
|
|
@@ -503,14 +631,21 @@ Extract only the frontmatter from a note without reading the full content.
|
|
|
503
631
|
```
|
|
504
632
|
|
|
505
633
|
**Response (optimized, returns frontmatter directly):**
|
|
634
|
+
|
|
506
635
|
```json
|
|
507
|
-
{
|
|
636
|
+
{
|
|
637
|
+
"title": "Project Ideas",
|
|
638
|
+
"tags": ["projects", "brainstorming"],
|
|
639
|
+
"created": "2023-01-15T10:30:00.000Z"
|
|
640
|
+
}
|
|
508
641
|
```
|
|
509
642
|
|
|
510
643
|
### `manage_tags`
|
|
644
|
+
|
|
511
645
|
Add, remove, or list tags in a note. Tags are managed in the frontmatter and inline tags are detected.
|
|
512
646
|
|
|
513
647
|
**Request (List Tags):**
|
|
648
|
+
|
|
514
649
|
```json
|
|
515
650
|
{
|
|
516
651
|
"name": "manage_tags",
|
|
@@ -522,6 +657,7 @@ Add, remove, or list tags in a note. Tags are managed in the frontmatter and inl
|
|
|
522
657
|
```
|
|
523
658
|
|
|
524
659
|
**Request (Add Tags):**
|
|
660
|
+
|
|
525
661
|
```json
|
|
526
662
|
{
|
|
527
663
|
"name": "manage_tags",
|
|
@@ -534,6 +670,7 @@ Add, remove, or list tags in a note. Tags are managed in the frontmatter and inl
|
|
|
534
670
|
```
|
|
535
671
|
|
|
536
672
|
**Request (Remove Tags):**
|
|
673
|
+
|
|
537
674
|
```json
|
|
538
675
|
{
|
|
539
676
|
"name": "manage_tags",
|
|
@@ -546,6 +683,7 @@ Add, remove, or list tags in a note. Tags are managed in the frontmatter and inl
|
|
|
546
683
|
```
|
|
547
684
|
|
|
548
685
|
**Response:**
|
|
686
|
+
|
|
549
687
|
```json
|
|
550
688
|
{
|
|
551
689
|
"path": "research-notes.md",
|
|
@@ -557,9 +695,11 @@ Add, remove, or list tags in a note. Tags are managed in the frontmatter and inl
|
|
|
557
695
|
```
|
|
558
696
|
|
|
559
697
|
### `search_notes`
|
|
560
|
-
|
|
698
|
+
|
|
699
|
+
Search for notes in the vault by content or frontmatter with multi-word matching and BM25 relevance reranking.
|
|
561
700
|
|
|
562
701
|
**Request:**
|
|
702
|
+
|
|
563
703
|
```json
|
|
564
704
|
{
|
|
565
705
|
"name": "search_notes",
|
|
@@ -575,21 +715,35 @@ Search for notes in the vault by content or frontmatter.
|
|
|
575
715
|
```
|
|
576
716
|
|
|
577
717
|
**Response (optimized with minified field names):**
|
|
718
|
+
|
|
578
719
|
```json
|
|
579
|
-
[
|
|
720
|
+
[
|
|
721
|
+
{
|
|
722
|
+
"p": "ai-research.md",
|
|
723
|
+
"t": "AI Research Notes",
|
|
724
|
+
"ex": "...machine learning...",
|
|
725
|
+
"mc": 2,
|
|
726
|
+
"ln": 15,
|
|
727
|
+
"uri": "obsidian://open?vault=MyVault&file=ai-research.md"
|
|
728
|
+
}
|
|
729
|
+
]
|
|
580
730
|
```
|
|
581
731
|
|
|
582
732
|
**Field names:**
|
|
733
|
+
|
|
583
734
|
- `p` = path
|
|
584
735
|
- `t` = title
|
|
585
736
|
- `ex` = excerpt (21 chars context)
|
|
586
737
|
- `mc` = match count
|
|
587
738
|
- `ln` = line number
|
|
739
|
+
- `uri` = Obsidian deep link for quick opening
|
|
588
740
|
|
|
589
741
|
### `move_note`
|
|
590
|
-
|
|
742
|
+
|
|
743
|
+
Move or rename a note in the vault (`.md`, `.markdown`, `.txt`).
|
|
591
744
|
|
|
592
745
|
**Request:**
|
|
746
|
+
|
|
593
747
|
```json
|
|
594
748
|
{
|
|
595
749
|
"name": "move_note",
|
|
@@ -602,6 +756,7 @@ Move or rename a note in the vault.
|
|
|
602
756
|
```
|
|
603
757
|
|
|
604
758
|
**Response:**
|
|
759
|
+
|
|
605
760
|
```json
|
|
606
761
|
{
|
|
607
762
|
"success": true,
|
|
@@ -611,10 +766,44 @@ Move or rename a note in the vault.
|
|
|
611
766
|
}
|
|
612
767
|
```
|
|
613
768
|
|
|
769
|
+
### `move_file`
|
|
770
|
+
|
|
771
|
+
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.
|
|
772
|
+
|
|
773
|
+
**Request:**
|
|
774
|
+
|
|
775
|
+
```json
|
|
776
|
+
{
|
|
777
|
+
"name": "move_file",
|
|
778
|
+
"arguments": {
|
|
779
|
+
"oldPath": "Miro/attachments/Pasted image 20250812140124.png",
|
|
780
|
+
"newPath": "assets/images/Pasted image 20250812140124.png",
|
|
781
|
+
"confirmOldPath": "Miro/attachments/Pasted image 20250812140124.png",
|
|
782
|
+
"confirmNewPath": "assets/images/Pasted image 20250812140124.png",
|
|
783
|
+
"overwrite": false
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
```
|
|
787
|
+
|
|
788
|
+
**Response:**
|
|
789
|
+
|
|
790
|
+
```json
|
|
791
|
+
{
|
|
792
|
+
"success": true,
|
|
793
|
+
"oldPath": "Miro/attachments/Pasted image 20250812140124.png",
|
|
794
|
+
"newPath": "assets/images/Pasted image 20250812140124.png",
|
|
795
|
+
"message": "Successfully moved file from Miro/attachments/Pasted image 20250812140124.png to assets/images/Pasted image 20250812140124.png"
|
|
796
|
+
}
|
|
797
|
+
```
|
|
798
|
+
|
|
799
|
+
**Safety Note:** `confirmOldPath` must exactly match `oldPath`, and `confirmNewPath` must exactly match `newPath`, otherwise the move is rejected.
|
|
800
|
+
|
|
614
801
|
### `read_multiple_notes`
|
|
802
|
+
|
|
615
803
|
Read multiple notes in a batch (maximum 10 files).
|
|
616
804
|
|
|
617
805
|
**Request:**
|
|
806
|
+
|
|
618
807
|
```json
|
|
619
808
|
{
|
|
620
809
|
"name": "read_multiple_notes",
|
|
@@ -628,18 +817,31 @@ Read multiple notes in a batch (maximum 10 files).
|
|
|
628
817
|
```
|
|
629
818
|
|
|
630
819
|
**Response (optimized, shortened field names):**
|
|
820
|
+
|
|
631
821
|
```json
|
|
632
|
-
{
|
|
822
|
+
{
|
|
823
|
+
"ok": [
|
|
824
|
+
{
|
|
825
|
+
"path": "note1.md",
|
|
826
|
+
"frontmatter": { "title": "Note 1" },
|
|
827
|
+
"content": "# Note 1\n\nContent here..."
|
|
828
|
+
}
|
|
829
|
+
],
|
|
830
|
+
"err": [{ "path": "note2.md", "error": "File not found" }]
|
|
831
|
+
}
|
|
633
832
|
```
|
|
634
833
|
|
|
635
834
|
**Field names:**
|
|
835
|
+
|
|
636
836
|
- `ok` = successful reads
|
|
637
837
|
- `err` = failed reads
|
|
638
838
|
|
|
639
839
|
### `update_frontmatter`
|
|
840
|
+
|
|
640
841
|
Update frontmatter of a note without changing content.
|
|
641
842
|
|
|
642
843
|
**Request:**
|
|
844
|
+
|
|
643
845
|
```json
|
|
644
846
|
{
|
|
645
847
|
"name": "update_frontmatter",
|
|
@@ -655,6 +857,7 @@ Update frontmatter of a note without changing content.
|
|
|
655
857
|
```
|
|
656
858
|
|
|
657
859
|
**Response:**
|
|
860
|
+
|
|
658
861
|
```json
|
|
659
862
|
{
|
|
660
863
|
"message": "Successfully updated frontmatter for: research-note.md"
|
|
@@ -662,9 +865,11 @@ Update frontmatter of a note without changing content.
|
|
|
662
865
|
```
|
|
663
866
|
|
|
664
867
|
### `get_notes_info`
|
|
868
|
+
|
|
665
869
|
Get metadata for notes without reading full content.
|
|
666
870
|
|
|
667
871
|
**Request:**
|
|
872
|
+
|
|
668
873
|
```json
|
|
669
874
|
{
|
|
670
875
|
"name": "get_notes_info",
|
|
@@ -676,8 +881,49 @@ Get metadata for notes without reading full content.
|
|
|
676
881
|
```
|
|
677
882
|
|
|
678
883
|
**Response (optimized, returns array directly):**
|
|
884
|
+
|
|
679
885
|
```json
|
|
680
|
-
[
|
|
886
|
+
[
|
|
887
|
+
{
|
|
888
|
+
"path": "note1.md",
|
|
889
|
+
"size": 1024,
|
|
890
|
+
"modified": 1695456000000,
|
|
891
|
+
"hasFrontmatter": true
|
|
892
|
+
}
|
|
893
|
+
]
|
|
894
|
+
```
|
|
895
|
+
|
|
896
|
+
### `get_vault_stats`
|
|
897
|
+
|
|
898
|
+
Get high-level vault statistics without reading note contents.
|
|
899
|
+
|
|
900
|
+
**Request:**
|
|
901
|
+
|
|
902
|
+
```json
|
|
903
|
+
{
|
|
904
|
+
"name": "get_vault_stats",
|
|
905
|
+
"arguments": {
|
|
906
|
+
"recentCount": 5,
|
|
907
|
+
"prettyPrint": false
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
```
|
|
911
|
+
|
|
912
|
+
**Response (optimized):**
|
|
913
|
+
|
|
914
|
+
```json
|
|
915
|
+
{
|
|
916
|
+
"notes": 1248,
|
|
917
|
+
"folders": 76,
|
|
918
|
+
"size": 18349210,
|
|
919
|
+
"recent": [
|
|
920
|
+
{
|
|
921
|
+
"path": "Daily/2026-02-27.md",
|
|
922
|
+
"modified": 1772188800000,
|
|
923
|
+
"size": 2814
|
|
924
|
+
}
|
|
925
|
+
]
|
|
926
|
+
}
|
|
681
927
|
```
|
|
682
928
|
|
|
683
929
|
## Security Considerations
|
|
@@ -685,27 +931,32 @@ Get metadata for notes without reading full content.
|
|
|
685
931
|
This MCP server implements several security measures to protect your Obsidian vault:
|
|
686
932
|
|
|
687
933
|
### Path Security
|
|
934
|
+
|
|
688
935
|
- **Path Traversal Protection:** All file paths are validated to prevent access outside the vault
|
|
689
936
|
- **Relative Path Enforcement:** Paths are normalized and restricted to the vault directory
|
|
690
937
|
- **Symbolic Link Safety:** Resolved paths are checked against vault boundaries
|
|
691
938
|
|
|
692
939
|
### File Filtering
|
|
940
|
+
|
|
693
941
|
- **Automatic Exclusions:** `.obsidian`, `.git`, `node_modules`, and system files are filtered
|
|
694
942
|
- **Extension Whitelist:** Only `.md`, `.markdown`, and `.txt` files are accessible by default
|
|
695
943
|
- **Hidden File Protection:** Dot files and system directories are automatically excluded
|
|
696
944
|
|
|
697
945
|
### Content Validation
|
|
946
|
+
|
|
698
947
|
- **YAML Frontmatter Validation:** Frontmatter is parsed and validated before writing
|
|
699
948
|
- **Function/Symbol Prevention:** Dangerous JavaScript objects are blocked from frontmatter
|
|
700
949
|
- **Data Type Checking:** Only safe data types (strings, numbers, arrays, objects) allowed
|
|
701
950
|
|
|
702
951
|
### Best Practices
|
|
952
|
+
|
|
703
953
|
- **Least Privilege:** Server only accesses the specified vault directory
|
|
704
954
|
- **Read-Only by Default:** Consider running with read-only permissions for sensitive vaults
|
|
705
955
|
- **Backup Recommended:** Always backup your vault before using write operations
|
|
706
956
|
- **Network Isolation:** Server uses stdio transport (no network exposure)
|
|
707
957
|
|
|
708
958
|
### What's NOT Protected
|
|
959
|
+
|
|
709
960
|
- **File Content:** The server can read/write any allowed file content
|
|
710
961
|
- **Vault Structure:** Directory structure is visible to AI assistants
|
|
711
962
|
- **File Metadata:** Creation times, file sizes, etc. are accessible
|
|
@@ -719,6 +970,7 @@ This MCP server implements several security measures to protect your Obsidian va
|
|
|
719
970
|
- `src/filesystem.ts` - Safe file operations with path validation
|
|
720
971
|
- `src/pathfilter.ts` - Directory and file filtering
|
|
721
972
|
- `src/search.ts` - Note search functionality with content and frontmatter support
|
|
973
|
+
- `src/uri.ts` - Obsidian URI generation for deep links
|
|
722
974
|
- `src/types.ts` - TypeScript type definitions
|
|
723
975
|
|
|
724
976
|
## Contributing
|