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
fix: address PR review comments on migration docs and type hints
- Fix all migration.md examples to use ServerRequestContext instead of RequestContext
- Fix all imports to use 'from mcp.server import Server, ServerRequestContext'
- Apply ruff formatting to code examples
- Add Server constructor calls to examples that were missing them
- Re-export ServerRequestContext from mcp.server.__init__
- Add type hints to TaskResultHandler docstring example
The `RequestContext` class now uses optional fields for request-specific data (`request_id`, `meta`, etc.) so it can be used for both request and notification handlers. In notification handlers, these fields are `None`.
588
579
589
580
```python
590
-
from mcp.shared.contextimportRequestContext
581
+
from mcp.serverimportServerRequestContext
591
582
592
583
# request_id, meta, etc. are available in request handlers
The `streamable_http_app()` method is now available directly on the lowlevel `Server` class, not just `MCPServer`. This allows using the streamable HTTP transport without the MCPServer wrapper.
658
649
659
650
```python
660
-
from mcp.server.lowlevel import Server
661
-
from mcp.shared.context import RequestContext
651
+
from mcp.server import Server, ServerRequestContext
662
652
from mcp.types import ListToolsResult, PaginatedRequestParams
0 commit comments