Bug
Running codedb mcp /path/to/project hangs indefinitely with scan=loading_snapshot files=0.
Root cause
isCommand() in main.zig:1072 includes "mcp" in its command list. So when called as
codedb mcp /path, the parser hits the isCommand(args[1]) branch at line 147, sets
root="." and cmd="mcp", and the path argument is silently ignored.
With root="." and root_is_explicit=false, the condition at line 227 evaluates to true:
const mcp_deferred_root = std.mem.eql(u8, cmd, "mcp")
and std.mem.eql(u8, root, ".")
and !root_is_explicit;
This triggers the deferred scan flow that waits for a roots/list MCP message —
which never arrives when running outside a MCP client, so the server hangs forever
at loading_snapshot.
Reproduction
codedb mcp /home/user/myproject
# → scan=loading_snapshot files=0 (hangs forever)
codedb /home/user/myproject mcp
# → scan=ready files=433 (works)
Fix
Two options:
- Fix the README to document the correct syntax:
codedb <path> mcp
- Or handle both arg orderings in the parser — if
args[1] == "mcp" and args[2]
looks like a path, treat it as the root
Workaround: CODEDB_ROOT=/path codedb mcp also works.
Bug
Running
codedb mcp /path/to/projecthangs indefinitely withscan=loading_snapshot files=0.Root cause
isCommand()inmain.zig:1072includes"mcp"in its command list. So when called ascodedb mcp /path, the parser hits theisCommand(args[1])branch at line 147, setsroot="."andcmd="mcp", and the path argument is silently ignored.With
root="."androot_is_explicit=false, the condition at line 227 evaluates to true:This triggers the deferred scan flow that waits for a
roots/listMCP message —which never arrives when running outside a MCP client, so the server hangs forever
at
loading_snapshot.Reproduction
Fix
Two options:
codedb <path> mcpargs[1] == "mcp"andargs[2]looks like a path, treat it as the root
Workaround:
CODEDB_ROOT=/path codedb mcpalso works.