vault-cortex

MCP server for Obsidian vaults — plugin-free search, memory, and full vault access for any AI agent.

CI Gitleaks GitHub Release License: MIT Node.js TypeScript MCP Server vault-cortex MCP server

vault-cortex

What is this?

vault-cortex gives any MCP client — Claude Desktop, Claude Code, Cursor, OpenCode — full access to your Obsidian vault. Search notes, read and write content, query the link graph, manage structured memory, and resolve daily notes — all through 23 tools over a single Docker container.

The typical Obsidian + MCP setup requires three moving parts running simultaneously: Obsidian open → Local REST API plugin → a separate MCP server wrapping the REST API. vault-cortex replaces all of that with Docker and your vault folder.

  • Plugin-free — Obsidian doesn't need to be running; headless sync keeps the vault current, and the server works directly with .md files on disk
  • Remote access — works from your phone, a remote server, or any MCP client via OAuth 2.1
  • Ranked search — SQLite FTS5 with BM25 scoring, stemming, phrase matching, and tag/property/folder filtering
  • Structured memory — dated entries, section targeting, auto-initialization for AI personalization
  • Obsidian-native — understands frontmatter, wikilinks, tags, headings, and daily notes

Roadmap

PhaseWhatStatus
1Vault CRUD, full-text search (FTS5), memory layer, OAuth 2.1Complete
2Semantic search + knowledge graph via LightRAGPlanned

Quick Start

Local (5 minutes — Docker + your vault folder)

Prerequisites: Docker and an Obsidian vault (or any folder of .md files).

1. Get the quickstart files

curl -O https://raw.githubusercontent.com/aliasunder/vault-cortex/main/deploy/local/docker-compose.yml curl -O https://raw.githubusercontent.com/aliasunder/vault-cortex/main/deploy/local/.env.example

2. Configure

cp .env.example .env

Edit .env — set MCP_AUTH_TOKEN (openssl rand -hex 32) and VAULT_PATH

3. Start

docker compose up

Connect Claude Desktop or Claude Code — add a remote MCP server with URL http://localhost:8000/mcp and your token as the bearer token.

Full local guide →

Remote (access from anywhere — Docker + Obsidian Sync)

Run vault-cortex on a VPS with Obsidian Sync for remote access from any device.

On your VPS:

mkdir -p /opt/vault-cortex && cd /opt/vault-cortex curl -O https://raw.githubusercontent.com/aliasunder/vault-cortex/main/deploy/remote/docker-compose.yml curl -O https://raw.githubusercontent.com/aliasunder/vault-cortex/main/deploy/remote/.env.example cp .env.example .env

Edit .env — set MCP_AUTH_TOKEN, PUBLIC_URL, OBSIDIAN_AUTH_TOKEN, VAULT_NAME

docker compose up -d

Connect via OAuth — add a remote MCP server with <PUBLIC_URL>/mcp. A consent page opens; enter your token to approve. JWT access tokens refresh automatically.

Full remote guide →

Tools (23)

CategoryToolDescription
Vault CRUDvault_read_noteRead a note by path
vault_write_noteCreate or overwrite a note with frontmatter
vault_patch_noteHeading-targeted edit (append, prepend, replace, insert)
vault_replace_in_noteFind-and-replace text in a note
vault_list_notesList notes with optional glob/folder filter
vault_delete_noteDelete a note (protected paths enforced)
Searchvault_searchFull-text search with tag/folder/property filters
vault_search_by_tagFind notes by tag (exact or prefix match)
vault_search_by_folderBrowse notes in a folder with metadata
vault_recent_notesRecently modified or created notes
vault_list_tagsAll tags with usage counts
Memoryvault_get_memoryRead structured memory (file, section, or all)
vault_update_memoryAppend a dated entry to a memory section
vault_delete_memoryRemove a specific memory entry by date
vault_list_memory_filesDiscover memory files and their sections
Propertiesvault_list_property_keysAll frontmatter keys with sample values
vault_list_property_valuesDistinct values for a property key
vault_search_by_propertyFind notes by frontmatter key-value
vault_update_propertiesAdd or update properties without touching the body
Linksvault_get_backlinksNotes linking to a given path
vault_get_outgoing_linksLinks from a given note
vault_find_orphansNotes with no incoming links
Daily Notesvault_get_daily_noteToday's (or any date's) daily note

