obsidian-local-mcp
README.md
# obsidian-local-mcp
A standalone **Model Context Protocol (MCP) server** that exposes an Obsidian vault as tools to any MCP-capable agent (Claude Desktop, OpenCode, etc.) — enabling read / write / search / organize operations on vault notes **without requiring Obsidian to be running**.
## Design principles
- **Local stdio MCP server** — no HTTP, no API keys. Launched as a subprocess by the MCP client.
- **File-based by design** — operates directly on the vault's Markdown files, not through the Obsidian app.
- **Safe** — all operations are restricted to paths inside the vault root (path-traversal guard). The `.obsidian/` config folder is never touched unless explicitly allowed.
## Tools (planned v1)
| Tool | Purpose |
|---|---|
| `list_notes` | Recursive listing of `.md` files, excluding `.obsidian/` |
| `read_note` | Return full note content (UTF-8) |
| `search_notes` | Regex/literal grep over vault content, filenames, or tags |
| `create_note` | Create note, auto-creating parent folders; refuses to overwrite unless allowed |
| `edit_note` | Exact string replacements (old/new pairs) |
| `move_note` | Move a note, optionally rewriting `[[wikilinks]]` across the vault |
| `delete_note` | Soft-delete into a vault-local `.trash/` folder |
| `manage_frontmatter` | Parse/modify YAML frontmatter while preserving the body |
## Install
```json
{
"mcpServers": {
"obsidian": {
"command": "npx",
"args": ["-y", "obsidian-local-mcp"],
"env": { "OBSIDIAN_VAULT_PATH": "C:\\path\\to\\MyVault" }
}
}
}
```
## Configuration
| Option | Env var | Meaning |
|---|---|---|
| `--vault <path>`, `-v` | `OBSIDIAN_VAULT_PATH` | Vault root (required). Validated at startup: must contain a `.obsidian/` folder. |
| `--allow-config` | `OBSIDIAN_ALLOW_CONFIG=1` | Permit access to `.obsidian/` (blocked by default). |
All tool paths are vault-relative; a path-traversal guard keeps every operation inside the vault root.
## Development
Requires Node 20+.
```bash
npm install # install dependencies
npm run build # compile TypeScript to dist/
npm test # run the 49-test suite (unit + MCP integration over in-memory transport)
npm run inspector # open the MCP Inspector UI against dist/index.js
```
Headless smoke test with the MCP Inspector CLI:
```bash
npx -y @modelcontextprotocol/inspector --cli node dist/index.js --vault /path/to/vault --method tools/list
```
> Note: the Inspector CLI passes `--tool-arg` values as raw strings, so array/object arguments (e.g. `edit_note`'s `edits`) are rejected by schema validation there — use the Inspector UI, or point an MCP client at the server, to exercise those.
## Status
✅ **v1 built and smoke-tested** — all 8 tools from the spec implemented, 49 tests passing, verified end-to-end with the MCP Inspector.
Install from npm (works on Windows, macOS, and Linux with Node 20+):
```json
{
"mcpServers": {
"obsidian": {
"command": "npx",
"args": ["-y", "obsidian-local-mcp", "--vault", "C:\\path\\to\\MyVault"]
}
}
}
```
> Prefer installing from source? `npx -y github:davidcastaneda838/obsidian-local-mcp --vault <path>` works too. macOS/Linux users usually have `node` on PATH and can use `"command": "node"`, `"args": ["obsidian-local-mcp", "--vault", "/Users/me/MyVault"]` after a global install. Windows GUI clients that don't inherit your PATH should use the absolute path to `node.exe` and the installed package's `dist/index.js`.
## License
MIT
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues