Skip to content

davepoon/buildwithclaude / plugins/all-skills/skills/obsidian-rest-api

obsidian-rest-api

Verified

Call the Obsidian Local REST API directly (over HTTP) for vault operations the mcp__obsidian__* tools do NOT expose — move/rename a note, overwrite a whole file atomically (PUT), act on the currently-open active file, run an Obsidian command, open a note in the UI, list all tags, or do date-specific periodic-note CRUD. Prefer the mcp__obsidian__* tools for plain read/append/patch/delete/search; fall back to this skill only when the required method is missing from MCP.

FileKindSize
SKILL.mdskill md4.0 KB
references/api_reference.mdmarkdown7.7 KB
scripts/olrapi.shexecutablescript1.9 KB

scripts/olrapi.sh

View on GitHub
#!/usr/bin/env bash
# olrapi.sh — authenticated wrapper around the Obsidian Local REST API.
# Resolves host/port/API-key from the connected obsidian MCP server config
# (~/.claude.json), so no secrets are hardcoded.
#
# Usage:
#   olrapi.sh <METHOD> <path> [extra curl args...]
#   olrapi.sh GET /tags/
#   olrapi.sh GET /vault/Note.md
#   olrapi.sh PUT /vault/New.md --data-binary @file.md -H 'Content-Type: text/markdown'
#   olrapi.sh MOVE "/vault/old/Note.md" -H 'Destination: archive/Note.md'
#
# Prints the HTTP status to stderr and the body to stdout.
set -euo pipefail

CFG="${OLRAPI_CONFIG:-$HOME/.claude.json}"

read -r HOST PORT KEY < <(python3 - "$CFG" <<'PY'
import json, sys
cfg = sys.argv[1]
def walk(o):
    if isinstance(o, dict):
        if 'OBSIDIAN_API_KEY' in o:
            yield o
        for v in o.values():
            yield from walk(v)
    elif isinstance(o, list):
        for v in o:
            yield from walk(v)
try:
    d = json.load(open(cfg))
except Exception:
    d = {}
env = next(walk(d), {})
host = (env.get('OBSIDIAN_HOST') or 'http://127.0.0.1').replace('https://','').replace('http://','')
port = env.get('OBSIDIAN_PORT') or '27123'
key  = env.get('OBSIDIAN_API_KEY') or ''
# env vars override config (useful on other machines)
import os
host = os.environ.get('OBSIDIAN_HOST', host).replace('https://','').replace('http://','')
port = os.environ.get('OBSIDIAN_PORT', port)
key  = os.environ.get('OBSIDIAN_API_KEY', key)
print(host, port, key)
PY
)

if [[ -z "${KEY:-}" ]]; then
  echo "olrapi: could not resolve OBSIDIAN_API_KEY (checked $CFG and env)" >&2
  exit 2
fi

METHOD="$1"; PATH_="$2"; shift 2

# 27124 is the TLS port for the Local REST API; -k because it uses a self-signed cert.
BASE="https://${HOST}:27124"
[[ "$PORT" == "27123" || "$PORT" == "27124" ]] || BASE="https://${HOST}:${PORT}"

curl -sk -X "$METHOD" "${BASE}${PATH_}" \
  -H "Authorization: Bearer ${KEY}" \
  -w '\n<<HTTP %{http_code}>>\n' \
  "$@"
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall