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 Server constructor
This commit is contained in:
committed by
David Soria Parra
parent
34a257147b
commit
3de4dc1f13
@@ -101,8 +101,9 @@ class NotificationOptions:
|
|||||||
|
|
||||||
|
|
||||||
class Server:
|
class Server:
|
||||||
def __init__(self, name: str):
|
def __init__(self, name: str, version: str | None = None):
|
||||||
self.name = name
|
self.name = name
|
||||||
|
self.version = version
|
||||||
self.request_handlers: dict[
|
self.request_handlers: dict[
|
||||||
type, Callable[..., Awaitable[types.ServerResult]]
|
type, Callable[..., Awaitable[types.ServerResult]]
|
||||||
] = {
|
] = {
|
||||||
@@ -114,7 +115,6 @@ class Server:
|
|||||||
|
|
||||||
def create_initialization_options(
|
def create_initialization_options(
|
||||||
self,
|
self,
|
||||||
version: str | None = None,
|
|
||||||
notification_options: NotificationOptions | None = None,
|
notification_options: NotificationOptions | None = None,
|
||||||
experimental_capabilities: dict[str, dict[str, Any]] | None = None,
|
experimental_capabilities: dict[str, dict[str, Any]] | None = None,
|
||||||
) -> InitializationOptions:
|
) -> InitializationOptions:
|
||||||
@@ -134,7 +134,7 @@ class Server:
|
|||||||
|
|
||||||
return InitializationOptions(
|
return InitializationOptions(
|
||||||
server_name=self.name,
|
server_name=self.name,
|
||||||
server_version=version if version else pkg_version("mcp"),
|
server_version=self.version if self.version else pkg_version("mcp"),
|
||||||
capabilities=self.get_capabilities(
|
capabilities=self.get_capabilities(
|
||||||
notification_options or NotificationOptions(),
|
notification_options or NotificationOptions(),
|
||||||
experimental_capabilities or {},
|
experimental_capabilities or {},
|
||||||
|
|||||||
Reference in New Issue
Block a user