- Rust 88.5%
- Nix 11.5%
|
|
||
|---|---|---|
| .forgejo/workflows | ||
| src | ||
| .env | ||
| .envrc | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| flake.lock | ||
| flake.nix | ||
| package.nix | ||
| README.md | ||
nixos-wiki-mcp
An MCP server that reads wiki entries from an offline dump of the official NixOS Wiki.
Download a wiki dump here (updated daily).
The wikidump.xml.zst file is a compressed MediaWiki XML export.
A small indexer compresses it once into a local SQLite database for fast lookups, and the MCP server exposes three tools over stdio:
| Tool | Description |
|---|---|
list_pages |
List the titles of all pages in the index. |
search_pages |
Search page titles by substring (case-insensitive). |
get_page |
Get a page's full wikitext and metadata by exact title. |
Setup
Build the index
First, build the SQLite index from the wiki dump:
nix develop -c cargo run --release --bin wikimbp-index
This reads ./wikidump.xml.zst and writes ./wiki-index.sqlite3.
You should see output like:
indexed 7498 pages into wiki-index.sqlite3 in 4.6s
Build & run the server
Build the MCP server:
nix build
This produces ./result/bin/wikimbp-server (and ./result/bin/wikimbp-index).
The server reads its database from the NIXOS_WIKI_DB environment variable (defaults to wiki-index.sqlite3 in the current directory).
Run it so your MCP client can spawn it as a stdio subprocess:
NIXOS_WIKI_DB=$PWD/wiki-index.sqlite3 nix run
Configure your MCP client
Point your MCP client at nix to run the server via flakes.
The server speaks the standard MCP protocol over stdio.
There is no HTTP endpoint and no registration server.
Example entry:
{
"mcpServers": {
"nixos-wiki": {
"command": "nix",
"args": ["run", "path:/absolute/path/to/project"],
"env": {
"NIXOS_WIKI_DB": "/absolute/path/to/wiki-index.sqlite3"
}
}
}
}
Smoke-test the server
You can drive the server manually by piping JSON-RPC requests to it over stdin:
printf '%s\n' \
'{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}' \
'{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"get_page","arguments":{"title":"Btrfs"}}}' \
| NIXOS_WIKI_DB=$PWD/wiki-index.sqlite3 nix run
Development
nix develop
cargo build # build both binaries
cargo test # run the test suite
cargo run --bin wikimbp-index # rebuild the index
cargo run --bin wikimbp-server # run the MCP server