diff --git a/src/mcp/server/__init__.py b/src/mcp/server/__init__.py index a0dd033..4c5dc04 100644 --- a/src/mcp/server/__init__.py +++ b/src/mcp/server/__init__.py @@ -101,8 +101,9 @@ def __init__( class Server: - def __init__(self, name: str): + def __init__(self, name: str, version: str | None = None): self.name = name + self.version = version self.request_handlers: dict[ type, Callable[..., Awaitable[types.ServerResult]] ] = { @@ -133,7 +134,7 @@ def pkg_version(package: str) -> str: return InitializationOptions( server_name=self.name, - server_version=pkg_version("mcp"), + server_version=self.version if self.version else pkg_version("mcp"), capabilities=self.get_capabilities( notification_options or NotificationOptions(), experimental_capabilities or {},