graphify icon indicating copy to clipboard operation
graphify copied to clipboard

serve: validate_graph_path fails when graph.json is outside cwd

Open skoodster opened this issue 7 months ago • 1 comments

Bug

serve.py's _load_graph() calls validate_graph_path(graph_path) without a base argument. validate_graph_path defaults base to Path("graphify-out").resolve() (i.e., cwd/graphify-out), so the server always fails when the graph file lives outside the current working directory.

This affects the MCP server when configured with an absolute path:

{
  "command": "python",
  "args": ["-m", "graphify.serve", "/home/user/.claude/skills/graphify/graphify-out/graph.json"]
}

Error:

error: Graph base directory does not exist: /current/working/dir/graphify-out. Run /graphify first to build the graph.

Fix

In serve.py line 13, pass the graph file's parent as the base:

- safe = validate_graph_path(graph_path)
+ safe = validate_graph_path(graph_path, base=Path(graph_path).resolve().parent)

Version

graphifyy 0.3.24

skoodster avatar Apr 09 '26 23:04 skoodster

Fixed in 0.3.25. The MCP server now correctly resolves the graph path regardless of where you run it from. Upgrade with pip install --upgrade graphifyy

safishamsi avatar Apr 09 '26 23:04 safishamsi