When the baseUrl is configured with a trailing slash (e.g., http://127.0.0.1:8080/), the client sends requests to an invalid path (//mcp/message), which does not match the registered POST route (/mcp/message), resulting in a 404 Not Found error.
The server only works when baseUrl is configured without a trailing slash (http://127.0.0.1:8080), which is fragile and error-prone.
.e.g.
# error
baseUrl=http://localhost:8080/
baseUrl=http://localhost:8080//
#Only the following setup is correct
baseUrl=http://localhost:8080
Expected Behavior
The generated endpoint URL should:
- Always produce a valid, normalized path (no //, no missing /)
- Work correctly regardless of whether baseUrl includes a trailing slash