feat: Adjusted MCPConnection logic so the cwd is resolved to current workspace folder. #7505
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.