You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: address minor migration guide gaps from upgrade eval
Follow-up to the previous commit covering the lower-severity gaps that
caused hesitation but not failures during the automated upgrade eval.
- Note that sse_client retains headers/timeout/auth params (only
streamable HTTP changed)
- Add Iterable[ReadResourceContents] to the read_resource wrapping-removed
example (was the recommended v1 return type)
- Note that mcp.settings no longer holds transport fields; debug and
log_level remain on the constructor
- Document Context generic params change (3→2, drop ServerSessionT) with
before/after
- Note there is currently no public handler introspection API
- Show RootModel construction direction (drop wrapper call), not just
parsing direction
- Add follow_redirects=True to the primary streamable_http_client example
and explain v1 set it internally
v1's internal client set `follow_redirects=True`; set it explicitly when supplying your own `httpx.AsyncClient` to preserve that behavior.
53
+
51
54
### `get_session_id` callback removed from `streamable_http_client`
52
55
53
56
The `get_session_id` callback (third element of the returned tuple) has been removed from `streamable_http_client`. The function now returns a 2-tuple `(read_stream, write_stream)` instead of a 3-tuple.
@@ -100,6 +103,8 @@ async with http_client:
100
103
101
104
The `headers`, `timeout`, `sse_read_timeout`, and `auth` parameters have been removed from `StreamableHTTPTransport`. Configure these on the `httpx.AsyncClient` instead (see example above).
102
105
106
+
Note: `sse_client` retains its `headers`, `timeout`, `sse_read_timeout`, and `auth` parameters — only the streamable HTTP transport changed.
107
+
103
108
### Removed type aliases and classes
104
109
105
110
The following deprecated type aliases and classes have been removed from `mcp.types`:
**Note:** DNS rebinding protection is automatically enabled when `host` is `127.0.0.1`, `localhost`, or `::1`. This now happens in `sse_app()` and `streamable_http_app()` instead of the constructor.
390
395
396
+
If you were mutating these via `mcp.settings` after construction (e.g., `mcp.settings.port = 9000`), pass them to `run()` / `sse_app()` / `streamable_http_app()` instead — these fields no longer exist on `Settings`. The `debug` and `log_level` parameters remain on the constructor.
397
+
391
398
### `MCPServer.get_context()` removed
392
399
393
400
`MCPServer.get_context()` has been removed. Context is now injected by the framework and passed explicitly — there is no ambient ContextVar to read from.
The high-level `Context` class (injected into `@mcp.tool()` etc.) similarly dropped its `ServerSessionT` parameter: `Context[ServerSessionT, LifespanContextT, RequestT]` → `Context[LifespanContextT, RequestT]`. Both remaining parameters have defaults, so bare `Context` is usually sufficient:
### `ProgressContext` and `progress()` context manager removed
581
620
582
621
The `mcp.shared.progress` module (`ProgressContext`, `Progress`, and the `progress()` context manager) has been removed. This module had no real-world adoption — all users send progress notifications via `Context.report_progress()` or `session.send_progress_notification()` directly.
@@ -752,6 +791,8 @@ if ListToolsRequest in server.request_handlers:
752
791
server = Server("my-server", on_list_tools=handle_list_tools)
753
792
```
754
793
794
+
If you need to check whether a handler is registered, track this yourself — there is currently no public introspection API.
795
+
755
796
### Lowlevel `Server`: decorator-based handlers replaced with constructor `on_*` params
756
797
757
798
The lowlevel `Server` class no longer uses decorator methods for handler registration. Instead, handlers are passed as `on_*` keyword arguments to the constructor.
@@ -876,10 +917,17 @@ Note: `params.arguments` can be `None` (the old decorator defaulted it to `{}`).
876
917
877
918
**`read_resource()` — content type wrapping removed:**
878
919
879
-
The old decorator auto-wrapped `str` into `TextResourceContents` and `bytes` into `BlobResourceContents` (with base64 encoding), and applied a default mimetype of `text/plain`:
920
+
The old decorator auto-wrapped `Iterable[ReadResourceContents]` (and the deprecated `str`/`bytes`shorthand) into `TextResourceContents`/`BlobResourceContents`, handling base64 encoding and mime-type defaulting:
880
921
881
922
```python
882
-
# Before (v1) — str/bytes auto-wrapped with mime type defaulting
923
+
# Before (v1) — Iterable[ReadResourceContents] auto-wrapped
924
+
from mcp.server.lowlevel.helper_types import ReadResourceContents
0 commit comments