MCP Python SDK 发布: v2.0.0b2
来源摘要
Second v2 beta. Pre-releases are opt-in only; `pip install mcp` still resolves to the stable 1.x line. ```bash pip install mcp==2.0.0b2 # or uv add "mcp==2.0.0b2" ``` The [documentation](https://py.sdk.modelcontextprotocol.io/v2/) has the full tutorial and API reference, and the [migration guide](https://py.sdk.modelcontextprotocol.io/v2/migration/) covers coming from v1. Stable v2 is still targeted for 2026-07-28 alongside the spec release - keep pinning an exact version. ## Highlights ### httpx is replaced by httpx2 (#2972) The SDK's HTTP stack now runs on [httpx2](https://pypi.org/project/httpx2/) (`>=2.5.0`), the next-generation httpx fork with SSE support built in, replacing `httpx` + `httpx-sse`. Most code needs no changes; if you pass your own `http_client` into a transport, change the import to `httpx2`. Runtime behavior that changes: - TLS verification uses the operating system trust store (via `truststore`) instead of certifi's bundle. `SSL_CERT_FILE` / `SSL_CERT_DIR` are honored first. - Loggers are renamed: `httpx` -> `httpx2`, `httpcore.*` -> `httpcore2.*` - update logging filters that match on those names. - SSE GET streams send `Accept: application/json, text/event-stream` (previously exactly `text/event-stream`). ### Client-side subscriptions/listen (#3047) The client half of `subscriptions/listen` (SEP-2575), promised in the b1 notes: one context manager, `async for` consumption, typed events. ```python async with client.listen(tools_list_changed=True, resource_subscriptions=["note://todo"]) as sub: print(sub.honored) # the subset the server agreed to deliver async for event in sub: match event: case ToolsListChanged(): tools = await client.list_tools() case ResourceUpdated(uri=uri): body = await client.read_resource(uri) ``` Entering waits for the serv
阅读原始来源- 来源
- MCP Python SDK 发布 · 官方来源
- 来源发布
- 2026/07/15 00:41
- 来源更新
- 2026/07/15 00:44
- 首次采集
- 2026/09/19 13:21
本文为公开信息索引与摘要,详情及后续变化请以原始来源为准。