A retrieval engine for the Midnight Network
Ask your docs,
not your model
Privacy-respecting hybrid search over the real Midnight docs and source — right inside your AI client.
claude mcp add midnight-manual -- mnm mcp serve
Quick start
Up and running
in three steps
No database, no API key, no account. You need a Rust toolchain (1.91+); the corpus is hosted and the reranker is fetched on demand.
01
Build the CLI
Clone, build the mnm binary, and put it on your PATH.
02
Add to your client
One command wires the MCP server into your AI assistant.
03
Search
Ask something Midnight-specific and get cited, ranked answers.
cargo build --release -p mn-cli && install -m 0755 target/release/mnm ~/.local/bin/mnm
claude mcp add midnight-manual -- mnm mcp serve
# ~/.codex/config.toml — [mcp_servers.midnight-manual] command="mnm" args=["mcp","serve"]
# ~/.cursor/mcp.json — { "mcpServers": { "midnight-manual": { "command": "mnm", "args": ["mcp","serve"] } } }
Your assistant's training data went stale the day it shipped. midnight-manual gives it hybrid search over the live Midnight corpus — ranked, reranked, and cited — so its answers trace back to the real docs and source, not a stale guess.
The retrieval engine
Confidence = trust × relevance
Lexical (PostgreSQL full-text) and semantic (pgvector) candidates are fused with
Reciprocal Rank Fusion (k=60). An optional bge-reranker-base cross-encoder sharpens the top
results. Then every hit's relevance is multiplied by a trust score — and the per-factor
breakdown comes back with it, so your assistant can explain why a passage is trustworthy.
Three tools, one binary
One workspace,
three ways in
In your AI client
Drop mnm mcp serve into Claude Code, Codex, or Cursor — your assistant gains hybrid search, reranking, and document navigation.
In your terminal
Search the corpus, inspect chunks and documents, and manage the local reranker. Add --json to anything for scripting.
Hosted by default
An axum + Postgres + pgvector service hosts the indexed corpus. It's the compiled-in default — most users never run a server.
In your AI client
13 tools, lazy-loaded
A hand-rolled MCP server (JSON-RPC over stdio) that starts in under half a second and
only loads the reranker the first time a query needs it (query embedding is remote, via VoyageAI). When the corpus rolls its embedding model forward,
search returns a structured embedding_model_mismatch envelope that tells the client to pull_models — no cryptic failures.
Find
search — hybrid full-text + vector retrieval, optional rerank, filters by source / tier / language / package. Every hit carries a confidence score.
Navigate
get_chunk, get_chunk_next/prev, get_chunk_neighbors, get_chunk_parents, get_document, get_document_full, get_document_chunks — pull exactly as much surrounding context as needed.
Operate
list_sources, pull_models, status, install_search_skill — enumerate sources, fetch the reranker on demand, report health, and install the Advanced Search Skill.
It teaches the technique
Searches like a
seasoned researcher
The server gives your assistant the power tools; the Advanced Search Skill teaches the technique. It's a persistent, auto-loaded Agent Skill — install once and your agent reaches for the right retrieval pattern on its own.
HyDE
Draft a hypothetical answer and search with it alongside the question.
Multi-query
Fuse 2–3 paraphrases to beat synonym mismatch.
Step-back
Pair the specific question with a broader framing.
Lexical anchoring
Send exact identifiers and error codes verbatim.
Symbol-aware
Scope by package / language, navigate by symbol path.
Retrieve-read-retrieve
Broad pass → read neighbours → refine → search again.
Trust-weighted
Rank and prune on each result's trust factors.
Cross-source
Surface disagreement instead of silently picking one.
mnm skills add
The smart chunker
It understands structure
Markdown is split along its heading hierarchy (every chunk carries its
heading_path). Source files are parsed with tree-sitter and split on real syntactic
boundaries — functions, impl blocks, modules — never mid-expression, each recording a structured
symbol_path. Compact is a first-class citizen: circuits, ledger
declarations, witnesses, and contracts each become their own attributable chunk.
Privacy
Where your
text goes
Embed remote, rerank local
Query embedding uses VoyageAI's voyage-code-3 — bring your own key, or let the hosted server proxy it (no account needed; it logs only token counts, never your query text). Reranking runs locally via bge-reranker-base (fastembed/ONNX) — no Python, no GPU.
Opt-out telemetry
Carries no query or chunk content, no tokens, no paths. Opt out three ways: an env var, a config flag, or mnm telemetry disable.
Enforced by a canary
A CI test feeds fake tokens, paths, and queries through every path that touches user content — any leak fails the build.