refactor(packages): move in-tree MCP packages to packages/ and standardize callPackage #281

Merged
nimmo merged 1 commit from feat/issue-273-standardize-mcp-packages into main 2026-10-07 13:00:24 +01:00
Owner

Summary

Resolves #273

This PR standardizes in-tree and external MCP package definitions:

  • Karakeep MCP has been extracted to the dedicated external flake repository nimmo/karakeep-mcp.nix (pinned via flake input karakeep-mcp), removing its 25 KiB pnpm-lock.yaml and npm dependency churn from nixos-config.
  • bookstack-mcp and mcp-pangolin are moved to canonical paths packages/bookstack-mcp/default.nix and packages/mcp-pangolin/default.nix with idiomatic callPackage signatures ({ lib, buildNpmPackage, ... }: and { lib, rustPlatform, ... }:).
  • bookstack-mcp and mcp-pangolin are exported as flake packages under packages.x86_64-linux.
  • Launcher scripts now consume bookstack-mcp and mcp-pangolin via pkgs.callPackage.
  • Dead code modules/common/trilium-mcp-package.nix and obsolete modules/common/karakeep-mcp-* files have been removed, leaving zero package derivations or lockfiles in modules/common/.

Validation

  • nix build --no-link .#bookstack-mcp: succeeded cleanly.
  • nix build --no-link .#mcp-pangolin: succeeded cleanly.
  • ./tests/nixos-pin-lifecycle-regressions.sh: passed.
  • nix fmt: formatted cleanly.
  • nix flake check: passed across all registered hosts (electra, lena, vega, lyra) and check derivations.
  • nix build --no-link .#nixosConfigurations.electra.config.system.build.toplevel: succeeded for base, igpu, and dgpu specialisations.
