Skip to content

Commit 0a82623

Browse files
committed
refactor: pass stdio params through **kwargs like other transports
The SSE and streamable-http overloads declare transport-specific params but the implementation catches them all via **kwargs. Follow the same pattern for stdin/stdout so the implementation signature stays uniform. Made-with: Cursor
1 parent 3d1bdea commit 0a82623

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

src/mcp/server/mcpserver/server.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -276,19 +276,12 @@ def run(
276276
def run(
277277
self,
278278
transport: Literal["stdio", "sse", "streamable-http"] = "stdio",
279-
*,
280-
stdin: anyio.AsyncFile[str] | None = None,
281-
stdout: anyio.AsyncFile[str] | None = None,
282279
**kwargs: Any,
283280
) -> None:
284281
"""Run the MCP server. Note this is a synchronous function.
285282
286283
Args:
287284
transport: Transport protocol to use ("stdio", "sse", or "streamable-http")
288-
stdin: Optional async text stream for MCP input (stdio transport only).
289-
When omitted, uses process stdin. See :func:`mcp.server.stdio.stdio_server`.
290-
stdout: Optional async text stream for MCP output (stdio transport only).
291-
When omitted, uses process stdout.
292285
**kwargs: Transport-specific options (see overloads for details)
293286
"""
294287
TRANSPORTS = Literal["stdio", "sse", "streamable-http"]
@@ -297,7 +290,7 @@ def run(
297290

298291
match transport:
299292
case "stdio":
300-
anyio.run(lambda: self.run_stdio_async(stdin=stdin, stdout=stdout))
293+
anyio.run(lambda: self.run_stdio_async(**kwargs))
301294
case "sse": # pragma: no cover
302295
anyio.run(lambda: self.run_sse_async(**kwargs))
303296
case "streamable-http": # pragma: no cover

0 commit comments

Comments
 (0)