Skip to content

listen EADDRINUSE: address already in use

Spec
2026-07-28
Evidence
E2Reproducedarm64
TypeScript SDK v2 (Node HTTP)
@modelcontextprotocol/node@2.1.2
Python SDK
mcp@2.3.0
Verified

Only one process can listen on an address and port. We started the same server twice on one port:

Server Message from the second copy
Node.js (TypeScript SDK v2 with node:http) Error: listen EADDRINUSE: address already in use 127.0.0.1:8502
Python SDK 2.3.0 (mcp.run("streamable-http"), uvicorn) ERROR: [Errno 98] error while attempting to bind on address ('127.0.0.1', 8510): [errno 98] address already in use

On macOS the Python error number should be 48 instead of 98 (the BSD value; not tested by us).

This only affects HTTP servers. A stdio server has no port.

The usual case: a previous run did not exit, for example a terminal tab you forgot, a --watch restart that left the old process, or a client that starts the server itself while you also run it by hand.

Find the process and stop it:

Terminal window
# macOS, Linux
lsof -iTCP:8502 -sTCP:LISTEN
kill <PID>
Terminal window
# Windows
netstat -ano | findstr :8502
taskkill /PID <PID>

If the process is not yours, choose another port and update every client configuration that has the URL. Read the port from an environment variable so you can change it without editing code.

MCPDev is community documentation. It is not affiliated with the Model Context Protocol project or with the vendors of the clients it covers.