← Back to microsoft/playwright
microsoft / playwright · Issue No. 42129
1.63.0-next (microsoft/playwright main at commit 2cc9f3ee7fdd82feb87edb7f24af77442bdc10e2)
The route is also present in the Playwright 1.62.0 source.
Source reference:
No application code is required to reproduce this.
npx -y @playwright/mcp@latest --port 8931 --headless
Wait for the server to report that it’s listening on port 8931.
From another process, send:
curl -i \
-X POST \
-H 'x-pw-mcp-kill: 1' \
http://localhost:8931/killkillkill
200 with Killing process and the MCP server enters its SIGINT shutdown path.The caller doesn’t need to be the process that started the MCP server. Any programmatic HTTP client that can reach an allowed host can send the same fixed header.
An ordinary MCP HTTP client shouldn’t be able to terminate the server process.
Graceful shutdown should remain available to the process that started the server or to an authorized process supervisor, without exposing process-lifecycle control through the normal HTTP API.
The MCP HTTP server exposes:
POST /killkillkill
x-pw-mcp-kill: 1
A matching request returns 200, emits SIGINT inside the server process, and starts graceful shutdown.
The header is a fixed public value. It reduces the CSRF risk, but it doesn’t authenticate the caller or show that the caller owns the process.
The endpoint was introduced in https://github.com/microsoft/playwright/pull/37484 so Playwright’s HTTP and SSE lifecycle tests could exercise graceful SIGINT shutdown on Windows. On Windows, child.kill('SIGTERM') terminates the process without running the same graceful shutdown handlers.
It originally shipped as an unauthenticated GET endpoint. https://github.com/microsoft/playwright/pull/40551 later changed it to POST with the fixed x-pw-mcp-kill: 1 header to reduce cross-origin request forgery exposure.
At the current source, the route appears in the MCP HTTP implementation and is called by the http transport browser sigint test. I couldn’t find a documented workflow that presents it as an agent-management or remote-administration API.
A possible replacement is to let the spawning test parent request graceful shutdown through the child stdin pipe it already owns:
SIGINT cleanup path;I’ve prepared an implementation and tests for this approach. The full MCP HTTP test file, build, and focused lint checks pass on Ubuntu 24.04, macOS 15, and Windows Server 2025.
System:
OS: Ubuntu 24.04.4 LTS
CPU: x64 GitHub-hosted runner
Binaries:
Node: 22.23.1
npm: 10.9.8
npmPackages:
playwright: 1.63.0-next
Relay reads this issue against the repository's contribution signals: the files it is likely to touch, how the maintainers triage work this size, and what the first contribution would exercise.
The full analysis for this issue is still being assembled. Until then, the description above and the thread on GitHub are the most reliable context.