nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildNpmPackage,
4 fetchFromGitHub,
5 playwright-driver,
6 playwright-test,
7}:
8
9buildNpmPackage rec {
10 pname = "playwright-mcp";
11 version = "0.0.31";
12
13 src = fetchFromGitHub {
14 owner = "Microsoft";
15 repo = "playwright-mcp";
16 tag = "v${version}";
17 hash = "sha256-Hw4OUZCHoquX6Ixv7GlsHcKxqOdJEQYfuDPzqYkVNAk=";
18 };
19
20 npmDepsHash = "sha256-70/t/mgSBwMv9C3VusbjIMMyy3e3npxQLXqKbdL9xa4=";
21
22 postInstall = ''
23 rm -r $out/lib/node_modules/@playwright/mcp/node_modules/playwright
24 rm -r $out/lib/node_modules/@playwright/mcp/node_modules/playwright-core
25 ln -s ${playwright-test}/lib/node_modules/playwright $out/lib/node_modules/@playwright/mcp/node_modules/playwright
26 ln -s ${playwright-test}/lib/node_modules/playwright-core $out/lib/node_modules/@playwright/mcp/node_modules/playwright-core
27
28 wrapProgram $out/bin/mcp-server-playwright \
29 --set PLAYWRIGHT_BROWSERS_PATH ${playwright-driver.browsers}
30 '';
31
32 passthru = {
33 # Package and playwright driver versions are tightly coupled.
34 skipBulkUpdate = true;
35 };
36
37 meta = {
38 changelog = "https://github.com/Microsoft/playwright-mcp/releases/tag/v${version}";
39 description = "Playwright MCP server";
40 homepage = "https://github.com/Microsoft/playwright-mcp";
41 license = lib.licenses.asl20;
42 mainProgram = "mcp-server-playwright";
43 maintainers = [ lib.maintainers.kalekseev ];
44 };
45}