Skip to content

Conversation

@4t145
Copy link
Collaborator

@4t145 4t145 commented May 19, 2025

How this client resolve the message endpoint

if sse_endpoint has this format: <schema><authority?><sse_pq>,
then the message endpoint will be <schema><authority?><message_pq>.

For example, if you config the sse_endpoint as http://example.com/some_path/sse,
and the server send the message endpoint event as message?session_id=123,
then the message endpoint will be http://example.com/message.

This follow the rules of JaveScript's new URL(url, base)

Motivation and Context

fix #196 #186 and all previous related issues.

How Has This Been Tested?

Breaking Changes

using the more proper names for SseClientConfig's fields:

  1. uri -> sse_endpoint
  2. use_sse_endpoint -> use_message_endpoint

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

@4t145 4t145 requested a review from jokemanfire May 19, 2025 03:10
@4t145 4t145 merged commit a3b42c4 into modelcontextprotocol:main May 19, 2025
9 checks passed
howardjohn added a commit to howardjohn/rust-sdk that referenced this pull request Jun 17, 2025
This was broken by
modelcontextprotocol#197.

The URL join behaves like this:

```
$ let baseUrl = "https://example.com/sse";
$ new URL("?sessionId=x", baseUrl).href
'https://example.com/sse?sessionId=x'
$ new URL("/?sessionId=x", baseUrl).href
'https://example.com/?sessionId=x'
```

The PR modelcontextprotocol#197 did not take into account the relative URL

Fixes modelcontextprotocol#252
howardjohn added a commit to howardjohn/rust-sdk that referenced this pull request Jun 18, 2025
This was broken by
modelcontextprotocol#197.

The URL join behaves like this:

```
$ let baseUrl = "https://example.com/sse";
$ new URL("?sessionId=x", baseUrl).href
'https://example.com/sse?sessionId=x'
$ new URL("/?sessionId=x", baseUrl).href
'https://example.com/?sessionId=x'
```

The PR modelcontextprotocol#197 did not take into account the relative URL

Fixes modelcontextprotocol#252
4t145 pushed a commit that referenced this pull request Jun 19, 2025
* sse: fix regression in URL joining

This was broken by
#197.

The URL join behaves like this:

```
$ let baseUrl = "https://example.com/sse";
$ new URL("?sessionId=x", baseUrl).href
'https://example.com/sse?sessionId=x'
$ new URL("/?sessionId=x", baseUrl).href
'https://example.com/?sessionId=x'
```

The PR #197 did not take into account the relative URL

Fixes #252

* Address review comments
@github-actions github-actions bot mentioned this pull request Jul 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SseClientTransport 404 error

2 participants