Configuration

All settings are environment variables with sensible defaults.

VariableRequired?DefaultDescription
MCP_AUTH_TOKENYesBearer token for authentication (also the JWT signing key)
VAULT_PATHLocal onlyHost path to your vault (bind mount source; remote uses a named volume)
PUBLIC_URLRemote onlyPublic URL for OAuth discovery metadata
MEMORY_DIRAbout MeVault folder for structured memory files
PROTECTED_PATHSMEMORY_DIR, Daily NotesFolders that vault_delete_note refuses to touch
ORPHAN_EXCLUDE_FOLDERSDaily Notes, Templates, MEMORY_DIRFolders excluded from orphan detection
TZUTCIANA timezone for timestamps and daily note resolution
SERVICE_DOCUMENTATION_URLGitHub repo URLURL returned in OAuth discovery metadata
LOG_LEVELinfoLogging verbosity: debug, info, warn, error
LOG_DIR/data/logs (Docker)Directory for persistent log files. Logs survive container restarts.
LOG_RETENTION_DAYS30Days to keep log files before automatic cleanup on startup

Smart defaults: Setting MEMORY_DIR automatically updates the defaults for PROTECTED_PATHS and ORPHAN_EXCLUDE_FOLDERS. You only set those explicitly for a fully custom list.

See templates/memory/ for memory file examples and the dated-entry design philosophy.

Authentication

Two methods, both validated at two layers (Lambda authorizer + Express middleware):

MethodUsed byToken format
OAuth 2.1Claude Desktop, Claude Code, claude.ai, any OAuth clientJWT (HS256, 24h)
Static bearerClaude Code, MCP Inspector, curlRaw MCP_AUTH_TOKEN

OAuth uses dynamic client registration — no Client ID/Secret needed. A consent page opens in your browser; enter your MCP_AUTH_TOKEN to approve. Refresh tokens have a 60-day sliding expiry (daily users never re-authenticate).

See ARCHITECTURE.md → Auth for the full flow diagram.

How It Works

graph LR Client["MCP Client"] -->|OAuth 2.1 / Bearer| Server["vault-mcp"] Server -->|read/write| Vault[("/vault
.md files")] Server -->|query| SQLite[("SQLite FTS5")] Sync["obsidian-sync"] <-->|Obsidian Sync| Vault

The vault .md files are the source of truth. SQLite FTS5 is rebuildable derived state — the index is built on startup and kept current by a file watcher. obsidian-sync keeps the vault in sync with your Obsidian apps (remote deployments only).

See ARCHITECTURE.md for the full design, auth flow diagrams, and Phase 1/2 boundaries.

Deployment Options

PathWhatGuide
LocalDocker on your machine, vault bind-mounteddeploy/local/
RemoteVPS + Obsidian Sync, access from anywheredeploy/remote/
AWS (SST)Full IaC: Lightsail + API Gateway + Lambda + CI/CDDEPLOY.md

Development

Run locally with hot reload

PUBLIC_URL=http://localhost:8000 MCP_AUTH_TOKEN=local-dev-token VAULT_PATH=~/Vault npm run dev:mcp

Tests

npm test

Full check suite

npm run prettier:check && npm run lint && npm test && npm run build

MCP Inspector — interactive browser UI for testing tools:

Start server (terminal 1), then:

npx @modelcontextprotocol/inspector

Enter http://localhost:8000/mcp as URL, local-dev-token as Bearer token

See CONTRIBUTING.md for the full development setup.

Tips

For Claude users

The obsidian-vault skill teaches Claude how to write Obsidian-compatible content — frontmatter, wikilinks, tags, callouts, and plugin-specific syntax. vault-cortex delivers the content; obsidian-vault ensures it renders correctly in Obsidian. Available for Claude Code and Claude Desktop.

Acknowledgments

vault-cortex's remote capability exists because of @Belphemur's obsidian-headless-sync-docker — a headless Obsidian Sync client that runs in Docker without a display server. It's the piece that makes "access your vault from anywhere" possible.

Contributing

See CONTRIBUTING.md for development setup, code conventions, and PR guidelines.

License

MIT

Security

Report vulnerabilities privately — see SECURITY.md.

相關伺服器