freshcrate
Home > MCP Servers > mcp-nixos

mcp-nixos

MCP-NixOS - Model Context Protocol Server for NixOS resources

Description

MCP-NixOS - Model Context Protocol Server for NixOS resources

README

MCP-NixOS - Because Your AI Shouldn't Hallucinate Package Names

CI codecov PyPI FlakeHub Python 3.11+ CodeRabbit Pull Request Reviews Built with Claude

Quick Start

๐Ÿšจ No Nix/NixOS Required! Works on any system - Windows, macOS, Linux. You're just querying APIs.

Option 1: uvx (Recommended)

Install MCP Server

{
  "mcpServers": {
    "nixos": {
      "command": "uvx",
      "args": ["mcp-nixos"]
    }
  }
}

Option 2: Nix

Install MCP Server

{
  "mcpServers": {
    "nixos": {
      "command": "nix",
      "args": ["run", "github:utensils/mcp-nixos", "--"]
    }
  }
}

Option 3: Docker

Install MCP Server

{
  "mcpServers": {
    "nixos": {
      "command": "docker",
      "args": ["run", "--rm", "-i", "ghcr.io/utensils/mcp-nixos"]
    }
  }
}

Your AI now has access to real NixOS data instead of making things up. You're welcome.

Option 4: HTTP (Remote MCP)

FastMCP supports running this server over HTTP at a URL (the MCP endpoint defaults to /mcp).

# Run an HTTP MCP server at http://127.0.0.1:8000/mcp
MCP_NIXOS_TRANSPORT=http MCP_NIXOS_HOST=127.0.0.1 MCP_NIXOS_PORT=8000 mcp-nixos

STDIO (default):

MCP_NIXOS_TRANSPORT=stdio mcp-nixos

Custom path:

MCP_NIXOS_TRANSPORT=http MCP_NIXOS_PATH=/api/mcp mcp-nixos

Stateless HTTP (disables per-client session state):

MCP_NIXOS_TRANSPORT=http MCP_NIXOS_STATELESS_HTTP=1 mcp-nixos

Option 5: Pi Coding Agent

Pi does not speak MCP natively. Two supported paths:

A. pi-mcp-adapter (recommended โ€” speaks MCP, single source of truth):

pi install npm:pi-mcp-adapter

Then add to ~/.pi/agent/mcp.json:

{
  "mcpServers": {
    "nixos": {
      "command": "uvx",
      "args": ["mcp-nixos"],
      "lifecycle": "lazy"
    }
  }
}

B. Project-local extension (clone + run): this repo ships .pi/extensions/mcp-nixos.ts, auto-loaded when you run pi in the cloned repo. Optional: cd .pi && npm install for editor type resolution. Pi runs it either way.

What Is This?

An MCP server providing accurate, real-time information about:

  • NixOS packages - 130K+ packages that actually exist
  • NixOS options - 23K+ ways to configure your system
  • Home Manager - 5K+ options for dotfile enthusiasts
  • nix-darwin - 1K+ macOS settings Apple doesn't document
  • Nixvim - 5K+ options for Neovim configuration via NuschtOS search
  • FlakeHub - 600+ flakes from FlakeHub.com registry
  • Noogle - 2K+ Nix functions with type signatures via noogle.dev
  • NixOS Wiki - Community documentation and guides from wiki.nixos.org
  • nix.dev - Official Nix tutorials and guides from nix.dev
  • Package versions - Historical versions with commit hashes via NixHub.io
  • Binary cache status - Check if packages are cached on cache.nixos.org with download sizes
  • Local flake inputs - Explore your pinned flake dependencies directly from the Nix store (requires Nix)

The Tools

Just two. We consolidated 17 tools into 2 because your AI's context window isn't infinite.

~1,030 tokens total. That's it. While other MCP servers are hogging your context like it's Black Friday, we're sipping minimalist tea in the corner. Your AI gets NixOS superpowers without the bloat.

nix - Unified Query Tool

One tool to rule them all:

nix(action, query, source, type, channel, limit)
Action What it does
search Search packages, options, programs, or flakes
info Get detailed info about a package or option
stats Get counts and categories
options Browse Home Manager/Darwin options by prefix
channels List available NixOS channels
flake-inputs Explore local flake inputs from Nix store
cache Check binary cache status for packages
Source What it queries
nixos Packages, options, programs
home-manager Home Manager options
darwin nix-darwin options
flakes Community flakes (search.nixos.org)
flakehub FlakeHub registry (flakehub.com)
nixvim Nixvim Neovim configuration options
noogle Nix function signatures and docs (noogle.dev)
wiki NixOS Wiki articles (wiki.nixos.org)
nix-dev Official Nix documentation (nix.dev)
nixhub Package metadata and store paths (nixhub.io)

