hive
Hive is an MCP server that connects your AI assistant to an Obsidian vault, enabling persistent knowledge management, context retrieval, and task delegation across sessions.
vault_list– Browse all vault projects or list files within a specific project, with optional glob pattern filteringvault_query– Read content from a vault project by section shortcut (context, tasks, roadmap, lessons) or by a specific file path, with optional metadata and line limitsvault_search– Full-text search across all vault files with support for regex, relevance ranking, metadata filters (type, status, tag, project), and recent-changes detectionsession_briefing– Load a comprehensive project briefing at session start, combining active tasks, recent lessons, git activity, and health metrics in a single callvault_write– Create new vault files or append/replace content in existing project sections, with auto-generated frontmatter and auto git commitvault_patch– Perform surgical find-and-replace edits on vault files (single or multi-patch), with validation and auto git commitvault_health– Get health metrics and validation reports for the vault, including drift detection (frontmatter, stale files, broken links) and usage analyticscapture_lesson– Save structured lessons learned (title, context, problem, solution) inline or batch-extract lessons from raw text using a worker modeldelegate_task– Offload tasks or vault file summarization to cheaper/free AI models (Ollama, OpenRouter), with cost and output length controlsworker_status– Check worker health, budget, connectivity, available models, and usage statistics
Automatically performs Git commits when creating, appending, replacing, or patching files within the vault.
Manages vault content stored in Markdown, allowing tools to browse, read, and update files while preserving project documentation structure.
Connects an AI assistant to an Obsidian vault to enable on-demand querying, full-text searching, and management of project context, tasks, roadmaps, and lessons.
Integrates with Ollama as a worker to delegate tasks or summarize vault files using local AI models.
Utilizes YAML frontmatter within vault files for metadata filtering, structured data retrieval, and health metrics.
hive-vault
Your AI coding assistant forgets everything between sessions. Hive fixes that.
Hive is an MCP server that connects your AI assistant to an Obsidian vault. Instead of loading everything upfront, it queries only what's needed — on demand.
Metric | Without Hive | With Hive |
Context loaded per session | ~800 lines (static) | ~50 lines (on demand) |
Token cost for context | 100% every session | 6% average per query |
Knowledge retained between sessions | 0% | 100% (in vault) |
Measured on a real vault with 19 projects, 200+ files. See benchmarks.
Quick Start
Hive runs without a vault — vault tools return a friendly error until VAULT_PATH is set, so you can install first and configure later.
# Minimal — uses default vault path ~/Projects/knowledge
claude mcp add -s user hive -- uvx --upgrade hive-vault
# With a custom vault path
claude mcp add -s user hive -e VAULT_PATH=$HOME/path/to/vault -- uvx --upgrade hive-vault
# Gemini CLI
gemini mcp add -s user -e VAULT_PATH=$HOME/path/to/vault hive-vault uvx -- --upgrade hive-vaultDefault vault path:
~/Projects/knowledge. Override withVAULT_PATH(orHIVE_VAULT_PATH) as shown above.
For Codex CLI, GitHub Copilot, Cursor, Windsurf, and other clients, see Getting Started.
Then ask your assistant: "Use vault_list to see my vault"
Related MCP server: MCP Tools for Obsidian
Requirements
Hive degrades gracefully — every recommended or optional dependency reveals more capability without breaking the baseline.
Required
Python 3.12+ (works on 3.13).
A directory of markdown files. The vault structure used by
00_meta/10_projects/50_work/80_agentsis optional — without it, vault tools still operate but the scope routing is flat.
Recommended
gitinitialised inside the vault. Without it,vault_write/vault_patchstill write to disk; they just skip the per-write commit (andvault_commitreports the working tree as untracked).The Obsidian desktop app to author the vault by hand.
The obsidian-git plugin with auto-commit set to 5–10 minutes. Pair it with
vault_write(commit=False)/vault_patch(commit=False)to push the git workload off the synchronous tool path; see Recommended configuration below.
Optional
Ollama running
qwen2.5-coder:7b(or compatible) for local, freedelegate_task/capture_lessonworker calls.An OpenRouter API key (
OPENROUTER_API_KEY) as a free-tier and paid fallback worker.A backup git remote (e.g. private GitHub repo) so vault history survives a disk loss.
Recommended configuration
Per ADR-006 (commit policy), the recommended pairing for write-heavy flows is:
Install and enable the obsidian-git plugin in your vault.
Set its auto-commit interval to 5 or 10 minutes.
Call
vault_write(..., commit=False)andvault_patch(..., commit=False)for all bulk operations.Optionally call
vault_commit(message="...")at the end of a session to force a checkpoint sooner than the obsidian-git tick.
vault_health reports a ## external_committer block when it detects obsidian-git in the vault. The commit=False durability contract is explicit: files are persisted to disk regardless; only the commit is deferred. A crash before the next flush loses the commit, not the content.
When a tool call is cancelled mid-flight (slow worker, client timeout), the server may have already mutated the disk before the cancel ack reaches the wire. vault_health surfaces a ## ghost_responses counter and emits a mcp.ghost_response.suppressed_after_cancel_ack WARNING for each event — verify state via vault_query rather than retrying, since the ErrorData ack does not imply rollback (ADR-007).
Daemon mode (optional)
The default uvx hive-vault runs a fresh server per session. Daemon mode instead runs one long-lived hive serve that owns the vault, with each session connecting through a thin hive client shim — useful for concurrent sessions, single-owner guarantees (ADR-011), and automatic version adoption. It always degrades to an in-process server if the daemon is down, so it never breaks a session.
uv tool install --upgrade hive-vault # >= 1.32.0
hive service install # supervise hive serve (systemd --user / Task Scheduler)Once supervised, the daemon self-updates: it polls its installed version and, on an upgrade, exits 75 so the supervisor restarts it into the new code — so a periodic uv tool upgrade hive-vault keeps every client current with no added startup latency. See the daemon mode guide and the activation runbook.
Tools
Tool | What it does |
| Load project context, tasks, roadmap, lessons — or any file by path |
| Full-text search with metadata filters, regex, ranked results, recent changes, lesson-usage ranking ( |
| Browse projects and files with glob filtering |
| Server identity (version, vault path, backends), health metrics, drift detection, usage stats, opt-in runtime block |
| Create, append, or replace vault files. |
| Surgical find-and-replace. |
| Flush pending |
| Capture lessons inline / batch-extract from text / look up existing lessons by keyword ( |
| Tasks + lessons + git log + health in one call |
| Route tasks to cheaper models or summarize vault files |
| Budget, connectivity, available models |
Plus 5 resources and 4 prompts for guided workflows.
Lesson reinforcement
Every read of a lesson via vault_query, vault_search, or capture_lesson(find=…) increments a counter and grows that lesson's confidence asymptotically toward 1.0. Validated lessons rank higher than one-shot captures over time.
# Surface the top-ranked lessons matching a keyword
capture_lesson(project="hive", find="multi-process")
# Search lessons ranked by usage signal (not BM25)
vault_search(query="timeout", rank_by="reinforcements") # most-reinforced first
vault_search(query="timeout", rank_by="confidence") # highest decayed confidence
vault_search(query="timeout", rank_by="hybrid") # α=0.7 BM25 + 0.3 confidenceStorage: SQLite side-table at HIVE_LESSON_DB_PATH (default ~/.local/share/hive/lesson_reinforcement.db). WAL mode + busy_timeout make it cross-process safe.
Architecture
MCP Host (Claude Code, Gemini CLI, Codex CLI, Cursor, ...)
└── hive-vault (MCP server, stdio)
├── Vault Tools (7) ── Obsidian vault (Markdown + YAML frontmatter)
├── Session Tools (1) ── Adaptive context assembly
└── Worker Tools (2) ── Ollama (free) → OpenRouter free → paid ($1/mo cap) → rejectDocumentation
Full documentation at mlorentedev.github.io/hive:
Getting Started — install for all MCP clients
Configuration — all 19 environment variables
Vault Structure — how to organize your vault
Use Cases — real-world workflows
Architecture — module map and design decisions
Troubleshooting — common issues and fixes
Project-bound knowledge (docs-as-code) lives in docs/:
docs/adr/— Architecture Decision Recordsdocs/runbooks/— operational proceduresdocs/troubleshooting/— known issues and root-cause write-upsdocs/lessons.md— accumulated gotchas and post-mortems
Contributing
See CONTRIBUTING.md for setup and PR workflow.
git clone https://github.com/mlorentedev/hive.git && cd hive
make install # create venv + install deps
make check # lint + typecheck + test (478 tests, 90% coverage)License
Maintenance
Latest Blog Posts
- 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/mlorentedev/hive'
If you have feedback or need assistance with the MCP directory API, please join our Discord server