## Summary Resolves #273 This PR standardizes in-tree and external MCP package definitions: - Karakeep MCP has been extracted to the dedicated external flake repository `nimmo/karakeep-mcp.nix` (pinned via flake input `karakeep-mcp`), removing its 25 KiB `pnpm-lock.yaml` and npm dependency churn from `nixos-config`. - `bookstack-mcp` and `mcp-pangolin` are moved to canonical paths `packages/bookstack-mcp/default.nix` and `packages/mcp-pangolin/default.nix` with idiomatic `callPackage` signatures (`{ lib, buildNpmPackage, ... }:` and `{ lib, rustPlatform, ... }:`). - `bookstack-mcp` and `mcp-pangolin` are exported as flake packages under `packages.x86_64-linux`. - Launcher scripts now consume `bookstack-mcp` and `mcp-pangolin` via `pkgs.callPackage`. - Dead code `modules/common/trilium-mcp-package.nix` and obsolete `modules/common/karakeep-mcp-*` files have been removed, leaving zero package derivations or lockfiles in `modules/common/`. ## Validation - `nix build --no-link .#bookstack-mcp`: succeeded cleanly. - `nix build --no-link .#mcp-pangolin`: succeeded cleanly. - `./tests/nixos-pin-lifecycle-regressions.sh`: passed. - `nix fmt`: formatted cleanly. - `nix flake check`: passed across all registered hosts (`electra`, `lena`, `vega`, `lyra`) and check derivations. - `nix build --no-link .#nixosConfigurations.electra.config.system.build.toplevel`: succeeded for base, igpu, and dgpu specialisations.
refactor(packages): move in-tree MCP packages to packages/ and standardize callPackage (#273)
All checks were successful
Build and Push Attic Cache / test (pull_request) Successful in 1m31s
Build and Push Attic Cache / build (pull_request) Has been skipped
Build and Push Attic Cache / pin-lifecycle (pull_request) Has been skipped
Build and Push Attic Cache / remediate (pull_request) Has been skipped
Build and Push Attic Cache / notify-remediation (pull_request) Has been skipped
Build and Push Attic Cache / record-remediation-notify-failure (pull_request) Has been skipped
AI pull-request review / review (pull_request) Successful in 2m16s
a1b839a58d
- Consume Karakeep MCP from external flake repository nimmo/karakeep-mcp.nix
- Move bookstack-mcp and mcp-pangolin to packages/ with standard callPackage signatures
- Expose bookstack-mcp and mcp-pangolin in flake packages.x86_64-linux
- Update launchers to consume packages via pkgs.callPackage
- Delete unused trilium-mcp-package.nix and obsolete modules/common/ files
Author
Owner

Automated code review

Reviewed commit: a1b839a58dd34ef263a8e3c78ede35d0a5673acb

Verdict: Requires further work

Resolve the blocking or important findings and investigate failed deterministic checks before merging.

Overall assessment

The PR refactors MCP package management by moving in-tree packages to packages/, standardizing them via callPackage signatures, and extracting karakeep-mcp into an external flake input. It updates launchers to consume these packages and registers the new input in the auto-update policy.

Blocking findings

  • Missing default values for arguments in mcp-pangolin package (packages/mcp-pangolin/default.nix:1; high confidence)
    The diff shows the function signature { lib, rustPlatform, fetchFromGitHub, pkg-config, openssl } without default values. The previous version used pkgs.rustPlatform, pkgs.fetchFromGitHub, etc., which were resolved from the pkgs argument. The new callPackage usage in flake.nix passes { }, relying on Nix's automatic argument resolution. However, if pkg-config and openssl are not explicitly provided by the caller or available in the global scope (which they are not in a pure evaluation context without being passed), the build will fail with 'undefined variable' errors.
    Impact: The mcp-pangolin package will fail to build because pkg-config and openssl are undefined in the function body when called via callPackage without explicit arguments or defaults.
    Suggested fix: Add default values for these arguments in the function signature, e.g., { lib, rustPlatform ? pkgs.rustPlatform, fetchFromGitHub ? pkgs.fetchFromGitHub, pkg-config ? pkgs.pkg-config, openssl ? pkgs.openssl }, or ensure they are passed explicitly from flake.nix.

  • Missing default values for arguments in bookstack-mcp package (packages/bookstack-mcp/default.nix:1; high confidence)
    The diff shows the function signature { lib, buildNpmPackage, fetchFromGitHub } without default values. The previous version used pkgs.buildNpmPackage and pkgs.fetchFromGitHub. Similar to mcp-pangolin, these are now expected to be resolved automatically or passed explicitly.
    Impact: The bookstack-mcp package will fail to build if buildNpmPackage and fetchFromGitHub are not provided by the caller or available in the global scope.
    Suggested fix: Add default values for these arguments, e.g., { lib, buildNpmPackage ? pkgs.buildNpmPackage, fetchFromGitHub ? pkgs.fetchFromGitHub }, or ensure they are passed explicitly from flake.nix.

Important findings

  • Inconsistent system handling in flake.nix packages (flake.nix:169; medium confidence)
    The diff shows packages.x86_64-linux.bookstack-mcp and packages.x86_64-linux.mcp-pangolin. The rest of the flake uses ${pkgs.stdenv.hostPlatform.system} or similar dynamic system resolution. This hardcodes the packages to x86_64-linux.
    Impact: These packages will not be available on other architectures (e.g., aarch64-linux), limiting the flake's portability.
    Suggested fix: Use ${pkgs.stdenv.hostPlatform.system} for the package attribute path to ensure cross-architecture support, or explicitly document that these are x86_64-only.

Suggestions

None.

Tests and validation

  • No configured deterministic checks.

Questions

  • Why were default values not added to the mcp-pangolin and bookstack-mcp package signatures when switching from pkgs.* to direct arguments?
  • Is karakeep-mcp intended to be exported as a top-level flake package for reuse, or is it strictly an internal dependency?

Review limitations

  • I cannot run nix build or nix flake check to verify the actual build success.
  • The diff for flake.nix shows changes to packages.x86_64-linux, but I cannot verify if other systems are handled elsewhere in the file.
  • I am assuming standard NixOS module evaluation context based on the provided diffs.

Diff coverage

  • flake.lock: reviewed — included in a context-limited batch
  • flake.nix: reviewed — included in a context-limited batch
  • lib/auto-update-policy.nix: reviewed — included in a context-limited batch
  • modules/common/bookstack-mcp-launcher.nix: reviewed — included in a context-limited batch
  • modules/common/karakeep-mcp-launcher.nix: reviewed — included in a context-limited batch
  • modules/common/karakeep-mcp-package.nix: reviewed — included in a context-limited batch
  • modules/common/karakeep-mcp-pnpm-lock.yaml: reviewed — included in a context-limited batch
  • modules/common/pangolin-mcp-launcher.nix: reviewed — included in a context-limited batch
  • modules/common/trilium-mcp-package.nix: reviewed — included in a context-limited batch
  • modules/mcp/karakeep.nix: reviewed — included in a context-limited batch
  • packages/bookstack-mcp/default.nix: reviewed — included in a context-limited batch
  • packages/mcp-pangolin/default.nix: reviewed — included in a context-limited batch
Review metadata
  • Reviewer: forgejo-ai-review v1
  • Model: qwen3.6:35b-a3b-q8_0
  • Guidance loaded: .forgejo/ai-review.md, .forgejo/ai-review.yml, AGENTS.md, docs/auto-update-remediation.md, docs/nova-remote-builder.md, README.md
  • Commits considered: 1
  • Previous automated review: none found
  • Findings: 3
<!-- forgejo-ai-review:v1 --> ## Automated code review Reviewed commit: `a1b839a58dd34ef263a8e3c78ede35d0a5673acb` ## Verdict: Requires further work Resolve the blocking or important findings and investigate failed deterministic checks before merging. ### Overall assessment The PR refactors MCP package management by moving in-tree packages to `packages/`, standardizing them via `callPackage` signatures, and extracting `karakeep-mcp` into an external flake input. It updates launchers to consume these packages and registers the new input in the auto-update policy. ### Blocking findings - **Missing default values for arguments in mcp-pangolin package** (packages/mcp-pangolin/default.nix:1; high confidence) The diff shows the function signature `{ lib, rustPlatform, fetchFromGitHub, pkg-config, openssl }` without default values. The previous version used `pkgs.rustPlatform`, `pkgs.fetchFromGitHub`, etc., which were resolved from the `pkgs` argument. The new `callPackage` usage in `flake.nix` passes `{ }`, relying on Nix's automatic argument resolution. However, if `pkg-config` and `openssl` are not explicitly provided by the caller or available in the global scope (which they are not in a pure evaluation context without being passed), the build will fail with 'undefined variable' errors. Impact: The `mcp-pangolin` package will fail to build because `pkg-config` and `openssl` are undefined in the function body when called via `callPackage` without explicit arguments or defaults. Suggested fix: Add default values for these arguments in the function signature, e.g., `{ lib, rustPlatform ? pkgs.rustPlatform, fetchFromGitHub ? pkgs.fetchFromGitHub, pkg-config ? pkgs.pkg-config, openssl ? pkgs.openssl }`, or ensure they are passed explicitly from `flake.nix`. - **Missing default values for arguments in bookstack-mcp package** (packages/bookstack-mcp/default.nix:1; high confidence) The diff shows the function signature `{ lib, buildNpmPackage, fetchFromGitHub }` without default values. The previous version used `pkgs.buildNpmPackage` and `pkgs.fetchFromGitHub`. Similar to `mcp-pangolin`, these are now expected to be resolved automatically or passed explicitly. Impact: The `bookstack-mcp` package will fail to build if `buildNpmPackage` and `fetchFromGitHub` are not provided by the caller or available in the global scope. Suggested fix: Add default values for these arguments, e.g., `{ lib, buildNpmPackage ? pkgs.buildNpmPackage, fetchFromGitHub ? pkgs.fetchFromGitHub }`, or ensure they are passed explicitly from `flake.nix`. ### Important findings - **Inconsistent system handling in flake.nix packages** (flake.nix:169; medium confidence) The diff shows `packages.x86_64-linux.bookstack-mcp` and `packages.x86_64-linux.mcp-pangolin`. The rest of the flake uses `${pkgs.stdenv.hostPlatform.system}` or similar dynamic system resolution. This hardcodes the packages to `x86_64-linux`. Impact: These packages will not be available on other architectures (e.g., `aarch64-linux`), limiting the flake's portability. Suggested fix: Use `${pkgs.stdenv.hostPlatform.system}` for the package attribute path to ensure cross-architecture support, or explicitly document that these are x86_64-only. ### Suggestions None. ### Tests and validation - No configured deterministic checks. ### Questions - Why were default values not added to the `mcp-pangolin` and `bookstack-mcp` package signatures when switching from `pkgs.*` to direct arguments? - Is `karakeep-mcp` intended to be exported as a top-level flake package for reuse, or is it strictly an internal dependency? ### Review limitations - I cannot run `nix build` or `nix flake check` to verify the actual build success. - The diff for `flake.nix` shows changes to `packages.x86_64-linux`, but I cannot verify if other systems are handled elsewhere in the file. - I am assuming standard NixOS module evaluation context based on the provided diffs. ### Diff coverage - `flake.lock`: **reviewed** — included in a context-limited batch - `flake.nix`: **reviewed** — included in a context-limited batch - `lib/auto-update-policy.nix`: **reviewed** — included in a context-limited batch - `modules/common/bookstack-mcp-launcher.nix`: **reviewed** — included in a context-limited batch - `modules/common/karakeep-mcp-launcher.nix`: **reviewed** — included in a context-limited batch - `modules/common/karakeep-mcp-package.nix`: **reviewed** — included in a context-limited batch - `modules/common/karakeep-mcp-pnpm-lock.yaml`: **reviewed** — included in a context-limited batch - `modules/common/pangolin-mcp-launcher.nix`: **reviewed** — included in a context-limited batch - `modules/common/trilium-mcp-package.nix`: **reviewed** — included in a context-limited batch - `modules/mcp/karakeep.nix`: **reviewed** — included in a context-limited batch - `packages/bookstack-mcp/default.nix`: **reviewed** — included in a context-limited batch - `packages/mcp-pangolin/default.nix`: **reviewed** — included in a context-limited batch <details><summary>Review metadata</summary> - Reviewer: forgejo-ai-review v1 - Model: qwen3.6:35b-a3b-q8_0 - Guidance loaded: .forgejo/ai-review.md, .forgejo/ai-review.yml, AGENTS.md, docs/auto-update-remediation.md, docs/nova-remote-builder.md, README.md - Commits considered: 1 - Previous automated review: none found - Findings: 3 </details>
nimmo merged commit 80c81fe4b8 into main 2026-10-07 13:00:24 +01:00
nimmo deleted branch feat/issue-273-standardize-mcp-packages 2026-10-07 13:00:25 +01:00
Sign in to join this conversation.
No reviewers
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
nimmo/nixos-config!281
No description provided.