Skip to content

Commit bbf0e12

Browse files
committed
fix: handle closed stdio process during writes
1 parent 1b5e677 commit bbf0e12

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/mcp/client/stdio.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,12 @@ async def stdin_writer():
174174
errors=server.encoding_error_handler,
175175
)
176176
)
177-
except anyio.ClosedResourceError: # pragma: no cover
177+
except (
178+
anyio.BrokenResourceError,
179+
anyio.ClosedResourceError,
180+
BrokenPipeError,
181+
ConnectionResetError,
182+
): # pragma: no cover
178183
await anyio.lowlevel.checkpoint()
179184

180185
async with anyio.create_task_group() as tg, process:

src/mcp/server/mcpserver/utilities/schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def dereference_local_refs(schema: dict[str, Any]) -> dict[str, Any]:
6363
prefix = f"#/{defs_key}/"
6464

6565
def inline(node: Any, stack: set[str]) -> Any:
66-
if node is None or isinstance(node, (str, int, float, bool)):
66+
if node is None or isinstance(node, str | int | float | bool):
6767
return node
6868
if isinstance(node, list):
6969
return [inline(item, stack) for item in node]

0 commit comments

Comments
 (0)