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