Skip to main content
Glama
VaultBridge MCP

VaultBridge MCP

by UDvoid
README.md
# VaultBridge MCP

[![CI](https://github.com/UDvoid/vaultbridge-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/UDvoid/vaultbridge-mcp/actions/workflows/ci.yml)
![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue)
![Zero Runtime Dependencies](https://img.shields.io/badge/dependencies-0-brightgreen)
![License: MIT](https://img.shields.io/badge/license-MIT-green)

**Zero-dependency, local-first MCP server for Markdown & Obsidian vaults.**

Give Claude Code, Cursor, Codex, and Gemini CLI fast, structured, read-only access to your local Markdown knowledge base — powered purely by Python 3.10+ standard library and SQLite FTS5.

- **Zero Runtime Dependencies**: Pure Python stdlib (`sqlite3`, `json`, `pathlib`, `re`, `hashlib`, `argparse`). No `pip` dependency tree, no vector DB daemon, no Node runtime required.
- **Bilingual FTS5 Retrieval**: Weighted BM25 full-text search across English, Chinese (CJK), and mixed technical notes — including 2-character Chinese terms.
- **Incremental Indexing**: Fast `mtime` + `sha256` change detection skips untouched files and resolves Obsidian WikiLinks (`[[Note]]`, `[[Note|Alias]]`, `[[Note#Heading]]`), YAML frontmatter, headings, and `#tags`.
- **Secure by Default**: Strict path-traversal blocking, symlink escape rejection, and built-in exclusion of `.git/`, `.obsidian/`, `.vaultbridge/`, `Credentials/`, `.env*`, and private keys.

---

## Architecture

```text
  Markdown / Obsidian Vault
  ├── README.md
  ├── projects/
  │   └── architecture.md   (YAML frontmatter, #headings, [[WikiLinks]], #tags)
  └── [BLOCKED: .git/, .obsidian/, Credentials/, .env*, *.key, ../]
                │
                ▼
  ┌──────────────────────────────────────────────────────────┐
  │  vaultbridge.indexer  (Pure Python 3.10+ stdlib)         │
  │  • mtime + sha256 incremental scanner                    │
  │  • YAML frontmatter, heading tree, WikiLink & tag parser │
  │  • CJK + English FTS5 tokenizer + BM25 ranking           │
  └───────────────────────────┬──────────────────────────────┘
                              │  .vaultbridge/index.db (SQLite WAL + FTS5)
                              ▼
  ┌──────────────────────────────────────────────────────────┐
  │  vaultbridge.server  (MCP stdio JSON-RPC 2.0)            │
  │  vb_brief │ vb_search │ vb_get │ vb_related │ vb_status  │
  └───────────────────────────┬──────────────────────────────┘
                              │  stdin / stdout (NDJSON)
                              ▼
     Claude Code  •  Cursor  •  Codex  •  Gemini CLI
```

---

## 30-Second Quick Start

### 1. Install

```bash
# Editable local install (zero runtime dependencies)
pip install -e .

# Or run directly from source with zero installation
PYTHONPATH=src python3 -m vaultbridge --version
```

### 2. Initialize & Index Your Vault

```bash
vaultbridge init --vault /path/to/your/vault
vaultbridge doctor --vault /path/to/your/vault
```

### 3. Try It in Your Terminal

```bash
# High-signal vault overview
vaultbridge brief --vault /path/to/your/vault

# Bilingual English + Chinese FTS5 search
vaultbridge search "architecture 架构" --vault /path/to/your/vault

# Start MCP stdio server
vaultbridge serve --vault /path/to/your/vault
```

---

## MCP Client Configuration

Replace `/path/to/your/vault` with the absolute path to your Markdown or Obsidian vault.

### Claude Code

Add via CLI:

```bash
claude mcp add vaultbridge -- vaultbridge serve --vault /path/to/your/vault
```

Or add to `.mcp.json` / `~/.claude.json`:

```json
{
  "mcpServers": {
    "vaultbridge": {
      "command": "vaultbridge",
      "args": ["serve", "--vault", "/path/to/your/vault"]
    }
  }
}
```

### Cursor

Add to `.cursor/mcp.json` (project) or `~/.cursor/mcp.json` (global):

```json
{
  "mcpServers": {
    "vaultbridge": {
      "command": "vaultbridge",
      "args": ["serve", "--vault", "/path/to/your/vault"]
    }
  }
}
```

### OpenAI Codex CLI

Add to `~/.codex/config.toml`:

```toml
[mcp_servers.vaultbridge]
command = "vaultbridge"
args = ["serve", "--vault", "/path/to/your/vault"]
```

### Gemini CLI

Add to `~/.gemini/settings.json`:

```json
{
  "mcpServers": {
    "vaultbridge": {
      "command": "vaultbridge",
      "args": ["serve", "--vault", "/path/to/your/vault"]
    }
  }
}
```

> Running directly from a cloned repo without `pip install`? Use `"command": "python3"`, `"args": ["-m", "vaultbridge", "serve", "--vault", "/path/to/your/vault"]`, and set `"env": { "PYTHONPATH": "/path/to/vaultbridge-mcp/src" }`.

---

## Exposed MCP Tools

| Tool | Purpose | Key Arguments |
| --- | --- | --- |
| `vb_brief` | One-call vault orientation: stats, folders, top tags, entry/MOC notes, recent notes, and optional topic hits. | `topic?`, `max_notes?` |
| `vb_search` | Weighted SQLite FTS5 BM25 search supporting English, Chinese (CJK), and mixed queries. | `query`, `limit?`, `tag?`, `path_prefix?` |
| `vb_get` | Read a verified vault-relative Markdown note (full, by heading section, or by line range) with strict boundary checks. | `path`, `heading?`, `start_line?`, `end_line?`, `max_chars?` |
| `vb_related` | Traverse outgoing WikiLinks, incoming backlinks, shared-tag neighbors, and same-folder peers. | `path`, `limit?` |
| `vb_status` | Report index health, note/link/tag counts, SQLite FTS5 readiness, staleness, and optional incremental re-index. | `check_stale?`, `reindex?` |

---

## CLI Reference

```bash
vaultbridge init   --vault /path/to/vault          # Create .vaultbridge/config.json and initial index
vaultbridge index  --vault /path/to/vault [--force] # Incremental (or full) FTS5 index update
vaultbridge search "query" --vault /path/to/vault  # Full-text search (--tag, --path-prefix, --json)
vaultbridge brief  [topic] --vault /path/to/vault  # Compact vault or topic briefing (--json)
vaultbridge serve  --vault /path/to/vault          # Start MCP stdio JSON-RPC 2.0 server
vaultbridge doctor --vault /path/to/vault          # Verify Python, FTS5, DB integrity, and security guards
```

Environment variables `VAULTBRIDGE_VAULT` and `VAULTBRIDGE_DB` can also be used instead of `--vault` and `--db`.

---

## Security & Privacy Model

VaultBridge Core is strictly local and read-only over MCP:

- **No network calls, no telemetry, no external embeddings API.**
- **Path Traversal Defense**: `vb_get` and `vb_related` reject absolute paths, `..` segments, null bytes, non-Markdown targets, and symlinks resolving outside the vault root.
- **Default Sensitive Exclusions**: Directories `.git/`, `.obsidian/`, `.vaultbridge/`, `.trash/`, `Credentials/`, `.secrets/`, `secrets/`, `.ssh/`, `.gnupg/`, `node_modules/`, `.venv/` and files `.env`, `.env.*`, `*.pem`, `*.key`, `*.p12`, `*.pfx`, `*.secret`, `id_rsa*`, `id_ed25519*` are excluded from both indexing and reads.
- **Custom Exclusions**: Add a `.vaultbridgeignore` file at the vault root using standard glob patterns.

---

## Development & Tests

Run the full zero-dependency test suite (including a real subprocess MCP stdio JSON-RPC 2.0 end-to-end test):

```bash
PYTHONPATH=src python3 -m unittest discover -s tests -v
```

Also compatible with `pytest`:

```bash
PYTHONPATH=src pytest -v
```

---

## VaultBridge Core vs. Pro

VaultBridge Core is open-source (MIT) and designed to remain fast, self-contained, and genuinely useful on its own. For power users running multi-agent knowledge workflows across multiple tools, an optional **VaultBridge Pro** add-on builds on top of the same local-first philosophy:

| Capability | VaultBridge Core (MIT) | VaultBridge Pro ($29 One-Time) |
| --- | :---: | :---: |
| Local SQLite FTS5 incremental indexing (EN + CJK) | Included | Included |
| 5 read-only MCP tools (`vb_brief`, `vb_search`, `vb_get`, `vb_related`, `vb_status`) | Included | Included |
| Path traversal & sensitive-directory protection | Included | Included |
| CLI (`init`, `index`, `search`, `brief`, `serve`, `doctor`) | Included | Included |
| 5-client non-destructive config merger (`setup`: Claude Code, Cursor, Codex, Gemini CLI, Windsurf) | — | Included |
| 38-rule + Shannon entropy `secret_guard` scanner & local git `pre-commit` hooks (zero plaintext echo) | — | Included |
| Structured `capture` write pipeline (`proposal`/`decision`/`handoff`/`inbox`, `--supersedes`, `--commit`) | — | Included |
| Ready-to-use Obsidian Starter Vault & cross-client AI rules templates (`init-vault`) | — | Included |

<!-- VAULTBRIDGE_PRO_LINKS_START -->
**VaultBridge Pro (v1.0.0 — $29 one-time)** checkout via Creem.io is going live shortly — star/watch this repository or follow [`@udvoid`](https://x.com/udvoid) for the live release link.
<!-- VAULTBRIDGE_PRO_LINKS_END -->

---

## License

MIT License — Copyright (c) 2026 UDvoid. See [LICENSE](LICENSE).