feat(mcp): add DeepSeek Harness configuration

This commit is contained in:
Lan-zk authored and GitHub committed 2026-08-20 02:26:56 +08:00
1 parent 634bb9a7d0
commit c286eec7d2
14 files changed
+127 -6

No files matched your search

@@ -1,5 +1,5 @@
import { describe, expect, it } from "vitest";
import { buildMcpCherryStudioConfig, buildMcpCodexConfig, buildMcpJsonConfig, buildMcpOpenCodeConfig, buildMcpPiConfig, buildMcpTraeConfig, buildMcpVsCodeConfig, mcpWebBackendUrl } from "@/lib/mcp/mcpConfigTemplates";
import { buildMcpCherryStudioConfig, buildMcpCodexConfig, buildMcpDeepSeekHarnessConfig, buildMcpJsonConfig, buildMcpOpenCodeConfig, buildMcpPiConfig, buildMcpTraeConfig, buildMcpVsCodeConfig, mcpWebBackendUrl } from "@/lib/mcp/mcpConfigTemplates";
describe("MCP config templates", () => {
it("builds the standard mcpServers JSON used by Claude, Cursor, TRAE, and Windsurf", () => {
@@ -145,6 +145,20 @@ describe("MCP config templates", () => {
expect(buildMcpCodexConfig({ command: "node", args: ["C:\\dbx\\mcp\\dist\\index.js"] })).toBe(["[mcp_servers.dbx]", 'command = "node"', 'args = ["C:\\\\dbx\\\\mcp\\\\dist\\\\index.js"]'].join("\n"));
});
it("builds the DeepSeek Harness Cordis insert patch", () => {
expect(buildMcpDeepSeekHarnessConfig()).toBe(["- insert:", " - id: mcp-dbx", " name: '@deepseek-ai/dsh-mcp-client'", " config:", " serverName: dbx", " transport: stdio", ' command: "dbx-mcp-server"'].join("\n"));
});
it("includes launch arguments and explicit environment in the DeepSeek Harness patch", () => {
expect(
buildMcpDeepSeekHarnessConfig({
command: "C:\\Program Files\\nodejs\\node.exe",
args: ["C:\\Users\\zhiyo\\AppData\\Roaming\\npm\\node_modules\\@dbx-app\\mcp-server\\dist\\index.js"],
env: { DBX_DATA_DIR: "D:\\DBX Data" },
}),
).toContain([' command: "C:\\\\Program Files\\\\nodejs\\\\node.exe"', ' args: ["C:\\\\Users\\\\zhiyo\\\\AppData\\\\Roaming\\\\npm\\\\node_modules\\\\@dbx-app\\\\mcp-server\\\\dist\\\\index.js"]', " env:", ' "DBX_DATA_DIR": "D:\\\\DBX Data"'].join("\n"));
});
it("builds OpenCode config without policy environment", () => {
const config = JSON.parse(buildMcpOpenCodeConfig());
@@ -123,7 +123,8 @@ describe("MCP policy settings state", () => {
expect(tabsSource).toContain("overscroll-x-contain");
expect(tabsSource).not.toContain("flex-wrap");
expect(tabsSource).not.toContain("grid-cols-");
expect(tabsSource.match(/flex-none shrink-0/g)).toHaveLength(9);
expect(tabsSource.match(/flex-none shrink-0/g)).toHaveLength(10);
expect(tabsSource).toContain('<TabsTrigger value="deepseek-harness"');
expect(tabsSource).not.toContain("min-w-0 px-");
});
});
+19 -2
View File
@@ -24,7 +24,7 @@ function withLaunchConfig(dbx: Record<string, unknown>, config?: McpLaunchConfig
return dbx;
}
function tomlStringArray(values: readonly string[]): string {
function quotedStringArray(values: readonly string[]): string {
return `[${values.map((value) => JSON.stringify(value)).join(", ")}]`;
}
@@ -74,7 +74,7 @@ export function buildMcpCodexConfig(config?: McpLaunchConfig): string {
const lines = ["[mcp_servers.dbx]", `command = ${JSON.stringify(launch.command)}`];
if (launch.args && launch.args.length > 0) {
lines.push(`args = ${tomlStringArray(launch.args)}`);
lines.push(`args = ${quotedStringArray(launch.args)}`);
}
if (launch.env && Object.keys(launch.env).length > 0) {
lines.push("", "[mcp_servers.dbx.env]");
@@ -86,6 +86,23 @@ export function buildMcpCodexConfig(config?: McpLaunchConfig): string {
return lines.join("\n");
}
export function buildMcpDeepSeekHarnessConfig(config?: McpLaunchConfig): string {
const launch = launchConfig(config);
const lines = ["- insert:", " - id: mcp-dbx", " name: '@deepseek-ai/dsh-mcp-client'", " config:", " serverName: dbx", " transport: stdio", ` command: ${JSON.stringify(launch.command)}`];
if (launch.args && launch.args.length > 0) {
lines.push(` args: ${quotedStringArray(launch.args)}`);
}
if (launch.env && Object.keys(launch.env).length > 0) {
lines.push(" env:");
for (const [key, value] of Object.entries(launch.env)) {
lines.push(` ${JSON.stringify(key)}: ${JSON.stringify(value)}`);
}
}
return lines.join("\n");
}
export function buildMcpOpenCodeConfig(config?: McpLaunchConfig): string {
const launch = launchConfig(config);
const dbx: Record<string, unknown> = {