|
64 | 64 | from mcp.server.streamable_http import EventStore |
65 | 65 | from mcp.server.streamable_http_manager import StreamableHTTPSessionManager |
66 | 66 | from mcp.server.transport_security import TransportSecuritySettings |
| 67 | +from mcp.server.checkpoint import CheckpointBackend |
67 | 68 | from mcp.shared.context import LifespanContextT, RequestContext, RequestT |
68 | 69 | from mcp.types import Annotations, AnyFunction, ContentBlock, GetPromptResult, Icon, ToolAnnotations |
69 | 70 | from mcp.types import Prompt as MCPPrompt |
@@ -173,6 +174,7 @@ def __init__( # noqa: PLR0913 |
173 | 174 | lifespan: (Callable[[FastMCP[LifespanResultT]], AbstractAsyncContextManager[LifespanResultT]] | None) = None, |
174 | 175 | auth: AuthSettings | None = None, |
175 | 176 | transport_security: TransportSecuritySettings | None = None, |
| 177 | + checkpoint_backend: CheckpointBackend | None = None, |
176 | 178 | ): |
177 | 179 | # Auto-enable DNS rebinding protection for localhost (IPv4 and IPv6) |
178 | 180 | if transport_security is None and host in ("127.0.0.1", "localhost", "::1"): |
@@ -230,6 +232,7 @@ def __init__( # noqa: PLR0913 |
230 | 232 | if auth_server_provider and not token_verifier: # pragma: no cover |
231 | 233 | self._token_verifier = ProviderTokenVerifier(auth_server_provider) |
232 | 234 | self._event_store = event_store |
| 235 | + self._checkpoint_backend = checkpoint_backend |
233 | 236 | self._retry_interval = retry_interval |
234 | 237 | self._custom_starlette_routes: list[Route] = [] |
235 | 238 | self.dependencies = self.settings.dependencies |
@@ -275,6 +278,11 @@ def session_manager(self) -> StreamableHTTPSessionManager: |
275 | 278 | "to avoid unnecessary initialization." |
276 | 279 | ) |
277 | 280 | return self._session_manager # pragma: no cover |
| 281 | + |
| 282 | + @property |
| 283 | + def checkpoint_backend(self) -> CheckpointBackend | None: |
| 284 | + """Return the checkpoint backend (if any) attached to this server.""" |
| 285 | + return self._checkpoint_backend |
278 | 286 |
|
279 | 287 | def run( |
280 | 288 | self, |
|
0 commit comments