Skip to content

fix(install): write cwd to MCP server entry so clients find graph.db#352

Open
Devilthelegend wants to merge 2 commits intotirth8205:mainfrom
Devilthelegend:fix/install-missing-cwd-mcp-json
Open

fix(install): write cwd to MCP server entry so clients find graph.db#352
Devilthelegend wants to merge 2 commits intotirth8205:mainfrom
Devilthelegend:fix/install-missing-cwd-mcp-json

Conversation

@Devilthelegend
Copy link
Copy Markdown
Contributor

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 cwd field, uvx/uv/poetry launches
code-review-graph serve in the wrong directory and cannot locate .code-review-graph/graph.db.

Root Cause

_build_server_entry() built the MCP server entry without a cwd field, so every platform
config written by code-review-graph install was missing it.

Changes

code_review_graph/skills.py

  • Added repo_root: Path parameter to _build_server_entry()
  • Always writes "cwd": str(repo_root) into every platform's server entry
    (Claude Code, Cursor, Windsurf, Kiro, OpenCode, Qwen, Zed, Continue, Codex)
  • Updated call site in install_platform_configs() to pass repo_root

tests/test_skills.py

  • Added assert entry["cwd"] == str(tmp_path) assertions to all platform install tests
  • Fixed test_install_codex_config to dynamically check command/args via
    _detect_serve_command() instead of hardcoded strings

Result

After this fix, .mcp.json will contain:

{
  "mcpServers": {
    "code-review-graph": {
      "command": "uvx",
      "args": ["code-review-graph", "serve"],
      "type": "stdio",
      "cwd": "/my/project"
    }
  }
}

Tests

67/67 tests passing.

@Devilthelegend Devilthelegend force-pushed the fix/install-missing-cwd-mcp-json branch 2 times, most recently from 3129c37 to dc0ed89 Compare April 20, 2026 09:21
@Devilthelegend Devilthelegend deleted the fix/install-missing-cwd-mcp-json branch April 20, 2026 09:39
@Devilthelegend Devilthelegend restored the fix/install-missing-cwd-mcp-json branch April 20, 2026 09:40
@Devilthelegend Devilthelegend force-pushed the fix/install-missing-cwd-mcp-json branch from dc0ed89 to f35887f Compare April 20, 2026 09:53
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.
@Devilthelegend Devilthelegend force-pushed the fix/install-missing-cwd-mcp-json branch from f35887f to cfa68d8 Compare April 20, 2026 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

install does not write cwd to .mcp.json — MCP server can't find graph database

1 participant