Title: fix(sse): preserve base path when resolving message endpoint from SSE by sterankin · Pull Request #422 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: fix(sse): preserve base path when resolving message endpoint from SSE by sterankin · Pull Request #422 · modelcontextprotocol/python-sdk
X Title: fix(sse): preserve base path when resolving message endpoint from SSE by sterankin · Pull Request #422 · modelcontextprotocol/python-sdk
Description: Problem When using the sse_client() transport, the server sends the endpoint as /messages. This is resolved using urljoin(url, sse.data), but this strips the full base path (e.g., /mcp/weather-alerts) and results in incorrect POSTs to the root /messages. Solution This patch updates the endpoint resolution to correctly derive uri_base from the provided SSE URL by removing /sse, and then joining the relative path properly: uri_base = url.rsplit("/sse", 1)[0] endpoint_url = urljoin(uri_base + "/", sse.data.lstrip("/")) This ensures that if the client connects to: https://example-mcp-server.com/mcp/weather-alerts/sse The messages are correctly posted to: https://example-mcp-server..com/mcp/weather-alerts/messages instead of: https://example-mcp-server..com/messages Notes This is backward-compatible and only affects the computed POST endpoint. Patch tested successfully against MCP servers behind API gateways.
Open Graph Description: Problem When using the sse_client() transport, the server sends the endpoint as /messages. This is resolved using urljoin(url, sse.data), but this strips the full base path (e.g., /mcp/weather-aler...
X Description: Problem When using the sse_client() transport, the server sends the endpoint as /messages. This is resolved using urljoin(url, sse.data), but this strips the full base path (e.g., /mcp/weather-aler...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/pull/422
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:8830f0c5-a7b7-5acd-807f-56bad268e142 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | C240:22230D:4D86:675D:6A635ADA |
| html-safe-nonce | 06b78da9561d3f02c1473b5cababc4de825645713d73cb4943c29b968a12e38f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMjQwOjIyMjMwRDo0RDg2OjY3NUQ6NkE2MzVBREEiLCJ2aXNpdG9yX2lkIjoiMzcxODE3OTU3NzA5NTM1OTYzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | cc7731f0f54a52c7f1534a977160d670dd789670a393488422798ac9e518902f |
| hovercard-subject-tag | pull_request:2438042805 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/modelcontextprotocol/python-sdk/pull/422/files |
| twitter:image | https://avatars.githubusercontent.com/u/11423287?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/11423287?s=400&v=4 |
| og:image:alt | Problem When using the sse_client() transport, the server sends the endpoint as /messages. This is resolved using urljoin(url, sse.data), but this strips the full base path (e.g., /mcp/weather-aler... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 59e55daad7174ca59d63c6974d58276ccb5477442e550bebb3c035e1bef11c94 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/modelcontextprotocol/python-sdk git https://github.com/modelcontextprotocol/python-sdk.git |
| octolytics-dimension-user_id | 182288589 |
| octolytics-dimension-user_login | modelcontextprotocol |
| octolytics-dimension-repository_id | 862584018 |
| octolytics-dimension-repository_nwo | modelcontextprotocol/python-sdk |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 862584018 |
| octolytics-dimension-repository_network_root_nwo | modelcontextprotocol/python-sdk |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 990295d92a4cc7b63fbbd83a046217cd7d77d49c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width