@loop_ouroboros/mcp-hub-lite 1.2.1 → 1.2.3
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/CHANGELOG.md +541 -366
- package/README.md +4 -0
- package/dist/client/assets/{HomeView-BBwvy1oj.js → HomeView-V1fKvWQ8.js} +1 -1
- package/dist/client/assets/{ResourceDetailView-CZ2aB73w.js → ResourceDetailView-DHGHssrh.js} +1 -1
- package/dist/client/assets/{ResourcesView-CN1NlhWs.js → ResourcesView-B1bvkmQD.js} +1 -1
- package/dist/client/assets/{ServerDashboard-k652Vw4Z.js → ServerDashboard-CZCByd7y.js} +1 -1
- package/dist/client/assets/{ServerDetail-BLQ-a4cO.js → ServerDetail-CI5UD8gj.js} +1 -1
- package/dist/client/assets/{ServerListView-BHrsFD5i.js → ServerListView-D8qv-xYg.js} +1 -1
- package/dist/client/assets/SettingsView-C-ae0-zz.js +1 -0
- package/dist/client/assets/{ToolCallDialog-BfPjLxfV.js → ToolCallDialog-BudOyGvS.js} +1 -1
- package/dist/client/assets/{ToolsView-CyuhYAE2.js → ToolsView-CbQkgTAu.js} +1 -1
- package/dist/client/assets/{_baseClone-DO5qfalW.js → _baseClone-e9R6V78L.js} +1 -1
- package/dist/client/assets/{el-form-item-CcGsD2K_.js → el-form-item-Dyx5MiWB.js} +1 -1
- package/dist/client/assets/{el-input-tYgeiaCT.js → el-input-CL9HPfdW.js} +1 -1
- package/dist/client/assets/{el-loading-Dwl9E_Vr.js → el-loading-2TW6JdfY.js} +1 -1
- package/dist/client/assets/{el-overlay-kqX_BABo.js → el-overlay-B5ZGCmXY.js} +1 -1
- package/dist/client/assets/{el-radio-group-D8aWBVOT.js → el-radio-group-Cr2ScjjJ.js} +1 -1
- package/dist/client/assets/{el-skeleton-item-BRwIFspE.js → el-skeleton-item-CdAfEgVR.js} +1 -1
- package/dist/client/assets/{el-switch-BF8c-xeU.js → el-switch-DnN1s0Wb.js} +1 -1
- package/dist/client/assets/{el-tab-pane-C4Ep94cd.js → el-tab-pane-BebZh0XF.js} +1 -1
- package/dist/client/assets/{el-table-column-Cog6uCh-.js → el-table-column-CV2zp3yI.js} +1 -1
- package/dist/client/assets/{index-ByNBhPAR.js → index-Ci5n5dA9.js} +1 -1
- package/dist/client/assets/index-DTZ9o3XO.js +2 -0
- package/dist/client/assets/{omit-CUnDT6sS.js → omit-DlmW8Yd6.js} +1 -1
- package/dist/client/assets/{raf-CmzeRPMd.js → raf-CeCd08aN.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/shared/models/server.model.d.ts +22 -0
- package/dist/server/shared/models/server.model.d.ts.map +1 -1
- package/dist/server/shared/models/server.model.js +41 -5
- package/dist/server/src/api/mcp/gateway.d.ts.map +1 -1
- package/dist/server/src/api/mcp/gateway.js +13 -5
- package/dist/server/src/api/web/resources.d.ts.map +1 -1
- package/dist/server/src/api/web/resources.js +26 -2
- package/dist/server/src/cli/commands/install.d.ts +25 -0
- package/dist/server/src/cli/commands/install.d.ts.map +1 -0
- package/dist/server/src/cli/commands/install.js +274 -0
- package/dist/server/src/cli/commands/use-guide.d.ts +11 -0
- package/dist/server/src/cli/commands/use-guide.d.ts.map +1 -0
- package/dist/server/src/cli/commands/use-guide.js +175 -0
- package/dist/server/src/cli/index.d.ts.map +1 -1
- package/dist/server/src/cli/index.js +4 -0
- package/dist/server/src/cli/server.d.ts +71 -0
- package/dist/server/src/cli/server.d.ts.map +1 -1
- package/dist/server/src/cli/server.js +138 -0
- package/dist/server/src/cli/use-guide.md +156 -0
- package/dist/server/src/config/config-loader.js +1 -1
- package/dist/server/src/config/config-migrator.d.ts.map +1 -1
- package/dist/server/src/config/config-migrator.js +1 -0
- package/dist/server/src/index.js +2 -7
- package/dist/server/src/server/dev-server.js +9 -48
- package/dist/server/src/server/runner.d.ts +12 -24
- package/dist/server/src/server/runner.d.ts.map +1 -1
- package/dist/server/src/server/runner.js +29 -109
- package/dist/server/src/server/startup.d.ts +43 -0
- package/dist/server/src/server/startup.d.ts.map +1 -0
- package/dist/server/src/server/startup.js +89 -0
- package/dist/server/src/services/connection/connection-manager.d.ts +52 -0
- package/dist/server/src/services/connection/connection-manager.d.ts.map +1 -1
- package/dist/server/src/services/connection/connection-manager.js +283 -193
- package/dist/server/src/services/gateway/gateway.service.d.ts.map +1 -1
- package/dist/server/src/services/gateway/gateway.service.js +31 -10
- package/dist/server/src/services/gateway/global-transport.d.ts.map +1 -1
- package/dist/server/src/services/gateway/global-transport.js +11 -5
- package/dist/server/src/services/gateway/request-handlers/initialize-handler.d.ts.map +1 -1
- package/dist/server/src/services/gateway/request-handlers/initialize-handler.js +12 -5
- package/dist/server/src/services/hub-manager.service.d.ts +2 -0
- package/dist/server/src/services/hub-manager.service.d.ts.map +1 -1
- package/dist/server/src/services/hub-manager.service.js +3 -16
- package/dist/server/src/utils/json-utils.d.ts +7 -0
- package/dist/server/src/utils/json-utils.d.ts.map +1 -1
- package/dist/server/src/utils/json-utils.js +17 -0
- package/dist/server/src/utils/logger/log-modules.d.ts +3 -0
- package/dist/server/src/utils/logger/log-modules.d.ts.map +1 -1
- package/dist/server/src/utils/logger/log-modules.js +2 -0
- package/dist/server/src/utils/port-checker.d.ts +18 -0
- package/dist/server/src/utils/port-checker.d.ts.map +1 -1
- package/dist/server/src/utils/port-checker.js +38 -0
- package/dist/server/src/utils/transports/stdio-transport.d.ts +12 -0
- package/dist/server/src/utils/transports/stdio-transport.d.ts.map +1 -1
- package/dist/server/src/utils/transports/stdio-transport.js +51 -2
- package/dist/server/src/utils/transports/transport-factory.d.ts +5 -1
- package/dist/server/src/utils/transports/transport-factory.d.ts.map +1 -1
- package/dist/server/src/utils/transports/transport-factory.js +5 -2
- package/dist/server/tests/integration/gateway/fault-tolerance.test.js +13 -2
- package/dist/server/tests/integration/gateway/mcp-connection.test.js +13 -2
- package/dist/server/tests/unit/config/config-migrator.test.js +4 -2
- package/dist/server/tests/unit/config/config.schema.test.js +2 -1
- package/dist/server/tests/unit/server/runner.test.js +77 -92
- package/dist/server/tests/unit/services/hub-manager-service.test.js +3 -2
- package/dist/server/tests/unit/utils/config.test.js +14 -7
- package/dist/server/tests/unit/utils/json-utils.test.js +28 -14
- package/dist/server/vite.config.d.ts.map +1 -1
- package/dist/server/vite.config.js +1 -0
- package/package.json +1 -5
- package/dist/client/assets/SettingsView-CUOFNXrz.js +0 -1
- package/dist/client/assets/index-CTB6oe-9.js +0 -2
|
@@ -160,6 +160,7 @@ export declare const ServerTemplateSchema: z.ZodObject<{
|
|
|
160
160
|
"round-robin": "round-robin";
|
|
161
161
|
"tag-match-unique": "tag-match-unique";
|
|
162
162
|
}>>;
|
|
163
|
+
readyPatterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
163
164
|
}, z.core.$strip>;
|
|
164
165
|
export type ServerTemplate = z.infer<typeof ServerTemplateSchema>;
|
|
165
166
|
/**
|
|
@@ -190,6 +191,7 @@ export declare const ServerConfigSchema: z.ZodObject<{
|
|
|
190
191
|
"round-robin": "round-robin";
|
|
191
192
|
"tag-match-unique": "tag-match-unique";
|
|
192
193
|
}>>;
|
|
194
|
+
readyPatterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
193
195
|
}, z.core.$strip>;
|
|
194
196
|
instances: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
195
197
|
id: z.ZodString;
|
|
@@ -229,6 +231,7 @@ export declare const LoggingConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
229
231
|
jsonPretty: z.ZodDefault<z.ZodBoolean>;
|
|
230
232
|
mcpCommDebug: z.ZodDefault<z.ZodBoolean>;
|
|
231
233
|
apiDebug: z.ZodDefault<z.ZodBoolean>;
|
|
234
|
+
gatewayDebug: z.ZodDefault<z.ZodBoolean>;
|
|
232
235
|
}, z.core.$strip>>;
|
|
233
236
|
export type LoggingConfig = z.infer<typeof LoggingConfigSchema>;
|
|
234
237
|
/**
|
|
@@ -242,6 +245,17 @@ export declare const SecurityConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
242
245
|
maxConnections: z.ZodDefault<z.ZodNumber>;
|
|
243
246
|
}, z.core.$strip>>;
|
|
244
247
|
export type SecurityConfig = z.infer<typeof SecurityConfigSchema>;
|
|
248
|
+
/**
|
|
249
|
+
* Startup Configuration Schema
|
|
250
|
+
* Unified configuration for server startup behavior
|
|
251
|
+
*/
|
|
252
|
+
export declare const StartupConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
253
|
+
startupDelay: z.ZodDefault<z.ZodNumber>;
|
|
254
|
+
readyTimeout: z.ZodDefault<z.ZodNumber>;
|
|
255
|
+
maxConnectRetries: z.ZodDefault<z.ZodNumber>;
|
|
256
|
+
connectRetryDelay: z.ZodDefault<z.ZodNumber>;
|
|
257
|
+
}, z.core.$strip>>;
|
|
258
|
+
export type StartupConfig = z.infer<typeof StartupConfigSchema>;
|
|
245
259
|
/**
|
|
246
260
|
* System Configuration Schema (v1.1 - Primary)
|
|
247
261
|
*/
|
|
@@ -265,7 +279,14 @@ export declare const SystemConfigSchema: z.ZodObject<{
|
|
|
265
279
|
jsonPretty: z.ZodDefault<z.ZodBoolean>;
|
|
266
280
|
mcpCommDebug: z.ZodDefault<z.ZodBoolean>;
|
|
267
281
|
apiDebug: z.ZodDefault<z.ZodBoolean>;
|
|
282
|
+
gatewayDebug: z.ZodDefault<z.ZodBoolean>;
|
|
268
283
|
}, z.core.$strip>>;
|
|
284
|
+
startup: z.ZodOptional<z.ZodDefault<z.ZodObject<{
|
|
285
|
+
startupDelay: z.ZodDefault<z.ZodNumber>;
|
|
286
|
+
readyTimeout: z.ZodDefault<z.ZodNumber>;
|
|
287
|
+
maxConnectRetries: z.ZodDefault<z.ZodNumber>;
|
|
288
|
+
connectRetryDelay: z.ZodDefault<z.ZodNumber>;
|
|
289
|
+
}, z.core.$strip>>>;
|
|
269
290
|
}, z.core.$strip>>;
|
|
270
291
|
security: z.ZodDefault<z.ZodObject<{
|
|
271
292
|
allowedNetworks: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
@@ -298,6 +319,7 @@ export declare const SystemConfigSchema: z.ZodObject<{
|
|
|
298
319
|
"round-robin": "round-robin";
|
|
299
320
|
"tag-match-unique": "tag-match-unique";
|
|
300
321
|
}>>;
|
|
322
|
+
readyPatterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
301
323
|
}, z.core.$strip>;
|
|
302
324
|
instances: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
303
325
|
id: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.model.d.ts","sourceRoot":"","sources":["../../../../shared/models/server.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjG,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAIjD;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE;QACN,GA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WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE;QACN,SAAS,EAAE,OAAO,CAAC;QACnB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC;QACnB,cAAc,EAAE,MAAM,CAAC;QACvB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAID;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,YAAY,CAAC;IACrB,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,mBAAmB,CAAC;IAC5B,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IAChC,SAAS,CAAC,EAAE,CAAC,oBAAoB,GAAG;QAAE,MAAM,EAAE,YAAY,CAAA;KAAE,CAAC,EAAE,CAAC;IAChE,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B"}
|
|
@@ -129,7 +129,10 @@ export const ServerTemplateSchema = ServerEnvConfigSchema.extend({
|
|
|
129
129
|
InstanceSelectionStrategy.ROUND_ROBIN,
|
|
130
130
|
InstanceSelectionStrategy.TAG_MATCH_UNIQUE
|
|
131
131
|
])
|
|
132
|
-
.optional()
|
|
132
|
+
.optional(),
|
|
133
|
+
// Ready patterns for startup detection (stdout/stderr output containing any pattern = server ready)
|
|
134
|
+
// Using .optional() without .default() - code should use readyPatterns ?? [] for default value
|
|
135
|
+
readyPatterns: z.array(z.string()).optional()
|
|
133
136
|
});
|
|
134
137
|
// ====== Server Config Schema (v1.1) ======
|
|
135
138
|
/**
|
|
@@ -151,14 +154,16 @@ export const LoggingConfigSchema = z
|
|
|
151
154
|
rotationAge: z.string().default('7d'),
|
|
152
155
|
jsonPretty: z.boolean().default(true),
|
|
153
156
|
mcpCommDebug: z.boolean().default(false),
|
|
154
|
-
apiDebug: z.boolean().default(false)
|
|
157
|
+
apiDebug: z.boolean().default(false),
|
|
158
|
+
gatewayDebug: z.boolean().default(false)
|
|
155
159
|
})
|
|
156
160
|
.default({
|
|
157
161
|
level: 'info',
|
|
158
162
|
rotationAge: '7d',
|
|
159
163
|
jsonPretty: true,
|
|
160
164
|
mcpCommDebug: false,
|
|
161
|
-
apiDebug: false
|
|
165
|
+
apiDebug: false,
|
|
166
|
+
gatewayDebug: false
|
|
162
167
|
});
|
|
163
168
|
// ====== Security Configuration Schema ======
|
|
164
169
|
/**
|
|
@@ -181,6 +186,28 @@ export const SecurityConfigSchema = z
|
|
|
181
186
|
idleConnectionTimeout: 300000,
|
|
182
187
|
maxConnections: 50
|
|
183
188
|
});
|
|
189
|
+
// ====== Startup Configuration Schema ======
|
|
190
|
+
/**
|
|
191
|
+
* Startup Configuration Schema
|
|
192
|
+
* Unified configuration for server startup behavior
|
|
193
|
+
*/
|
|
194
|
+
export const StartupConfigSchema = z
|
|
195
|
+
.object({
|
|
196
|
+
// Sequential startup delay between instances (ms)
|
|
197
|
+
startupDelay: z.number().min(0).max(60000).default(3000),
|
|
198
|
+
// Ready pattern detection timeout (ms)
|
|
199
|
+
readyTimeout: z.number().min(10000).max(300000).default(120000),
|
|
200
|
+
// Maximum connection retry attempts
|
|
201
|
+
maxConnectRetries: z.number().min(0).max(10).default(3),
|
|
202
|
+
// Base delay for exponential backoff retry (ms)
|
|
203
|
+
connectRetryDelay: z.number().min(1000).max(30000).default(5000)
|
|
204
|
+
})
|
|
205
|
+
.default({
|
|
206
|
+
startupDelay: 3000,
|
|
207
|
+
readyTimeout: 120000,
|
|
208
|
+
maxConnectRetries: 3,
|
|
209
|
+
connectRetryDelay: 5000
|
|
210
|
+
});
|
|
184
211
|
// ====== System Configuration Schema ======
|
|
185
212
|
/**
|
|
186
213
|
* System Configuration Schema (v1.1 - Primary)
|
|
@@ -193,7 +220,9 @@ export const SystemConfigSchema = z.object({
|
|
|
193
220
|
port: z.number().default(7788),
|
|
194
221
|
language: z.enum(['zh', 'en']).default('zh'),
|
|
195
222
|
theme: z.enum(['light', 'dark', 'system']).default('system'),
|
|
196
|
-
logging: LoggingConfigSchema
|
|
223
|
+
logging: LoggingConfigSchema,
|
|
224
|
+
// Using .optional() without .default() - code should use startup ?? {defaults} for default value
|
|
225
|
+
startup: StartupConfigSchema.optional()
|
|
197
226
|
})
|
|
198
227
|
.default({
|
|
199
228
|
host: 'localhost',
|
|
@@ -205,7 +234,14 @@ export const SystemConfigSchema = z.object({
|
|
|
205
234
|
rotationAge: '7d',
|
|
206
235
|
jsonPretty: true,
|
|
207
236
|
mcpCommDebug: false,
|
|
208
|
-
apiDebug: false
|
|
237
|
+
apiDebug: false,
|
|
238
|
+
gatewayDebug: false
|
|
239
|
+
},
|
|
240
|
+
startup: {
|
|
241
|
+
startupDelay: 3000,
|
|
242
|
+
readyTimeout: 120000,
|
|
243
|
+
maxConnectRetries: 3,
|
|
244
|
+
connectRetryDelay: 5000
|
|
209
245
|
}
|
|
210
246
|
}),
|
|
211
247
|
security: SecurityConfigSchema,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../../../../../src/api/mcp/gateway.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAgC,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../../../../../src/api/mcp/gateway.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAgC,MAAM,SAAS,CAAC;AAU7E;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,eAAe,iBA6H9D"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Handles all MCP protocol requests at /mcp endpoint
|
|
4
4
|
*/
|
|
5
5
|
import { logger, LOG_MODULES } from '../../utils/logger/index.js';
|
|
6
|
-
import { stringifyForLogging, getMcpCommDebugSetting } from '../../utils/json-utils.js';
|
|
6
|
+
import { stringifyForLogging, getMcpCommDebugSetting, getGatewayDebugSetting } from '../../utils/json-utils.js';
|
|
7
7
|
import { wrapReplyForDebug } from './debug-response-wrapper.js';
|
|
8
8
|
import { createSessionTransport } from '../../services/gateway/global-transport.js';
|
|
9
9
|
/**
|
|
@@ -44,17 +44,25 @@ export async function mcpGatewayRoutes(fastify) {
|
|
|
44
44
|
wrapReplyForDebug(reply, '');
|
|
45
45
|
reply.hijack();
|
|
46
46
|
try {
|
|
47
|
-
|
|
47
|
+
if (getGatewayDebugSetting()) {
|
|
48
|
+
logger.debug(`About to create session transport for MCP request`, LOG_MODULES.GATEWAY);
|
|
49
|
+
}
|
|
48
50
|
const { transport, server } = await createSessionTransport();
|
|
49
|
-
|
|
51
|
+
if (getGatewayDebugSetting()) {
|
|
52
|
+
logger.debug(`Created session transport successfully, handling MCP request`, LOG_MODULES.GATEWAY);
|
|
53
|
+
}
|
|
50
54
|
try {
|
|
51
55
|
await transport.handleRequest(request.raw, reply.raw, request.body);
|
|
52
|
-
|
|
56
|
+
if (getGatewayDebugSetting()) {
|
|
57
|
+
logger.debug(`Successfully handled MCP request with server: ${server.constructor.name}`, LOG_MODULES.GATEWAY);
|
|
58
|
+
}
|
|
53
59
|
}
|
|
54
60
|
finally {
|
|
55
61
|
// Resources will be automatically cleaned up by garbage collection
|
|
56
62
|
// since transport and server are local to this request scope
|
|
57
|
-
|
|
63
|
+
if (getGatewayDebugSetting()) {
|
|
64
|
+
logger.debug(`Session transport request completed, resources will be GC'd`, LOG_MODULES.GATEWAY);
|
|
65
|
+
}
|
|
58
66
|
}
|
|
59
67
|
}
|
|
60
68
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../../../../src/api/web/resources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAK1C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../../../../src/api/web/resources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAK1C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,eAAe,iBA6G/D"}
|
|
@@ -64,8 +64,32 @@ export async function webResourceRoutes(fastify) {
|
|
|
64
64
|
// Use hubToolsService.readResource to handle Hub URI -> MCP URI conversion
|
|
65
65
|
// This properly maps hub://servers/{name}/{instanceIndex}/{mcpPath} to MCP native URI
|
|
66
66
|
try {
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
const result = await hubToolsService.readResource(uri);
|
|
68
|
+
// Check if result is already in MCP ReadResourceResult format { contents: [...] }
|
|
69
|
+
if (result && typeof result === 'object' && 'contents' in result) {
|
|
70
|
+
return result;
|
|
71
|
+
}
|
|
72
|
+
// Wrap non-MCP format results into { contents: [...] } format
|
|
73
|
+
// This handles: ServerMetadata, Tool[], Resource[], string (use-guide), etc.
|
|
74
|
+
let mimeType = 'application/json';
|
|
75
|
+
let text;
|
|
76
|
+
if (typeof result === 'string') {
|
|
77
|
+
mimeType = 'text/markdown';
|
|
78
|
+
text = result;
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
mimeType = 'application/json';
|
|
82
|
+
text = JSON.stringify(result, null, 2);
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
contents: [
|
|
86
|
+
{
|
|
87
|
+
uri,
|
|
88
|
+
mimeType,
|
|
89
|
+
text
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
};
|
|
69
93
|
}
|
|
70
94
|
catch (error) {
|
|
71
95
|
const errorObj = error;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
/**
|
|
3
|
+
* CLI command for installing a new MCP server to MCP Hub Lite.
|
|
4
|
+
*
|
|
5
|
+
* This command provides two modes of operation:
|
|
6
|
+
*
|
|
7
|
+
* 1. **Parametric mode** (default): Specify server properties via individual options
|
|
8
|
+
* 2. **JSON mode** (--json): Pass a complete server configuration as JSON
|
|
9
|
+
*
|
|
10
|
+
* ## Parametric Mode
|
|
11
|
+
*
|
|
12
|
+
* ```
|
|
13
|
+
* mcp-hub-lite install <name> <commandOrUrl> [args...]
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* ## JSON Mode
|
|
17
|
+
*
|
|
18
|
+
* ```
|
|
19
|
+
* mcp-hub-lite install --json '{"name":"github-mcp","type":"stdio","command":"npx github-mcp"}'
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @returns {Command} The configured install command instance for registration with Commander.js
|
|
23
|
+
*/
|
|
24
|
+
export declare const installCommand: Command;
|
|
25
|
+
//# sourceMappingURL=install.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/install.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAqBpC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,cAAc,SA6EvB,CAAC"}
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { getServerStatus, installServer } from '../server.js';
|
|
3
|
+
import { parseEnvVars, parseHeaders } from '../server.js';
|
|
4
|
+
/**
|
|
5
|
+
* CLI command for installing a new MCP server to MCP Hub Lite.
|
|
6
|
+
*
|
|
7
|
+
* This command provides two modes of operation:
|
|
8
|
+
*
|
|
9
|
+
* 1. **Parametric mode** (default): Specify server properties via individual options
|
|
10
|
+
* 2. **JSON mode** (--json): Pass a complete server configuration as JSON
|
|
11
|
+
*
|
|
12
|
+
* ## Parametric Mode
|
|
13
|
+
*
|
|
14
|
+
* ```
|
|
15
|
+
* mcp-hub-lite install <name> <commandOrUrl> [args...]
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* ## JSON Mode
|
|
19
|
+
*
|
|
20
|
+
* ```
|
|
21
|
+
* mcp-hub-lite install --json '{"name":"github-mcp","type":"stdio","command":"npx github-mcp"}'
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @returns {Command} The configured install command instance for registration with Commander.js
|
|
25
|
+
*/
|
|
26
|
+
export const installCommand = new Command('install')
|
|
27
|
+
.description('Add a new MCP server to MCP Hub Lite')
|
|
28
|
+
.argument('[name]', 'Server name (required in parametric mode)')
|
|
29
|
+
.argument('[commandOrUrl]', 'Command (stdio) or URL (sse/streamable-http)')
|
|
30
|
+
.argument('[args...]', 'Command arguments (stdio only)')
|
|
31
|
+
.option('-j, --json <config>', 'Server configuration as JSON')
|
|
32
|
+
.option('-t, --transport <type>', 'Transport type (stdio, sse, streamable-http)', 'stdio')
|
|
33
|
+
.option('-e, --env <env...>', 'Environment variables (KEY=VALUE)')
|
|
34
|
+
.option('-H, --header <header...>', 'HTTP headers (Header-Key: Value)')
|
|
35
|
+
.option('--timeout <seconds>', 'Timeout in seconds', parseInt, 60)
|
|
36
|
+
.option('--strategy <strategy>', 'Instance selection strategy (random, round-robin, tag-match-unique)', 'random')
|
|
37
|
+
.option('-a, --auto-start', 'Auto-start the server', true)
|
|
38
|
+
.option('--no-auto-start', 'Disable auto-start')
|
|
39
|
+
.option('-d, --description <description>', 'Server description')
|
|
40
|
+
.addHelpText('after', `
|
|
41
|
+
|
|
42
|
+
Modes:
|
|
43
|
+
This command supports two modes - parametric (default) and JSON.
|
|
44
|
+
|
|
45
|
+
# Parametric mode (individual options):
|
|
46
|
+
mcp-hub-lite install github-mcp "npx github-mcp" --env API_KEY=xxx
|
|
47
|
+
|
|
48
|
+
# JSON mode (complete config):
|
|
49
|
+
mcp-hub-lite install --json '{"name":"github-mcp","type":"stdio","command":"npx github-mcp","env":{"API_KEY":"xxx"}}'
|
|
50
|
+
|
|
51
|
+
JSON config fields:
|
|
52
|
+
name (required) - Server name
|
|
53
|
+
type - Transport type: stdio, sse, streamable-http (default: stdio)
|
|
54
|
+
command - Command for stdio transport
|
|
55
|
+
url - URL for sse/streamable-http transport
|
|
56
|
+
args - Command arguments (stdio)
|
|
57
|
+
env - Environment variables object
|
|
58
|
+
headers - HTTP headers object
|
|
59
|
+
timeout - Timeout in seconds (default: 60)
|
|
60
|
+
enabled - Auto-start enabled (default: true)
|
|
61
|
+
description - Server description
|
|
62
|
+
instanceSelectionStrategy - random, round-robin, tag-match-unique (default: random)
|
|
63
|
+
|
|
64
|
+
Examples:
|
|
65
|
+
# Parametric mode
|
|
66
|
+
mcp-hub-lite install github-mcp "npx github-mcp" --env API_KEY=xxx
|
|
67
|
+
mcp-hub-lite install api-server https://api.example.com/mcp -t streamable-http -H "Authorization: Bearer xxx"
|
|
68
|
+
|
|
69
|
+
# JSON mode
|
|
70
|
+
mcp-hub-lite install --json '{"name":"github-mcp","type":"stdio","command":"npx github-mcp","env":{"API_KEY":"xxx"}}'
|
|
71
|
+
mcp-hub-lite install --json '{"name":"api-server","type":"streamable-http","url":"https://api.example.com/mcp","headers":{"Authorization":"Bearer xxx"}}'
|
|
72
|
+
`)
|
|
73
|
+
.action(async (name, commandOrUrl, args, options) => {
|
|
74
|
+
try {
|
|
75
|
+
// Check if server is running and get connection info
|
|
76
|
+
const status = await getServerStatus();
|
|
77
|
+
if (!status.running) {
|
|
78
|
+
console.error('Error: MCP Hub Lite server is not running.');
|
|
79
|
+
console.error('Start the server with: mcp-hub-lite start');
|
|
80
|
+
process.exit(1);
|
|
81
|
+
}
|
|
82
|
+
// JSON mode
|
|
83
|
+
if (options.json) {
|
|
84
|
+
await handleJsonMode(options.json, status.host, status.port);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
// Parametric mode
|
|
88
|
+
await handleParametricMode(name, commandOrUrl, args, options, status.host, status.port);
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
92
|
+
process.exit(1);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
/**
|
|
96
|
+
* Handles JSON mode - installs server from complete JSON config
|
|
97
|
+
*/
|
|
98
|
+
async function handleJsonMode(jsonConfig, host, port) {
|
|
99
|
+
let config;
|
|
100
|
+
// Parse JSON
|
|
101
|
+
try {
|
|
102
|
+
config = JSON.parse(jsonConfig);
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
console.error('Error: Invalid JSON format in --json option');
|
|
106
|
+
process.exit(1);
|
|
107
|
+
}
|
|
108
|
+
// Validate required fields
|
|
109
|
+
if (!config.name) {
|
|
110
|
+
console.error('Error: "name" field is required in JSON config');
|
|
111
|
+
process.exit(1);
|
|
112
|
+
}
|
|
113
|
+
// Validate transport type
|
|
114
|
+
const transport = config.type || 'stdio';
|
|
115
|
+
if (!['stdio', 'sse', 'streamable-http'].includes(transport)) {
|
|
116
|
+
console.error(`Error: Invalid transport type "${config.type}"`);
|
|
117
|
+
console.error('Valid types: stdio, sse, streamable-http');
|
|
118
|
+
process.exit(1);
|
|
119
|
+
}
|
|
120
|
+
// Validate command/url based on transport
|
|
121
|
+
const isHttpTransport = transport !== 'stdio';
|
|
122
|
+
if (isHttpTransport && !config.url) {
|
|
123
|
+
console.error(`Error: "url" field is required for transport type "${transport}"`);
|
|
124
|
+
process.exit(1);
|
|
125
|
+
}
|
|
126
|
+
if (!isHttpTransport && !config.command) {
|
|
127
|
+
console.error(`Error: "command" field is required for transport type "${transport}"`);
|
|
128
|
+
process.exit(1);
|
|
129
|
+
}
|
|
130
|
+
// Validate URL format for HTTP transports
|
|
131
|
+
if (isHttpTransport && config.url) {
|
|
132
|
+
try {
|
|
133
|
+
new URL(config.url);
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
console.error(`Error: Invalid URL "${config.url}"`);
|
|
137
|
+
process.exit(1);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
// Build install options
|
|
141
|
+
const installOptions = {
|
|
142
|
+
name: config.name,
|
|
143
|
+
...(isHttpTransport
|
|
144
|
+
? { url: config.url }
|
|
145
|
+
: { command: config.command, args: config.args || [] }),
|
|
146
|
+
transport: transport,
|
|
147
|
+
env: config.env || {},
|
|
148
|
+
headers: config.headers || {},
|
|
149
|
+
timeout: config.timeout || 60,
|
|
150
|
+
autoStart: config.enabled !== false,
|
|
151
|
+
instanceSelectionStrategy: config.instanceSelectionStrategy || 'random',
|
|
152
|
+
description: config.description
|
|
153
|
+
};
|
|
154
|
+
// Install the server
|
|
155
|
+
await installServer(installOptions, host, port);
|
|
156
|
+
console.log(`Successfully installed server: ${config.name}`);
|
|
157
|
+
console.log(` Type: ${transport}`);
|
|
158
|
+
if (isHttpTransport) {
|
|
159
|
+
console.log(` URL: ${config.url}`);
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
console.log(` Command: ${config.command}`);
|
|
163
|
+
}
|
|
164
|
+
if (Object.keys(installOptions.env).length > 0) {
|
|
165
|
+
console.log(` Env: ${JSON.stringify(installOptions.env)}`);
|
|
166
|
+
}
|
|
167
|
+
if (Object.keys(installOptions.headers).length > 0) {
|
|
168
|
+
console.log(` Headers: ${JSON.stringify(installOptions.headers)}`);
|
|
169
|
+
}
|
|
170
|
+
if (installOptions.instanceSelectionStrategy !== 'random') {
|
|
171
|
+
console.log(` Strategy: ${installOptions.instanceSelectionStrategy}`);
|
|
172
|
+
}
|
|
173
|
+
if (config.description) {
|
|
174
|
+
console.log(` Description: ${config.description}`);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Handles parametric mode - installs server from individual options
|
|
179
|
+
*/
|
|
180
|
+
async function handleParametricMode(name, commandOrUrl, args, options, host, port) {
|
|
181
|
+
// Validate required positional arguments
|
|
182
|
+
if (!name) {
|
|
183
|
+
console.error('Error: Server name is required in parametric mode');
|
|
184
|
+
console.error('Or use --json mode for complete config: mcp-hub-lite install --json \'{"name":"..."}\'');
|
|
185
|
+
process.exit(1);
|
|
186
|
+
}
|
|
187
|
+
if (!commandOrUrl) {
|
|
188
|
+
console.error('Error: Command or URL is required in parametric mode');
|
|
189
|
+
console.error('Or use --json mode for complete config: mcp-hub-lite install --json \'{"name":"..."}\'');
|
|
190
|
+
process.exit(1);
|
|
191
|
+
}
|
|
192
|
+
// Determine transport type
|
|
193
|
+
const transportLower = options.transport.toLowerCase();
|
|
194
|
+
if (!['stdio', 'sse', 'streamable-http'].includes(transportLower)) {
|
|
195
|
+
console.error(`Error: Invalid transport type "${options.transport}"`);
|
|
196
|
+
console.error('Valid types: stdio, sse, streamable-http');
|
|
197
|
+
process.exit(1);
|
|
198
|
+
}
|
|
199
|
+
// Parse environment variables
|
|
200
|
+
let env = {};
|
|
201
|
+
if (options.env && options.env.length > 0) {
|
|
202
|
+
try {
|
|
203
|
+
env = parseEnvVars(options.env);
|
|
204
|
+
}
|
|
205
|
+
catch (error) {
|
|
206
|
+
console.error(`Error: Invalid env format - ${error instanceof Error ? error.message : String(error)}`);
|
|
207
|
+
process.exit(1);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
// Parse HTTP headers
|
|
211
|
+
let headers = {};
|
|
212
|
+
if (options.header && options.header.length > 0) {
|
|
213
|
+
try {
|
|
214
|
+
headers = parseHeaders(options.header);
|
|
215
|
+
}
|
|
216
|
+
catch (error) {
|
|
217
|
+
console.error(`Error: Invalid header format - ${error instanceof Error ? error.message : String(error)}`);
|
|
218
|
+
process.exit(1);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
// Determine if this is a URL (sse/streamable-http) or command (stdio)
|
|
222
|
+
const isHttpTransport = transportLower !== 'stdio';
|
|
223
|
+
// Validate that URL is provided for HTTP transports
|
|
224
|
+
if (isHttpTransport) {
|
|
225
|
+
try {
|
|
226
|
+
new URL(commandOrUrl);
|
|
227
|
+
}
|
|
228
|
+
catch {
|
|
229
|
+
console.error(`Error: Invalid URL "${commandOrUrl}" for transport type "${transportLower}"`);
|
|
230
|
+
process.exit(1);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
// Parse strategy
|
|
234
|
+
const strategyLower = options.strategy.toLowerCase();
|
|
235
|
+
if (!['random', 'round-robin', 'tag-match-unique'].includes(strategyLower)) {
|
|
236
|
+
console.error(`Error: Invalid strategy "${options.strategy}"`);
|
|
237
|
+
console.error('Valid strategies: random, round-robin, tag-match-unique');
|
|
238
|
+
process.exit(1);
|
|
239
|
+
}
|
|
240
|
+
// Build install options
|
|
241
|
+
const installOptions = {
|
|
242
|
+
name,
|
|
243
|
+
...(isHttpTransport ? { url: commandOrUrl } : { command: commandOrUrl, args }),
|
|
244
|
+
transport: transportLower,
|
|
245
|
+
env,
|
|
246
|
+
headers,
|
|
247
|
+
timeout: options.timeout,
|
|
248
|
+
autoStart: options.autoStart,
|
|
249
|
+
instanceSelectionStrategy: strategyLower,
|
|
250
|
+
description: options.description
|
|
251
|
+
};
|
|
252
|
+
// Install the server
|
|
253
|
+
await installServer(installOptions, host, port);
|
|
254
|
+
console.log(`Successfully installed server: ${name}`);
|
|
255
|
+
console.log(` Type: ${transportLower}`);
|
|
256
|
+
if (isHttpTransport) {
|
|
257
|
+
console.log(` URL: ${commandOrUrl}`);
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
console.log(` Command: ${commandOrUrl}`);
|
|
261
|
+
}
|
|
262
|
+
if (Object.keys(env).length > 0) {
|
|
263
|
+
console.log(` Env: ${JSON.stringify(env)}`);
|
|
264
|
+
}
|
|
265
|
+
if (Object.keys(headers).length > 0) {
|
|
266
|
+
console.log(` Headers: ${JSON.stringify(headers)}`);
|
|
267
|
+
}
|
|
268
|
+
if (strategyLower !== 'random') {
|
|
269
|
+
console.log(` Strategy: ${strategyLower}`);
|
|
270
|
+
}
|
|
271
|
+
if (options.description) {
|
|
272
|
+
console.log(` Description: ${options.description}`);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
/**
|
|
3
|
+
* CLI command for displaying the use guide in Markdown format.
|
|
4
|
+
*
|
|
5
|
+
* This command outputs the CLI usage guide, similar to how MCP Hub Lite
|
|
6
|
+
* provides a use-guide resource for MCP protocol usage.
|
|
7
|
+
*
|
|
8
|
+
* @returns {Command} The configured use-guide command instance for registration with Commander.js
|
|
9
|
+
*/
|
|
10
|
+
export declare const useGuideCommand: Command;
|
|
11
|
+
//# sourceMappingURL=use-guide.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-guide.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/use-guide.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmKpC;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,SAKxB,CAAC"}
|