Skip to content

Bump mcp and other dependencies for Dependabot alerts - #4047

Merged
DouweM merged 15 commits into
pydantic:mainfrom
dsfaccini:dependabot-calls
Jan 22, 2026
Merged

Bump mcp and other dependencies for Dependabot alerts#4047
DouweM merged 15 commits into
pydantic:mainfrom
dsfaccini:dependabot-calls

Conversation

@dsfaccini

@dsfaccini dsfaccini commented Jan 20, 2026

Copy link
Copy Markdown
Contributor

Bumping several packages.

mcp.py needs a bit of a refactor because of an http function that changes name
at the same time, mcp 1.24 introduces a hang that has a (draft) PR open modelcontextprotocol/python-sdk#1838 so we need to pragma: no cover a couple lines and wait for that to merge

Summary

  • 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.

Test plan

  • MCP tests pass
  • Full CI

🤖 Generated with Claude Code

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>
dsfaccini and others added 2 commits January 20, 2026 00:01
- 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>
@dsfaccini
dsfaccini marked this pull request as ready for review January 20, 2026 19:41
@dsfaccini
dsfaccini requested a review from DouweM January 20, 2026 19:41
Comment thread pydantic_ai_slim/pydantic_ai/_mcp.py Outdated
messages.BinaryContent(data=base64.b64decode(content.data), media_type=content.mimeType)
]
else:
raise NotImplementedError(f'Unsupported user content type: {type(content).__name__}')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the new types we could support here and below? Add a comment at lease please

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Could we support AudioContent easily in the ImageContent branch 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)

Comment thread pydantic_ai_slim/pydantic_ai/mcp.py Outdated
],
]: ...

# Only used by MCPServerSSE which has a hang bug (https://github.com/modelcontextprotocol/python-sdk/issues/1811).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeahp I wanted to keep this lean but I made that change now

Comment thread pydantic_ai_slim/pydantic_ai/mcp.py Outdated
Comment thread pydantic_ai_slim/pydantic_ai/mcp.py Outdated
dsfaccini and others added 2 commits January 21, 2026 11:38
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
Comment thread pydantic_ai_slim/pydantic_ai/_mcp.py Outdated
messages.BinaryContent(data=base64.b64decode(content.data), media_type=content.mimeType)
]
else:
raise NotImplementedError(f'Unsupported user content type: {type(content).__name__}')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Could we support AudioContent easily in the ImageContent branch 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)

Comment thread pydantic_ai_slim/pydantic_ai/_mcp.py
Comment thread pydantic_ai_slim/pydantic_ai/mcp.py Outdated
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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

precisely

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove pragma "and add a test", right? Also worth marking as "TODO:"

Comment thread pydantic_ai_slim/pydantic_ai/mcp.py
Comment thread pydantic_ai_slim/pydantic_ai/mcp.py Outdated
dsfaccini and others added 4 commits January 21, 2026 22:20
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Comment thread pydantic_ai_slim/pydantic_ai/_mcp.py Outdated
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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why for Marcelo lol

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lmao sorry

Comment thread pydantic_ai_slim/pydantic_ai/mcp.py Outdated
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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@DouweM
DouweM merged commit bb9f877 into pydantic:main Jan 22, 2026
30 checks passed
@DouweM DouweM changed the title chore: Bump dependencies for Dependabot alerts Bump mcp and other dependencies for Dependabot alerts Jan 22, 2026
@DouweM DouweM removed the chore label Jan 22, 2026
@DouweM DouweM added the feature New feature request, or PR implementing a feature (enhancement) label Jan 22, 2026
thiagohora pushed a commit to thiagohora/pydantic-ai that referenced this pull request Feb 10, 2026
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
wenming-ma pushed a commit to wenming-ma/pydantic-ai that referenced this pull request Mar 12, 2026
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting author revision feature New feature request, or PR implementing a feature (enhancement)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants