diff --git a/README.md b/README.md index fe47f2a..88f55ec 100644 --- a/README.md +++ b/README.md @@ -148,6 +148,60 @@ When running as an MCP server, the following tools are available: | `list_revisions` | List all indexed revisions | | `delete_revision` | Delete an indexed revision | +## NixOS Module + +A NixOS module is provided for running the MCP server as a systemd service. + +```nix +{ + inputs.labmcp.url = "github:torjus/labmcp"; + + outputs = { self, nixpkgs, labmcp }: { + nixosConfigurations.myhost = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + labmcp.nixosModules.nixos-options-mcp + { + services.nixos-options-mcp = { + enable = true; + indexOnStart = [ "nixos-unstable" ]; + }; + } + ]; + }; + }; +} +``` + +### Module Options + +| Option | Type | Default | Description | +|--------|------|---------|-------------| +| `enable` | bool | `false` | Enable the service | +| `package` | package | from flake | Package to use | +| `database.type` | enum | `"sqlite"` | `"sqlite"` or `"postgres"` | +| `database.name` | string | `"nixos-options.db"` | SQLite database filename | +| `database.connectionString` | string | `""` | PostgreSQL connection URL | +| `indexOnStart` | list of string | `[]` | Revisions to index on service start | +| `user` | string | `"nixos-options-mcp"` | User to run the service as | +| `group` | string | `"nixos-options-mcp"` | Group to run the service as | +| `dataDir` | path | `/var/lib/nixos-options-mcp` | Directory for data storage | + +### PostgreSQL Example + +```nix +{ + services.nixos-options-mcp = { + enable = true; + database = { + type = "postgres"; + connectionString = "postgres://nixos:nixos@localhost/nixos_options?sslmode=disable"; + }; + indexOnStart = [ "nixos-unstable" "nixos-24.11" ]; + }; +} +``` + ## Development ```bash