Skip to main content

Model Context Protocol server for NixOS, Home Manager, and nix-darwin resources

Project description

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.

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
  • 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.

~365 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
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)

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")

# 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:

nix_versions(package, version, limit)

Examples:

# List recent versions
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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_nixos-2.2.0.tar.gz (678.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_nixos-2.2.0-py3-none-any.whl (24.3 kB view details)

Uploaded Python 3

File details

Details for the file mcp_nixos-2.2.0.tar.gz.

File metadata

  • Download URL: mcp_nixos-2.2.0.tar.gz
  • Upload date:
  • Size: 678.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mcp_nixos-2.2.0.tar.gz
Algorithm Hash digest
SHA256 a1bcc12486211e7bc86d2c54585160ab8ab0fedd8932164234aef571e0fe89ff
MD5 0d1d387171c3d7e807889bf8d1bdc504
BLAKE2b-256 5b24ece8d29bd1d7f9eaee22e7e16dffb942b9d91bd957f21307bfc452ef688e

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_nixos-2.2.0.tar.gz:

Publisher: publish.yml on utensils/mcp-nixos

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcp_nixos-2.2.0-py3-none-any.whl.

File metadata

  • Download URL: mcp_nixos-2.2.0-py3-none-any.whl
  • Upload date:
  • Size: 24.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mcp_nixos-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 88f126e687fb58722f438d8f1c22f0706c89c628cf059e6716257ed0fb594e31
MD5 13c9869b9246016404853fbbfeae548e
BLAKE2b-256 93ba695eaa47314b3175ce7f0d262d31c91b60012b3a668cd84197c33b9829b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_nixos-2.2.0-py3-none-any.whl:

Publisher: publish.yml on utensils/mcp-nixos

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page