Tips and troubleshooting
Common use cases
Capture ideas from the terminal
Add a quick note to your daily journal without opening Obsidian:
curl -X POST -H "Authorization: Bearer KEY" \
-H "Content-Type: application/json" \
-d '{"params": {"content": "- Idea: build a CLI dashboard"}}' \
http://127.0.0.1:27124/api/v1/cli/daily/append
Build a shell alias
Add to your .bashrc or .zshrc:
export OBSIDIAN_API_KEY="your-key-here"
# Quick note to daily
qn() {
curl -s -X POST \
-H "Authorization: Bearer $OBSIDIAN_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"params\": {\"content\": \"- $*\"}}" \
http://127.0.0.1:27124/api/v1/cli/daily/append > /dev/null
echo "Added to daily note"
}
# Search vault
vs() {
curl -s -H "Authorization: Bearer $OBSIDIAN_API_KEY" \
"http://127.0.0.1:27124/api/v1/cli/search?query=$1"
}
Then use: qn Remember to review the PR or vs meeting notes.
Automate with cron
Append a daily reminder at 9 AM:
0 9 * * * curl -s -X POST -H "Authorization: Bearer KEY" -H "Content-Type: application/json" -d '{"params":{"content":"- [ ] Review inbox"}}' http://127.0.0.1:27124/api/v1/cli/daily/append
Use with Python
import requests
API_KEY = "your-key-here"
BASE = "http://127.0.0.1:27124/api/v1/cli"
HEADERS = {"Authorization": f"Bearer {API_KEY}"}
# List files
r = requests.get(f"{BASE}/files", headers=HEADERS)
print(r.json()["stdout"])
# Create a note
r = requests.post(
f"{BASE}/create",
headers={**HEADERS, "Content-Type": "application/json"},
json={"params": {"name": "Report", "content": "# Report\n\nGenerated by script"}}
)
print(r.json())
Use with JavaScript/TypeScript
const API_KEY = 'your-key-here'
const BASE = 'http://127.0.0.1:27124/api/v1/cli'
// List files
const files = await fetch(`${BASE}/files`, {
headers: { Authorization: `Bearer ${API_KEY}` }
}).then((r) => r.json())
// Create a note
const result = await fetch(`${BASE}/create`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
params: { name: 'Report', content: '# Report\n\nGenerated by script' }
})
}).then((r) => r.json())
Troubleshooting
Server won’t start
Check the Obsidian CLI is installed:
obsidian --version
If this doesn’t work, install the CLI from Obsidian’s documentation.
The server will still start even without the CLI, but all command endpoints will return 503.
Check if the port is in use:
Another application may be using port 27124. Change the port in Settings > Obsidian CLI REST > Server.
Connection refused
- Make sure the server is running (check the status bar for “CLI REST: 127.0.0.1:27124”)
- If you see “CLI REST: off”, open the command palette and run Toggle REST/MCP server
- Check that you’re connecting to the correct address and port
401 Unauthorized
- Verify your API key matches the one in plugin settings
- Make sure you’re using the
Authorization: Bearer <key>format - If you regenerated the key, update it in your scripts/clients
403 Forbidden
- The command may be blocked. Check Settings > Command filtering
- The command may be dangerous. Enable Allow dangerous commands in settings if needed
404 Not found
- Check the URL path — remember that CLI colons become slashes (
property:setbecomesproperty/set) - The REST API or MCP server may be disabled. Check Settings > Interfaces
405 Method not allowed
- You’re using the wrong HTTP method. Check the command reference for the correct method
- As a workaround, POST is accepted for all commands
503 Service unavailable
- The Obsidian CLI binary is not found
- Install it and make sure it’s in your PATH
- The plugin checks these paths: system PATH,
/usr/local/bin,/usr/bin
Commands return empty stdout
- Some commands require parameters. Check the Obsidian CLI documentation for required arguments
- The CLI defaults to the active file for many commands. If no file is open, results may be empty
MCP tools not appearing
- Ensure the MCP server is enabled in settings
- Verify the URL:
http://127.0.0.1:27124/mcp - Restart your MCP client after changing the server configuration
Plugin doesn’t load
- Verify
main.jsandmanifest.jsonexist in<vault>/.obsidian/plugins/obsidian-cli-rest/ - Try disabling and re-enabling the plugin
- Check the Obsidian developer console for errors (Ctrl+Shift+I)