Error POSTing to endpoint (HTTP 404)
- Spec
2026-07-28- Evidence
- E2Reproducedarm64
- TypeScript SDK (client)
@modelcontextprotocol/client@2.4.0- TypeScript SDK v1
@modelcontextprotocol/sdk@1.32.2- Verified
What it means
Section titled “What it means”Something answered on the host and port, but not at that path. We pointed clients at http://127.0.0.1:8501/ while the Express server only served /mcp. Express answered 404 with an HTML page, and the clients put that page into the error:
| Client SDK | Message |
|---|---|
| TypeScript v1 | Streamable HTTP error: Error POSTing to endpoint: <!DOCTYPE html> … <pre>Cannot POST /</pre> … (error code 404) |
| TypeScript v2 | Error POSTing to endpoint: <!DOCTYPE html> … <pre>Cannot POST /</pre> … |
The text after Error POSTing to endpoint: is whatever the server returned, so it changes with the framework. Cannot POST / is Express’s wording.
The URL path is wrong
Section titled “The URL path is wrong”- Most servers serve MCP at
/mcp. A URL that ends at the port, likehttp://localhost:8000, misses it. - An old SSE address (
/sse) on a server that moved to Streamable HTTP, or the other way round. See From HTTP+SSE to Streamable HTTP. - A reverse proxy that mounts the server under a prefix, such as
/api/mcp.
Check the server’s startup log or code for the exact path, then test it with the Inspector CLI.
The same wording for other HTTP errors
Section titled “The same wording for other HTTP errors”Clients use Error POSTing to endpoint for other HTTP failures too, with the server’s response body after it. A 401 from a server that requires a token looked like this in the TypeScript v1 client:
Streamable HTTP error: Error POSTing to endpoint: {"error":"invalid_token","error_description":"Missing or invalid access token"}Read the body: invalid_token means 401 Unauthorized, not a wrong path.
Related
Section titled “Related”- fetch failed: nothing answered on that host and port at all.
MCPDev is community documentation. It is not affiliated with the Model Context Protocol project or with the vendors of the clients it covers.