54 lines
2.2 KiB
Nix
54 lines
2.2 KiB
Nix
{
|
|
lib,
|
|
buildNpmPackage,
|
|
fetchzip,
|
|
}:
|
|
|
|
buildNpmPackage rec {
|
|
pname = "romm-mcp";
|
|
version = "1.0.5";
|
|
|
|
src = fetchzip {
|
|
url = "https://registry.npmjs.org/${pname}/-/${pname}-${version}.tgz";
|
|
hash = "sha256-SOYzG0CtNSvIrxOYJq3UDXRlXylqbDjo2f5qfpbiYmI=";
|
|
};
|
|
|
|
# Upstream publishes no package-lock.json (only package.json), and
|
|
# buildNpmPackage requires one to compute npmDepsHash. This lock is generated
|
|
# from the published tarball itself -- `npm install --package-lock-only
|
|
# --ignore-scripts` inside the extracted 1.0.5 package -- so it locks exactly
|
|
# the dependency tree that shipped with this version.
|
|
npmDepsHash = "sha256-oSlECdIf2ZP8ZZhOUChkcJAmUTj6TFTdeTJLY5RwLGo=";
|
|
|
|
postPatch = ''
|
|
cp ${./package-lock.json} package-lock.json
|
|
|
|
# romm_system action=scan was stubbed out client-side ("Scan endpoint removed in
|
|
# RomM 5.0"), but RomM 5.4 restored POST /api/tasks/scan, so the stub only blocks a
|
|
# working endpoint. Upstream publishes no sources in the npm tarball, so this patches
|
|
# the compiled dist/ directly; drop it once upstream restores runScan().
|
|
patch -p1 < ${./romm-mcp-scan.patch}
|
|
|
|
# RomM 5.x only deletes the file when POST /api/roms/delete carries delete_from_fs[];
|
|
# 1.0.5 exposes no delete tool at all (client.deleteRoms sends roms[] alone and no
|
|
# tool calls it), so a cleanup from MCP was impossible. This patch adds
|
|
# romm_delete_rom (row + file, delete_from_fs on by default) and
|
|
# romm_delete_rom_file (drop one duplicate of a multi-file ROM). Both are pure
|
|
# insertions guarded by confirm_delete, and both were exercised against RomM 5.4.1:
|
|
# dist-only again, so drop the patch when upstream ships the tools.
|
|
patch -p1 < ${./romm-mcp-delete.patch}
|
|
'';
|
|
|
|
# dist/*.js (tsc output) ships inside the npm tarball, so there is nothing to
|
|
# compile here -- same arrangement as navidrome-mcp and n8n-mcp.
|
|
dontNpmBuild = true;
|
|
|
|
meta = with lib; {
|
|
description = "MCP server for RomM: browse, search and administrate a self-hosted ROM library";
|
|
homepage = "https://github.com/rodrigosiviero/romm-mcp";
|
|
license = licenses.mit;
|
|
mainProgram = pname;
|
|
platforms = platforms.all;
|
|
};
|
|
}
|