Skip to main content
Glama
obsidian-vault-mcp

obsidian-vault-mcp

by TOMO0904
README.md
# obsidian-vault-mcp

[![CI](https://github.com/TOMO0904/obsidian-vault-mcp/actions/workflows/test.yml/badge.svg)](https://github.com/TOMO0904/obsidian-vault-mcp/actions/workflows/test.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
[![Python](https://img.shields.io/badge/python-3.10%2B-blue.svg)](pyproject.toml)

A small, **read-only** [MCP](https://modelcontextprotocol.io/) server that lets any
MCP-compatible chat AI (Claude Desktop, OpenMausBot, etc.) read your
[Obsidian](https://obsidian.md/) vault: search notes, fetch a note's content, and
list its `[[internal links]]`.

- 日本語: [README.ja.md](README.ja.md)
- Read-only by design: the server never writes to or deletes from the vault.
- Local-first: vault content goes only to the MCP client that asked. Nothing is
  sent anywhere else.
- Respects the vault's own `AGENTS.md` rule: `90_System/Indexes/catalog.jsonl`
  is searched **before** broad note reads.

## Table of contents

- [Quick start](#quick-start)
- [Tools](#tools)
- [Install](#install)
- [Configure an MCP client](#configure-an-mcp-client)
- [Examples](#examples)
- [Tests and CI](#tests-and-ci)
- [Known limitations](#known-limitations)
- [Layout](#layout)
- [Security notes](#security-notes)
- [License](#license)
- [Changelog](#changelog)

## Quick start

```bash
pip install .                                   # or: pip install obsidian-vault-mcp from PyPI
export OBSIDIAN_VAULT_PATH="/path/to/your/Obsidian Vault"
# Windows: set OBSIDIAN_VAULT_PATH=C:\Users\you\Documents\Obsidian Vault
```

Register the server in your MCP client (template:
[examples/mcp_client_config.example.json](examples/mcp_client_config.example.json)):

```json
{
  "mcpServers": {
    "obsidian-vault": {
      "command": "obsidian-vault-mcp",
      "args": [],
      "env": { "OBSIDIAN_VAULT_PATH": "/path/to/your/Obsidian Vault" }
    }
  }
}
```

Then just ask the AI, e.g. "search my vault for X" — the catalog index is
searched first, per the vault's AGENTS.md.

## Tools

| Tool | Description |
| --- | --- |
| `search_catalog(query, limit)` | Search the vault index `90_System/Indexes/catalog.jsonl` (searched first, per the vault's AGENTS.md). |
| `search_notes(query, limit)` | Catalog hits first, then full-text search over note paths/contents with snippets. |
| `get_note(path, max_chars)` | Read one note (path relative to the vault root). Path escapes outside the vault are rejected. |
| `list_links(path)` | List the `[[internal links]]` of a note (target + optional alias). |
| `list_notes()` | List all markdown notes in the vault. |

## Install

```bash
python -m venv .venv
.venv/Scripts/pip install -r requirements.txt        # Windows
# .venv/bin/pip install -r requirements.txt          # macOS / Linux
# for development (tests): pip install -r requirements-dev.txt
```

Or install the package directly: `pip install .` (provides the
`obsidian-vault-mcp` command). Requires Python 3.10+.

## Configure an MCP client

Point your client at the server and set the vault path via the
`OBSIDIAN_VAULT_PATH` environment variable (or pass `--vault PATH`).

Example (Claude Desktop style `mcpServers` config) — a ready-to-edit copy lives
in [examples/mcp_client_config.example.json](examples/mcp_client_config.example.json):

```json
{
  "mcpServers": {
    "obsidian-vault": {
      "command": "obsidian-vault-mcp",
      "args": ["--vault", "C:/Users/you/Documents/Obsidian Vault"],
      "env": { "OBSIDIAN_VAULT_PATH": "C:/Users/you/Documents/Obsidian Vault" }
    }
  }
}
```

Run standalone for a manual smoke test (stdio, JSON-RPC):

```bash
obsidian-vault-mcp --vault "C:/Users/you/Documents/Obsidian Vault"
```

## Examples

- [examples/mcp_client_config.example.json](examples/mcp_client_config.example.json) —
  MCP client `mcpServers` template (env-var based; no secrets in the file).

## Tests and CI

```bash
pip install .[dev]
python -m pytest -q
```

Covers the vault layer (catalog-first search, path-escape rejection, link
extraction) and an end-to-end stdio MCP handshake (`initialize`, `tools/list`,
`tools/call`) against a temporary vault. GitHub Actions runs the same suite on
every push/PR across Python 3.10-3.13 (see the CI badge above).

## Known limitations

- Automated tests cover the vault layer and the stdio JSON-RPC handshake.
  Connecting from a real desktop MCP client and long-running sessions have
  **not** been verified yet.
- If `90_System/Indexes/catalog.jsonl` does not exist, catalog search returns an
  empty list; full note search still works.
- `get_note` truncates content at 20,000 characters by default (override with
  `max_chars`).
- Hidden folders/files (names starting with `.`) are skipped when listing and
  searching notes.
- Read-only by design: there are no write tools at all.

## Layout

```
obsidian-vault-mcp/
├── .github/workflows/test.yml      # CI (pytest on Python 3.10-3.13)
├── examples/                       # sample MCP client config (no secrets)
├── src/obsidian_vault_mcp/
│   ├── vault.py     # read-only vault access (stdlib only, unit-testable)
│   └── server.py    # MCP (FastMCP) stdio server exposing the tools
├── tests/
│   ├── test_vault.py        # unit tests
│   ├── test_vault_paths.py  # path-traversal rejection tests
│   └── test_server_stdio.py # end-to-end MCP-over-stdio smoke test
├── LICENSE  CHANGELOG.md  pyproject.toml
├── README.md  README.ja.md
└── requirements.txt / requirements-dev.txt
```

## Security notes

- Read-only: no tool can create, modify, or delete vault files.
- Path traversal guard: any path resolving outside the vault (including via
  `..`, absolute paths, or symlinks) is rejected.
- No secrets are read, logged, or sent; the server only reads local files and
  answers the connected MCP client.

## License

MIT — see [LICENSE](LICENSE).

## Changelog

See [CHANGELOG.md](CHANGELOG.md).

TDQS

A3.5/5.0

Scored across 5 tools

Disambiguation3/5

search_catalog is a strict subset of search_notes (which returns catalog hits first, then note hits), so the boundary between the two is blurred and an agent must rely on the AGENTS.md rationale rather than on distinct semantics. Similarly, list_notes and search_notes both return note paths, differing mainly in filtering. get_note and list_links are cleanly distinct, and the descriptions do provide guidance, keeping this from being worse.

Naming Consistency5/5

All five tools follow a consistent snake_case verb_noun pattern: search_catalog, search_notes, get_note, list_links, list_notes. Verbs (search/get/list) map predictably to retrieval semantics with no camelCase or stylistic drift.

Tool Count5/5

Five tools is well-scoped for a read-oriented vault access server; each tool covers a distinct access pattern (index lookup, broad search, single note read, link listing, enumeration) with no filler tools.

Completeness3/5

The surface is entirely read-only: there is no create, update, append, move, or delete operation, and no way to inspect frontmatter/tags or incoming backlinks (list_links is outgoing-only). This is coherent for a deliberately read-only server, but leaves notable gaps for typical vault note management workflows.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues