mcp-optimizer 0.0.1-alpha.1 → 0.0.2-alpha.1
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/bin/mcp-optimizer.js +29 -1
- package/package.json +1 -1
package/bin/mcp-optimizer.js
CHANGED
|
@@ -1,9 +1,37 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// Lightweight CLI wrapper for the MCP Optimizer package.
|
|
4
|
-
//
|
|
4
|
+
// Accept `--port <n>` or `--port=<n>` (or `--audit-port`) to configure the server
|
|
5
|
+
// port when launching via `npx` (e.g. `npx -y mcp-optimizer -- --port 6000`).
|
|
5
6
|
|
|
6
7
|
try {
|
|
8
|
+
const args = process.argv.slice(2);
|
|
9
|
+
for (let i = 0; i < args.length; i++) {
|
|
10
|
+
const a = args[i];
|
|
11
|
+
// Accept environment-style args like PORT=6000
|
|
12
|
+
if (a.includes('=') && !a.startsWith('--')) {
|
|
13
|
+
const [k, v] = a.split('=', 2);
|
|
14
|
+
if (k && v !== undefined) {
|
|
15
|
+
process.env[k] = v;
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
if (a.startsWith('--port=')) {
|
|
20
|
+
process.env.PORT = a.split('=')[1];
|
|
21
|
+
}
|
|
22
|
+
else if (a === '--port' && args[i + 1]) {
|
|
23
|
+
process.env.PORT = args[i + 1];
|
|
24
|
+
i++;
|
|
25
|
+
}
|
|
26
|
+
else if (a.startsWith('--audit-port=')) {
|
|
27
|
+
process.env.AUDIT_PORT = a.split('=')[1];
|
|
28
|
+
}
|
|
29
|
+
else if (a === '--audit-port' && args[i + 1]) {
|
|
30
|
+
process.env.AUDIT_PORT = args[i + 1];
|
|
31
|
+
i++;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
7
35
|
// Require built output. When installed via npm the package root
|
|
8
36
|
// will contain `dist/index.js` after `npm pack` / `npm publish`.
|
|
9
37
|
require('../dist/index.js');
|
package/package.json
CHANGED