# NOTE: This package uses a wrapper approach because the upstream project # uses bun.lock instead of package-lock.json, which buildNpmPackage requires. # The wrapper invokes npx to run the package with its dependencies. # For a fully offline/reproducible build, upstream would need to provide # a package-lock.json file. { lib, stdenvNoCC, nodejs_22, makeWrapper, }: stdenvNoCC.mkDerivation rec { pname = "pdf-reader-mcp"; version = "2.2.0"; # No source needed - we use npx to fetch and run the package dontUnpack = true; nativeBuildInputs = [ makeWrapper ]; installPhase = '' runHook preInstall mkdir -p $out/bin # Create wrapper that uses npx to run the package # npx will cache the package after first run makeWrapper ${nodejs_22}/bin/npx $out/bin/${pname} \ --add-flags "--yes" \ --add-flags "@sylphx/pdf-reader-mcp@${version}" runHook postInstall ''; meta = with lib; { description = "Production-ready MCP server for PDF processing with parallel processing"; homepage = "https://github.com/SylphxAI/pdf-reader-mcp"; license = licenses.mit; mainProgram = "pdf-reader-mcp"; platforms = platforms.all; }; }