Skip to content

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

Hermes trust ask: name it only when the name reads back as the same server and tool

Bugfixer 2610f255dc7c4
diff --git a/server/drivers/acp/hermes-mcp-trust.test.ts b/server/drivers/acp/hermes-mcp-trust.test.ts
index c7b889f0cf..71e71ade61 100644
--- a/server/drivers/acp/hermes-mcp-trust.test.ts
+++ b/server/drivers/acp/hermes-mcp-trust.test.ts
@@ -42,6 +42,7 @@ describe("Hermes MCP trust asks", () => {
{ toolCall: { ...trustAsk(), kind: "edit" }, options: OPTIONS },
{ toolCall: { kind: "execute", title: "rm -rf build", rawInput: { command: "rm -rf build", description: "recursive delete" } }, options: OPTIONS },
{ toolCall: trustAsk("my__server"), options: OPTIONS },
+ { toolCall: trustAsk("linear_"), options: OPTIONS }, // mcp__linear___create_issue reads back as linear / _create_issue
{ toolCall: trustAsk("linear", "create issue"), options: OPTIONS },
{ toolCall: trustAsk("linear'"), options: OPTIONS },
];
diff --git a/server/drivers/acp/hermes-mcp-trust.ts b/server/drivers/acp/hermes-mcp-trust.ts
index f51a4b00c4..685db52670 100644
--- a/server/drivers/acp/hermes-mcp-trust.ts
+++ b/server/drivers/acp/hermes-mcp-trust.ts
@@ -1,3 +1,5 @@
+import { providerMcpTool } from "../../provider-tool-allow.ts";
+
// hermes-agent asks before a write-capable tool runs on an MCP server its own config.yaml marks `trust: untrusted`
// (tools/mcp_tool_handlers.py `_ask_for_call`). The ask reaches ACP as a shell call (acp_adapter/permissions.py): kind
// `execute`, title "<description>: <message>", rawInput {command: message, description}. As a shell call, "Always allow"
@@ -14,6 +16,9 @@ export function hermesPermissionRequest(params: Record<string, any>): Record<str
const options: Array<{ kind?: unknown }> = Array.isArray(params.options) ? params.options : [];
const description = toolCall.rawInput?.description;
const asked = toolCall.kind === "execute" && typeof description === "string" ? REMEMBERABLE_TRUST_ASK.exec(description) : null;
- if (!asked || asked[1].includes("__") || !options.some((option) => option.kind === "allow_always")) return params;
- return { ...params, toolCall: { ...toolCall, kind: "other", title: `mcp__${asked[1]}__${asked[2]}` } };
+ if (!asked || !options.some((option) => option.kind === "allow_always")) return params;
+ const title = `mcp__${asked[1]}__${asked[2]}`;
+ const readBack = providerMcpTool(title);
+ if (readBack?.server !== asked[1] || readBack.tool !== asked[2]) return params;
+ return { ...params, toolCall: { ...toolCall, kind: "other", title } };
}