The Obsidian MCP Server enables AI assistants to interact with an Obsidian vault for comprehensive note management and organization:
- Note operations: Read, create, update (replace or append), and delete notes
- Smart search: Find notes by content, tags, path, modification date, or Obsidian search syntax
- Organization: Create, move, and manage folders and notes, including bulk operations
- Tag management: Add, remove, or update tags; list all unique tags with usage counts
- Link analysis: Examine backlinks, outgoing links, and identify broken links
- Metadata: Retrieve statistics like word count, size, and link analysis
- AI-optimized: Designed for seamless integration with clear error messages and smart defaults
- Secure: Uses API key authentication and local-only connections
- Performance: Optimized for large vaults using concurrent operations and batching
Provides tools for reading, creating, searching, and managing notes in an Obsidian vault through the Local REST API plugin, enabling operations like listing notes by directory, reading note content, creating/updating notes, and performing text searches.
Obsidian MCP Server
A Model Context Protocol (MCP) server that enables AI assistants like Claude to interact with your Obsidian vault. This server provides tools for reading, creating, searching, and managing notes in Obsidian through the Local REST API plugin.
Features
- 📖 Read & write notes - Full access to your Obsidian vault with automatic overwrite protection
- 🔍 Smart search - Find notes by content, tags, or modification date
- 📁 Browse vault - List and navigate your notes and folders by directory
- 🏷️ Tag management - Add, remove, and organize tags (supports both frontmatter and inline tags)
- 🔗 Link management - Find backlinks, analyze outgoing links, and identify broken links
- 📊 Note insights - Get statistics like word count and link analysis
- 🎯 AI-optimized - Clear error messages and smart defaults for better AI interactions
- 🔒 Secure - API key authentication with local-only connections
- ⚡ Performance optimized - Concurrent operations and batching for large vaults
- 🚀 Bulk operations - Create folder hierarchies and move entire folders with all their contents
Prerequisites
- Obsidian with the Local REST API plugin installed and enabled
- Python 3.10+ installed on your system
- Node.js (optional, for running MCP Inspector)
Installation
Quick Install
- Install and configure Obsidian:
- Install the Local REST API plugin in Obsidian
- Enable the plugin in Settings > Community plugins
- Go to Settings > Local REST API
- Copy your API key (you'll need this for step 2)
- Configure your AI tool:Edit your Claude Desktop config file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- Windows:
%APPDATA%\Claude\claude_desktop_config.json
Add to your Cursor settings:
- Project-specific:
.cursor/mcp.json
in your project directory - Global:
~/.cursor/mcp.json
in your home directory
Then: Open Settings → Cursor Settings → Enable MCP
Edit your Windsurf config file:
- Location:
~/.codeium/windsurf/mcp_config.json
Then: Open Windsurf Settings → Advanced Settings → Cascade → Add Server → Refresh
Replace
your-api-key-here
with the API key you copied from Obsidian.Using HTTPS or custom port? Add
"OBSIDIAN_API_URL": "https://localhost:27124"
to the env section. See Advanced Configuration for details. - macOS:
- Restart your AI tool to load the new configuration.
That's it! The server will now be available in your AI tool with access to your Obsidian vault.
Note: This uses
uvx
which automatically downloads and runs the server in an isolated environment. Most users won't need to install anything else. If you don't haveuv
installed, you can also usepipx install obsidian-mcp
and change the command to"obsidian-mcp"
in the config.
Try It Out
Here are some example prompts to get started:
- "Show me all notes I modified this week"
- "Create a new daily note for today with my meeting agenda"
- "Search for all notes about project planning"
- "Read my Ideas/startup.md note"
Development Installation
- Clone the repository:
- Set up Python environment:
- Install dependencies:
- Set up Obsidian Local REST API:
- Install the Local REST API plugin in Obsidian
- Enable the plugin in Obsidian settings
- Copy the API key from the plugin settings
- Note the port number (default: 27123 for HTTP, 27124 for HTTPS)
- Configure environment variables:
- Add to Claude Desktop (for development):Edit your Claude Desktop config file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- Windows:
%APPDATA%\Claude\claude_desktop_config.json
- macOS:
Project Structure
Available Tools
Note Management
read_note
Read the content and metadata of a specific note.
Parameters:
path
: Path to the note (e.g., "Daily/2024-01-15.md")
Returns:
create_note
Create a new note or update an existing one.
Parameters:
path
: Path where the note should be createdcontent
: Markdown content of the note (consider adding tags for organization)overwrite
(default:false
): Whether to overwrite existing notes
Best Practices:
- Add relevant tags when creating notes to maintain organization
- Use
list_tags
to see existing tags and maintain consistency - Tags can be added as inline hashtags (
#tag
) or in frontmatter
update_note
Update the content of an existing note.
⚠️ IMPORTANT: By default, this tool REPLACES the entire note content. Always read the note first if you need to preserve existing content.
Parameters:
path
: Path to the note to updatecontent
: New markdown content (REPLACES existing content unless using append)create_if_not_exists
(default:false
): Create if doesn't existmerge_strategy
(default:"replace"
): How to handle content"replace"
: Overwrites entire note content (default)"append"
: Adds new content to the end of existing content
Safe Update Pattern:
- ALWAYS read first to preserve content
- Modify the content as needed
- Update with the complete new content
- Or use append mode to add content to the end
delete_note
Delete a note from the vault.
Parameters:
path
: Path to the note to delete
Search and Discovery
search_notes
Search for notes containing specific text or tags.
Parameters:
query
: Search query (supports Obsidian search syntax)context_length
(default:100
): Number of characters to show around matches
Search Syntax:
- Text search:
"machine learning"
- Tag search:
tag:project
ortag:#project
- Path search:
path:Daily/
- Combined:
tag:urgent TODO
search_by_date
Search for notes by creation or modification date.
Parameters:
date_type
(default:"modified"
): Either "created" or "modified"days_ago
(default:7
): Number of days to look backoperator
(default:"within"
): Either "within" (last N days) or "exactly" (exactly N days ago)
Returns:
Example usage:
- "Show me all notes modified today" →
search_by_date("modified", 0, "within")
- "Show me all notes modified this week" →
search_by_date("modified", 7, "within")
- "Find notes created in the last 30 days" →
search_by_date("created", 30, "within")
- "What notes were modified exactly 2 days ago?" →
search_by_date("modified", 2, "exactly")
list_notes
List notes in your vault with optional recursive traversal.
Parameters:
directory
(optional): Specific directory to list (e.g., "Daily", "Projects")recursive
(default:true
): List all notes recursively
Returns:
list_folders
List folders in your vault with optional recursive traversal.
Parameters:
directory
(optional): Specific directory to list fromrecursive
(default:true
): Include all nested subfolders
Returns:
Organization
create_folder
Create a new folder in the vault, including all parent folders in the path.
Parameters:
folder_path
: Path of the folder to create (e.g., "Apple/Studies/J71P")create_placeholder
(default:true
): Whether to create a placeholder file
Returns:
Note: This tool will create all necessary parent folders. For example, if "Apple" exists but "Studies" doesn't, it will create both "Studies" and "J71P".
move_note
Move a note to a new location.
Parameters:
source_path
: Current path of the notedestination_path
: New path for the noteupdate_links
(default:true
): Update links in other notes (future enhancement)
move_folder
Move an entire folder and all its contents to a new location.
Parameters:
source_folder
: Current folder path (e.g., "Projects/Old")destination_folder
: New folder path (e.g., "Archive/Projects/Old")update_links
(default:true
): Update links in other notes (future enhancement)
Returns:
add_tags
Add tags to a note's frontmatter.
Parameters:
path
: Path to the notetags
: List of tags to add (without # prefix)
update_tags
Update tags on a note - either replace all tags or merge with existing.
Parameters:
path
: Path to the notetags
: New tags to set (without # prefix)merge
(default:false
): If true, adds to existing tags. If false, replaces all tags
Perfect for AI workflows:
remove_tags
Remove tags from a note's frontmatter.
Parameters:
path
: Path to the notetags
: List of tags to remove
get_note_info
Get metadata and statistics about a note without retrieving its full content.
Parameters:
path
: Path to the note
Returns:
list_tags
List all unique tags used across your vault with usage statistics.
Parameters:
include_counts
(default:true
): Include usage count for each tagsort_by
(default:"name"
): Sort by "name" or "count"
Returns:
Performance Notes:
- Fast for small vaults (<1000 notes)
- May take several seconds for large vaults
- Uses concurrent batching for optimization
Link Management
⚡ Performance Note: Link management tools have been heavily optimized in v1.1.5:
- 84x faster link validity checking
- 96x faster broken link detection
- 2x faster backlink searches
- Includes automatic caching and batch processing
get_backlinks
Find all notes that link to a specific note.
Parameters:
path
: Path to the note to find backlinks forinclude_context
(default:true
): Whether to include text context around linkscontext_length
(default:100
): Number of characters of context to include
Returns:
Use cases:
- Understanding which notes reference a concept or topic
- Discovering relationships between notes
- Building a mental map of note connections
get_outgoing_links
List all links from a specific note.
Parameters:
path
: Path to the note to extract links fromcheck_validity
(default:false
): Whether to check if linked notes exist
Returns:
Use cases:
- Understanding what a note references
- Checking note dependencies before moving/deleting
- Exploring the structure of index or hub notes
find_broken_links
Find all broken links in the vault, a specific directory, or a single note.
Parameters:
directory
(optional): Specific directory to check (defaults to entire vault)single_note
(optional): Check only this specific note for broken links
Returns:
Use cases:
- After renaming or deleting notes
- Regular vault maintenance
- Before reorganizing folder structure
Testing
Running Tests
Testing with MCP Inspector
- Ensure Obsidian is running with the Local REST API plugin enabled
- Run the MCP Inspector:
- Open the Inspector UI at
http://localhost:5173
- Test the tools interactively with your actual vault
Integration with Claude Desktop
For development installations, see the Development Installation section above.
Enhanced Error Handling
The server provides detailed, actionable error messages to help AI systems recover from errors:
Example Error Messages
Invalid Path:
Empty Search Query:
Invalid Date Parameters:
Troubleshooting
"Connection refused" error
- Ensure Obsidian is running
- Verify the Local REST API plugin is enabled
- Check that the port matches (default: 27123 for HTTP, 27124 for HTTPS)
- Confirm the API key is correct
- The enhanced error will show the exact URL and port being used
Tags not showing up
- Ensure tags are properly formatted (with or without # prefix)
- Check that the Local REST API plugin is up to date
- Tags in frontmatter should be in YAML array format:
tags: [tag1, tag2]
- Inline tags should use the # prefix:
#project #urgent
"Certificate verify failed" error
- This is expected with the Local REST API's self-signed certificate
- The server handles this automatically
"Module not found" error
- Ensure your virtual environment is activated
- Run from the project root:
python -m src.server
- Verify PYTHONPATH includes the project directory
Empty results when listing notes
- Specify a directory when using
list_notes
(e.g., "Daily", "Projects") - Root directory listing requires recursive implementation
- Check if notes are in subdirectories
Tags not updating
- Ensure notes have YAML frontmatter section for frontmatter tags
- Frontmatter must include a
tags:
field (even if empty) - The server now properly reads both frontmatter tags and inline hashtags
Best Practices for AI Assistants
Preventing Data Loss
- Always read before updating: The
update_note
tool REPLACES content by default - Use append mode for additions: When adding to existing notes, use
merge_strategy="append"
- Check note existence: Use
read_note
to verify a note exists before modifying - Be explicit about overwrites: Only use
overwrite=true
when intentionally replacing content
Recommended Workflows
Safe note editing:
- Read the existing note first
- Modify the content as needed
- Update with the complete new content
Adding to daily notes:
- Use
merge_strategy="append"
to add entries without losing existing content
Creating new notes:
- Use
create_note
withoverwrite=false
(default) to prevent accidental overwrites - Add relevant tags to maintain organization
- Use
list_tags
to see existing tags and avoid creating duplicates
Organizing with tags:
- Check existing tags with
list_tags
before creating new ones - Maintain consistent naming (e.g., use "project" not "projects")
- Use tags to enable powerful search and filtering
Security Considerations
- Keep your API key secret - never commit it to version control
- The server validates all paths to prevent directory traversal attacks
- Communication with Obsidian uses HTTP by default (localhost only) or HTTPS with self-signed certificate
- The server only accepts local connections through the REST API
Development
Code Style
- Uses FastMCP framework for MCP implementation
- Pydantic models for type safety and validation
- Modular architecture with separated concerns
- Comprehensive error handling and user-friendly messages
Adding New Tools
- Create tool function in appropriate module under
src/tools/
- Add Pydantic models if needed in
src/models/
- Register the tool in
src/server.py
with the@mcp.tool()
decorator - Include comprehensive docstrings
- Add tests in
tests/
- Test with MCP Inspector before deploying
Changelog
v1.1.7 (2025-01-10)
- 🔄 Changed default API endpoint to HTTP (
http://127.0.0.1:27123
) for easier setup - 📝 Updated documentation to reflect HTTP as default, HTTPS as optional
- 🔧 Added note about automatic trailing slash handling in URLs
- ✨ Improved first-time user experience with zero-configuration setup
v1.1.6 (2025-01-10)
- 🐛 Fixed timeout errors when creating or updating large notes
- ⚡ Added graceful timeout handling for better reliability with large content
- 🔧 Improved error reporting to prevent false failures on successful operations
v1.1.5 (2025-01-09)
- ⚡ Massive performance optimization for link management:
- 84x faster link validity checking
- 96x faster broken link detection
- 2x faster backlink searches
- Added automatic caching and batch processing
- 🔧 Optimized concurrent operations for large vaults
- 📝 Enhanced documentation for performance considerations
v1.1.4 (2025-01-09)
- 🔗 Added link management tools for comprehensive vault analysis:
get_backlinks
- Find all notes linking to a specific noteget_outgoing_links
- List all links from a note with validity checkingfind_broken_links
- Identify broken links for vault maintenance
- 🔧 Fixed URL construction to support both HTTPS (default) and HTTP endpoints
- 📝 Enhanced link parsing to handle both wiki-style and markdown links
- ⚡ Optimized backlink search to handle various path formats
v1.1.3 (2025-01-09)
- 🐛 Fixed search_by_date to properly find notes modified today (days_ago=0)
- ✨ Added list_folders tool for exploring vault folder structure
- ✨ Added create_folder tool that creates full folder hierarchies
- ✨ Added move_folder tool for bulk folder operations
- ✨ Added update_tags tool for AI-driven tag management
- 🐛 Fixed tag reading to properly handle both frontmatter and inline hashtags
- ✨ Added list_tags tool to discover existing tags with usage statistics
- ⚡ Optimized performance with concurrent batching for large vaults
- 📝 Improved documentation and error messages following MCP best practices
- 🎯 Enhanced create_note to encourage tag usage for better organization
v1.1.2 (2025-01-09)
- Fixed PyPI package documentation
v1.1.1 (2025-01-06)
- Initial PyPI release
Publishing (for maintainers)
To publish a new version to PyPI:
Users can then install and run with:
Configuration
Advanced Configuration
If you're using a non-standard setup, you can customize the server behavior with these environment variables:
OBSIDIAN_API_URL
- Override the default API endpoint (default:http://127.0.0.1:27123
)- Use this if you're running the HTTPS endpoint (e.g.,
https://localhost:27124
) - Or if you've changed the port number in the Local REST API plugin settings
- The HTTP endpoint is used by default for easier setup
- Note: Trailing slashes are handled automatically (both
http://127.0.0.1:27123
andhttp://127.0.0.1:27123/
work)
- Use this if you're running the HTTPS endpoint (e.g.,
Example for HTTPS or non-standard configurations:
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-tool
) - Write tests for new functionality
- Ensure all tests pass
- Commit your changes (
git commit -m 'Add amazing tool'
) - Push to the branch (
git push origin feature/amazing-tool
) - Open a Pull Request
License
MIT License - see LICENSE file for details
Acknowledgments
- Anthropic for creating the Model Context Protocol
- Obsidian team for the amazing note-taking app
- coddingtonbear for the Local REST API plugin
- dsp-ant for the FastMCP framework
You must be authenticated.
local-only server
The server can only run on the client's local machine because it depends on local resources.
Tools
A Model Context Protocol server that enables AI assistants like Claude to interact with your Obsidian vault through the Local REST API plugin, allowing reading, creating, searching, and managing notes.
Related MCP Servers
- -securityAlicense-qualityA local MCP server that enables AI applications like Claude Desktop to securely access and work with Obsidian vaults, providing capabilities for reading notes, executing templates, and performing semantic searches.Last updated -60TypeScriptMIT License
- -securityAlicense-qualityProvides a standardized interface for AI assistants to interact with Obsidian vaults through a local REST API, enabling reading, writing, searching, and managing notes.Last updated -37TypeScriptMIT License
- -securityFlicense-qualityThis project implements a Model Context Protocol (MCP) server for connecting AI models with Obsidian knowledge bases. Through this server, AI models can directly access and manipulate Obsidian notes, including reading, creating, updating, and deleting notes, as well as managing folder structures.Last updated -5987JavaScript
- -securityAlicense-qualityA Model Context Protocol server that enables AI assistants to read, write, and manipulate notes in your Obsidian vault through a standardized interface.Last updated -598TypeScriptISC License