Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 805fb46

Browse filesBrowse files
authored
add cwd to StdioServerParameters (#292)
1 parent 08f4e01 commit 805fb46
Copy full SHA for 805fb46

File tree

Expand file treeCollapse file tree

1 file changed

+5
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-0
lines changed

‎src/mcp/client/stdio.py

Copy file name to clipboardExpand all lines: src/mcp/client/stdio.py
+5Lines changed: 5 additions & 0 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.