mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-11-10 09:13:53 +08:00
handle_index_repository requires repo_path and errors with "repo_path is required" if it is absent. list_projects only ever advertises the project NAME, never repo_path, and every read tool accepts that name back through get_project_arg's project/project_name/ project_id/projectName aliases -- but index_repository did not, so re-indexing an already-indexed project by the name list_projects gave you had no resolution path and failed immediately. Add resolved_repo_path_from_project_arg(): a query-only lookup of the project's own stored root_path, tried when repo_path is absent before giving up. It never touches srv->store or srv->current_project, so it cannot disturb whatever project the server already has cached, and an unresolvable name still falls through to the original, correct "repo_path is required" error. Verified in a clean ubuntu:24.04 container (TEST_SUITES=mcp make -f Makefile.cbm test-focused): the new tool_index_repository_resolves_root_path_from_project_name_issue1211 fails on unpatched main (strstr(resp, "repo_path is required") is not NULL) and passes with the fix; the companion tool_index_repository_unknown_project_name_still_requires_repo_path guards the fallback stays exact for a name that was never indexed. Full mcp suite: 179 passed on both sides, with one pre-existing, unrelated failure (tool_detect_changes_contained_commands_clean_up_error_and_success, test_mcp.c:5814) reproducing identically on unmodified origin/main. scripts/lint.sh --ci and scripts/security-audit.sh both clean. Fixes #1211 Signed-off-by: Amir Fathi <amirfathi.me@gmail.com>