Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/mcp/client/stdio.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import sys
from contextlib import asynccontextmanager
from pathlib import Path
from typing import Literal

import anyio
Expand Down Expand Up @@ -66,6 +67,9 @@ class StdioServerParameters(BaseModel):
If not specified, the result of get_default_environment() will be used.
"""

cwd: str | Path | None = None
"""The working directory to use when spawning the process."""

encoding: str = "utf-8"
"""
The text encoding used when sending/receiving messages to the server
Expand Down Expand Up @@ -101,6 +105,7 @@ async def stdio_client(server: StdioServerParameters):
[server.command, *server.args],
env=server.env if server.env is not None else get_default_environment(),
stderr=sys.stderr,
cwd=server.cwd,
)

async def stdout_reader():
Expand Down