{ lib, python3Packages, fetchFromGitHub, fetchPypi, fetchurl, }: let # Internal dependency: pyzotero (not in nixpkgs) pyzotero = python3Packages.buildPythonPackage rec { pname = "pyzotero"; version = "1.14.0"; format = "wheel"; src = fetchPypi { inherit pname version; format = "wheel"; dist = "py3"; python = "py3"; hash = "sha256-OUoU8HTEFwVfzqopcLWUzpJaYJTJ09zIpzTgdCbs9BU="; }; propagatedBuildInputs = with python3Packages; [ feedparser bibtexparser httpx whenever ]; doCheck = false; pythonImportsCheck = [ "pyzotero" ]; meta = with lib; { description = "Python wrapper for the Zotero API"; homepage = "https://github.com/urschrei/pyzotero"; license = licenses.blueOak100; }; }; # pdf-inspector: Rust with prebuilt abi3 wheels, not in nixpkgs. # Pinned exactly (pre-1.0); no Python dependencies of its own. pdf-inspector = python3Packages.buildPythonPackage rec { pname = "pdf-inspector"; version = "0.2.6"; format = "wheel"; src = fetchurl { url = "https://files.pythonhosted.org/packages/59/af/be72ab2bd310b6532e4311cf06175eb722802ccea29dbd9281f66c645bd8/pdf_inspector-0.2.6-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl"; hash = "sha256-33bdEAUEtwXOku8sZo8VLwUnfZQqvZSn0/JSy1RI1W0="; }; doCheck = false; pythonImportsCheck = [ "pdf_inspector" ]; meta = with lib; { description = "PDF text extraction (Rust, abi3 wheels)"; homepage = "https://github.com/54yyyu/pdf-inspector"; license = licenses.mit; }; }; in python3Packages.buildPythonApplication rec { pname = "zotero-mcp"; version = "0.13.0"; pyproject = true; src = fetchFromGitHub { owner = "54yyyu"; repo = "zotero-mcp"; rev = "v${version}"; hash = "sha256-xL54SbaAczkwk4tkan+wVVTv9ACKIC6hcAADI2GTnxk="; }; build-system = with python3Packages; [ hatchling ]; # Core dependencies (from pyproject.toml v0.13.0) dependencies = with python3Packages; [ pyzotero python-dotenv pdf-inspector markdownify pydantic requests fastmcp httpx unidecode bibtexparser # Runtime deps for the annotation/layout/read tools (upstream "pdf" extra). # nix's optional-dependencies is passthru-only and installs nothing, so # anything needed at runtime must live in this list. pymupdf ebooklib ]; # Optional extras (semantic search, PDF, scite). # NOTE: buildPythonApplication stores these in passthru only and does NOT # install them; adding an extra here has no runtime effect. optional-dependencies = with python3Packages; { semantic = [ chromadb sentence-transformers openai google-genai tiktoken ]; pdf = [ pymupdf ebooklib ]; scite = [ requests ]; }; pythonImportsCheck = [ "zotero_mcp" ]; meta = with lib; { description = "MCP server connecting Zotero with AI assistants for research library access"; homepage = "https://github.com/54yyyu/zotero-mcp"; license = licenses.mit; mainProgram = "zotero-mcp"; platforms = platforms.all; }; }