Skip to content

Conversation

meanderix
Copy link

@meanderix meanderix commented Sep 1, 2025

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 resolve cwd to the current workspace directory. This causes issues with some of the original Anthropic MCP servers, such as mcp-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, the cwd 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 update cwd.

AI Code Review

  • Team members only: AI review runs automatically when PR is opened or marked ready for review
  • Team members can also trigger a review by commenting @continue-general-review or @continue-detailed-review

Checklist

  • I've read the contributing guide
  • The relevant docs, if any, have been updated or created
  • The relevant tests, if any, have been updated or created

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.

  • Bug Fixes
    • Resolve cwd from IDE workspace dirs when not provided.
    • Preserve user-provided cwd as-is.
    • Avoids defaulting to the VS Code binary path.

@meanderix meanderix requested a review from a team as a code owner September 1, 2025 07:20
@meanderix meanderix requested review from tomasz-stefaniak and removed request for a team September 1, 2025 07:20
@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Sep 1, 2025
Copy link

github-actions bot commented Sep 1, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@meanderix
Copy link
Author

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?

@meanderix meanderix changed the title Enhancement: Adjusted MCPConnection logic so the cwd is resolved to current workspace folder. feat: Adjusted MCPConnection logic so the cwd is resolved to current workspace folder. Sep 1, 2025
@meanderix
Copy link
Author

recheck

@meanderix
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

@RomneyDa
Copy link
Collaborator

RomneyDa commented Sep 9, 2025

@meanderix relative paths (no leading slash) can be resolved using the resolveRelativePathInDir util

@RomneyDa
Copy link
Collaborator

RomneyDa commented Sep 9, 2025

@meanderix could you also add unit tests for this to validate expected behavior on various platforms etc?

@meanderix
Copy link
Author

@RomneyDa I'll take a look at that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:S This PR changes 10-29 lines, ignoring generated files.
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

2 participants