Spaces:
Sleeping
Sleeping
Download src/fastmcp/server/low_level.py from purecipher/xsecuremcp: direct link, hf CLI and curl.
- Browser
- Download file 1.24 kB
-
https://huggingface.co/spaces/purecipher/xsecuremcp/resolve/main/src/fastmcp/server/low_level.py
- Command line
-
hf download hf://spaces/purecipher/xsecuremcp/src/fastmcp/server/low_level.py
-
curl -L -o low_level.py https://huggingface.co/spaces/purecipher/xsecuremcp/resolve/main/src/fastmcp/server/low_level.py
1.24 kB
| from typing import Any | |
| from mcp.server.lowlevel.server import ( | |
| LifespanResultT, | |
| NotificationOptions, | |
| RequestT, | |
| ) | |
| from mcp.server.lowlevel.server import ( | |
| Server as _Server, | |
| ) | |
| from mcp.server.models import InitializationOptions | |
| class LowLevelServer(_Server[LifespanResultT, RequestT]): | |
| def __init__(self, *args, **kwargs): | |
| super().__init__(*args, **kwargs) | |
| # FastMCP servers support notifications for all components | |
| self.notification_options = NotificationOptions( | |
| prompts_changed=True, | |
| resources_changed=True, | |
| tools_changed=True, | |
| ) | |
| def create_initialization_options( | |
| self, | |
| notification_options: NotificationOptions | None = None, | |
| experimental_capabilities: dict[str, dict[str, Any]] | None = None, | |
| **kwargs: Any, | |
| ) -> InitializationOptions: | |
| # ensure we use the FastMCP notification options | |
| if notification_options is None: | |
| notification_options = self.notification_options | |
| return super().create_initialization_options( | |
| notification_options=notification_options, | |
| experimental_capabilities=experimental_capabilities, | |
| **kwargs, | |
| ) | |