feat: add version string parameter to Server constructor
This commit is contained in:
parent
34a257147b
commit
3de4dc1f13
1 changed files with 3 additions and 3 deletions
|
|
@ -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 {},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue