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`.
589
580
590
581
```python
591
-
from mcp.shared.contextimportRequestContext
582
+
from mcp.serverimportServerRequestContext
592
583
593
584
# 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.
659
650
660
651
```python
661
-
from mcp.server.lowlevel import Server
662
-
from mcp.shared.context import RequestContext
652
+
from mcp.server import Server, ServerRequestContext
663
653
from mcp.types import ListToolsResult, PaginatedRequestParams
0 commit comments