[BUG] [MCP] startup and initialization issue, works in UI, still doesn't in CLI
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
#MCP #BUG
Bug: Claude Desktop MCP sandbox forces CWD=/, breaking MCP servers that rely on working directory or --repo path arguments
Claude Code version: 2.1.87
OS: macOS (Apple Silicon)
MCP server tested: code-review-graph v2.2.1
---
Summary
Claude Desktop spawns all MCP server processes with CWD=/ (filesystem root) via its disclaimer sandbox helper. This silently breaks any MCP server that determines its working context from the process working directory — even when an explicit --repo path argument is passed in the config. The --repo argument is received by the binary but the server still resolves its database path relative to /, resulting in a [Errno 30] Read-only file system: '/.code-review-graph' error on every tool call.
---
Steps to Reproduce
- Install any MCP server that uses CWD or a
--repo/--rootflag to locate its data directory (e.g.code-review-graph) - Register it in
~/Library/Application Support/Claude/claude_desktop_config.jsonwith an explicit--repo /absolute/pathargument - Launch Claude Desktop and connect to the MCP server
- Call any tool on the server
Result: Server resolves all paths relative to / instead of the configured repo path
Expected: Server uses the path provided via --repo argument
---
Root Cause
Claude Desktop routes all MCP process spawning through /Applications/Claude.app/Contents/Helpers/disclaimer. This helper forces CWD=/ at the OS level before exec-ing the MCP binary. The following errors are visible in ~/Library/Logs/Claude/main.log:
Failed to spawn node (via disclaimer): ...disclaimer exited with code 1: Failed to spawn process: No such file or directory
Failed to spawn python (via disclaimer): ...disclaimer exited with code 1: Failed to spawn process: No such file or directory
The MCP server binary receives the --repo argument correctly but internally falls back to resolving paths from CWD, which is /.
Verified by: Running the server manually in terminal with an identical command works perfectly. The stdio MCP handshake completes cleanly. The failure is exclusively caused by the Desktop sandbox environment.
---
Impact
- Affects all MCP servers that use CWD-relative path resolution
- The
argsconfig field inclaude_desktop_config.jsonis effectively broken for path-based arguments - No error is surfaced to Anonymous — the server appears connected but all tool calls fail with cryptic filesystem errors
- Cannot be fixed via config — no combination of
args,env, or path settings resolves it
---
Workaround
Pass the repo path explicitly on every individual tool call as a parameter (e.g. repo_root="/absolute/path"). This is impractical for production use and requires the caller to know the internals of each MCP server.
---
Suggested Fix
The disclaimer sandbox helper should either:
- Preserve the spawning process's CWD when exec-ing MCP servers, or
- Allow an explicit
cwdfield inclaude_desktop_config.jsonMCP server entries, e.g.:
{
"mcpServers": {
"my-server": {
"command": "/path/to/binary",
"args": ["serve"],
"cwd": "/Anonymouss/Anonymous/myproject"
}
}
}
The cwd field is already supported by other MCP host implementations (e.g. VS Code's MCP config) and would resolve this class of issue entirely.
What Should Happen?
Result: Server resolves all paths relative to / instead of the configured repo path
Expected: Server uses the path provided via --repo argument
Error Messages/Logs
Failed to spawn node (via disclaimer): ...disclaimer exited with code 1: Failed to spawn process: No such file or directory
Failed to spawn python (via disclaimer): ...disclaimer exited with code 1: Failed to spawn process: No such file or directory
### Impact
- Affects **all MCP servers** that use CWD-relative path resolution
- The `args` config field in `claude_desktop_config.json` is effectively broken for path-based arguments
- No error is surfaced to Anonymous — the server appears connected but all tool calls fail with cryptic filesystem errors
- Cannot be fixed via config — no combination of `args`, `env`, or path settings resolves it
Steps to Reproduce
Steps to Reproduce
- Install any MCP server that uses CWD or a
--repo/--rootflag to locate its data directory (e.g.code-review-graph) - Register it in
~/Library/Application Support/Claude/claude_desktop_config.jsonwith an explicit--repo /absolute/pathargument - Launch Claude Desktop and connect to the MCP server
- Call any tool on the server
Result: Server resolves all paths relative to / instead of the configured repo path
Expected: Server uses the path provided via --repo argument
Claude Model
Not sure / Multiple models
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
Claude 1.569.0 (49894a)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