nix-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| NIX_MCP_ROOTS | No | Colon-separated workspace roots used as the configured filesystem boundary when MCP client roots are not provided. | |
| NIX_MCP_PROFILE | No | Policy profile controlling advertised mutation tools and execution authority. Supported values are safe (default), developer, operator, and v1-compat. | safe |
| NIX_MCP_DEPLOY_PATH | No | Explicit path to the deploy-rs executable used for deployment planning and application. | |
| NIX_MCP_ALLOW_PROFILE | No | Set to 1 to advertise and permit the profile_manage tool. | |
| NIX_MCP_ALLOW_SIGNING | No | Set to 1 to permit store signing without enabling deletion, GC, repair, or optimisation. | |
| NIX_MCP_DEPLOY_TARGETS | No | Comma-separated allowlist of permitted deployment targets, for example host1,root@host2. | |
| NIX_MCP_ALLOW_PROVISIONING | No | Set to 1 to permit nixos-anywhere application under operator policy. | |
| NIX_MCP_NIXOS_REBUILD_PATH | No | Explicit path to the nixos-rebuild executable used for deployment planning and application. | |
| NIX_MCP_NIXOS_ANYWHERE_PATH | No | Explicit path to the nixos-anywhere executable used for deployment planning and application. | |
| NIX_MCP_ALLOW_STORE_MAINTENANCE | No | Set to 1 to advertise store maintenance and permit destructive store operations. |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
Start with workspace_inspect when the target is unknown. Use focused build/check/run/develop tools before command. Call discover for advanced operations; discovery never grants authority. Every execution returns a runId: use run_inspect for diagnostics and bounded logs. Deployment always requires deploy_plan followed by deploy_apply. Never replace a policy denial with raw shell execution.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
| logging | {} |
| prompts | {
"listChanged": true
} |
| resources | {
"listChanged": true
} |
| completions | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| workspace_inspectA | Start here in a Nix repository. Detect the flake, outputs, Nix version, deployment adapters, and the most useful next tool. |
| discoverA | Find the best MCP tool or version-supported Nix operation for an intent. Use before command when no first-class tool fits. |
| buildB | Build one or more packages, NixOS systems, checks, or store paths. Returns output paths and a durable run ID for diagnostics. |
| checkA | Validate flake outputs and checks. Prefer this for repository-wide quality gates; use build for one focused output. |
| runC | Run a flake application without installing it. Application arguments are passed as an array after --, never through a shell. |
| developB | Execute an argument-array command in a project dev shell. Use run for a flake app and build for a derivation. |
| evalB | Inspect a Nix value without building its result. Supports flake attributes, expressions, files, typed function arguments, raw text, and JSON. |
| syntax_checkA | Parse one or more Nix files without evaluating or building them. Uses nix-instantiate --parse for compatibility. |
| searchC | Search nixpkgs or another flake for packages. Use flake_inspect to list a project's complete output tree. |
| flake_inspectB | Inspect flake outputs, locked inputs, revision metadata, or resolved flake information. Use eval for one exact value. |
| derivation_inspectA | Show the build recipe for an installable or .drv path, optionally including the recursive derivation graph. |
| closure_inspectC | Measure a closure, inspect references, explain a dependency chain, or compare two closures. |
| run_inspectA | Read status, extracted diagnostics, or bounded stdout/stderr from an earlier MCP run. Use nix log through command for unrelated derivations. |
| commandA | Execute a non-interactive installed Nix operation returned by discover. Options are validated against the runtime command catalog and effect policy. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
| inspect-and-build | Explore a workspace and build the most relevant requested output. |
| diagnose-failure | Inspect structured diagnostics and then only the relevant log region. |
| inspect-derivation | Analyze a derivation recipe and its runtime closure. |
| update-flake-input | Update one lock input and verify the result. |
| plan-deployment | Create, review, and optionally apply a fingerprinted deployment plan. |
| use-nix-tool | Apply one tool according to its manual. |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
| Nix capability catalog | First-class tools, manuals, installed Nix operations, effects, and policy availability. |
| Inspect Nix Workspace | Start here in a Nix repository. Detect the flake, outputs, Nix version, deployment adapters, and the most useful next tool. |
| Discover Nix Capability | Find the best MCP tool or version-supported Nix operation for an intent. Use before command when no first-class tool fits. |
| Build Nix Installables | Build one or more packages, NixOS systems, checks, or store paths. Returns output paths and a durable run ID for diagnostics. |
| Check Nix Flake | Validate flake outputs and checks. Prefer this for repository-wide quality gates; use build for one focused output. |
| Run Nix Application | Run a flake application without installing it. Application arguments are passed as an array after --, never through a shell. |
| Run in Nix Development Shell | Execute an argument-array command in a project dev shell. Use run for a flake app and build for a derivation. |
| Evaluate Nix Value | Inspect a Nix value without building its result. Supports flake attributes, expressions, files, typed function arguments, raw text, and JSON. |
| Check Nix Syntax | Parse one or more Nix files without evaluating or building them. Uses nix-instantiate --parse for compatibility. |
| Search Nix Packages | Search nixpkgs or another flake for packages. Use flake_inspect to list a project's complete output tree. |
| Inspect Nix Flake | Inspect flake outputs, locked inputs, revision metadata, or resolved flake information. Use eval for one exact value. |
| Inspect Nix Derivation | Show the build recipe for an installable or .drv path, optionally including the recursive derivation graph. |
| Inspect Nix Closure | Measure a closure, inspect references, explain a dependency chain, or compare two closures. |
| Inspect Nix MCP Run | Read status, extracted diagnostics, or bounded stdout/stderr from an earlier MCP run. Use nix log through command for unrelated derivations. |
| Run Discovered Nix Operation | Execute a non-interactive installed Nix operation returned by discover. Options are validated against the runtime command catalog and effect policy. |
| inspect-build-debug | |
| update-input | |
| derivation-analysis | |
| deployment | |
| /app |
TDQS
Scored across 14 tools
Descriptions actively draw boundaries between the easy-to-confuse pairs (run vs develop vs build, check vs build, eval vs flake_inspect), which is unusually careful. The only real overlap is the inspect family, where workspace_inspect and flake_inspect both surface flake/output information, and run_inspect's name collides conceptually with 'run'.
Two clear conventions coexist: bare verbs (build, check, run, eval, search, develop, discover) and noun+inspect (closure_inspect, workspace_inspect, flake_inspect, derivation_inspect, run_inspect), plus syntax_check which follows neither exactly. Each family is internally consistent and readable, but the set as a whole mixes patterns, and 'command' is a bare noun.
14 tools sits squarely in the well-scoped range and every tool maps to a recognizable Nix workflow (inspect, build, eval, run, develop, validate, search, diagnose). Nothing looks redundant or padded for the scope of a Nix repository assistant.
Coverage is broad: evaluation, building, checks, dev shells, package search, flake/derivation/closure inspection, syntax parsing, and post-run diagnostics. Gaps exist around flake lock/update and store management (gc, copy, delete), but the discover + command escape hatch provides a validated path to those operations.