Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Don't flag Cursor's MCP calls as one repeated call

AdityaUmale6b479913cd8a
diff --git a/server/host/loop-guard.test.ts b/server/host/loop-guard.test.ts
index 2d0c347024..3040a0cf83 100644
--- a/server/host/loop-guard.test.ts
+++ b/server/host/loop-guard.test.ts
@@ -136,6 +136,12 @@ describe("loop guard, setting off", () => {
expect(r.rows).toEqual([]);
});
+ it("never counts Cursor's MCP calls: each arrives titled \"MCP: tool\" with no name or arguments", () => {
+ const r = rig({ settings: { enabled: false } });
+ times(25, () => r.play({ title: "MCP: tool" }));
+ expect(r.rows).toEqual([]);
+ });
+
it("counts a permission ask by its tool and summary, and cuts a long call in the notice", () => {
const r = rig({ settings: { enabled: false } });
for (let i = 0; i < 5; i++) r.ask("Bash", "npm test\n");
diff --git a/server/repeat-detector.test.ts b/server/repeat-detector.test.ts
index 27e5623e23..92c59bca23 100644
--- a/server/repeat-detector.test.ts
+++ b/server/repeat-detector.test.ts
@@ -21,6 +21,7 @@ describe("toolItemKey", () => {
expect(toolItemKey("Bash", undefined)).toBeNull();
expect(toolItemKey("Bash", '{"command":"ls"}')).toBeNull();
expect(toolItemKey(undefined, undefined)).toBeNull();
+ expect(toolItemKey("MCP: tool", undefined)).toBeNull();
});
it("tells apart calls an adapter titles alike by their input", () => {
diff --git a/server/repeat-detector.ts b/server/repeat-detector.ts
index 16d676297e..c2d5c27f1f 100644
--- a/server/repeat-detector.ts
+++ b/server/repeat-detector.ts
@@ -7,10 +7,14 @@ export function callKey(tool: string, args: string | undefined): string | null {
return `${tool}:${a}`;
}
+/** Cursor's ACP adapter titles every MCP call "MCP: tool" and sends an empty input: like a bare tool name, it names no call. */
+const NAMELESS_TITLE = /^MCP:\s*tool$/i;
+
/** Antigravity's ACP adapter titles every call alike ("Running list_directory") and carries what differs only in the input. */
export function toolItemKey(title: string | undefined, input: string | undefined): string | null {
const t = (title ?? "").trim();
if (!/\s|\//.test(t)) return null;
+ if (!input && NAMELESS_TITLE.test(t)) return null;
return input ? `tool:${JSON.stringify([t, input])}` : callKey("tool", t);
}