@aiwerk/mcp-bridge 2.8.8 → 2.8.9
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/package.json +2 -1
- package/scripts/postinstall.cjs +45 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiwerk/mcp-bridge",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.9",
|
|
4
4
|
"description": "Standalone MCP server that multiplexes multiple MCP servers into one interface",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/src/index.js",
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"build": "tsc",
|
|
45
45
|
"test": "node --import tsx --test tests/*.test.ts",
|
|
46
46
|
"typecheck": "tsc --noEmit",
|
|
47
|
+
"postinstall": "node scripts/postinstall.cjs",
|
|
47
48
|
"prepublishOnly": "tsc && bash scripts/validate-recipes.sh && node -e \"const v=require('./package.json').version;const fs=require('fs');const cl=fs.readFileSync('CHANGELOG.md','utf8');if(!cl.includes('['+v+']')){console.error('ERROR: CHANGELOG.md missing entry for v'+v);process.exit(1)}\"",
|
|
48
49
|
"validate-recipe": "npx tsx bin/validate-recipe.ts",
|
|
49
50
|
"lint": "eslint src/",
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// Only run auto-init on global installs, not when installed as a dependency
|
|
4
|
+
// npm sets npm_config_global=true for global installs
|
|
5
|
+
const isGlobal = process.env.npm_config_global === "true" ||
|
|
6
|
+
process.env.npm_lifecycle_event === "postinstall" &&
|
|
7
|
+
!process.env.npm_package_name; // not set when we ARE the package being installed as dep
|
|
8
|
+
|
|
9
|
+
// Also check: if our parent is another package's node_modules, skip
|
|
10
|
+
const isNested = __dirname.includes("node_modules") &&
|
|
11
|
+
__dirname.split("node_modules").length > 2;
|
|
12
|
+
|
|
13
|
+
if (isNested) {
|
|
14
|
+
// We're a nested dependency (e.g., inside openclaw-mcp-bridge), skip
|
|
15
|
+
process.exit(0);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const { execSync } = require("child_process");
|
|
19
|
+
const { existsSync } = require("fs");
|
|
20
|
+
const { join } = require("path");
|
|
21
|
+
const os = require("os");
|
|
22
|
+
|
|
23
|
+
const configDir = join(os.homedir(), ".mcp-bridge");
|
|
24
|
+
const configPath = join(configDir, "config.json");
|
|
25
|
+
|
|
26
|
+
// Only auto-init if config doesn't exist yet (fresh install)
|
|
27
|
+
if (existsSync(configPath)) {
|
|
28
|
+
console.log("[mcp-bridge] Config already exists, skipping auto-init.");
|
|
29
|
+
process.exit(0);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
try {
|
|
33
|
+
// Find our own binary
|
|
34
|
+
const binPath = join(__dirname, "..", "dist", "bin", "mcp-bridge.js");
|
|
35
|
+
if (!existsSync(binPath)) {
|
|
36
|
+
// Not built yet (source install), skip
|
|
37
|
+
process.exit(0);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
console.log("[mcp-bridge] Running auto-init...");
|
|
41
|
+
execSync(`node "${binPath}" init`, { stdio: "inherit" });
|
|
42
|
+
} catch (err) {
|
|
43
|
+
// Don't fail the install if init fails
|
|
44
|
+
console.log("[mcp-bridge] Auto-init skipped (non-fatal):", err.message || err);
|
|
45
|
+
}
|