Skip to content

Commit b38b406

Browse files
mcp supports cwd config and defaults to workspace cwd (#2171)
* mcp supports cwd config and defaults to workspace cwd * clean up * Update src/services/mcp/McpHub.ts Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> --------- Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
1 parent e7a1db8 commit b38b406

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/services/mcp/McpHub.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ const createServerTypeSchema = () => {
6363
type: z.enum(["stdio"]).optional(),
6464
command: z.string().min(1, "Command cannot be empty"),
6565
args: z.array(z.string()).optional(),
66+
cwd: z.string().default(() => vscode.workspace.workspaceFolders?.at(0)?.uri.fsPath ?? process.cwd()),
6667
env: z.record(z.string()).optional(),
6768
// Ensure no SSE fields are present
6869
url: z.undefined().optional(),
@@ -314,7 +315,7 @@ export class McpHub {
314315
mcpSettingsFilePath,
315316
`{
316317
"mcpServers": {
317-
318+
318319
}
319320
}`,
320321
)
@@ -427,6 +428,7 @@ export class McpHub {
427428
transport = new StdioClientTransport({
428429
command: config.command,
429430
args: config.args,
431+
cwd: config.cwd,
430432
env: {
431433
...config.env,
432434
...(process.env.PATH ? { PATH: process.env.PATH } : {}),

0 commit comments

Comments
 (0)