Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

fix(dsh): run MCP proxy as Node under Electron (#4272)

Mchenr187657bbd044
diff --git a/examples/dsh-memory-plugin/mcp.mjs b/examples/dsh-memory-plugin/mcp.mjs
index fa7953c24..06740ef9b 100644
--- a/examples/dsh-memory-plugin/mcp.mjs
+++ b/examples/dsh-memory-plugin/mcp.mjs
@@ -16,7 +16,10 @@ export const PROXY_PATH = fileURLToPath(new URL("./servers/mcp-proxy.mjs", impor
* already resolved have to be passed explicitly.
*/
export function buildMcpConfig(config) {
- const env = {};
+ // In DSH Desktop, process.execPath is Electron's executable rather than a
+ // standalone Node binary. This tells Electron to run the proxy script as
+ // Node instead of attempting to launch a second Desktop instance.
+ const env = { ELECTRON_RUN_AS_NODE: "1" };
if (config.endpoint) env.OPENVIKING_URL = config.endpoint;
if (config.apiKey) env.OPENVIKING_API_KEY = config.apiKey;
if (config.account) env.OPENVIKING_ACCOUNT = config.account;
diff --git a/examples/dsh-memory-plugin/mcp.test.mjs b/examples/dsh-memory-plugin/mcp.test.mjs
index d8a89e0a9..d671b3686 100644
--- a/examples/dsh-memory-plugin/mcp.test.mjs
+++ b/examples/dsh-memory-plugin/mcp.test.mjs
@@ -20,6 +20,7 @@ test("the mount config validates against the pinned bridge's own schema", () =>
assert.equal(parsed.serverName, "openviking");
assert.equal(parsed.command, process.execPath);
assert.deepEqual(parsed.args, [PROXY_PATH]);
+ assert.equal(parsed.env.ELECTRON_RUN_AS_NODE, "1");
assert.equal(parsed.toolCallTimeoutMs, 60000);
// Startup must not be fatal: recall, capture, and commit keep working when
// only the MCP endpoint is down, and the bridge reconnects on its own.
@@ -42,6 +43,7 @@ test("credentials resolved by the plugin reach the proxy through the child env",
const { env } = buildMcpConfig(config);
assert.deepEqual(env, {
+ ELECTRON_RUN_AS_NODE: "1",
OPENVIKING_URL: "http://ov.example.com",
OPENVIKING_API_KEY: "secret",
OPENVIKING_ACCOUNT: "acme",
@@ -69,7 +71,10 @@ test("an anonymous local server forwards no credential env", () => {
mcpToolCallTimeoutMs: 60000,
});
- assert.deepEqual(env, { OPENVIKING_URL: "http://127.0.0.1:1933" });
+ assert.deepEqual(env, {
+ ELECTRON_RUN_AS_NODE: "1",
+ OPENVIKING_URL: "http://127.0.0.1:1933",
+ });
});
test("mounting passes the bridge plugin and its config to the host context", () => {