mirror of
https://github.com/aljazceru/mcp-python-sdk.git
synced 2025-12-19 14:54:24 +01:00
feat: add version string parameter to 'create_initialization_options'
This commit is contained in:
committed by
David Soria Parra
parent
e691c511ab
commit
937c640f04
@@ -114,6 +114,7 @@ class Server:
|
||||
|
||||
def create_initialization_options(
|
||||
self,
|
||||
version: str | None = None,
|
||||
notification_options: NotificationOptions | None = None,
|
||||
experimental_capabilities: dict[str, dict[str, Any]] | None = None,
|
||||
) -> InitializationOptions:
|
||||
@@ -133,7 +134,7 @@ class Server:
|
||||
|
||||
return InitializationOptions(
|
||||
server_name=self.name,
|
||||
server_version=pkg_version("mcp"),
|
||||
server_version=version if version else pkg_version("mcp"),
|
||||
capabilities=self.get_capabilities(
|
||||
notification_options or NotificationOptions(),
|
||||
experimental_capabilities or {},
|
||||
|
||||
@@ -19,8 +19,9 @@ Example usage:
|
||||
async with sse.connect_sse(
|
||||
request.scope, request.receive, request._send
|
||||
) as streams:
|
||||
# Pass user visible version string, egs. 0.1.0
|
||||
await app.run(
|
||||
streams[0], streams[1], app.create_initialization_options()
|
||||
streams[0], streams[1], app.create_initialization_options("0.1.0")
|
||||
)
|
||||
|
||||
async def handle_messages(request):
|
||||
|
||||
Reference in New Issue
Block a user