{
  lib,
  buildNpmPackage,
  fetchFromGitHub,
  makeWrapper,
  playwright-driver,
  linkFarm,
  jq,
  ...
}:

let
  revision = "1161";

  chromium-headless-shell =
    playwright-driver.passthru.components."chromium-headless-shell".overrideAttrs
      (old: {
        inherit revision;
      });

  browsers-headless-only = linkFarm "playwright-browsers-headless-only" [
    {
      name = "chromium-${revision}";
      path = chromium-headless-shell;
    }
  ];
in
buildNpmPackage {
  pname = "fetcher-mcp";
  version = "0.3.9";

  src = fetchFromGitHub {
    owner = "jae-jae";
    repo = "fetcher-mcp";
    rev = "8754aff66e3d9207502207bf82a493f45f556bb8";
    hash = "sha256-CH9qTU+BS3/zCs9QVIHPqoHdul9qpaha1D+gZzoLteY=";
  };

  env.PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = "1";

  nativeBuildInputs = [
    makeWrapper
    jq
  ];

  npmDepsHash = "sha256-waLaOeDaCsgltLrri0kjjFJPazOE/cY+2F+Yu0i55Cg=";

  postPatch = ''
    ${jq}/bin/jq 'del(.scripts.postinstall) | del(.scripts."install-browser")' package.json > package.json.tmp && mv package.json.tmp package.json
  '';

  makeWrapperArgs = [
    "--set"
    "PLAYWRIGHT_BROWSERS_PATH"
    "${browsers-headless-only}"
    # "--set"
    # "PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS"
    # "true"
  ];

  meta = {
    description = "MCP server for fetch web page content using Playwright headless browser";
    homepage = "https://github.com/jae-jae/fetcher-mcp";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ ];
    mainProgram = "fetcher-mcp";
    platforms = lib.platforms.all;
  };
}