Examples:

# Search NixOS packages
nix(action="search", query="firefox", source="nixos", type="packages")

# Get package info
nix(action="info", query="firefox", source="nixos", type="package")

# Search Home Manager options
nix(action="search", query="git", source="home-manager")

# Browse darwin options
nix(action="options", source="darwin", query="system.defaults")

# Search Nixvim options
nix(action="search", query="telescope", source="nixvim")

# Get Nixvim option info
nix(action="info", query="plugins.telescope.enable", source="nixvim")

# Search FlakeHub
nix(action="search", query="nixpkgs", source="flakehub")

# Get FlakeHub flake info
nix(action="info", query="NixOS/nixpkgs", source="flakehub")

# Search Noogle for Nix functions
nix(action="search", query="mapAttrs", source="noogle")

# Get Noogle function info
nix(action="info", query="lib.attrsets.mapAttrs", source="noogle")

# Browse Noogle function categories
nix(action="options", source="noogle", query="lib.strings")

# Search NixOS Wiki
nix(action="search", query="nvidia", source="wiki")

# Get Wiki page info
nix(action="info", query="Flakes", source="wiki")

# Search nix.dev documentation
nix(action="search", query="packaging tutorial", source="nix-dev")

# Search NixHub for package metadata
nix(action="search", query="nodejs", source="nixhub")

# Get detailed package info from NixHub (license, homepage, store paths)
nix(action="info", query="python", source="nixhub")

# Check binary cache status
nix(action="cache", query="hello")

# Check cache for specific version
nix(action="cache", query="python", version="3.12.0")

# Check cache for specific system
nix(action="cache", query="firefox", system="x86_64-linux")

# Get stats
nix(action="stats", source="nixos", channel="stable")

# List local flake inputs (requires Nix)
nix(action="flake-inputs", type="list")

# Browse files in a flake input
nix(action="flake-inputs", type="ls", query="nixpkgs:pkgs/by-name")

# Read a file from a flake input
nix(action="flake-inputs", type="read", query="nixpkgs:flake.nix")

nix_versions - Package Version History

Find historical versions with nixpkgs commit hashes. Output includes:

  • Package metadata (license, homepage, programs) when available
  • Platform availability per version (Linux/macOS)
  • Nixpkgs commit hash for reproducible builds
  • Attribute path for Nix expressions
nix_versions(package, version, limit)

Examples:

# List recent versions with metadata
nix_versions(package="python", limit=5)

# Find specific version
nix_versions(package="nodejs", version="20.0.0")

Installation

You DON'T need Nix installed. This runs anywhere Python runs.

# Run directly (no install)
uvx mcp-nixos

# Or install
pip install mcp-nixos

For Nix users:

nix run github:utensils/mcp-nixos
nix profile install github:utensils/mcp-nixos

Declarative Installation (NixOS / Home Manager / nix-darwin)

mcp-nixos is available in nixpkgs:

# NixOS (configuration.nix)
environment.systemPackages = [ pkgs.mcp-nixos ];

# Home Manager (home.nix)
home.packages = [ pkgs.mcp-nixos ];

# nix-darwin (darwin-configuration.nix)
environment.systemPackages = [ pkgs.mcp-nixos ];

Or use the flake directly with the provided overlay:

# flake.nix
{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    mcp-nixos.url = "github:utensils/mcp-nixos";
  };

  outputs = { self, nixpkgs, mcp-nixos, ... }: {
    # Example: NixOS configuration
    nixosConfigurations.myhost = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      modules = [{
        nixpkgs.overlays = [ mcp-nixos.overlays.default ];
        environment.systemPackages = [ pkgs.mcp-nixos ];
      }];
    };

    # Example: Home Manager standalone
    homeConfigurations.myuser = home-manager.lib.homeManagerConfiguration {
      pkgs = import nixpkgs {
        system = "x86_64-linux";
        overlays = [ mcp-nixos.overlays.default ];
      };
      modules = [{
        home.packages = [ pkgs.mcp-nixos ];
      }];
    };
  };
}

Development

nix develop          # Enter dev shell
nix build            # Build package
pytest tests/        # Run tests
ruff check .         # Lint
ruff format .        # Format
mypy mcp_nixos/      # Type check

