fix(mcp): include portable data directory in configs

This commit is contained in:
t8y2 committed 2026-08-02 16:50:55 +08:00
1 parent bcafc4a474
commit 8efe83aaa1
7 files changed
+32 -5

No files matched your search

@@ -31,11 +31,12 @@ describe("MCP config templates", () => {
const nodeLaunch = {
command: "C:\\Program Files\\nodejs\\node.exe",
args: ["C:\\Users\\supervisor\\AppData\\Roaming\\npm\\node_modules\\@dbx-app\\mcp-server\\bin\\dbx-mcp-server.js"],
env: { DBX_DATA_DIR: "D:\\GreenSoft\\DBX\\data" },
};
const nativeBinPath = "C:\\Users\\supervisor\\AppData\\Roaming\\npm\\node_modules\\@dbx-app\\mcp-win32-x64\\bin\\dbx-mcp.exe";
expect(JSON.parse(buildMcpTraeConfig(nodeLaunch, nativeBinPath))).toEqual({
mcpServers: { dbx: { command: nativeBinPath } },
mcpServers: { dbx: { command: nativeBinPath, env: nodeLaunch.env } },
});
expect(JSON.parse(buildMcpTraeConfig(nodeLaunch))).toEqual({
mcpServers: { dbx: nodeLaunch },
@@ -59,6 +60,16 @@ describe("MCP config templates", () => {
expect(buildMcpJsonConfig(launch)).not.toContain("DBX_MCP_ALLOW_WRITES");
});
it("includes the portable DBX data directory in JSON and Codex configs", () => {
const launch = {
command: "dbx-mcp-server",
env: { DBX_DATA_DIR: "D:\\GreenSoft\\DBX\\data" },
};
expect(JSON.parse(buildMcpJsonConfig(launch)).mcpServers.dbx.env).toEqual(launch.env);
expect(buildMcpCodexConfig(launch)).toContain('DBX_DATA_DIR = "D:\\\\GreenSoft\\\\DBX\\\\data"');
});
it("keeps a deployed Web base path in DBX_WEB_URL", () => {
expect(mcpWebBackendUrl("https://dbx.example.com", "/tools/dbx/api")).toBe("https://dbx.example.com/tools/dbx");
});
+1
View File
@@ -3288,6 +3288,7 @@ export async function checkMcpServerStatus(): Promise<import("@/lib/backend/taur
bin_path: null,
native_bin_path: null,
script_path: null,
data_dir: null,
install_command: "npm install -g @dbx-app/mcp-server@latest --registry=https://registry.npmjs.org",
update_command: "npm install -g @dbx-app/mcp-server@latest --registry=https://registry.npmjs.org",
error: "MCP Server status is only available in the desktop app.",
+1
View File
@@ -1897,6 +1897,7 @@ export interface McpServerStatus {
bin_path: string | null;
native_bin_path: string | null;
script_path: string | null;
data_dir: string | null;
install_command: string;
update_command: string;
error: string | null;
@@ -41,7 +41,7 @@ export function buildMcpJsonConfig(config?: McpLaunchConfig): string {
}
export function buildMcpTraeConfig(config?: McpLaunchConfig, nativeBinPath?: string): string {
return buildMcpJsonConfig(nativeBinPath ? { command: nativeBinPath } : config);
return buildMcpJsonConfig(nativeBinPath ? { command: nativeBinPath, env: config?.env } : config);
}
export function buildMcpVsCodeConfig(config?: McpLaunchConfig): string {