Pass workspace directory to MCP servers
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 62/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- rust, vscode
- Domain
- developer-experience, tooling
Research direction
No file or test is named; start by locating the VS Code extension entry point that spawns MCP servers and compare its cwd handling with the Codex CLI behavior described here. Done means MCP servers start in the active workspace root, including in the reported Remote: WSL setup, so path-dependent tools can detect the project without manual activation.
Written by the indexing model from the issue text.
Description
Summary
The Codex VS Code extension spawns MCP servers from the VS Code installation directory instead of the workspace directory. This fundamentally breaks semantic code analysis tools like Serena that rely on correct working directory to index and analyze codebases.
Impact
Serena provides symbolic code operations that are essential for large codebase work:
find_symbol/find_referencing_symbols- call graph traversalreplace_symbol_body- precise symbol-level editsget_symbols_overview- fast structural understanding
Without correct cwd, these tools cannot auto-detect the project, forcing users to manually activate projects every session. This defeats the purpose of semantic tooling.
Current State
| Client | MCP Server cwd | Works? |
|---|---|---|
| Codex CLI | Project directory | ✅ |
| Codex VS Code (Remote: WSL) | /mnt/c/.../Microsoft VS Code |
❌ |
Proposed Fix
When spawning MCP servers, pass cwd: ${workspaceFolder} (or the active workspace root). This is a one-line fix that would unblock all path-dependent MCP tools.
Workarounds Attempted
--project-from-cwdflag in Serena - fails because cwd is wrong- Manual
activate_projecteach session - works but error-prone - Wrapper scripts - cannot access workspace info at spawn time
CODEX_WORKSPACE_ROOTenv var - only available at tool-call time, not spawn time
I've also filed a feature request on Serena to use CODEX_WORKSPACE_ROOT at tool-call time (oraios/serena#970), but the proper fix should be in the VS Code extension.
Related Issues
- #7281 - WSL2 Remote spawns MCP with wrong cwd (my previous report)
- #4222 - MCP servers not launched in workspace folder
- #5387 - Related duplicate
Environment
- Codex VS Code extension: v0.4.67
- Platform: WSL2 Ubuntu on Windows 11
- VS Code: Remote - WSL
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.5k
- Avg merge
- 1m
- Merged PRs (30d)
- 1k
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from openai/codex
-
enhancement remote
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
bug CLI windows-os
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
macOS sandbox blocks hw.optional.arm64 sysctl, causing Flutter to misdetect Apple Silicon as x64 Openbug CLI sandbox
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug CLI TUI
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
CLI config enhancement skills
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
gitbutlerapp/gitbutler#15998 · 1 comment ·
-
bug triage:deciding
Difficulty 1/5 Under an hour Newbie friendliness 88/100
open-telemetry/otel-arrow#4132 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
bitcoindevkit/bdk-ffi#1125 ·