by utensils
Provides real-time NixOS package, configuration option, and version‑history data to AI assistants via Model Context Protocol, eliminating hallucinated responses about the Nix ecosystem.
Mcp Nixos delivers a Model Context Protocol (MCP) server that queries official NixOS search APIs, NixHub version data, and related services. It exposes endpoints for packages, NixOS options, Home Manager settings, and nix‑darwin (macOS) configurations, allowing AI agents to obtain accurate, up‑to‑date information.
uvx mcp-nixos
, installed via pip install mcp-nixos
, launched with nix run github:utensils/mcp-nixos
, or run in a Docker container (ghcr.io/utensils/mcp-nixos
)..mcp.json
in the client’s working directory:
{
"mcpServers": {
"nixos": {
"type": "stdio",
"command": "uv",
"args": ["run", "--directory", "/path/to/mcp-nixos", "mcp-nixos"]
}
}
}
The client will start the server automatically and route queries to it.nixos_search
, home_manager_info
, or nixhub_package_versions
from your assistant.Q: Do I need NixOS installed to use the server? A: No. The server only calls public web APIs, so it works on any system with Python.
Q: How does the server stay up‑to‑date?
A: It queries the official search.nixos.org
backend and NixHub in real time; no local cache is kept.
Q: What if I want to run it behind a firewall?
A: Set the ELASTICSEARCH_URL
environment variable to point to a reachable NixOS API endpoint.
Q: Can I limit the number of version entries returned?
A: Yes. Use nixhub_package_versions(package, limit)
to restrict the result set.
Q: Is there a Docker image?
A: Yes – ghcr.io/utensils/mcp-nixos
. Run it with docker run --rm -i ghcr.io/utensils/mcp-nixos
.
🎉 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?
🚨 No Nix/NixOS Required! This tool works on any system - Windows, macOS, Linux. You're just querying web APIs.
{
"mcpServers": {
"nixos": {
"command": "uvx",
"args": ["mcp-nixos"]
}
}
}
{
"mcpServers": {
"nixos": {
"command": "nix",
"args": ["run", "github:utensils/mcp-nixos", "--"]
}
}
}
{
"mcpServers": {
"nixos": {
"command": "docker",
"args": ["run", "--rm", "-i", "ghcr.io/utensils/mcp-nixos"]
}
}
}
That's it. Your AI assistant now has access to real NixOS data instead of making things up. You're welcome.
MCP-NixOS is a Model Context Protocol server that gives your AI assistant accurate, real-time information about:
nixos_search(query, type, channel)
- Search packages, options, or programsnixos_info(name, type, channel)
- Get detailed info about packages/optionsnixos_stats(channel)
- Package and option countsnixos_channels()
- List all available channelsnixos_flakes_search(query)
- Search community flakesnixos_flakes_stats()
- Flake ecosystem statisticsnixhub_package_versions(package, limit)
- Get version history with commit hashesnixhub_find_version(package, version)
- Smart search for specific versionshome_manager_search(query)
- Search user config optionshome_manager_info(name)
- Get option details (with suggestions!)home_manager_stats()
- See what's availablehome_manager_list_options()
- Browse all 131 categorieshome_manager_options_by_prefix(prefix)
- Explore options by prefixdarwin_search(query)
- Search macOS optionsdarwin_info(name)
- Get option detailsdarwin_stats()
- macOS configuration statisticsdarwin_list_options()
- Browse all 21 categoriesdarwin_options_by_prefix(prefix)
- Explore macOS optionsRemember: You DON'T need Nix/NixOS installed! This tool runs anywhere Python runs.
# Run directly with uvx (no installation needed)
uvx mcp-nixos
# Or install globally
pip install mcp-nixos
uv pip install mcp-nixos
# Run without installing
nix run github:utensils/mcp-nixos
# Install to profile
nix profile install github:utensils/mcp-nixos
await
stable
always points to current stableWant to test your changes in Claude Code or another MCP client? Create a .mcp.json
file in your project directory:
{
"mcpServers": {
"nixos": {
"type": "stdio",
"command": "uv",
"args": [
"run",
"--directory",
"/home/hackerman/Projects/mcp-nixos",
"mcp-nixos"
]
}
}
}
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:
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)
# Install development dependencies
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
Just one. We're minimalists now:
Variable | Description | Default |
---|---|---|
ELASTICSEARCH_URL |
NixOS API endpoint | https://search.nixos.org/backend |
If you encounter this error when running via Nix:
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
This project queries data from several amazing services:
Note: These services have not endorsed this tool. We're just grateful API consumers.
MIT - Because sharing is caring, even if the code hurts.
Created by James Brink and maintained by masochists who enjoy Nix and async/await patterns.
Special thanks to the NixOS project for creating an OS that's simultaneously the best and worst thing ever.
Please log in to share your review and rating for this MCP.
Explore related MCPs that share similar capabilities and solve comparable challenges
by zed-industries
A high‑performance, multiplayer code editor designed for speed and collaboration.
by modelcontextprotocol
Model Context Protocol Servers
by modelcontextprotocol
A Model Context Protocol server for Git repository interaction and automation.
by modelcontextprotocol
A Model Context Protocol server that provides time and timezone conversion capabilities.
by cline
An autonomous coding assistant that can create and edit files, execute terminal commands, and interact with a browser directly from your IDE, operating step‑by‑step with explicit user permission.
by continuedev
Enables faster shipping of code by integrating continuous AI agents across IDEs, terminals, and CI pipelines, offering chat, edit, autocomplete, and customizable agent workflows.
by upstash
Provides up-to-date, version‑specific library documentation and code examples directly inside LLM prompts, eliminating outdated information and hallucinated APIs.
by github
Connects AI tools directly to GitHub, enabling natural‑language interactions for repository browsing, issue and pull‑request management, CI/CD monitoring, code‑security analysis, and team collaboration.
by daytonaio
Provides a secure, elastic infrastructure that creates isolated sandboxes for running AI‑generated code with sub‑90 ms startup, unlimited persistence, and OCI/Docker compatibility.