fix(install): write cwd to MCP server entry so clients find graph.db - #352
fix(install): write cwd to MCP server entry so clients find graph.db#352Devilthelegend wants to merge 2 commits into
Conversation
3129c37 to
dc0ed89
Compare
dc0ed89 to
f35887f
Compare
Fixes tirth8205#325 MCP clients (Cursor, Claude Code, Windsurf, etc.) spawn the server process from their own working directory, not the project root. Without a cwd field, uvx/uv/poetry launches code-review-graph serve in the wrong directory and cannot locate .code-review-graph/graph.db. Fix: pass repo_root into _build_server_entry() and write cwd: str(repo_root) into every platform's server entry. Also fix test_install_codex_config to dynamically check command/args via _detect_serve_command() instead of hardcoded strings.
f35887f to
cfa68d8
Compare
|
Hi @Devilthelegend — first, an apology: you posted this cwd fix on April 28, and I shipped essentially the same change in ed5e980 on May 7 without crediting your PR. You got there first; the silent overlap is on me. Main now covers everything in this branch — cwd in _build_server_entry for all platforms (including Codex TOML), the list_tools-based tool filter, shebang detection, module-scope CALLS edges, Julia qualified names, and the duplicate-file cleanup — which is why it conflicts in all six files. One thing main still lacks: your per-platform entry["cwd"] assertions in test_skills.py. If you open a slim follow-up with just those assertions, rebased on main, I'll gladly take it — it's better regression coverage than what I wrote. For future PRs: please keep the diff scoped to the title (this one carried ~2,600 lines of unrelated parser/cleanup changes), and run the full suite — the async _restore_tools fixture broke 7 tests in test_main.py. Closing as superseded, with thanks. |
Summary
Fixes #325
MCP clients (Cursor, Claude Code, Windsurf, etc.) spawn the server process from their own
working directory, not the project root. Without a
cwdfield,uvx/uv/poetrylaunchescode-review-graph servein the wrong directory and cannot locate.code-review-graph/graph.db.Root Cause
_build_server_entry()built the MCP server entry without acwdfield, so every platformconfig written by
code-review-graph installwas missing it.Changes
code_review_graph/skills.pyrepo_root: Pathparameter to_build_server_entry()"cwd": str(repo_root)into every platform's server entry(Claude Code, Cursor, Windsurf, Kiro, OpenCode, Qwen, Zed, Continue, Codex)
install_platform_configs()to passrepo_roottests/test_skills.pyassert entry["cwd"] == str(tmp_path)assertions to all platform install teststest_install_codex_configto dynamically checkcommand/argsvia_detect_serve_command()instead of hardcoded stringsResult
After this fix,
.mcp.jsonwill contain:{ "mcpServers": { "code-review-graph": { "command": "uvx", "args": ["code-review-graph", "serve"], "type": "stdio", "cwd": "/my/project" } } }Tests
67/67 tests passing.