feat(mcp): run server from Rust binary

This commit is contained in:
t8y2 committed 2026-07-18 17:57:44 +08:00
1 parent c19c4b9be6
commit 8d7dc695bb
35 files changed
+3492 -100

No files matched your search

+4 -3
View File
@@ -2,12 +2,13 @@ import assert from "node:assert/strict";
import { spawn, type ChildProcessWithoutNullStreams } from "node:child_process";
import { mkdtemp, rm, symlink } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { join, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { test } from "vitest";
const packageDir = fileURLToPath(new URL("..", import.meta.url));
const mcpBin = fileURLToPath(new URL("../dist/index.js", import.meta.url));
const mcpBin = fileURLToPath(new URL("../bin/dbx-mcp-server.js", import.meta.url));
const rustBinary = join(process.env.CARGO_TARGET_DIR || resolve(packageDir, "../..", "target"), "debug", process.platform === "win32" ? "dbx-mcp.exe" : "dbx-mcp");
type InitializeResponse = {
id: number;
@@ -24,7 +25,7 @@ test("responds to initialize when invoked through an npm-style symlink", async (
try {
child = spawn(process.execPath, [bin.path], {
cwd: packageDir,
env: { ...process.env },
env: { ...process.env, DBX_MCP_BINARY: rustBinary },
});
const responsePromise = readJsonRpcResponse(child, 5000);