diff --git a/src/mcp/client/session_group.py b/src/mcp/client/session_group.py index 700b5417f..d402ee082 100644 --- a/src/mcp/client/session_group.py +++ b/src/mcp/client/session_group.py @@ -13,7 +13,7 @@ from collections.abc import Callable from datetime import timedelta from types import TracebackType -from typing import Any, TypeAlias +from typing import Any, Literal, TypeAlias import anyio from pydantic import BaseModel @@ -30,6 +30,9 @@ class SseServerParameters(BaseModel): """Parameters for intializing a sse_client.""" + # The type of server connection. + type: Literal["sse"] = "sse" + # The endpoint URL. url: str @@ -46,6 +49,9 @@ class SseServerParameters(BaseModel): class StreamableHttpParameters(BaseModel): """Parameters for intializing a streamablehttp_client.""" + # The type of server connection. + type: Literal["streamable_http"] = "streamable_http" + # The endpoint URL. url: str diff --git a/src/mcp/client/stdio/__init__.py b/src/mcp/client/stdio/__init__.py index 50bceddec..804c2ec2f 100644 --- a/src/mcp/client/stdio/__init__.py +++ b/src/mcp/client/stdio/__init__.py @@ -69,6 +69,9 @@ def get_default_environment() -> dict[str, str]: class StdioServerParameters(BaseModel): + type: Literal["stdio"] = "stdio" + """The type of server connection.""" + command: str """The executable to run to start the server."""