Fix: fail fast with actionable errors when MCP endpoint returns#50
Open
zyma wants to merge 1 commit into
Open
Conversation
aartaria
reviewed
Jun 8, 2026
Comment on lines
+598
to
+606
| # Best-effort: surface the first connection's URL/slug to the | ||
| # streamable-HTTP guard so unexpected-content-type failures | ||
| # log with caller context. ``get_tools()`` discovers across all | ||
| # connections; per-server enrichment happens in the patched | ||
| # transport via the contextvar. | ||
| first_slug = next(iter(connections), None) | ||
| first_url = getattr(connections[first_slug], "url", None) if first_slug else None | ||
| async with guarded_streamable_http(url=first_url, server_slug=first_slug): | ||
| tools = await client.get_tools() |
Contributor
There was a problem hiding this comment.
feels this PR is trying to fix a bug in the mcp which has already been addressed in modelcontextprotocol/python-sdk#2005
Unfortunately 2005 hasn't made it yet to a stable release, though I would still tend to wait, given I don't see this issue too critical
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
when an MCP endpoint returns HTML instead of JSON/SSE, fail fast with an actionable error instead of hanging
Checklist