-
Notifications
You must be signed in to change notification settings - Fork 3.6k
feat: Adjusted MCPConnection logic so the cwd is resolved to current workspace folder. #7505
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
base: main
Are you sure you want to change the base?
feat: Adjusted MCPConnection logic so the cwd is resolved to current workspace folder. #7505
Conversation
All contributors have signed the CLA ✍️ ✅ |
An open question would be how to handle manually specified relative paths. Do we want them to be relative to the vscode folder or to the workspace folder? |
recheck |
I have read the CLA Document and I hereby sign the CLA |
@meanderix relative paths (no leading slash) can be resolved using the |
@meanderix could you also add unit tests for this to validate expected behavior on various platforms etc? |
@RomneyDa I'll take a look at that. |
Quick bump on this @meanderix , would be great to get it in! |
@Patrick-Erichsen @RomneyDa I've refactored the code a bit and added tests. Let me know what you think. |
Description
It was made possible specifiying a current working directory (cwd) for mcp servers in the following PR.
However, unless
cwd
is manually set in the MCP server definition itself, there is no way for the MCP server to resolvecwd
to the current workspace directory. This causes issues with some of the original Anthropic MCP servers, such asmcp-server-git
. See #7173.The following PR attempts to adjust the logic so that unless
cwd
is manually set, we use the workspace folder. (As far as I can tell, unless we do this, thecwd
is actually resolved to path of the vscode binary.)This makes
mcp-server-git
(and other mcp servers) work in multiple projects without having to manually updatecwd
.AI Code Review
@continue-general-review
or@continue-detailed-review
Checklist
Tests
Summary by cubic
Default MCP server cwd to the current workspace root when not explicitly set. This fixes path resolution issues and lets servers like mcp-server-git work across projects without manual config.