@szc-ft/mcp-szcd-client 0.12.2 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,6 +13,7 @@
13
13
  import fs from "node:fs";
14
14
  import path from "node:path";
15
15
  import os from "node:os";
16
+ import { getClientConfigHeader } from "./common.js";
16
17
 
17
18
  // ==================== 路径工具 ====================
18
19
 
@@ -78,10 +79,16 @@ export function syncTraeCnMcpJson(deps) {
78
79
  return;
79
80
  }
80
81
 
81
- config.mcpServers[serverName] = {
82
+ const clientConfigHeader = deps.getClientConfigHeader ? deps.getClientConfigHeader() : null;
83
+ const serverConfig = {
82
84
  type: "http",
83
85
  url: mcpUrl,
84
86
  };
87
+ if (clientConfigHeader) {
88
+ serverConfig.headers = { "X-Client-Config": clientConfigHeader };
89
+ }
90
+
91
+ config.mcpServers[serverName] = serverConfig;
85
92
 
86
93
  const dir = path.dirname(mcpJsonPath);
87
94
  if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
@@ -119,10 +126,16 @@ export function syncMcpUrl(targetUrl, serverName) {
119
126
  return;
120
127
  }
121
128
 
122
- config.mcpServers[serverName] = {
129
+ const clientConfigHeader = getClientConfigHeader();
130
+ const serverConfig = {
123
131
  type: "http",
124
132
  url: mcpUrl,
125
133
  };
134
+ if (clientConfigHeader) {
135
+ serverConfig.headers = { "X-Client-Config": clientConfigHeader };
136
+ }
137
+
138
+ config.mcpServers[serverName] = serverConfig;
126
139
 
127
140
  const dir = path.dirname(mcpJsonPath);
128
141
  if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
@@ -33,6 +33,7 @@ const IS_QUICK = process.argv.includes("--quick");
33
33
  const deps = {
34
34
  getMcpServerUrl: common.getMcpServerUrl,
35
35
  getMcpServerName: common.getMcpServerName,
36
+ getClientConfigHeader: common.getClientConfigHeader,
36
37
  safeExecSync: common.safeExecSync,
37
38
  isCommandAvailable: common.isCommandAvailable,
38
39
  ensureDirectory: common.ensureDirectory,
@@ -96,12 +96,13 @@ function updatePlatformsJson(targetUrl) {
96
96
  return;
97
97
  }
98
98
 
99
- if (platforms.platforms.qwen.mcp.url === mcpUrl) {
99
+ if (platforms.platforms.qwen.mcp.httpUrl === mcpUrl) {
100
100
  console.log(`⏭️ platforms.json qwen.mcp already up-to-date: ${mcpUrl}`);
101
101
  return;
102
102
  }
103
103
 
104
- platforms.platforms.qwen.mcp.url = mcpUrl;
104
+ platforms.platforms.qwen.mcp.httpUrl = mcpUrl;
105
+ delete platforms.platforms.qwen.mcp.url;
105
106
  fs.writeFileSync(platformsPath, JSON.stringify(platforms, null, 4) + "\n");
106
107
  console.log(`✓ Updated platforms.json: qwen.mcp.url → ${mcpUrl}`);
107
108