Skip to content

Commit cae5231

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

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
@@ -30,6 +30,9 @@
3030
class SseServerParameters(BaseModel):
3131
"""Parameters for intializing a sse_client."""
3232

33+
# The type of server connection.
34+
type: Literal["sse"] = "sse"
35+
3336
# The endpoint URL.
3437
url: str
3538

@@ -46,6 +49,9 @@ class SseServerParameters(BaseModel):
4649
class StreamableHttpParameters(BaseModel):
4750
"""Parameters for intializing a streamablehttp_client."""
4851

52+
# The type of server connection.
53+
type: Literal["streamable_http"] = "streamable_http"
54+
4955
# The endpoint URL.
5056
url: str
5157

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)