robwilde/obsidian-mcp-server
If you are the rightful owner of obsidian-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The Obsidian MCP Server for Claude Code enables seamless integration between Claude Code and Obsidian, allowing AI-generated content to be saved directly to an Obsidian vault with proper formatting and organization.
Obsidian MCP Server for Claude Code
š¤ Seamlessly save Claude Code responses directly to your Obsidian vault with automatic formatting and project-specific organization.
Overview
This MCP (Model Context Protocol) server creates a bridge between Claude Code and Obsidian, allowing you to automatically save AI-generated content (reports, code reviews, documentation) directly to your Obsidian vault with proper formatting and organization.
⨠Key Features
- šÆ Direct Integration: Ask Claude Code to "save to Obsidian" and it happens automatically
- š Project-Specific Organization: Configure custom folders and templates per project
- šØ Rich Formatting: Automatic frontmatter, timestamps, and structured templates
- āļø Easy Setup: One-command installation with interactive configuration
- š§ Flexible Templates: Customizable templates for reports, reviews, and notes
- š Obsidian URL Support: Read files directly from Obsidian URLs with space/special character handling
Quick Start
1. Installation
Clone this repository and run the interactive installer:
git clone https://github.com/robwilde/obsidian-mcp-server.git
cd obsidian-mcp-server
python3 install.py
The installer will:
- ā Check Python 3.8+ and install MCP dependencies
- ā Prompt for your Obsidian vault path
- ā
Install the MCP server globally to
~/.claude/
- ā Configure Claude Code settings automatically
- ā Optionally create project-specific configuration
2. Usage
After installation, simply ask Claude Code:
"Create a security review of the authentication system and save to Obsidian"
"Generate API documentation and save it to Obsidian as a report"
"Document the database schema and save to Obsidian"
"Read this Obsidian file: obsidian://open?vault=MyVault&file=Notes/ProjectPlan"
"@obsidian obsidian://open?vault=MyVault&file=Docs%2FMeeting%20Notes%202025"
Claude Code will automatically use the appropriate tools to interact with your Obsidian vault.
Project Configuration
Global Setup
The MCP server is installed globally and configured via ~/.claude/settings.json
:
{
"mcpServers": {
"obsidian-claude-code": {
"command": "python3",
"args": ["/home/user/.claude/obsidian_mcp_server.py"],
"env": {
"OBSIDIAN_VAULT_PATH": "/path/to/your/obsidian/vault"
}
}
}
}
Project-Specific Configuration
Each project can have custom settings in .claude/obsidian.json
:
{
"folder": "Projects/My Awesome Project",
"templates": {
"report": "# {title}\n\n**š Report Generated**\n- **Date:** {timestamp}\n- **Project:** {project}\n\n{content}",
"review": "# Code Review: {title}\n\n**š Review Details**\n- **Date:** {timestamp}\n- **Project:** {project}\n\n{content}",
"note": "# {title}\n\n**š Note**\n- **Created:** {timestamp}\n- **Project:** {project}\n\n{content}"
}
}
Adding Project Config to Existing Projects
python3 install.py --project-config
File Structure
obsidian-mcp-server/
āāā README.md # This file
āāā install.py # Interactive installer
āāā obsidian_mcp_server.py # Main MCP server
āāā hook.py # Claude Code hook script (optional)
āāā CLAUDE.md # Development guidance
āāā .claude/obsidian.json # Example project config
āāā Building an MCP Server...md # Detailed implementation guide
How It Works
Architecture
- MCP Server: Runs as a background service providing tools to Claude Code
- Project Detection: Automatically detects project context and configuration
- Template Engine: Formats content using customizable templates
- File Organization: Saves files to project-specific folders in your vault
Available Tools
The MCP server provides these tools to Claude Code:
save_to_obsidian
: Primary tool for saving formatted content with templatesread_obsidian_url
: Read files from Obsidian URLs (handles URL encoding for spaces and special characters)save_claude_response
: Direct response saving (if implemented via hooks)list_vault_files
: Browse existing vault files (planned)get_vault_structure
: View vault folder hierarchy (planned)
Generated File Format
Files are automatically saved with:
---
created: 2025-01-27T14:30:22.123456
source: claude-code
tags: [claude-code, report, project-name]
---
# Security Review: Authentication System
**š Report Generated**
- **Date:** 2025-01-27 14:30:22
- **Project:** my-awesome-project
- **Type:** Technical Report
---
[Your content here, formatted according to the template]
---
*Generated by Claude Code*
Requirements
- Python 3.8+
- Claude Code (with MCP support)
- Obsidian (any recent version)
- MCP Python package (auto-installed by installer)
Advanced Usage
Reading Obsidian URLs
The read_obsidian_url
tool allows Claude Code to read files directly from Obsidian URLs:
# Basic usage
"Read file from: obsidian://open?vault=MyVault&file=Notes/ProjectPlan"
# With URL-encoded spaces and special characters
"@obsidian obsidian://open?vault=MyVault&file=Meeting%20Notes%2FQ1%202025"
# Files with special characters in names
"Read: obsidian://open?vault=DevNotes&file=Issues%2FWAI-130%20Assignee%20field"
The tool automatically:
- Parses the vault name and file path from the URL
- Handles URL-encoded characters (spaces, slashes, special chars)
- Adds .md extension if not present
- Uses the configured
OBSIDIAN_VAULT_PATH
to locate files
Custom Templates
Modify .claude/obsidian.json
to customize how different content types are formatted:
{
"templates": {
"security-review": "# š Security Review: {title}\n\n**Reviewed by:** Claude Code\n**Date:** {timestamp}\n\n## Executive Summary\n\n{content}",
"api-docs": "# š API Documentation: {title}\n\n**Generated:** {timestamp}\n**Version:** 1.0\n\n{content}"
}
}
Environment Variables
OBSIDIAN_VAULT_PATH
: Path to your Obsidian vault (set by installer)
Debugging
Enable debug logging by setting:
export MCP_DEBUG=1
Troubleshooting
Common Issues
MCP server not found
# Reinstall MCP dependencies
pip install --upgrade mcp
Vault path not found
# Check environment variable
echo $OBSIDIAN_VAULT_PATH
# Or update settings manually
vim ~/.claude/settings.json
Project config not detected
# Create project config in current directory
python3 install.py --project-config
Support
- Check the file for development guidance
- Review the detailed implementation guide in the documentation
- Ensure Claude Code is restarted after installation
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Test with the install script
- Submit a pull request
License
MIT License - see LICENSE file for details.
Acknowledgments
- Built for the Claude Code ecosystem
- Uses the Model Context Protocol (MCP)
- Integrates with Obsidian knowledge management
Made with ā¤ļø for the Claude Code community