diff --git a/vibn-frontend/app/api/mcp/route.ts b/vibn-frontend/app/api/mcp/route.ts index 1d269a3..8b57706 100644 --- a/vibn-frontend/app/api/mcp/route.ts +++ b/vibn-frontend/app/api/mcp/route.ts @@ -5144,7 +5144,11 @@ async function toolFsGlob(principal: Principal, params: Record) { { status: 400 }, ); } - const cwd = normalizeFsPath(String(params.cwd ?? ""), project.slug); + const rawCwd = + params.cwd === undefined || params.cwd === null || params.cwd === "" + ? "." + : String(params.cwd); + const cwd = normalizeFsPath(rawCwd, project.slug); if (cwd instanceof NextResponse) return cwd; // ripgrep --files --glob is faster + smarter than `find` and respects .gitignore. const cmd = `cd ${shq(cwd)} && rg --files --glob ${shq(pattern)} | head -500`; @@ -6261,7 +6265,11 @@ async function toolFsTree(principal: Principal, params: Record) { if (guard) return guard; const project = await resolveProjectOr404(principal, params); if (project instanceof NextResponse) return project; - const path = normalizeFsPath(String(params.path ?? ""), project.slug); + const rawPath = + params.path === undefined || params.path === null || params.path === "" + ? "." + : String(params.path); + const path = normalizeFsPath(rawPath, project.slug); if (path instanceof NextResponse) return path; // Use find to generate a tree structure, ignoring node_modules and .git