bischoff99/obsidian-rest-api-mcp
3.2
If you are the rightful owner of obsidian-rest-api-mcp 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 REST API MCP Server is a Model Context Protocol server that integrates with Obsidian via its REST API plugin, allowing for seamless interaction with the Obsidian vault.
Tools
5
Resources
0
Prompts
0
Obsidian REST API MCP Server
MCP (Model Context Protocol) server that integrates with Obsidian via its REST API plugin.
Setup
Prerequisites
- Node.js 16+
- Obsidian with Local REST API plugin installed and running
- API key from Obsidian Local REST API
Installation
- Install dependencies:
npm install
- Build TypeScript:
npm run build
- Set environment variables (or use .env):
export OBSIDIAN_API_KEY="your-api-key"
export OBSIDIAN_BASE_URL="https://localhost:27124"
export OBSIDIAN_INSECURE="true" # For self-signed certs
Usage
Start server:
node dist/index.js
Using with Claude Desktop (Cursor/Claude):
Add to your MCP configuration file:
{
"mcpServers": {
"obsidian-rest-api": {
"command": "node",
"args": ["/Users/andrejs/obsidian-rest-api-mcp/dist/index.js"],
"env": {
"OBSIDIAN_API_KEY": "e29e5b1e31e900c737a04f9c079b4f95ff282c23a64e2aa46b13d251e42088e0",
"OBSIDIAN_BASE_URL": "https://localhost:27124",
"OBSIDIAN_INSECURE": "true"
}
}
}
}
Available Tools
- read_file: Read a file from the vault
- write_file: Create or write a file to the vault
- list_files: List files in vault directory
- search: Search vault content
- delete_file: Delete a file from the vault
Configuration
OBSIDIAN_API_KEY: Bearer token for Obsidian API authenticationOBSIDIAN_BASE_URL: Base URL of Obsidian REST API (default: https://localhost:27124)OBSIDIAN_INSECURE: Allow self-signed certificates (default: false)
Testing
Test with curl:
export API_KEY="your-api-key"
# List vault files
curl -s -k -H "Authorization: Bearer $API_KEY" https://localhost:27124/vault/ | jq .
# Read a file
curl -s -k -H "Authorization: Bearer $API_KEY" https://localhost:27124/vault/Dashboard.md
# Create a file
curl -X POST -k -H "Authorization: Bearer $API_KEY" \
-H "Content-Type: text/markdown" \
-d "# Test\nContent" \
https://localhost:27124/vault/test.md
Architecture
Claude/Cursor
↓
MCP Protocol (stdio)
↓
obsidian-rest-api-mcp (Node.js)
↓
HTTPS (TLS 1.3)
↓
Obsidian Local REST API
↓
Obsidian Vault
Troubleshooting
SSL Certificate Errors
The Obsidian REST API uses self-signed certificates. Use OBSIDIAN_INSECURE=true in development.
Connection Refused
- Verify Obsidian is running:
lsof -i :27124 - Check API key is correct
- Ensure REST API plugin is enabled in Obsidian
No Files Returned
- Make sure vault has files
- Check that Local REST API plugin is active
- Verify read permissions on vault directory
Development
# Development mode with ts-node
npm run dev
# Watch mode
npm run build && npm run start
License
MIT