Skip to content

Commit

Permalink
feat: add version string parameter to Server constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
restlessronin committed Dec 10, 2024
1 parent 6a37f43 commit b51fad7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/mcp/server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
] = {
Expand All @@ -114,7 +115,6 @@ def __init__(self, name: str):

def create_initialization_options(
self,
version: str | None = None,
notification_options: NotificationOptions | None = None,
experimental_capabilities: dict[str, dict[str, Any]] | None = None,
) -> InitializationOptions:
Expand All @@ -134,7 +134,7 @@ def pkg_version(package: str) -> str:

return InitializationOptions(
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(
notification_options or NotificationOptions(),
experimental_capabilities or {},
Expand Down

0 comments on commit b51fad7

Please sign in to comment.