What is MCP-NixOS provides real-time information about NixOS packages and configurations.?
MCP-NixOS is a Model Context Protocol server that gives your AI assistant accurate, real-time information about NixOS packages, configuration options, Home Manager settings, and more. It works on any system and does not require Nix/NixOS to be installed.
Documentation
MCP-NixOS - Because Your AI Assistant Shouldn't Hallucinate About Packages
π REFACTORED: Version 1.0.0 represents a complete rewrite that drastically simplified everything. We removed all the complex caching, abstractions, and "enterprise" patterns. Because sometimes less is more, and more is just showing off.
π ASYNC UPDATE: Version 1.0.1 migrated to FastMCP 2.x for modern async goodness. Because who doesn't love adding await to everything?
Quick Start (Because You Want to Use It NOW)
π¨ No Nix/NixOS Required! This tool works on any system - Windows, macOS, Linux. You're just querying web APIs.
Replace /home/hackerman/Projects/mcp-nixos with your actual project path (yes, even you, Windows users with your C:\Users\CoolDev\... paths).
This .mcp.json file:
Automatically activates when you launch Claude Code from the project directory
Uses your local code instead of the installed package
Enables real-time testing - just restart Claude Code after changes
Already in .gitignore so you won't accidentally commit your path
With Nix (The Blessed Path)
nix develop
menu # Shows all available commands
# Common tasks
run # Start the server (now with FastMCP!)
run-tests # Run all tests (now async!)
lint # Format and check code (ruff replaced black/flake8)
typecheck # Check types (mypy still judges you)
build # Build the package
publish # Upload to PyPI (requires credentials)
Without Nix (The Path of Pain)
uv pip install -e ".[dev]" # or pip install -e ".[dev]"
# Run the server locally
uv run mcp-nixos # or python -m mcp_nixos.server
# Development commands
pytest tests/ # Now with asyncio goodness
ruff format mcp_nixos/ # black is so 2023
ruff check mcp_nixos/ # flake8 is for boomers
mypy mcp_nixos/ # Still pedantic as ever
# Build and publish
python -m build # Build distributions
twine upload dist/* # Upload to PyPI
Testing Philosophy
367 tests that actually test things (now async because why not)
Real API calls because mocks are for cowards (await real_courage())
Plain text validation ensuring no XML leaks through
Cross-platform tests because Windows users deserve pain too
15 test files down from 29 because organization is a virtue
error: derivation '/nix/store/...-python3.11-watchfiles-1.0.4.drv' specifies a sandbox profile,
but this is only allowed when 'sandbox' is 'relaxed'
Solution: Run with relaxed sandbox mode:
nix run --option sandbox relaxed github:utensils/mcp-nixos --
Why this happens: The watchfiles package (a transitive dependency via MCP) requires custom sandbox permissions for file system monitoring. This is only allowed when Nix's sandbox is in 'relaxed' mode instead of the default 'strict' mode.
Permanent fix: Add to your /etc/nix/nix.conf:
sandbox = relaxed
Acknowledgments
This project queries data from several amazing services:
NixHub.io - Provides package version history and commit tracking