Bump mcp and other dependencies for Dependabot alerts - #4047
Conversation
Bumping several packages to address Dependabot security alerts: - mcp: 1.18.0 → 1.25.0 - fastmcp: 2.12.0 → 2.14.3 - gradio: 5.9.0 → 6.3.0 - aiohttp: 3.13.2 → 3.13.3 - urllib3: 2.6.2 → 2.6.3 - pyasn1: 0.6.1 → 0.6.2 - cbor2: 5.7.1 → 5.8.0 Updated MCP integration for breaking API changes: - Handle new SamplingMessageContentBlock types (ToolUseContent, ToolResultContent) - Use streamable_http_client instead of deprecated streamablehttp_client - Override client_streams in MCPServerStreamableHTTP for new API Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove deprecated type='messages' from Gradio Chatbot (now default) - Update SamplingMessage docstring to include new meta field Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
| messages.BinaryContent(data=base64.b64decode(content.data), media_type=content.mimeType) | ||
| ] | ||
| else: | ||
| raise NotImplementedError(f'Unsupported user content type: {type(content).__name__}') |
There was a problem hiding this comment.
What are the new types we could support here and below? Add a comment at lease please
There was a problem hiding this comment.
the painful stuff is that content: SamplingMessageContentBlock | list[SamplingMessageContentBlock]
but I've moved the NotImplementedError into an explicit branch checking all rest-types and added an assert_never at the end
There was a problem hiding this comment.
- Could we support
AudioContenteasily in theImageContentbranch above? - Let's make it clear in the error which types are not yet supported (like in
map_from_sampling_content) but relatively easily could be, vs anything that is fundamentally unsupported. Just so people know what their options are when they hit this error (e.g. contribute a fix)
| ], | ||
| ]: ... | ||
|
|
||
| # Only used by MCPServerSSE which has a hang bug (https://github.com/modelcontextprotocol/python-sdk/issues/1811). |
There was a problem hiding this comment.
Should this just be on that subclass then? We may not need the _transport_client thing anymore if each class will have its own implementation of this entire thing
There was a problem hiding this comment.
yeahp I wanted to keep this lean but I made that change now
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
| messages.BinaryContent(data=base64.b64decode(content.data), media_type=content.mimeType) | ||
| ] | ||
| else: | ||
| raise NotImplementedError(f'Unsupported user content type: {type(content).__name__}') |
There was a problem hiding this comment.
- Could we support
AudioContenteasily in theImageContentbranch above? - Let's make it clear in the error which types are not yet supported (like in
map_from_sampling_content) but relatively easily could be, vs anything that is fundamentally unsupported. Just so people know what their options are when they hit this error (e.g. contribute a fix)
| def _transport_client(self): | ||
| return sse_client # pragma: no cover | ||
| # sse_client has a hang bug (https://github.com/modelcontextprotocol/python-sdk/issues/1811). | ||
| # Remove pragma once https://github.com/modelcontextprotocol/python-sdk/pull/1838 is released. |
There was a problem hiding this comment.
It's not obvious why a hang bug results in a pragma: no cover, and why we can remove the pragma once the hang bug is fixed. I think we'd need to add a new test to actually cover SSE, but your point is that we can't because of the hang bug?
There was a problem hiding this comment.
Remove pragma "and add a test", right? Also worth marking as "TODO:"
| if isinstance(content, mcp_types.TextContent): # pragma: no branch | ||
| return messages.TextPart(content=content.text) | ||
| else: | ||
| # TODO(Marcelo): Add support for Image/Audio using FilePart. |
| def _transport_client(self): | ||
| return sse_client # pragma: no cover | ||
| # sse_client has a hang bug (https://github.com/modelcontextprotocol/python-sdk/issues/1811). | ||
| # Remove pragma once https://github.com/modelcontextprotocol/python-sdk/pull/1838 is released. |
There was a problem hiding this comment.
Remove pragma "and add a test", right? Also worth marking as "TODO:"
Updated comment to indicate a future test addition after a specific pull request is released.
mcp and other dependencies for Dependabot alerts
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
Bumping several packages.
mcp.pyneeds a bit of a refactor because of an http function that changes nameat the same time,
mcp 1.24introduces a hang that has a (draft) PR open modelcontextprotocol/python-sdk#1838 so we need topragma: no covera couple lines and wait for that to mergeSummary
Updated MCP integration for breaking API changes.
Test plan
🤖 Generated with Claude Code