@aiwerk/mcp-bridge 2.8.18 → 2.8.20
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/src/mcp-router.d.ts +2 -0
- package/dist/src/mcp-router.js +26 -3
- package/package.json +1 -1
package/dist/src/mcp-router.d.ts
CHANGED
|
@@ -87,6 +87,7 @@ export type RouterDispatchResponse = {
|
|
|
87
87
|
maturity?: string;
|
|
88
88
|
sideEffects?: string;
|
|
89
89
|
pricing?: string;
|
|
90
|
+
signed?: boolean;
|
|
90
91
|
}>;
|
|
91
92
|
} | {
|
|
92
93
|
action: "catalog";
|
|
@@ -100,6 +101,7 @@ export type RouterDispatchResponse = {
|
|
|
100
101
|
maturity?: string;
|
|
101
102
|
sideEffects?: string;
|
|
102
103
|
pricing?: string;
|
|
104
|
+
signed?: boolean;
|
|
103
105
|
}>;
|
|
104
106
|
} | {
|
|
105
107
|
action: "install";
|
package/dist/src/mcp-router.js
CHANGED
|
@@ -124,6 +124,7 @@ export class McpRouter {
|
|
|
124
124
|
maturity: r.maturity,
|
|
125
125
|
sideEffects: r.sideEffects,
|
|
126
126
|
pricing: r.pricing,
|
|
127
|
+
signed: Array.isArray(r.badges) ? r.badges.includes("signed") : false,
|
|
127
128
|
}))
|
|
128
129
|
};
|
|
129
130
|
}
|
|
@@ -150,6 +151,7 @@ export class McpRouter {
|
|
|
150
151
|
maturity: r.maturity,
|
|
151
152
|
sideEffects: r.sideEffects,
|
|
152
153
|
pricing: r.pricing,
|
|
154
|
+
signed: Array.isArray(r.badges) ? r.badges.includes("signed") : false,
|
|
153
155
|
}))
|
|
154
156
|
};
|
|
155
157
|
}
|
|
@@ -157,7 +159,7 @@ export class McpRouter {
|
|
|
157
159
|
return this.error("mcp_error", `Catalog browse failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
158
160
|
}
|
|
159
161
|
}
|
|
160
|
-
// Install server from catalog (runtime
|
|
162
|
+
// Install server from catalog (runtime + persisted to config file)
|
|
161
163
|
if (normalizedAction === "install") {
|
|
162
164
|
const serverName = server || params?.server;
|
|
163
165
|
if (!serverName) {
|
|
@@ -180,15 +182,36 @@ export class McpRouter {
|
|
|
180
182
|
const missing = requiredVars.filter(v => !process.env[v]);
|
|
181
183
|
// Add to runtime config
|
|
182
184
|
this.servers[serverName] = serverConfig;
|
|
183
|
-
// Also update clientConfig.servers so generateDescription includes it
|
|
184
185
|
this.clientConfig.servers[serverName] = serverConfig;
|
|
186
|
+
// Persist to config file
|
|
187
|
+
try {
|
|
188
|
+
const os = await import("os");
|
|
189
|
+
const fs = await import("fs");
|
|
190
|
+
const path = await import("path");
|
|
191
|
+
const configPath = path.join(os.homedir(), ".mcp-bridge", "config.json");
|
|
192
|
+
if (fs.existsSync(configPath)) {
|
|
193
|
+
const raw = JSON.parse(fs.readFileSync(configPath, "utf-8"));
|
|
194
|
+
if (!raw.servers)
|
|
195
|
+
raw.servers = {};
|
|
196
|
+
if (!raw.servers[serverName]) {
|
|
197
|
+
raw.servers[serverName] = serverConfig;
|
|
198
|
+
fs.writeFileSync(configPath, JSON.stringify(raw, null, 2) + "\n", "utf-8");
|
|
199
|
+
this.logger.info(`Persisted "${serverName}" to ${configPath}`);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
catch (persistErr) {
|
|
204
|
+
this.logger.warn(`Could not persist "${serverName}" to config: ${persistErr instanceof Error ? persistErr.message : String(persistErr)}`);
|
|
205
|
+
}
|
|
206
|
+
const credUrl = recipe.auth?.credentialsUrl;
|
|
185
207
|
if (missing.length > 0) {
|
|
186
208
|
return {
|
|
187
209
|
action: "install",
|
|
188
210
|
server: serverName,
|
|
189
211
|
installed: true,
|
|
190
|
-
message: `Server "${serverName}"
|
|
212
|
+
message: `Server "${serverName}" installed. Missing env vars: ${missing.join(", ")}. Set them before calling.`,
|
|
191
213
|
missingEnvVars: missing,
|
|
214
|
+
...(credUrl ? { credentialsUrl: credUrl } : {}),
|
|
192
215
|
};
|
|
193
216
|
}
|
|
194
217
|
return {
|