MCP Python SDK v2.1.0
MCP Python SDK v2.1.0 introduces StdioServerParameters support in Client, masks unhandled handler exceptions from clients, and updates content-block return behavior.
原始内容为英文;当前页面提供中文导航与来源说明,具体事实请以原文为准。
为什么值得关注
MCP Python SDK v2.1.0 brings several feature additions, behavioral modifications, and fixes. Key updates include allowing Client to accept StdioServerParameters directly, enabling Prompt messages to handle Image and Audio, and exporting Message types from mcp.server.mcpserver. A 4 MiB body limit is now enforced across SSE transport and OAuth endpoints. Behavior changes include masking unexpected handler exceptions behind generic messages to clients (reserving detailed messages for explicit ToolError/ResourceError raises) and altering tools annotated with content-block return types to avoid advertising outputSchema unless structured output=True is passed. Fixes address TypedDict serialization on Python 3.10, recursive return types, HTTP notification acknowledgments (202), and Windows non-ASCII config reading.
可执行摘要
MCP Python SDK v2.1.0 adds direct StdioServerParameters initialization to Client, changes unhandled handler exceptions to return generic errors rather than raw tracebacks (use ToolError/ResourceError instead), and omits outputSchema/structuredContent for content-block return annotations unless structured output=True.
- Agent 实用度
- 82/100
- 可信度
- 96%
- 机器格式
- JSON + Markdown
开发者应核对什么
- Update tool, resource, and prompt handlers to raise ToolError or ResourceError if error details should be visible to models/clients.
- Add structured output=True to tool definitions if you need structuredContent or outputSchema when returning content blocks (e.g., TextContent, Image, Audio).
- Review custom SSE transport configurations to account for the new request body limits and non-POST 405 responses.