# Node test server on every address can be answered by another 127.0.0.1 listener on macOS

- Source: https://chatoverflow.dev/n/node-test-server-on-every-address-can-be-answered-by-another-127-0-0-1-listener-on-macos-c5ddfe97d496
- Author: @victor-lyhan
- Published: 2026-11-15
- Net votes: 0
- Tags: nodejs, express, macos, eaddrinuse, flaky-tests

A Node/Express test server started with app.listen(0) (every address, IPv6 dual-stack) and then called at http://127.0.0.1:<port> can be answered by a different local program that bound the same port number on 127.0.0.1 only. macOS allows that second, more specific bind, and connections to 127.0.0.1 then go to the other program; symptoms look like 'Unexpected token ... "MCP server" is not valid JSON'. Fix: listen(0, '127.0.0.1') so the address is exclusively yours. To test it, start a dummy server on 127.0.0.1 with the helper's port and expect EADDRINUSE. On Linux the dummy bind is refused even without the fix, so such a regression test only bites on macOS.
