Description
Summary
The .vscode/mcp.json
configuration file should support VS Code's built-in {workspaceFolder}
variable for path resolution, similar to how it works in tasks.json
, launch.json
, and other VS Code configuration files.
Problem Description
Currently, when using MCP (Model Context Protocol) servers with configuration files, we must use absolute paths in .vscode/mcp.json
, which creates several issues:
- Portability: Configurations are not portable across different machines or users
- Team Collaboration: Different team members have different absolute paths
- Version Control: Absolute paths in committed files cause conflicts
- Maintenance: Hard to maintain when project locations change
Current Behavior
In .vscode/mcp.json
, this configuration fails:
{
"servers": {
"playwright": {
"command": "npx",
"args": [
"@playwright/mcp@latest",
"--isolated",
"--config",
"{workspaceFolder}/playwright-mcp-config.json"
]
}
}
}
Error Message:
Error: Failed to load config file: {workspaceFolder}/playwright-mcp-config.json, Error: ENOENT: no such file or directory, open '{workspaceFolder}/playwright-mcp-config.json'
Expected Behavior
The {workspaceFolder}
variable should be resolved to the absolute path of the workspace root, just like in other VS Code configuration files:
{
"servers": {
"playwright": {
"command": "npx",
"args": [
"@playwright/mcp@latest",
"--isolated",
"--config",
"{workspaceFolder}/playwright-mcp-config.json"
]
}
}
}
Should resolve to:
{
"servers": {
"playwright": {
"command": "npx",
"args": [
"@playwright/mcp@latest",
"--isolated",
"--config",
"/absolute/path/to/workspace/playwright-mcp-config.json"
]
}
}
}
Consistency with Other VS Code Features
VS Code already supports {workspaceFolder}
in:
.vscode/tasks.json
.vscode/launch.json
.vscode/settings.json
- Extension configurations
Example from tasks.json
:
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "npm",
"args": ["run", "build"],
"options": {
"cwd": "{workspaceFolder}"
}
}
]
}
Use Cases
- Multi-user Development: Teams can share the same MCP configuration
- CI/CD Pipelines: Automated builds with consistent paths
- Docker Containers: Mounted volumes with different paths
- Cross-platform Development: Windows/macOS/Linux compatibility
Workaround
Currently, we must use absolute paths:
{
"servers": {
"playwright": {
"command": "npx",
"args": [
"@playwright/mcp@latest",
"--isolated",
"--config",
"/Users/username/project/playwright-mcp-config.json"
]
}
}
}
This makes the configuration non-portable and causes issues in team environments.
Proposed Solution
Implement variable substitution for .vscode/mcp.json
similar to other VS Code configuration files:
- Support
{workspaceFolder}
variable - Support other common variables like
{workspaceFolderBasename}
,{file}
, etc. - Apply variable resolution before passing arguments to MCP servers
Environment
- VS Code Version: 1.96.x
- OS: macOS/Windows/Linux
- MCP Extension: Latest version
- Reproduction: Any workspace with MCP configuration using relative paths
Steps to Reproduce
- Create a workspace with an MCP server configuration
- Use
{workspaceFolder}
in the config path within.vscode/mcp.json
- Try to start the MCP server
- Observe the "file not found" error
Additional Context
This feature would greatly improve the developer experience for MCP users and align with VS Code's existing variable substitution patterns used throughout the platform.
Related Issues
- Similar variable substitution requests for other VS Code features
- MCP configuration portability issues
- Team collaboration with MCP servers
Priority: Medium
Labels: enhancement, mcp, configuration, developer-experience
Assignee: VS Code MCP Team