Fix run() call indentation to be inside stdio_server context

The run() call was outside the async with stdio_server() block, meaning
the streams would be closed before being used.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Chris Guidry 2026-01-14 09:33:59 -05:00
commit 91df79d43c

View file

@ -2382,16 +2382,16 @@ class FastMCP(Generic[LifespanResultT]):
f"Starting MCP server {self.name!r} with transport 'stdio'{mode}"
)
await self._mcp_server.run(
read_stream,
write_stream,
self._mcp_server.create_initialization_options(
notification_options=NotificationOptions(
tools_changed=True
await self._mcp_server.run(
read_stream,
write_stream,
self._mcp_server.create_initialization_options(
notification_options=NotificationOptions(
tools_changed=True
),
),
),
stateless=stateless,
)
stateless=stateless,
)
finally:
reset_transport(token)