Muninn
Muninn MCP server lets AI coding agents search indexed code and manage curated repository knowledge.
Run hybrid, full-text, semantic, and structural searches over indexed repositories.
Target a checkout with
repoorcwd; Git worktrees resolve through registered families, and a first search may register/index a new linked worktree when permitted.Record or update curated knowledge notes under an exact repository-path key, then search, list, or delete them.
Treat search results as evidence to inspect: structural matches are name-based candidates, and incomplete Git operations retain the last completed index.
Integrates with Git repositories and worktrees to maintain a searchable code index, sharing unchanged content and embeddings across linked worktrees while keeping separate searchable views per checkout.
Integrates with OpenAI's hosted embedding backend to generate embeddings for selected source code chunks and query text, enabling semantic code search.
Muninn
Code search and repository knowledge for AI coding agents through MCP.
Muninn maintains a searchable code index for Codex, Claude Code and other compatible MCP clients. Ask where a behavior is implemented, retrieve relevant source ranges, and inspect the code before changing it.
Git worktrees share unchanged content and embeddings while keeping separate
searchable views. A search selects the checkout named by repo or cwd, so a
feature branch and the primary checkout can return their own implementations.
Combine semantic and full-text retrieval with hybrid search.
Follow recorded structural relationships and verify them against source.
Reuse unchanged indexed content across linked Git worktrees.
Store and search curated repository notes.
Muninn needs PostgreSQL with pgvector, Apache AGE and pgcrypto, an indexing watcher, and an MCP connection. Local and hosted embedding backends are available; hosted embeddings send selected source chunks to the provider.
Start with Getting started. Agents performing installation use AGENTS.md.
Article: Muninn code search across Git worktrees.
Install the binaries with Nix
With Nix installed and its nix-command and flakes features enabled, build the
CLI, watcher and MCP server without installing them:
nix build github:kamysh/muninn#muninn
./result/bin/muninn --version
./result/bin/muninn-index --version
./result/bin/muninn-mcp --versionTo add these programs to your user profile instead, use
nix profile add github:kamysh/muninn#muninn.
This installs binaries only. Follow Getting started to
prepare PostgreSQL and its extensions, configure embeddings, start the watcher
and connect your MCP client. No database or service is created by this package.
Use the installed absolute executable paths when configuring the watcher and
MCP client; command -v muninn-index and command -v muninn-mcp show them after
installation.
The commands follow the repository's default branch. Append a commit to the
repository address, as in github:kamysh/muninn/COMMIT#muninn, to pin a version.
Related MCP server: grepsense
Why Muninn exists
An agent repeatedly exploring a large codebase spends context and time finding the same implementations. Plain text search is useful when the name is known; questions about behavior, relationships and prior repository decisions need other entry points. Muninn maintains a searchable index and durable notes so an agent can find relevant source, then read and verify it.
Git worktrees add a second problem: each checkout has its own files, but copying a full chunk/vector index for every branch wastes space and embedding work. Muninn groups linked worktrees into a repository family. It shares unchanged file versions and embeddings, stores file differences per checkout, and searches the checkout the caller selected. Updating the primary checkout adjusts those differences without changing another checkout's published view.
Registration is explicit. A cheap inventory helps a human or agent choose which files matter before the first index starts. An enabled family discovers linked worktrees automatically and shares its configuration across them. Independent non-Git directories can also be registered.
What runs
Component | Role |
| CLI: bootstrap, configuration TUI/JSON, inventory and indexing control |
| Background watcher and reconciliation of enabled families |
| Stdio MCP server launched by the agent client |
postgres-ai | Recommended database distribution: a compatible PostgreSQL, pgvector and Apache AGE stack |
Use postgres-ai for installation. The underlying prerequisites are PostgreSQL with pgvector, Apache AGE and pgcrypto; postgres-ai supplies them together. Assembling a compatible stack yourself is an advanced, non-recommended alternative, documented separately in the custom database guide.
MCP provides search_hybrid, search_fulltext, search_semantic,
search_structural, and record_knowledge, search_knowledge,
list_knowledge, delete_knowledge.
Search results are evidence to inspect, not compiler-verified answers. Full-text search is tokenized; structural edges are name-based candidates. During a merge, rebase or unresolved conflict, Muninn retains the last completed index instead of indexing transient conflict contents. See behavior and limits.
The Codex and Claude Code guidance asks agents to explain, in plain language, how useful a Muninn retrieval was for the current task: a 0–5 score, a reason and the next step. This is the agent’s judgment, not a search rank. The agent setup guide installs that guidance.
Data and privacy
The database and processes can run on your machine. Local embeddings run there after the model is downloaded. Hosted Voyage/OpenAI embeddings send selected source chunks and query text to the provider; those chunks are source code. A remote PostgreSQL deployment also stores the index off-machine. MCP returns source excerpts to the chosen agent client, whose model/data settings apply. Local indexing alone does not make a cloud agent session offline.
Start here
These docs describe the 1.2.2 source tree. Install matching binaries from v1.2.2 or build from this source tree.
Task | Guide |
Install and use Muninn as a human | |
Have an agent perform an installation | |
Connect Codex or Claude and install useful guidance | |
Assemble a custom database stack (advanced, not recommended) | |
Configure file selection and embeddings | |
Upgrade an existing installation | |
Build, understand the design or contribute | |
Remove a family or installation |
Everyday commands
muninn add /path/to/repo # Human configuration TUI; separate Start confirmation
muninn config /path/to/checkout # Review/edit shared family policy
muninn preflight /path/to/checkout --json
muninn config /path/to/checkout --json # Agent inspection
muninn start /path/to/checkout --json # Explicitly enable and run indexing
muninn status # Registered-family overview
muninn usage --days 30Agents should check a complete JSON policy before saving it and guard saves and
start requests with the returned family ID/revision. See the
shared skill. New repositories snapshot global family settings at creation; review the
visible defaults and select the backend before registering. Saved settings do
not follow later global edits. status PATH, pause, resume and remove still use the
registered locator shown by status; they are not arbitrary-worktree commands.
In particular, remove deletes an entire registered family's code index.
Related projects
Project | Purpose |
Dependency-based PostgreSQL migrations as a Rust library and CLI | |
Decisions, evidence and reasoning memory across agent sessions |
Muninn and Mimir can run independently. Their documented setup can share one compatible PostgreSQL instance with separate roles and databases.
License
Apache License 2.0 — see LICENSE. Contributions are subject to the Contributor License Agreement.
Available Tools
8 toolsdelete_knowledgeC
Delete a knowledge item by its UUID.
Inputs: id (required).
list_knowledgeB
List knowledge for an exact repository-path key, ordered by most recently updated. Worktrees do not automatically share this key.
Inputs: repo (required).
record_knowledgeA
Store a curated knowledge item under an exact repository-path key (no worktree/family resolution). Items are embedded and searchable via search_knowledge. Provide 'id' to update an existing item.
Inputs: body (required), repo (required), title (required), id, +2 more.
search_fulltextA
Tokenized full-text keyword search, not literal substring or regex matching. Supply 'repo' (absolute checkout/directory path) or 'cwd' (a directory inside it); 'repo' takes precedence. Git worktrees resolve through Git and registered families; directory roots through database registration. A first search can register and index a new linked worktree when its family already permits indexing. Subsequent searches use that checkout's last completed index; incomplete Git operations retain it.
Inputs: query (required), cwd, repo, limit.
search_hybridA
Semantic + fulltext hybrid search over indexed repos. Supply 'repo' (absolute checkout/directory path) or 'cwd' (a directory inside it); 'repo' takes precedence. Git worktrees resolve through Git and registered families; directory roots through database registration. A first search can register and index a new linked worktree when its family already permits indexing. Subsequent searches use that checkout's last completed index; incomplete Git operations retain it.
Inputs: query (required), cwd, repo, limit.
search_knowledgeA
Hybrid semantic + fulltext search over curated notes under an exact repository-path key; no worktree/family resolution. Use the established main-checkout key for shared notes.
Inputs: repo (required), query (required), limit.
search_semanticA
Vector similarity search. Supply 'repo' (absolute checkout/directory path) or 'cwd' (a directory inside it); 'repo' takes precedence. Git worktrees resolve through Git and registered families; directory roots through database registration. A first search can register and index a new linked worktree when its family already permits indexing. Subsequent searches use that checkout's last completed index; incomplete Git operations retain it.
Inputs: query (required), cwd, repo, limit.
search_structuralA
Find name-based related-symbol candidates, not compiler-verified bindings. For Git checkouts, call resolution prefers matches in the caller file, keeping ties; otherwise it keeps checkout-wide matches. Verify paths and source. Supply 'repo' (absolute checkout/directory path) or 'cwd' (a directory inside it); 'repo' takes precedence. Git worktrees resolve through Git and registered families; directory roots through database registration. A first search can register and index a new linked worktree when its family already permits indexing. Subsequent searches use that checkout's last completed index; incomplete Git operations retain it.
Inputs: symbol (required), relation (required), cwd, repo.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
The four search_* tools map to distinct modalities (hybrid, fulltext, semantic, structural), and the knowledge tools (record/search/delete/list) are clearly separated. However, the search tools share nearly identical boilerplate about repo/cwd resolution, making the first-purpose distinction easy to gloss over, and search_knowledge sits conceptually close to the search_* family.
Consistent snake_case with search_<modality> for retrieval and <verb>_knowledge for note management. The minor inconsistency is that search_knowledge uses the verb_noun form while the other searches use object-noun (modality) naming, but the pattern remains readable.
Eight tools is well-scoped for a code-search server: four search modalities plus a complete knowledge-item lifecycle. Each tool earns its place with no obvious redundancy.
Knowledge items have full lifecycle coverage (record/create+update, list/read, search, delete) and retrieval spans four modalities. The gap is index management: no explicit re-index, index-status, or delete-index tool, though searches auto-register/index to mitigate.
Maintenance
Related MCP Connectors
Codebase knowledge graph — architectural awareness for AI coding agents via MCP
Token-efficient search for coding agents over public and private documentation.
Code intelligence for coding agents: semantic, AST, graph, and full-text search. 279+ languages.
Sub-millisecond persistent memory, behavioral code search, and bug localization for AI agents.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceFour-layer hybrid search and knowledge graph for AI coding assistants: BM25 + vector embeddings + RAPTOR directory summaries + graph expansion fused into a single MCP tool.317 npm21Apache 2.0
- AlicenseNot gradedqualityCmaintenanceProvides two-modal code search (lexical via Zoekt and semantic via ChromaDB embeddings) for AI coding agents through MCP tools, enabling fast regex and meaning-based code lookup.MIT
- AlicenseNot gradedqualityCmaintenanceAST-aware semantic code search engine for AI agents, enabling code retrieval by intent with call-graph context and optional LLM enrichment.31 PyPI2MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI coding agents to navigate and understand entire codebases through symbol-aware semantic retrieval and relational call graph traversal, supporting structural impact analysis and code modification workflows over MCP.Apache 2.0