-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Set CWD of MCP server for single-root workspaces #964
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@@ -170,6 +170,7 @@ export class McpHub { | |||
// ...(process.env.NODE_PATH ? { NODE_PATH: process.env.NODE_PATH } : {}), | |||
}, | |||
stderr: "pipe", // necessary for stderr to be available | |||
cwd: config.cwd ?? this.getDefaultCwd(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider updating the configuration schema to document the new 'cwd' option explicitly.
Hey @gusbicalho, Thank you for your contribution. We genuinely apologize for taking so long to give you any feedback on your PR, we are working hard to prevent this from happening again. We are closing this PR because it seems that this feature is already implemented into Roo Code. We've now shifted to a clearer issue-first workflow to avoid this kind of situation going forward. Please create an issue first for any future contributions, as outlined there. Thank you for your patience. We would be happy to see more of your contributions in the future. |
Description
It's useful to have the MCP process started in the workspace directory, so the process can rely on local configuration files.
For example, I use ASDF to manage NodeJS version in a project. By setting the CWD to be the current workspace, an MCP that runs
npx
will use the node version defined for the project.This is a very recent addition to the @modelcontextprotocol/sdk so I updated it to version 1.5.0.
When we do not specify the CWD, the MCP server is spawned at
process.cwd()
, which (in my machine at least) returns/
.Type of change
/
path.config.cwd
is undefined. We would then only apply the new behaviour ifconfig.cwd === <some_special_value>
e.g."{workspaceDir}"
.How Has This Been Tested?
Tested the extension locally and found that it now starts an MCP with the correct CWD.
Checklist:
Additional context
Related Issues
Reviewers
Important
Sets CWD for MCP servers to workspace directory in single-root workspaces and updates SDK to version 1.5.0.
McpHub.ts
.process.cwd()
if no workspace or multiple workspaces.@modelcontextprotocol/sdk
to version 1.5.0 inpackage.json
.This description was created by
for 00e9c7b. It will automatically update as commits are pushed.