test-execution-platform-mcp 0.6.0-rc2 → 0.6.0-rc3
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.
- package/dist/setup/cli.js +26 -4
- package/dist/setup/config.js +6 -2
- package/dist/setup/verify.js +1 -1
- package/package.json +1 -1
package/dist/setup/cli.js
CHANGED
|
@@ -22,6 +22,26 @@ const localDirname = typeof __dirname !== 'undefined'
|
|
|
22
22
|
const DEFAULT_API_BASE_URL = 'https://qc.vivas.vn';
|
|
23
23
|
const SERVER_NAME = 'test-execution-platform';
|
|
24
24
|
const TOKEN_PATTERN = /^tep_mcp_[a-f0-9]{64,}$/;
|
|
25
|
+
// Resolve the stdio MCP server command + args.
|
|
26
|
+
//
|
|
27
|
+
// Two execution contexts:
|
|
28
|
+
// 1. npm/npx install (e.g. `npx test-execution-platform-mcp@rc setup`):
|
|
29
|
+
// process.execPath is the node interpreter. To launch the stdio MCP
|
|
30
|
+
// server we must pass `dist/index.js` as an argument.
|
|
31
|
+
// 2. Standalone binary (qc-mcp-setup.exe / qc-mcp.exe on Windows, or
|
|
32
|
+
// pkg-bundled binary on macOS/Linux): process.execPath is the binary
|
|
33
|
+
// itself, which already contains the stdio server entry point.
|
|
34
|
+
//
|
|
35
|
+
// We detect context 1 by checking whether `dist/index.js` exists next to
|
|
36
|
+
// this script. If yes, spawn `node + dist/index.js`. Otherwise the exec
|
|
37
|
+
// path is the binary and needs no args.
|
|
38
|
+
function resolveStdioServerCommand() {
|
|
39
|
+
const indexPath = resolve(localDirname, '..', 'index.js');
|
|
40
|
+
if (existsSync(indexPath)) {
|
|
41
|
+
return { command: process.execPath, args: [indexPath] };
|
|
42
|
+
}
|
|
43
|
+
return { command: process.execPath, args: [] };
|
|
44
|
+
}
|
|
25
45
|
function printUsage() {
|
|
26
46
|
const lines = [
|
|
27
47
|
'QC MCP Setup Wizard',
|
|
@@ -70,8 +90,8 @@ async function runSetup() {
|
|
|
70
90
|
console.log(' ' + formatSuccess('Token format looks good'));
|
|
71
91
|
// Step 3: write configs
|
|
72
92
|
console.log('\n' + formatStep(3, 4, 'Writing config files'));
|
|
73
|
-
const binaryPath
|
|
74
|
-
const entry = buildMcpEntry(binaryPath, DEFAULT_API_BASE_URL, token);
|
|
93
|
+
const { command: binaryPath, args: binaryArgs } = resolveStdioServerCommand();
|
|
94
|
+
const entry = buildMcpEntry(binaryPath, binaryArgs, DEFAULT_API_BASE_URL, token);
|
|
75
95
|
const targets = [];
|
|
76
96
|
if (paths.claudeDesktopConfig)
|
|
77
97
|
targets.push({ path: paths.claudeDesktopConfig, name: 'Claude Desktop', format: 'json' });
|
|
@@ -96,6 +116,7 @@ async function runSetup() {
|
|
|
96
116
|
console.log('\n' + formatStep(4, 4, 'Verification'));
|
|
97
117
|
const verifyResult = await verifyMcpHandshake({
|
|
98
118
|
binary: binaryPath,
|
|
119
|
+
args: binaryArgs,
|
|
99
120
|
apiBaseUrl: DEFAULT_API_BASE_URL,
|
|
100
121
|
token,
|
|
101
122
|
});
|
|
@@ -111,8 +132,8 @@ async function runSetup() {
|
|
|
111
132
|
return 0;
|
|
112
133
|
}
|
|
113
134
|
async function runVerify() {
|
|
114
|
-
const binaryPath
|
|
115
|
-
if (!existsSync(binaryPath)) {
|
|
135
|
+
const { command: binaryPath, args: binaryArgs } = resolveStdioServerCommand();
|
|
136
|
+
if (binaryArgs.length === 0 && !existsSync(binaryPath)) {
|
|
116
137
|
console.log(formatError(`Binary not found at ${binaryPath}`));
|
|
117
138
|
return 1;
|
|
118
139
|
}
|
|
@@ -123,6 +144,7 @@ async function runVerify() {
|
|
|
123
144
|
}
|
|
124
145
|
const result = await verifyMcpHandshake({
|
|
125
146
|
binary: binaryPath,
|
|
147
|
+
args: binaryArgs,
|
|
126
148
|
apiBaseUrl: process.env.TEST_EXECUTION_API_BASE_URL ?? DEFAULT_API_BASE_URL,
|
|
127
149
|
token,
|
|
128
150
|
});
|
package/dist/setup/config.js
CHANGED
|
@@ -18,14 +18,18 @@ export function mergeMcpServer(current, serverName, entry) {
|
|
|
18
18
|
mcpServers[serverName] = { ...(mcpServers[serverName] ?? {}), ...entry };
|
|
19
19
|
return { ...current, mcpServers };
|
|
20
20
|
}
|
|
21
|
-
export function buildMcpEntry(command, baseUrl, token) {
|
|
22
|
-
|
|
21
|
+
export function buildMcpEntry(command, args, baseUrl, token) {
|
|
22
|
+
const entry = {
|
|
23
23
|
command,
|
|
24
24
|
env: {
|
|
25
25
|
TEST_EXECUTION_API_BASE_URL: baseUrl,
|
|
26
26
|
TEST_EXECUTION_MCP_TOKEN: token,
|
|
27
27
|
},
|
|
28
28
|
};
|
|
29
|
+
if (args && args.length > 0) {
|
|
30
|
+
entry.args = args;
|
|
31
|
+
}
|
|
32
|
+
return entry;
|
|
29
33
|
}
|
|
30
34
|
function backupPathFor(file) {
|
|
31
35
|
const ts = new Date().toISOString().replace(/[:.]/g, '-');
|
package/dist/setup/verify.js
CHANGED
|
@@ -19,7 +19,7 @@ const HEALTH_REQUEST = JSON.stringify({
|
|
|
19
19
|
export function verifyMcpHandshake(input) {
|
|
20
20
|
const timeoutMs = input.timeoutMs ?? 10_000;
|
|
21
21
|
return new Promise((resolve) => {
|
|
22
|
-
const child = spawn(input.binary, [], {
|
|
22
|
+
const child = spawn(input.binary, input.args ?? [], {
|
|
23
23
|
env: {
|
|
24
24
|
...process.env,
|
|
25
25
|
TEST_EXECUTION_API_BASE_URL: input.apiBaseUrl,
|