fix handling different sse endpoints (relative/absolute) #470
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation and Context
Currently absolute endpoints are handling incorrectly.
For example, IDE Index Plugin uses sse endpoint
http://127.0.0.1:29170/index-mcp/sseand returns/index-mcp?sessionId=.... It should result in POST endpointhttp://127.0.0.1:29170/index-mcp?sessionId=...but currently resolves inhttp://127.0.0.1:29170/index-mcp/index-mcp?sessionId=..You can check TS implementation:
https://github.com/modelcontextprotocol/typescript-sdk/blob/main/packages/client/src/client/sse.ts#L181
Or java implementation:
https://github.com/modelcontextprotocol/java-sdk/blob/main/mcp-core/src/main/java/io/modelcontextprotocol/client/transport/HttpClientSseClientTransport.java#L337
https://github.com/modelcontextprotocol/java-sdk/blob/main/mcp-core/src/main/java/io/modelcontextprotocol/util/Utils.java#L71
How Has This Been Tested?
I built project and tested it against IDE Index Plugin.
I tried to run tests but:
kotlin-sdk-test/src/commonTestare ignored (and incorrent: it expectes that sse server is echo server that is incorrect. check)kotlin-sdk-test/src/jvmTestare passed except npm-related.Breaking Changes
No (except if users uses incorrect written server)
Types of changes
Checklist
Additional context
Feel free advice me what tests should be added.