Obsidian CLI MCP Server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Obsidian CLI MCP Serverlist all notes in my daily folder"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
obsidian-cli-mcp-server
A local MCP server that wraps the official Obsidian CLI (v1.12+), giving LLM agents full access to 80+ vault operations through a single tool.
Zero network dependencies — no API keys, no cloud services; everything runs locally
Single-tool design — one
obsidian_exectool accepts any CLI command, so new Obsidian CLI features work instantly without updating the serverSafety-first — dangerous commands (
eval,devtools, etc.) are blocked at two layers; all execution usesspawnwithout shell interpretation, preventing command injectionDual execution mode — direct spawn for terminal environments + HTTP relay for Electron-hosted clients (Claude Desktop, Cowork)
Prerequisites
Obsidian v1.12.4+ with CLI enabled (Settings → General → Command line interface)
The
obsidianbinary in yourPATH(or setOBSIDIAN_CLI_PATH)Node.js ≥ 18
expect(pre-installed on macOS; needed forsearch/search:context)
Related MCP server: Obsidian MCP Server
Quick Start
# Clone and build
git clone https://github.com/cks850711/obsidian-cli-mcp-server.git
cd obsidian-cli-mcp-server
npm install
npm run buildConfiguration
Claude Code
Add to your Claude Code MCP settings:
{
"mcpServers": {
"obsidian-cli": {
"command": "node",
"args": ["/absolute/path/to/obsidian-cli-mcp-server/dist/index.js"]
}
}
}Claude Desktop
{
"mcpServers": {
"obsidian-cli": {
"command": "node",
"args": ["/absolute/path/to/obsidian-cli-mcp-server/dist/index.js"]
}
}
}Note: Claude Desktop is an Electron app, and spawning the Obsidian CLI (also Electron) from it causes a SingletonSocket IPC conflict. You must start the HTTP relay server from a terminal first — see HTTP Relay below.
Available Tools
obsidian_exec
Execute any Obsidian CLI sub-command and return its output.
Parameter | Type | Required | Description |
| string | ✅ | CLI sub-command and arguments (without the leading |
| string | — | Target a specific vault by name |
Examples:
command="help"
command="read file=MyNote"
command="search query=\"meeting notes\" limit=10"
command="create name=NewNote content=\"Hello world\""
command="files folder=Projects ext=md"
command="tasks todo"
command="tags counts sort=count"
command="properties file=MyNote"
command="backlinks file=MyNote"
command="bookmarks"For the full list of available CLI commands, run command="help".
obsidian_blocked_commands
Returns the list of CLI commands that are blocked by this server for safety reasons. Takes no parameters.
HTTP Relay
When the MCP server runs inside an Electron process tree (e.g., Claude Desktop), the Obsidian CLI binary hangs due to Electron's SingletonSocket IPC mechanism. The relay server solves this by running in a separate terminal.
# Start the relay (keep this terminal open)
npm run relay
# Default: http://127.0.0.1:27182The MCP server automatically tries the relay first, then falls back to direct spawn. No configuration needed — just start the relay before using the MCP server from Electron-based clients.
Environment variable | Default | Description |
|
| Relay server port |
|
| Path to the Obsidian CLI binary |
Security
Blocked Commands
The following commands are blocked by default to prevent unintended side effects:
Command | Reason |
| Arbitrary JavaScript execution inside Obsidian |
| Restarts the Obsidian app |
| Toggles Electron DevTools |
| Chrome DevTools Protocol — arbitrary method execution |
| CSS inspection |
| Debugger attach/detach |
| DOM query |
| Mobile emulation toggle |
The blocklist is enforced at two layers — both the MCP server (cli.ts) and the relay server (relay-server.ts) independently reject blocked commands. To customize, edit src/constants.ts.
Command Injection Prevention
All commands are executed via Node.js child_process.spawn without a shell (shell: false by default). User input is parsed into an argv array by a custom parser (parse-args.ts) — not by sh -c. This means:
Shell metacharacters (
;,|,$(),` `,&&) are not interpretedThe executable is always the fixed
obsidianbinary — it cannot be changed by user inputNo command substitution, variable expansion, or piping is possible
For search / search:context (which require a TTY), commands are wrapped with expect. Arguments are quoted using Tcl brace-quoting ({...}), which is fully literal with no substitution.
Architecture
LLM (Claude)
│
│ MCP (stdio)
▼
┌──────────────────────┐
│ MCP Server │
│ (index.ts) │
│ │
│ obsidian_exec tool │
│ ┌────────────────┐ │
│ │ isBlocked() │──│── Layer 1: block dangerous commands
│ │ parseArgs() │──│── Parse without shell
│ └───────┬────────┘ │
└──────────┼───────────┘
│
┌─────┴──────┐
▼ ▼
┌─────────┐ ┌───────────┐
│ Relay │ │ Direct │
│ Server │ │ Spawn │
│ (HTTP) │ │ │
│ :27182 │ │ │
└────┬────┘ └─────┬─────┘
│ │
▼ ▼
┌─────────────────┐
│ obsidian CLI │
│ (Electron) │
└─────────────────┘Development
npm run dev # Watch mode (tsx)
npm run build # Compile TypeScript
npm test # Run parse-args unit tests
npm run relay # Start HTTP relay serverLicense
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/cks850711/obsidian-cli-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server