Skip to content

Commit 805fb46

Browse files
authored
add cwd to StdioServerParameters (#292)
1 parent 08f4e01 commit 805fb46

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/mcp/client/stdio.py

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
import sys
33
from contextlib import asynccontextmanager
4+
from pathlib import Path
45
from typing import Literal
56

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

70+
cwd: str | Path | None = None
71+
"""The working directory to use when spawning the process."""
72+
6973
encoding: str = "utf-8"
7074
"""
7175
The text encoding used when sending/receiving messages to the server
@@ -101,6 +105,7 @@ async def stdio_client(server: StdioServerParameters):
101105
[server.command, *server.args],
102106
env=server.env if server.env is not None else get_default_environment(),
103107
stderr=sys.stderr,
108+
cwd=server.cwd,
104109
)
105110

106111
async def stdout_reader():

0 commit comments

Comments
 (0)