diff --git a/README.org b/README.org index 85dd515..0681f4a 100644 --- a/README.org +++ b/README.org @@ -8,11 +8,12 @@ This repository provides Nix derivations for MCP (Model Context Protocol) server * Available Packages -| Package | Description | Language | -|----------------------------+----------------------------------------------------------+----------| -| academic-search-mcp-server | Search academic papers via Semantic Scholar and Crossref | Python | -| manim-mcp-server | Execute Manim animation code and return videos | Python | -| zotero-mcp | Connect Zotero research library with AI assistants | Python | +| Package | Description | Language | +|----------------------------+----------------------------------------------------------+------------| +| academic-search-mcp-server | Search academic papers via Semantic Scholar and Crossref | Python | +| manim-mcp-server | Execute Manim animation code and return videos | Python | +| pdf-reader-mcp | Production-ready PDF processing with parallel processing | TypeScript | +| zotero-mcp | Connect Zotero research library with AI assistants | Python | * Usage @@ -236,7 +237,7 @@ buildGoModule rec { } #+end_src -*** Node.js +*** Node.js (with package-lock.json) #+begin_src nix { lib, buildNpmPackage, fetchFromGitHub }: @@ -265,6 +266,42 @@ buildNpmPackage rec { } #+end_src +*** Node.js (wrapper for npm packages without package-lock.json) + +Use this approach when the upstream project uses bun.lock or yarn.lock instead of package-lock.json: + +#+begin_src nix +{ lib, stdenvNoCC, nodejs_22, makeWrapper }: + +stdenvNoCC.mkDerivation rec { + pname = "example-mcp-server"; + version = "1.0.0"; + + # No source needed - npx fetches the package + dontUnpack = true; + + nativeBuildInputs = [ makeWrapper ]; + + installPhase = '' + runHook preInstall + mkdir -p $out/bin + makeWrapper ${nodejs_22}/bin/npx $out/bin/${pname} \ + --add-flags "--yes" \ + --add-flags "@scope/package-name@${version}" + runHook postInstall + ''; + + meta = with lib; { + description = "Description"; + homepage = "https://github.com/owner/repo"; + license = licenses.mit; + mainProgram = pname; + }; +} +#+end_src + +Note: This approach requires network access on first run as npx downloads the package. + ** Calculating Hashes When adding a new package, use =lib.fakeHash= initially: diff --git a/issues.md b/issues.md new file mode 100644 index 0000000..19a260e --- /dev/null +++ b/issues.md @@ -0,0 +1,17 @@ +# Issues + +## PDF Reader MCP Connection Issue + +**Status:** Open +**Reported:** 2026-02-04 + +**Issue:** The pdf-reader-mcp is in the path, I have enabled it, but it still says connection closed. + +**Details:** +- Package is installed and available in PATH +- MCP server has been enabled in configuration +- Connection still fails with "connection closed" error + +--- + +## [Back to top](#issues) \ No newline at end of file diff --git a/opencode.json b/opencode.json index d8bf6ea..2fec7c1 100644 --- a/opencode.json +++ b/opencode.json @@ -20,6 +20,11 @@ "type": "local", "command": ["zotero-mcp"], "enabled": true + }, + "pdf-reader": { + "type": "local", + "command": ["pdf-reader-mcp"], + "enabled": true } } } diff --git a/packages/default.nix b/packages/default.nix index 41c8315..e463cc4 100644 --- a/packages/default.nix +++ b/packages/default.nix @@ -14,5 +14,6 @@ # Add new packages here: academic-search-mcp-server = pkgs.callPackage ./academic-search-mcp-server/package.nix { }; zotero-mcp = pkgs.callPackage ./zotero-mcp/package.nix { }; + pdf-reader-mcp = pkgs.callPackage ./pdf-reader-mcp/package.nix { }; # example-mcp-server = pkgs.callPackage ./example-mcp-server/package.nix { }; } diff --git a/packages/pdf-reader-mcp/package.nix b/packages/pdf-reader-mcp/package.nix new file mode 100644 index 0000000..81d15ac --- /dev/null +++ b/packages/pdf-reader-mcp/package.nix @@ -0,0 +1,43 @@ +# 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; + }; +}