From b5da9431aade28e29538ebbe74dcf5193bedf627 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Wed, 4 Feb 2026 00:01:00 +0100 Subject: [PATCH] docs: add nixos-options MCP configuration Co-Authored-By: Claude Opus 4.5 --- .mcp.json | 12 ++++++++++++ CLAUDE.md | 17 +++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 .mcp.json diff --git a/.mcp.json b/.mcp.json new file mode 100644 index 0000000..01c6a16 --- /dev/null +++ b/.mcp.json @@ -0,0 +1,12 @@ +{ + "mcpServers": { + "nixos-options": { + "command": "nix", + "args": ["run", "git+https://git.t-juice.club/torjus/labmcp#nixos-options", "--", "serve"], + "env": { + "NIXOS_OPTIONS_DATABASE": "sqlite:///run/user/1000/labmcp/nixos-options.db" + } + } + } +} + diff --git a/CLAUDE.md b/CLAUDE.md index e160929..104bdcd 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -63,6 +63,23 @@ Examples: - `template2: add proxmox image configuration` - `terraform: add VM deployment configuration` +### NixOS Options Lookup + +An MCP server is available for searching and looking up NixOS option documentation. This is useful when configuring new services or options for hosts. + +**Session Setup:** At the start of each session, index the nixpkgs revision from `flake.lock` to ensure option documentation matches the project's nixpkgs version: + +1. Read `flake.lock` and find the `nixpkgs` node's `rev` field +2. Call `index_revision` with that git hash + +**Usage Examples:** + +- `search_options` - Search for options by name or description (e.g., query "nginx" or "postgresql") +- `get_option` - Get full details for a specific option (e.g., `services.loki.configuration`) +- `get_file` - Fetch the source file from nixpkgs that declares an option + +This ensures documentation matches the exact nixpkgs version (currently NixOS 25.11) used by this flake. + ## Architecture ### Directory Structure