Skip to content

Commit e455823

Browse files
committed
add type field to client session config BaseModels
1 parent d28a1a6 commit e455823

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/mcp/client/session_group.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from collections.abc import Callable
1414
from datetime import timedelta
1515
from types import TracebackType
16-
from typing import Any, TypeAlias
16+
from typing import Any, Literal, TypeAlias
1717

1818
import anyio
1919
from pydantic import BaseModel
@@ -29,6 +29,9 @@
2929

3030
class SseServerParameters(BaseModel):
3131
"""Parameters for intializing a sse_client."""
32+
33+
# The type of server connection.
34+
type: Literal["sse"] = "sse"
3235

3336
# The endpoint URL.
3437
url: str
@@ -45,6 +48,9 @@ class SseServerParameters(BaseModel):
4548

4649
class StreamableHttpParameters(BaseModel):
4750
"""Parameters for intializing a streamablehttp_client."""
51+
52+
# The type of server connection.
53+
type: Literal["streamable_http"] = "streamable_http"
4854

4955
# The endpoint URL.
5056
url: str

src/mcp/client/stdio/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ def get_default_environment() -> dict[str, str]:
6969

7070

7171
class StdioServerParameters(BaseModel):
72+
type: Literal["stdio"] = "stdio"
73+
"""The type of server connection."""
74+
7275
command: str
7376
"""The executable to run to start the server."""
7477

0 commit comments

Comments
 (0)