The Obsidian MCP Server creates a bridge between Claude Code and Obsidian, enabling you to automatically save AI-generated content directly to your Obsidian vault with proper formatting and organization based on your project settings.
To install the Obsidian MCP Server:
git clone https://github.com/robwilde/obsidian-mcp-server.git
cd obsidian-mcp-server
python3 install.py
The installer will:
~/.claude/
After installation, you can ask Claude Code to save content to Obsidian using simple commands:
"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"
Claude Code will automatically format and save the content to your Obsidian vault.
The MCP server uses a global configuration file at ~/.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"
}
}
}
}
For project-specific settings, create a .claude/obsidian.json
file:
{
"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}"
}
}
To add project configuration to existing projects:
python3 install.py --project-config
You can ask Claude Code to read files directly from your Obsidian vault:
"Read this Obsidian file: obsidian://open?vault=MyVault&file=Notes/ProjectPlan"
"@obsidian obsidian://open?vault=MyVault&file=Docs%2FMeeting%20Notes%202025"
The system handles URL-encoded characters for spaces and special characters.
You can customize how different content types are formatted by modifying the templates in your project configuration:
{
"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}"
}
}
Files are automatically saved with frontmatter and formatting based on your templates:
---
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*
If the MCP server is not found:
# Reinstall MCP dependencies
pip install --upgrade mcp
If the vault path is not found:
# Check environment variable
echo $OBSIDIAN_VAULT_PATH
# Or update settings manually
vim ~/.claude/settings.json
If project configuration is not detected:
# Create project config in current directory
python3 install.py --project-config
Enable debug logging for troubleshooting:
export MCP_DEBUG=1
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "obsidian-claude-code" '{"command":"python3","args":["/home/user/.claude/obsidian_mcp_server.py"],"env":{"OBSIDIAN_VAULT_PATH":"/path/to/your/obsidian/vault"}}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"obsidian-claude-code": {
"command": "python3",
"args": [
"/home/user/.claude/obsidian_mcp_server.py"
],
"env": {
"OBSIDIAN_VAULT_PATH": "/path/to/your/obsidian/vault"
}
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"obsidian-claude-code": {
"command": "python3",
"args": [
"/home/user/.claude/obsidian_mcp_server.py"
],
"env": {
"OBSIDIAN_VAULT_PATH": "/path/to/your/obsidian/vault"
}
}
}
}
3. Restart Claude Desktop for the changes to take effect