Logo van NixOS

NixOS

Organisatie
utensils

MCP-NixOS - Model Context Protocol Server for NixOS resources

Uitgeverutensils
Repositorymcp-nixos
TaalPython
Forks
45
Sterren
839
Beschikbare tools
18
Transporttypestdio
Categorieën
LicentieMIT
Links
  • Koppel tools aan AI-workflows

    NixOS biedt MCP-functionaliteit die compatibele AI-clients en agenten kunnen gebruiken.

  • 18 beschikbare tools

    Bekijk hieronder de aanroepbare acties, inclusief namen en beschrijvingen als de server die beschikbaar stelt.

  • Configuratie om direct te kopiëren

    Gebruik de installatievoorbeelden om deze server in je favoriete MCP-client te configureren.

  • Indicatoren van opensource-interesse

    839 sterren en 45 forks in de gekoppelde repository.

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

MCP Toplist

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

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

Option 2: Nix

Install MCP Server

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

Option 3: Docker

Install MCP Server

json
{
  "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).

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

bash
MCP_NIXOS_TRANSPORT=stdio mcp-nixos

Custom path:

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

Stateless HTTP (disables per-client session state):

bash
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):

bash
pi install npm:pi-mcp-adapter

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

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
  • NVF - 2.4K+ Neovim options from its published unstable documentation
  • 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:

text
nix(action, query, source, type, channel, limit, version, system)

version and system are only used by action="cache".

ActionWhat it does
searchSearch packages, options, programs, or flakes
infoGet detailed info about a package or option
statsGet counts and categories
browseBrowse Home Manager, Darwin, Nixvim, NVF, or Noogle by prefix (legacy alias: options)
channelsList available NixOS channels
flake-inputsExplore local flake inputs from Nix store
cacheCheck binary cache status for packages
storeRead files or list directories at an explicit /nix/store path (requires Nix)
SourceWhat it queries
nixosPackages, options, programs
home-managerHome Manager options
darwinnix-darwin options
flakesCommunity flakes (search.nixos.org)
flakehubFlakeHub registry (flakehub.com)
nixvimNixvim Neovim configuration options
nvfNVF Neovim configuration options (latest unstable docs)
noogleNix function signatures and docs (noogle.dev)
wikiNixOS Wiki articles (wiki.nixos.org)
nix-devOfficial Nix documentation (nix.dev)
nixhubPackage metadata and store paths (nixhub.io)

NVF results use canonical vim.* option paths. Queries may also use the shorthand programs.nvf.vim.* or the NixOS/Home Manager module path programs.nvf.settings.vim.*; both are normalized automatically.

Examples:

python
# 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="browse", 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 NVF options
nix(action="search", query="vim.languages.nix", source="nvf")

# Get NVF option info using a module wrapper path
nix(action="info", query="programs.nvf.settings.vim.languages.nix.enable", source="nvf")

# Browse NVF options below a prefix
nix(action="browse", query="programs.nvf.vim.languages.nix", source="nvf")

# 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="browse", 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")

# List or read a store path directly (requires Nix)
nix(action="store", type="ls", query="/nix/store/<hash>-<name>")
nix(action="store", type="read", query="/nix/store/<hash>-<name>/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
python
nix_versions(package, version, limit)

Examples:

python
# 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.

bash
# Run directly (no install)
uvx mcp-nixos

# Or install
pip install mcp-nixos

For Nix users:

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

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

nix
# 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 ];
      }];
    };
  };
}

overlays.default only adds pkgs.mcp-nixos. The package carries its own FastMCP 4 / MCP SDK 2 stack (see nix/fastmcp4.nix), including a starlette at or above the 1.0.1 security floor FastMCP requires, so nothing else in your Python package set changes, even on nixpkgs channels that still ship FastMCP 3. If you also want pkgs.python3Packages.fastmcp itself upgraded set-wide, apply mcp-nixos.overlays.fastmcp4 in addition.

Development

bash
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
  • NVF - Neovim configuration framework and published option catalogue

License

MIT - Because sharing is caring.


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

Installatie

TypingMind
Vereisten:

Node.js 18+

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

