Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ test/
binaryDiscovery.test.ts Real executable discovery on PATH (13 tests)
initializeProject.test.ts Status display, agents file classification, formatError (69 tests)
managedLifecycle.test.ts Managed install with real file I/O (26 tests)
mcpConfig.test.ts MCP config with real temp directories (15 tests)
mcpConfig.test.ts MCP config with real temp directories (16 tests)
managedInstall.test.ts Managed Update compares latest vs managed binary (10 tests)
mcpRegister.test.ts Native MCP definition helper for binary path (6 tests)
statusRefresh.test.ts Status and MCP refresh order after input change (1 test)
Expand Down
14 changes: 2 additions & 12 deletions src/mcp/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,18 +177,8 @@ function withPatchloomEntry(
}

function hasPatchloomEntry(kind: McpTargetKind, config: Record<string, unknown>): boolean {
if (usesMcpServersKey(kind)) {
const modern = objectValue(config.mcpServers);
if (typeof modern.patchloom === "object" && modern.patchloom !== null) {
return true;
}
if (kind === "cursor-workspace") {
const legacy = objectValue(config.servers);
return typeof legacy.patchloom === "object" && legacy.patchloom !== null;
}
return false;
}
const root = objectValue(config.servers);
const key = usesMcpServersKey(kind) ? "mcpServers" : "servers";
const root = objectValue(config[key]);
return typeof root.patchloom === "object" && root.patchloom !== null;
}

Expand Down
25 changes: 25 additions & 0 deletions test/unit/mcpConfig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,31 @@ test("configureMcpTargets creates both vscode and cursor configs", async () => {
});
});

test("inspectMcpTargets does not treat Cursor servers-only file as configured", async () => {
await withTempDir(async (workspace) => {
const cursorDir = path.join(workspace, ".cursor");
await fs.mkdir(cursorDir, { recursive: true });
await fs.writeFile(
path.join(cursorDir, "mcp.json"),
JSON.stringify({ servers: { patchloom: { command: "patchloom", args: ["mcp-server"] } } }),
"utf8"
);

const targets = await inspectMcpTargets({
workspaceFolderPath: workspace,
homeDir: workspace,
readFile: async (filePath) => {
try { return await fs.readFile(filePath, "utf8"); } catch { return undefined; }
}
});

const cursorTarget = targets.find((t) => t.kind === "cursor-workspace");
assert.ok(cursorTarget);
assert.equal(cursorTarget.exists, true);
assert.equal(cursorTarget.configured, false, "Cursor only loads mcpServers");
});
});

test("inspectMcpTargets reads configured status from real files", async () => {
await withTempDir(async (workspace) => {
const vscodeDir = path.join(workspace, ".vscode");
Expand Down
Loading