Get the FREE Ultimate OpenClaw Setup Guide →

nix s

A nix flake for configuring Model Context Protocol (MCP) servers across supported AI assistant clients

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio ismail-kattakath-nix-mcp-servers npx -y @modelcontextprotocol/server-github \
  --env GITHUB_PERSONAL_ACCESS_TOKEN="REQUIRED through assertion"

How to use

Nix MCP Servers provides declarative configuration for MCP servers that expose access to AI model contexts for clients like Claude and Cursor. The filesystem server grants access to local or configured directories where models or artifacts reside, while the GitHub server enables MCP-style access to models or artifacts stored in GitHub. This setup is designed to be integrated with Home Manager or NixOS configurations, enabling per-client server access with simple enable flags. To use it, enable the desired servers (filesystem and/or github) for a client, and ensure the required environment (like a GitHub token) is provided where needed. The result is a generated MCP configuration that clients can consume to interact with the server backends in a consistent way.

You can mix and match servers per client. For example, Cursor might use only the filesystem server, while Claude could be configured to access both filesystem and GitHub sources. The project emphasizes a declarative approach: enable the modules, provide any required tokens, and the hosting configuration will generate the appropriate MCP server configuration files for the target client.

How to install

Prerequisites:

  • Nix and Flakes enabled on your system
  • Home Manager (if integrating with Home Manager) or NixOS configuration workflow

Step 1: Install or enable Nix Flakes

  • Ensure your Nix installation supports flakes and that you have a flake-enabled configuration.

Step 2: Add the MCP servers flake as an input in your configuration

  • In NixOS or Home Manager, reference the nix-mcp-servers flake as shown in the docs. For example:
{
  inputs = {
    nix-mcp-servers.url = "github:aloshy-ai/nix-mcp-servers";
  };
  outputs = { nixpkgs, home-manager, nix-mcp-servers, ... }: {
    homeConfigurations."yourusername" = home-manager.lib.homeManagerConfiguration {
      modules = [
        nix-mcp-servers.homeManagerModules.default
        {
          nix-mcp-servers = {
            clients.generateConfigs = true;
            clients.cursor.enable = true;
            clients.cursor.filesystem.enable = true;
            clients.cursor.filesystem.paths = [ "/path/to/allowed" ];
            clients.github.enable = false;
          };
        }
      ];
    };
  };
}

Step 3: Enable and configure servers for clients

  • Use the provided examples to enable and configure the desired servers for each client (Claude or Cursor). For example, enable filesystem for Cursor and, if needed, GitHub access with a token for Claude.

Step 4: Apply your configuration

  • Run the appropriate Nix commands for your setup (e.g., nixos-rebuild switch on NixOS or nix run '<flake>#homeConfigurations.youruser.activation' for Home Manager).

Prerequisites recap:

  • Nix and flakes enabled
  • Access tokens configured where required (e.g., GitHub token for GitHub server)
  • Understanding of your client layout (Claude vs Cursor) and which servers you want active for each client.

Additional notes

Tips and notes:

  • The GitHub server requires a GitHub personal access token; provide it in your environment when enabling the server.
  • The filesystem server uses the server-filesystem image/package; ensure your allowed paths are configured if applicable in your environment.
  • The configuration is designed to be used with Home Manager or NixOS modules. If you are not using Home Manager, adapt the server definitions to your NixOS modules accordingly.
  • When generating configs, you can selectively enable or disable servers per client to tailor access for Claude and Cursor.
  • If you encounter issues, verify that your Nix flake inputs are up to date and that the MCP servers are correctly referenced in your home-manager or nixos configurations.

Related MCP Servers

Sponsor this space

Reach thousands of developers