@@ -150,7 +150,8 @@ def __init__(
150
150
151
151
Args:
152
152
connection_params: Parameters for the MCP connection (Stdio, SSE or
153
- Streamable HTTP).
153
+ Streamable HTTP). Stdio by default also has a 5s read timeout as other
154
+ parameters but it's not configurable for now.
154
155
errlog: (Optional) TextIO stream for error logging. Use only for
155
156
initializing a local stdio MCP session.
156
157
"""
@@ -174,6 +175,9 @@ async def create_session(self) -> ClientSession:
174
175
175
176
try :
176
177
if isinstance (self ._connection_params , StdioServerParameters ):
178
+ # So far timeout is not configurable. Given MCP is still evolving, we
179
+ # would expect stdio_client to evolve to accept timeout parameter like
180
+ # other client.
177
181
client = stdio_client (
178
182
server = self ._connection_params , errlog = self ._errlog
179
183
)
@@ -211,6 +215,13 @@ async def create_session(self) -> ClientSession:
211
215
if isinstance (self ._connection_params , StdioServerParameters ):
212
216
# Default timeout for MCP session is 5 seconds, same as SseServerParams
213
217
# and StreamableHTTPServerParams.
218
+ # TODO :
219
+ # 1. make timeout configurable
220
+ # 2. Add StdioConnectionParams to include StdioServerParameters as a
221
+ # field and rename other two params to XXXXConnetionParams. Ohter
222
+ # two params are actually connection params, while stdio is
223
+ # special, stdio_client takes the resposibility of starting the
224
+ # server and working as a client.
214
225
session = await self ._exit_stack .enter_async_context (
215
226
ClientSession (
216
227
* transports [:2 ],
0 commit comments