Skip to content

Upgrade Python libraries to mcp 2.2.0, and bump others as well - #197

Open
a-akimov wants to merge 1 commit into
modelcontextprotocol:mainfrom
a-akimov:chore/python-deps-upgrade
Open

Upgrade Python libraries to mcp 2.2.0, and bump others as well#197
a-akimov wants to merge 1 commit into
modelcontextprotocol:mainfrom
a-akimov:chore/python-deps-upgrade

Conversation

@a-akimov

@a-akimov a-akimov commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Motivation and Context

Updating to the latest version of mcp (2.2.0) and anthropic (1.4.0), as well as other dependencies to keep the repo up-to-date.

Code changes required by the new SDKs

  • weather-server-python/weather.py: all four ValueError raises became ToolError. Since mcp 2.1, an unexpected exception from a tool reaches the model only as "Error executing tool get_alerts" with a traceback in the server log. ToolError is the anticipated-failure path, and its message is returned as an error result.
  • mcp-client-python/client.py: Client accepts StdioServerParameters directly since 2.1, so the stdio_client wrapper and its import are gone. One line was also reflowed by the newer ruff formatter.

How Has This Been Tested?

Locally.

Breaking Changes

N/a

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

N/a

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The broad SDK and transitive dependency upgrade warrants final human validation despite the coherent API migrations.

Pull request overview

Upgrades the Python MCP examples to MCP 2.2.0 and compatible dependencies.

Changes:

  • Uses ToolError for expected weather-tool failures.
  • Adopts direct Client(StdioServerParameters) construction.
  • Refreshes dependency constraints and lock data.
File summaries
File Description
weather-server-python/weather.py Returns expected failures as MCP tool errors.
weather-server-python/uv.lock Locks upgraded server dependencies.
weather-server-python/pyproject.toml Requires MCP 2.2.0+.
mcp-client-python/README.md Documents direct stdio client construction.
mcp-client-python/pyproject.toml Updates MCP, Anthropic, and supporting dependencies.
mcp-client-python/client.py Uses the new MCP client API.
Review details
  • Files reviewed: 5/7 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@a-akimov
a-akimov requested a review from olaservo September 9, 2026 16:29
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.

2 participants