# Obsidian CLI REST MCP plugin for Obsidian [[Obsidian]] community plugin that exposes all [[Obsidian CLI]] commands through two interfaces: a local HTTP REST API and an [[Model Context Protocol (MCP)]] server. It bridges the Obsidian CLI with programmatic access, enabling scripts, tools, and AI assistants to control an Obsidian vault. Created by [[Sébastien Dubois]]. Licensed under MIT. ## How It Works - Runs inside Obsidian as a community plugin - On activation, starts a localhost HTTP server on `127.0.0.1:27124` by default - CLI commands map to REST paths with colons replaced by slashes (e.g., `property:set` becomes `/api/v1/cli/property/set`) - The MCP endpoint (`/mcp`) uses two fixed tools (`search` and `execute`) regardless of command count - REST API and MCP server can be independently toggled on/off - Uses `execFile` (not `exec`) to invoke the Obsidian CLI, avoiding shell injection ## Key Features - **File operations**: list, create, read, append, prepend, move, rename, delete - **Full-text search** with context - **Frontmatter property management** - **Daily note interactions** - **Tag and task management** - **Link analysis**: outgoing links, backlinks, orphans, dead ends - **Template handling** - **Bookmark management** - **Plugin/theme control** - **Sync and publish status** - **Workspace layouts** - **Additional**: bases, CSS snippets, file history, word counts ## Security - Localhost-only binding by default (`127.0.0.1`) - Auto-generated 64-character API key (Bearer token) - Dangerous commands blocked by default (eval, restart, devtools) - Command-level blocklist capability - Network exposure (`0.0.0.0`) requires explicit opt-in ## Prerequisites - [[Obsidian]] desktop v1.4.0+ - [[Obsidian CLI]] installed and in system PATH ## Installation Install through Obsidian's Community Plugins marketplace: search for "Obsidian CLI REST", install, and enable. The server automatically starts on `http://127.0.0.1:27124`. ## Configuration | Setting | Default | Purpose | |---------|---------|---------| | Port | 27124 | HTTP server port | | Bind address | 127.0.0.1 | Local vs. network exposure | | Auto-start | On | Server initialization on plugin load | | REST API | On | Enable/disable HTTP endpoints | | MCP server | On | Enable/disable MCP endpoint | | Dangerous commands | Off | Restrict eval, restart, devtools | | Request timeout | 30s | CLI execution time limit | ## References - Community: https://community.obsidian.md/plugins/cli-rest-mcp - Documentation: https://dsebastien.github.io/obsidian-cli-rest/ - Source code: https://github.com/dsebastien/obsidian-cli-rest ## Related - [[Obsidian CLI]] - [[Obsidian]] - [[Obsidian Starter Kit]] - [[Model Context Protocol (MCP)]] - [[Local REST API plugin for Obsidian]]