modelcontextprotocol / modelcontextprotocol/typescript-sdk
MCP SDK Path Handling Bug for Subpath Servers
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 13.4k
- Forks
- 2.2k
- Avg merge
- 3d 15h
- Merged PRs (30d)
- 4
Description
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:
- Start MCP Server at
http://domain.com/subpath/sse - 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/.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading src/client/sse.ts around line 146 and reproduce the connection failure with a server URL containing /subpath/sse. Verify that the message endpoint retains the server subpath rather than becoming /messages/, and confirm that Inspector or Cherry Studio can connect successfully through the subpath.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 74/100