Beschikbare tools

  • nixos_search

    Search NixOS packages, options, or programs.

    Args: query: Search term to look for search_type: Type of search - "packages", "options", "programs", or "flakes" limit: Maximum number of results to return (1-100) channel: NixOS channel to search in (e.g., "unstable", "stable", "25.05")

    Returns: Plain text results with bullet points or error message

  • nixos_info

    Get detailed info about a NixOS package or option.

    Args: name: Name of the package or option to look up type: Type of lookup - "package" or "option" channel: NixOS channel to search in (e.g., "unstable", "stable", "25.05")

    Returns: Plain text details about the package/option or error message

  • nixos_channels

    List available NixOS channels with their status.

    Returns: Plain text list showing channel names, versions, and availability

  • nixos_stats

    Get NixOS statistics for a channel.

    Args: channel: NixOS channel to get stats for (e.g., "unstable", "stable", "25.05")

    Returns: Plain text statistics including package/option counts

  • home_manager_search

    Search Home Manager configuration options.

    Searches through available Home Manager options by name and description.

    Args: query: The search query string to match against option names and descriptions limit: Maximum number of results to return (default: 20, max: 100)

    Returns: Plain text list of matching options with name, type, and description

  • home_manager_info

    Get detailed information about a specific Home Manager option.

    Requires an exact option name match. If not found, suggests similar options.

    Args: name: The exact option name (e.g., 'programs.git.enable')

    Returns: Plain text with option details (name, type, description) or error with suggestions

  • home_manager_stats

    Get statistics about Home Manager options.

    Retrieves overall statistics including total options, categories, and top categories.

    Returns: Plain text summary with total options, category count, and top 5 categories

  • home_manager_list_options

    List all Home Manager option categories.

    Enumerates all top-level categories with their option counts.

    Returns: Plain text list of categories sorted alphabetically with option counts

  • home_manager_options_by_prefix

    Get Home Manager options matching a specific prefix.

    Useful for browsing options under a category or finding exact option names.

    Args: option_prefix: The prefix to match (e.g., 'programs.git' or 'services')

    Returns: Plain text list of options with the given prefix, including descriptions

  • darwin_search

    Search nix-darwin (macOS) configuration options.

    Searches through available nix-darwin options by name and description.

    Args: query: The search query string to match against option names and descriptions limit: Maximum number of results to return (default: 20, max: 100)

    Returns: Plain text list of matching options with name, type, and description

  • darwin_info

    Get detailed information about a specific nix-darwin option.

    Requires an exact option name match. If not found, suggests similar options.

    Args: name: The exact option name (e.g., 'system.defaults.dock.autohide')

    Returns: Plain text with option details (name, type, description) or error with suggestions

  • darwin_stats

    Get statistics about nix-darwin options.

    Retrieves overall statistics including total options, categories, and top categories.

    Returns: Plain text summary with total options, category count, and top 5 categories

  • darwin_list_options

    List all nix-darwin option categories.

    Enumerates all top-level categories with their option counts.

    Returns: Plain text list of categories sorted alphabetically with option counts

  • darwin_options_by_prefix

    Get nix-darwin options matching a specific prefix.

    Useful for browsing options under a category or finding exact option names.

    Args: option_prefix: The prefix to match (e.g., 'system.defaults' or 'services')

    Returns: Plain text list of options with the given prefix, including descriptions

  • nixos_flakes_stats

    Get statistics about available NixOS flakes.

    Retrieves statistics from the flake search index including total packages, unique repositories, flake types, and top contributors.

    Returns: Plain text summary with flake statistics and top contributors

  • nixos_flakes_search

    Search NixOS flakes by name, description, owner, or repository.

    Searches the flake index for community-contributed packages and configurations. Flakes are indexed separately from official packages.

    Args: query: The search query (flake name, description, owner, or repository) limit: Maximum number of results to return (default: 20, max: 100) channel: Ignored - flakes use a separate indexing system

    Returns: Plain text list of unique flakes with their packages and metadata

  • nixhub_package_versions

    Get version history and nixpkgs commit hashes for a specific package from NixHub.io.

    Use this tool when users need specific package versions or commit hashes for reproducible builds.

    Args: package_name: Name of the package to query (e.g., "firefox", "python") limit: Maximum number of versions to return (default: 10, max: 50)

    Returns: Plain text with package info and version history including commit hashes

  • nixhub_find_version

    Find a specific version of a package in NixHub with smart search.

    Automatically searches with increasing limits to find the requested version.

    Args: package_name: Name of the package to query (e.g., "ruby", "python") version: Specific version to find (e.g., "2.6.7", "3.5.9")

    Returns: Plain text with version info and commit hash if found, or helpful message if not

Gebruik NixOS MCP met meerdere AI-modellen

TypingMind koppelt MCP-tools aan de werkruimte. Zodra NixOS is verbonden, kun je deze dus met verschillende AI-modellen in TypingMind gebruiken, zonder de verbinding voor elk model apart in te stellen. Deze MCP-integratie draait lokaal via de TypingMind MCP-connector op je apparaat.

Installatiehandleiding voor de lokale connector

Gebruik dit als de MCP-server toegang nodig heeft tot lokale bestanden, apps of privébronnen op je computer.

1

Open de MCP-instellingen

Ga in TypingMind naar Instellingen, Geavanceerde instellingen en vervolgens Model Context Protocol. Kies daar Connector instellen.

  1. Open TypingMind in je browser.
  2. Klik op het pictogram Instellingen.
  3. Ga naar Geavanceerde instellingen.
  4. Open het gedeelte Model Context Protocol.
  5. Klik op Connector instellen en kies Dit apparaat.
Instelscherm voor de TypingMind MCP-connector met Dit apparaat geselecteerd
2

Voer de connectoropdracht uit

Kies Dit apparaat, kopieer de opdracht uit TypingMind en voer deze uit in Terminal. Laat het proces draaien zolang je MCP gebruikt.

  1. Kopieer de installatieopdracht die TypingMind toont.
  2. Open Terminal op macOS of Windows Terminal op Windows.
  3. Plak de opdracht en voer deze uit.
  4. Keur de pakketinstallatie goed als Terminal vraagt of je wilt doorgaan.
  5. Laat het proces in het Terminal-venster draaien zolang je MCP-tools gebruikt.
3

Voeg NixOS toe als server

Klik op Servers bewerken zodra de connectorstatus Gereed is en plak de MCP-serverconfiguratie.

  1. Wacht tot de connectorstatus Gereed aangeeft.
  2. Klik op Servers bewerken.
  3. Plak de MCP-serverconfiguratie van NixOS.
  4. Sla de serverlijst op.
  5. Vernieuw om te controleren of de connector nog steeds klaar is voor gebruik.
MCP-instellingen van TypingMind met een actieve server en de knop Servers bewerken
{
  "mcpServers": {
    "nixos": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-nixos"
      ]
    }
  }
}
4

Gebruik de verbinding met verschillende modellen

Sla de serverlijst op, open Plug-ins en schakel de MCP-tools van NixOS in. Selecteer vervolgens een ondersteund AI-model in TypingMind en gebruik de tools in de chat of wijs ze toe aan een AI-agent.

  1. Open de pagina Plug-ins in TypingMind.
  2. Schakel de MCP-tools van NixOS in.
  3. Start een chat en kies het AI-model dat je wilt gebruiken.
  4. Gebruik de MCP-tools in een chat of wijs ze toe aan een AI-agent.
  5. Schakel wanneer nodig over naar een ander AI-model zonder opnieuw verbinding te maken met MCP.
TypingMind-chat met ingeschakelde MCP-tools en een geselecteerd AI-model
Kun je NixOS gebruiken om me hiermee te helpen?
NixOS
Zeker. Ik heb het gelezen.
Dit vond ik met NixOS.

Veelgestelde vragen

Waarvoor wordt de MCP-server NixOS gebruikt?

NixOS is een MCP-server waarmee compatibele AI-clients verbinding kunnen maken met externe tools en context. In TypingMind hoef je deze MCP-server maar één keer toe te voegen om de tools beschikbaar te maken in je AI-werkruimte.

Kan ik NixOS MCP met meerdere AI-modellen in TypingMind gebruiken?

Ja. TypingMind verbindt MCP-tools op werkruimteniveau. Daardoor kun je NixOS gebruiken met verschillende AI-modellen, zoals Claude, ChatGPT, Gemini of andere modellen die je in TypingMind hebt ingesteld, zonder de MCP-server voor elk model afzonderlijk in te stellen.

Waarom NixOS MCP gebruiken met TypingMind?

TypingMind is een van de beste interfaces voor chats met LLM's, omdat het meerdere AI-modellen, prompts, plug-ins, AI-agenten, API-sleutels en MCP-tools samenbrengt in één werkruimte. Als NixOS verbonden is, kun je de MCP-tools ervan gebruiken met je favoriete modellen en je chatworkflow overzichtelijk houden in TypingMind.

Hoe verbind ik NixOS MCP met TypingMind?

NixOS werkt via de lokale MCP-connector van TypingMind. Dit is de beste optie als de MCP-server toegang nodig heeft tot lokale bestanden, desktopapps, opdrachtregeltools of privébronnen op je computer.

Welke tools biedt NixOS MCP in TypingMind?

NixOS biedt 18 MCP-tools die je kunt inschakelen via de pagina Plug-ins in TypingMind. Je kunt ze gebruiken in chats of toewijzen aan AI-agenten.

Moet ik mijn API-sleutels delen met TypingMind om NixOS MCP te gebruiken?

Nee. TypingMind werkt in de eerste plaats lokaal en laat je de controle houden over je modelaanbieders, API-sleutels, prompts en MCP-configuratie. Als NixOS authenticatie vereist, voeg je bij het maken van de verbinding de vereiste headers, OAuth-instellingen of lokale configuratie voor die MCP-server toe.

Gerelateerde MCP-servers

Toon alles

Maak nu je eigen AI-werkruimte

Schrijf je in voor onze nieuwsbrief en blijf op de hoogte van nieuwe functies en toekomstige weggeefacties 👇