A Model Context Protocol (MCP) server that provides AI assistants with direct access to Obsidian vaults.
This server enables AI assistants to read, write, search, and analyze Obsidian markdown notes with error handling and memory optimization.
- 42 tools for vault operations
- Memory-optimized for large vaults (50KB+ files)
- Structured error reporting - no silent failures
- Performance helpers for streaming large files
- Conversation-aware cache - 50MB file cache, 10MB search cache
obsidian_create_file- Create new notes with content and frontmatterobsidian_read_file- Read note content (cached for performance)obsidian_update_file- Update existing notes preserving frontmatterobsidian_delete_file- Delete notes with confirmationobsidian_rename_file- Rename/move notes with link updatesobsidian_list_files- List markdown notes with filtering and sortingobsidian_read_multiple_files- Read multiple notes in one operationobsidian_delete_folder- Delete folders with safety checks:- Requires explicit confirmation
- Empty folder check (unless forced)
- Returns success/failure status
obsidian_list_folders- List all vault folders:- Regex pattern filtering
- Option to exclude empty folders
- Sorted alphabetically
obsidian_check_folder_empty- Verify if a folder contains filesobsidian_get_file_size- Get file sizes:- Raw bytes or human-readable format (KB, MB, GB)
obsidian_list_all_files- List all files types (not just .md):- Glob pattern support
- Optional size information
- Configurable result limit
obsidian_ensure_folder- Create folders idempotently:- Creates parent directories if needed
- Reports if folder was created or existed
obsidian_edit_file- Edit files by replacing specific text sections:- Supports multiple edits in one operation
- Preview mode (dryRun) to see changes before applying
- Shows diff of changes made
- Only writes to disk if changes occur
- Efficient for small edits in large files
obsidian_search_text- Full-text search across vaultobsidian_search_by_tags- Find notes by tagsobsidian_search_by_links- Find notes by link relationshipsobsidian_search_by_date- Find notes by creation/modification dateobsidian_search_advanced- Multi-criteria searchobsidian_find_similar_notes- Find content-similar notes
obsidian_get_frontmatter- Read note frontmatterobsidian_update_frontmatter- Update frontmatterobsidian_get_tags- Get tags from a noteobsidian_add_tags- Add tags to notesobsidian_remove_tags- Remove tags from notesobsidian_find_by_frontmatter- Search by frontmatter fields
obsidian_get_backlinks- Find notes linking to a noteobsidian_get_forward_links- Find notes linked from a noteobsidian_find_orphaned_notes- Find unlinked notesobsidian_get_note_connections- Get all connections for a noteobsidian_find_most_connected_notes- Find hub notesobsidian_find_path_between_notes- Find link paths between notesobsidian_get_graph_stats- Get vault graph statistics
obsidian_get_vault_stats- Vault statisticsobsidian_create_daily_note- Create daily notes with templatesobsidian_apply_template- Apply templates to new notesobsidian_find_broken_links- Find broken internal linksobsidian_find_duplicate_notes- Find similar/duplicate contentobsidian_cleanup_vault- Vault maintenance operations
obsidian_get_all_tags- Get all unique tags in vaultobsidian_export_vault_structure- Export vault structureobsidian_test- Test server connectivity
The obsidian_edit_file tool is perfect for making small changes to large files:
// Preview changes first
obsidian-mcp:obsidian_edit_file({
path: "my-note",
dryRun: true,
edits: [
{ oldText: "TODO", newText: "DONE" },
{ oldText: "draft", newText: "final", replaceAll: true }
]
})
// Apply the changes
obsidian-mcp:obsidian_edit_file({
path: "my-note",
edits: [
{ oldText: "TODO", newText: "DONE" }
]
})// Read a file
obsidian-mcp:obsidian_read_file({ path: "daily/2024-01-13" })
// Create a new file with frontmatter
obsidian-mcp:obsidian_create_file({
path: "projects/new-idea",
content: "# New Project\n\nDescription here...",
frontmatter: {
tags: ["project", "active"],
created: "2024-01-13"
}
})// Search for text
obsidian-mcp:obsidian_search_text({
query: "machine learning",
caseSensitive: false,
limit: 10
})
// Find notes by tags
obsidian-mcp:obsidian_search_by_tags({
tags: ["important", "todo"],
matchAll: true
})- String comparison limit: 50KB (larger files use hash comparison)
- Levenshtein algorithm limit: 1KB strings maximum
- Large file handling: Streaming for files >5MB
- Batch processing: 20 files concurrent max
- Conversation cache: 50MB for files, 10MB for searches (1hr/30min TTL)
All operations return structured responses:
{
"success": true,
"data": { /* results */ },
"errors": [ /* any errors */ ],
"metadata": {
"totalProcessed": 100,
"successCount": 98,
"errorCount": 2
}
}- Max Levenshtein string length: 1,000 characters
- Max content comparison size: 50KB
- Large file threshold: 5MB (uses streaming)
- Batch processing size: 20 files
- Node.js 18.0.0 or higher
- npm or yarn
- An Obsidian vault
-
Clone the repository:
git clone https://github.com/quanticsoul4772/obsidian-mcp.git cd obsidian-mcp -
Install dependencies:
npm install
-
Build the project:
npm run build
-
Configure Claude Desktop (see Configuration section)
The server requires the vault path as a command line argument:
Add to your Claude Desktop MCP settings:
{
"obsidian": {
"command": "node",
"args": ["/path/to/obsidian-mcp/build/index.js", "/path/to/your/obsidian/vault"]
}
}node build/index.js /path/to/your/obsidian/vault- No authentication needed (AI assistant access only)
- Conversation-aware caching for repeated operations
- No complex logging (can't persist between chats)
- Partial results on errors (operations continue)
- Hash comparison for duplicate detection on large files
- Cache automatically invalidates on file modifications
-
"Vault path is required" error
- Ensure vault path is provided as second argument in Claude Desktop config
- Path must be absolute, not relative
-
"Tool not found" errors
- All tools require the
obsidian-mcp:prefix - Example:
obsidian-mcp:obsidian_read_file
- All tools require the
-
Permission errors
- Ensure the vault directory is readable/writable
- Check file permissions on your operating system
-
Large vault performance
- Use filtering options to limit results
- Cache warming may take a moment on first operations
- Consider using
limitparameter on list operations
- Run TypeScript compiler in watch mode:
tsc --watch - Test specific tools:
node build/index.js /path/to/test/vault - Check cache statistics in responses for performance tuning
Contributions are welcome! Please:
- Follow the existing code patterns
- Add tests for new functionality
- Update documentation
- Ensure TypeScript compilation succeeds