Skip to content

#1 Persistent memory for AI coding agents based on real-world benchmarks

fix(mcp): use DELETE for governance memory deletion proxy (#423)

이민재b48176cacd82
diff --git a/src/mcp/standalone.ts b/src/mcp/standalone.ts
index ae1f4f36..86678a76 100644
--- a/src/mcp/standalone.ts
+++ b/src/mcp/standalone.ts
@@ -176,7 +176,7 @@ async function handleProxy(
}
case "memory_governance_delete": {
const result = await handle.call("/agentmemory/governance/memories", {
- method: "POST",
+ method: "DELETE",
body: JSON.stringify({ memoryIds: v.memoryIds, reason: v.reason }),
});
return textResponse(result);
diff --git a/test/mcp-standalone-proxy.test.ts b/test/mcp-standalone-proxy.test.ts
index 6522691d..0d93b227 100644
--- a/test/mcp-standalone-proxy.test.ts
+++ b/test/mcp-standalone-proxy.test.ts
@@ -75,6 +75,43 @@ describe("@agentmemory/mcp standalone — server proxy (issue #159)", () => {
expect(body.results[0].id).toBe("m1");
});
+ it("proxies memory_governance_delete to the DELETE REST endpoint", async () => {
+ const calls: Array<{ url: string; method: string; body?: unknown }> = [];
+ installFetch((url, init) => {
+ const method = init?.method || "GET";
+ if (url.endsWith("/agentmemory/livez")) return new Response("ok", { status: 200 });
+ calls.push({
+ url,
+ method,
+ body: init?.body ? JSON.parse(init.body as string) : undefined,
+ });
+ if (url.endsWith("/agentmemory/governance/memories") && method === "DELETE") {
+ return new Response(JSON.stringify({ success: true, deleted: 2 }), {
+ status: 200,
+ headers: { "content-type": "application/json" },
+ });
+ }
+ return new Response("method not allowed", { status: 405, statusText: "Method Not Allowed" });
+ });
+
+ const res = await handleToolCall("memory_governance_delete", {
+ memoryIds: "mem_1, mem_2",
+ reason: "cleanup stale test data",
+ });
+
+ expect(JSON.parse(res.content[0].text)).toEqual({ success: true, deleted: 2 });
+ expect(calls).toEqual([
+ {
+ url: `${BASE}/agentmemory/governance/memories`,
+ method: "DELETE",
+ body: {
+ memoryIds: ["mem_1", "mem_2"],
+ reason: "cleanup stale test data",
+ },
+ },
+ ]);
+ });
+
it("local fallback returns the same shape as proxy for memory_smart_search", async () => {
installFetch(() => {
throw new Error("ECONNREFUSED");