The Obsidian Local REST API MCP Server provides an AI-native interface for interacting with Obsidian vaults through a local REST API, offering task-oriented tools that make it easier for language models to work effectively with your notes and files.
npx obsidian-local-rest-api-mcp
# Clone the repository
git clone https://github.com/j-shelfwood/obsidian-local-rest-api-mcp.git
cd obsidian-local-rest-api-mcp
# Install dependencies with bun
bun install
# Build the project
bun run build
Before using the MCP server, you'll need:
Set environment variables for API connection:
export OBSIDIAN_API_URL="http://obsidian-local-rest-api.test" # Default URL (or http://localhost:8000 for non-Valet setups)
export OBSIDIAN_API_KEY="your-api-key" # Optional bearer token
# Development mode with auto-reload
bun run dev
# Production mode
bun run start
# Or run directly
node build/index.js
Add to your claude_desktop_config.json:
{
"mcpServers": {
"obsidian-vault": {
"command": "npx",
"args": ["obsidian-local-rest-api-mcp"],
"env": {
"OBSIDIAN_API_URL": "http://obsidian-local-rest-api.test",
"OBSIDIAN_API_KEY": "your-api-key-if-needed"
}
}
}
}
Use the included .vscode/mcp.json configuration file.
For Cherry Studio, use these settings:
obsidian-vault (or any name you prefer)Standard Input/Output (stdio)npxobsidian-local-rest-api-mcpOBSIDIAN_API_URL: http://obsidian-local-rest-api.test (or your API URL)OBSIDIAN_API_KEY: your-api-key (if required)list_directoryPurpose: List directory contents with pagination to prevent context overflow
{
"path": "Projects/",
"recursive": false,
"limit": 20,
"offset": 0
}
read_filePurpose: Read content of any file in the vault
{"path": "notes/meeting-notes.md"}
write_filePurpose: Write file with multiple modes - replaces separate create/update operations
{
"path": "notes/summary.md",
"content": "# Meeting Summary\n...",
"mode": "append" // "overwrite", "append", "prepend"
}
delete_itemPurpose: Delete any file or directory
{"path": "old-notes/"}
create_or_update_notePurpose: Intelligent upsert - creates if missing, updates if exists
{
"path": "daily/2024-12-26",
"content": "## Tasks\n- Review AI-native MCP design",
"frontmatter": {"tags": ["daily", "tasks"]}
}
get_daily_notePurpose: Smart daily note retrieval with common naming patterns
{"date": "today"} // or "yesterday", "2024-12-26"
get_recent_notesPurpose: Get recently modified notes
{"limit": 5}
search_vaultPurpose: Multi-scope search with advanced filtering
{
"query": "machine learning",
"scope": ["content", "filename", "tags"],
"path_filter": "research/"
}
find_related_notesPurpose: Discover conceptual relationships between notes
{
"path": "ai-research.md",
"on": ["tags", "links"]
}
If your MCP client shows "Start Failed" or similar errors:
Test the server directly:
npx obsidian-local-rest-api-mcp --version
Should output the version number.
Test MCP protocol:
# Run test script
node -e "
const { spawn } = require('child_process');
const child = spawn('npx', ['obsidian-local-rest-api-mcp'], { stdio: ['pipe', 'pipe', 'pipe'] });
child.stdout.on('data', d => console.log('OUT:', d.toString()));
child.stderr.on('data', d => console.log('ERR:', d.toString()));
setTimeout(() => {
child.stdin.write(JSON.stringify({jsonrpc:'2.0',id:1,method:'initialize',params:{protocolVersion:'2024-11-05',capabilities:{},clientInfo:{name:'test',version:'1.0.0'}}})+'\n');
setTimeout(() => child.kill(), 2000);
}, 500);
"
Should show initialization response.
Check Environment Variables:
OBSIDIAN_API_URL points to a running Obsidian Local REST APIcurl http://obsidian-local-rest-api.test/api/filesVerify Obsidian Local REST API:
Enable debug logging by setting environment variables:
export DEBUG=1
export NODE_ENV=development
Server logs are written to stderr to avoid interfering with MCP protocol communication on stdout.
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "obsidian-vault" '{"command":"npx","args":["obsidian-local-rest-api-mcp"],"env":{"OBSIDIAN_API_URL":"http://obsidian-local-rest-api.test","OBSIDIAN_API_KEY":"your-api-key-if-needed"}}'
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-vault": {
"command": "npx",
"args": [
"obsidian-local-rest-api-mcp"
],
"env": {
"OBSIDIAN_API_URL": "http://obsidian-local-rest-api.test",
"OBSIDIAN_API_KEY": "your-api-key-if-needed"
}
}
}
}
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.json2. Add this to your configuration file:
{
"mcpServers": {
"obsidian-vault": {
"command": "npx",
"args": [
"obsidian-local-rest-api-mcp"
],
"env": {
"OBSIDIAN_API_URL": "http://obsidian-local-rest-api.test",
"OBSIDIAN_API_KEY": "your-api-key-if-needed"
}
}
}
}
3. Restart Claude Desktop for the changes to take effect