Acknowledgments

  • NixHub.io - Package version history
  • search.nixos.org - Official NixOS search
  • FlakeHub - Flake registry by Determinate Systems
  • Jetify - Creators of Devbox and NixHub
  • Noogle - Nix function search engine
  • NuschtOS - Static option search infrastructure powering Nixvim support
  • Nixvim - Neovim configuration framework for Nix

License

MIT - Because sharing is caring.


Created by James Brink. Maintained by massฬถoฬถcฬถhฬถiฬถsฬถtฬถsฬถ enthusiasts who enjoy Nix.

Release History

VersionChangesUrgencyDate
v2.4.0# MCP-NixOS: v2.4.0 Release Notes - FastMCP 3.x Upgrade ## Overview MCP-NixOS v2.4.0 upgrades the framework dependency to FastMCP 3.x (`fastmcp>=3.2.0`). No user-facing behavior changes โ€” this is a dependency bump needed to keep the project buildable alongside downstream nixpkgs work that moves consumers (e.g. `ha-mcp`) onto FastMCP 3 (tracked in [NixOS/nixpkgs#511658](https://github.com/NixOS/nixpkgs/pull/511658)). ## Changes in v2.4.0 ### ๐Ÿš€ Framework - **FastMCP 3.x upgrade** (#127, #130High4/21/2026
v2.3.2## Overview MCP-NixOS v2.3.2 improves the `nix` tool's descriptions and error messages so smaller local models (qwen3.6, qwen3-coder via Pi, etc.) can reliably map intent to the right `action`/`type` combo. Also ships a project-local Pi Coding Agent extension. Addresses #123 and #125. ## Highlights - ๐Ÿ”ง **Rename `action=options` โ†’ `action=browse`** (#125) โ€” the old name collided with "the options action" in models' minds; old name kept as silent alias for back-compat. - ๐ŸŽฏ **`browse` with `sHigh4/21/2026
v2.3.1## Overview Fixes package search and info lookups for dotted/namespaced attribute paths (e.g., `kdePackages.qt6ct`, `python314Packages.matplotlib`). ## Highlights - Search now queries `package_attr_name` and extracts pname from dotted names (#118) - Info lookup falls back to attribute path when pname lookup fails - Results display full attribute paths so users can identify package sets - Fixed circular symlinks between CLAUDE.md and AGENTS.md ## Installation ```bash pip install mcp-nixos==2.3Medium4/3/2026
v2.3.0## Overview MCP-NixOS v2.3.0 adds HTTP transport support for Remote MCP, binary cache status checking, NixHub as a rich metadata source, and restructures the codebase into a modular architecture. ## Highlights - **HTTP Transport** (#104): `MCP_NIXOS_TRANSPORT=http` with configurable host/port/path and stateless mode โ€” by @ReStranger - **Binary Cache Status** (#92): `nix(action="cache")` checks if packages have pre-built binaries on cache.nixos.org - **NixHub Metadata** (#92): `nix(source="nixLow3/6/2026
v2.2.0## Overview MCP-NixOS v2.2.0 adds three new documentation sources and a new flake-inputs action for exploring local Nix store dependencies. ## Highlights - ๐Ÿ” **NixOS Wiki** (`source="wiki"`) - Search and retrieve wiki articles - ๐Ÿ“š **nix.dev** (`source="nix-dev"`) - Search official Nix tutorials and guides - ๐Ÿ”ง **Noogle** (`source="noogle"`) - Search 2,000+ Nix built-in functions with type signatures - ๐Ÿ“ฆ **Flake Inputs** (`action="flake-inputs"`) - Explore local Nix store dependencies (requLow1/30/2026
v2.1.1## Overview MCP-NixOS v2.1.1 fixes the Nix flake by using stable Python in nixpkgs and includes several build system improvements. ## Changes in v2.1.1 ### ๐Ÿ”ง Improvements & Bug Fixes - **Stable Python Compatibility**: Reverted from Python 3.14 to stable Python 3 in nixpkgs - **Version Retrieval Fix**: Dynamic version detection now reads from pyproject.toml when package isn't installed - **Flake Enhancements**: Better source filtering, unit tests run during build, versioned Docker tags - **CLow1/26/2026
v2.1.0## Overview MCP-NixOS v2.1.0 converts to a pure Nix flake build system and adds FlakeHub integration. This release fixes build compatibility with nixpkgs-unstable (issue #67). ## Highlights - ๐Ÿš€ **Pure Nix Flake**: Complete rewrite from hybrid venv/pip to pure Nix - ๐ŸŒ **FlakeHub Integration**: Now available on FlakeHub for easier installation - ๐Ÿ”ง **Build Fix**: Resolved fastmcp/mcp version constraint issue with nixpkgs-unstable - ๐Ÿ **Python 3.14**: Now builds with Python 3.14 from nixpkgs Low1/7/2026
v2.0.0## Overview MCP-NixOS v2.0.0 is a major release that consolidates 17 MCP tools into just 2 unified tools, reducing token overhead by 95%. This release also adds comprehensive Nixvim support with 16,600+ configuration options. ## Highlights ### ๐ŸŽฏ 95% Token Reduction - **Before**: 17 individual tools consuming ~15,000 tokens - **After**: 2 unified tools consuming ~1,400 tokens - `nix` (769 tokens) - Unified query tool - `nix_versions` (643 tokens) - Package version history ### ๐Ÿš€ Nixvim SLow1/6/2026
v1.1.0## Overview MCP-NixOS v1.1.0 updates to NixOS 25.11 as the new stable channel, fixes the flakes search index, and improves CI/CD reliability. ## Highlights - ๐Ÿš€ **NixOS 25.11 Stable**: Updated stable channel to the latest release - ๐Ÿ”ง **Flakes Search Fixed**: Resolved Elasticsearch index issues (#62) - ๐Ÿ›ก๏ธ **CI Reliability**: Added automatic retry for flaky integration tests (#63, #64) - ๐Ÿ“ฆ **Portability**: Improved `.mcp.json` with relative paths ## Installation ```bash pip install mcp-nixLow1/6/2026
v1.0.3## Overview MCP-NixOS v1.0.3 fixes encoding errors when parsing Home Manager and nix-darwin documentation, ensuring robust operation with various HTML encodings from CDN edge servers. ## Highlights - ๐Ÿ”ง **Fixed HTML Encoding Errors**: Resolves intermittent "unknown encoding: windows-1252" errors - ๐ŸŒ **Enhanced CDN Resilience**: Better handling of documentation served from different edge servers - โœ… **Comprehensive Testing**: Added encoding tests for windows-1252, ISO-8859-1, and UTF-8 with BLow10/18/2025
v1.0.2## Overview MCP-NixOS v1.0.2 is a maintenance release focused on CI/CD improvements, security fixes, and enhanced Docker support. ## Highlights - ๐Ÿš€ Manual workflow dispatch for Docker builds - ๐Ÿ”’ Automated GHCR package visibility - ๐Ÿณ Continuous Docker builds on main branch - ๐Ÿ“ฆ FlakeHub publishing integration - ๐Ÿ”ง API resilience improvements with fallback channels - ๐Ÿ›ก๏ธ Security fix for PrismJS vulnerability ## Installation ```bash pip install mcp-nixos==1.0.2 # or uv pip install mcp-nixoLow10/1/2025
v1.0.1## What's Changed - Migrated to FastMCP for improved async performance - Fixed IntelliJ MCP integration compatibility issues - Restored minimal __main__.py implementation - Updated MCP SDK to 1.12.3 **Full Changelog**: https://github.com/utensils/mcp-nixos/compare/v1.0.0...v1.0.1Low8/3/2025
v1.0.0 ## Overview MCP-NixOS v1.0.0 is a complete rewrite that proves less is more. We've drastically simplified the codebase while maintaining 100% functionality and adding new features. This isn't just a refactorโ€”it's a masterclass in minimalism. ## Changes in v1.0.0 ### ๐ŸŽฏ The Nuclear Option - **Complete Rewrite**: Drastically simplified the entire codebase - **Stateless Operation**: No more cache directories filling up your disk - **Direct API Calls**: Removed all abstraction layersโ€”now it's jLow5/26/2025

Dependencies & License Audit

Loading dependencies...

Similar Packages

maverick-mcpMaverickMCP - Personal Stock Analysis MCP Servermain@2026-04-17
claude-code-statuslineโšก Real-time token, context & agent dashboard for Claude Code โ€” zero polling, pure stdinv1.1.0
mcp-anythingOne command to turn any codebase into an MCP serverv0.1.0
claude-copilotTransform Claude Code into a full development team. 11 specialized agents (Architect, Engineer, QA, Security, UX, DevOps, and more), persistent memory across sessions, and 25,000+ on-demand skills. Wov2.10.0
mcp-task-orchestratorA Model Context Protocol server that provides task orchestration capabilities for AI assistantsv1.8.0