Skip to content

Incorrect baseUrl concatenation causes / in message endpoint URL, leading to 404 #645

@leehaut

Description

@leehaut

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions