Skip to content

MCP SDK Can not handle the MCP Servers with subpath #471

Open
@tobegit3hub

Description

@tobegit3hub

Issue:
Clients (Inspector/Cherry Studio) fail to connect when MCP Server uses a subpath (e.g., http://domain.com/subpath/sse). Root paths (http://domain.com/) work normally.

Reproduce:

  1. Start MCP Server at http://domain.com/subpath/sse
  2. Client connection fails with error:
    Error POSTing to endpoint (HTTP 503): no healthy upstream

Cause:
In sse.ts#L146, new URL() discards the subpath from the server URL. Example:
Request to /messages/ becomes http://domain.com/messages/ instead of http://domain.com/subpath/messages/.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions