From 18a42873b2b13e23c710eaaa7ca3ce1c6c8b8acc Mon Sep 17 00:00:00 2001 From: nntrivi2001 Date: Thu, 13 Aug 2026 15:36:36 +0700 Subject: [PATCH] fix(mcp): fall back to lane cwd when source_repo is null Adopted lanes have source_repo = null; lane-mcp.js passed it raw to readSourceMcpServers and threw ENOMCPCONFIG. Match the existing fallback pattern in lane-env.js/lane-profile.js. --- server/__tests__/lane-mcp.test.js | 7 +++++++ server/lib/lane-mcp.js | 7 ++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/server/__tests__/lane-mcp.test.js b/server/__tests__/lane-mcp.test.js index e69816f..14a860f 100644 --- a/server/__tests__/lane-mcp.test.js +++ b/server/__tests__/lane-mcp.test.js @@ -79,6 +79,13 @@ describe("syncMcp — reading and relocating", () => { `${lane.cwd}/.playwright-mcp/profiles/default` ); }); + + it("falls back to the lane's own cwd when source_repo is null (adopted lane)", async () => { + const lane = makeLane(null); + writeClaudeJson({ [lane.cwd]: { mcpServers: { playwright: { command: "npx", args: [] } } } }); + const result = await laneMcp.syncMcp(lane); + assert.deepEqual(result.servers, ["playwright"]); + }); }); describe("syncMcp — Playwright output-dir pinning", () => { diff --git a/server/lib/lane-mcp.js b/server/lib/lane-mcp.js index a11372d..79a3521 100644 --- a/server/lib/lane-mcp.js +++ b/server/lib/lane-mcp.js @@ -120,8 +120,9 @@ function excludeFromGit(laneDir, line) { * @returns {{servers: string[], profilesSeeded: string[]}} */ async function syncMcp(lane) { - const sourceServers = readSourceMcpServers(lane.source_repo); - const relocated = relocate(sourceServers, lane.source_repo, lane.cwd); + const sourceRepo = lane.source_repo || lane.cwd; + const sourceServers = readSourceMcpServers(sourceRepo); + const relocated = relocate(sourceServers, sourceRepo, lane.cwd); pinPlaywrightOutputDir(relocated, lane.cwd); fs.writeFileSync( @@ -130,7 +131,7 @@ async function syncMcp(lane) { ); excludeFromGit(lane.cwd, ".mcp.json"); - const profilesSeeded = seedProfiles(lane.source_repo, lane.cwd); + const profilesSeeded = seedProfiles(sourceRepo, lane.cwd); return { servers: Object.keys(relocated), profilesSeeded }; }