@mastra/deployer 0.3.4-alpha.4 → 0.3.5-alpha.0

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.
@@ -217,6 +217,11 @@ export declare function errorHandler(err: Error, c: Context): Response;
217
217
 
218
218
  export declare function executeAgentToolHandler(c: Context): Promise<Response>;
219
219
 
220
+ /**
221
+ * Handler for POST /api/mcp/:serverId/tools/:toolId/execute - Execute a tool on an MCP Server
222
+ */
223
+ export declare const executeMcpServerToolHandler: (c: Context) => Promise<Response>;
224
+
220
225
  export declare function executeToolHandler(tools: Record<string, any>): (c: Context) => Promise<Response>;
221
226
 
222
227
  export declare class FileEnvService extends EnvService {
@@ -381,7 +386,99 @@ export declare function getLogsHandler(c: Context): Promise<Response>;
381
386
  export declare function getLogTransports(c: Context): Promise<Response>;
382
387
 
383
388
  /**
384
- * Handler for POST /api/servers/:serverId/mcp
389
+ * Handler for GET /api/mcp/v0/servers/:id - Get MCP Server Details (Registry Style)
390
+ */
391
+ export declare const getMcpRegistryServerDetailHandler: (c: Context) => Promise<(Response & TypedResponse< {
392
+ error: string;
393
+ }, 500, "json">) | (Response & TypedResponse< {
394
+ error: string;
395
+ }, 404, "json">) | (Response & TypedResponse< {
396
+ package_canonical?: string | undefined;
397
+ packages?: {
398
+ registry_name: "npm" | "docker" | "pypi" | "homebrew" | string;
399
+ name: string;
400
+ version: string;
401
+ command?: {
402
+ name: "npx" | "docker" | "pypi" | "uvx" | string;
403
+ subcommands?: {
404
+ name: string;
405
+ description: string;
406
+ is_required?: boolean | undefined;
407
+ subcommands?: /*elided*/ any[] | undefined;
408
+ positional_arguments?: {
409
+ position: number;
410
+ name: string;
411
+ description: string;
412
+ is_required: boolean;
413
+ is_repeatable?: boolean | undefined;
414
+ is_editable?: boolean | undefined;
415
+ choices?: string[] | undefined;
416
+ default_value?: string | number | boolean | undefined;
417
+ }[] | undefined;
418
+ named_arguments?: {
419
+ short_flag?: string | undefined;
420
+ long_flag?: string | undefined;
421
+ requires_value?: boolean | undefined;
422
+ name: string;
423
+ description: string;
424
+ is_required: boolean;
425
+ is_repeatable?: boolean | undefined;
426
+ is_editable?: boolean | undefined;
427
+ choices?: string[] | undefined;
428
+ default_value?: string | number | boolean | undefined;
429
+ }[] | undefined;
430
+ }[] | undefined;
431
+ positional_arguments?: {
432
+ position: number;
433
+ name: string;
434
+ description: string;
435
+ is_required: boolean;
436
+ is_repeatable?: boolean | undefined;
437
+ is_editable?: boolean | undefined;
438
+ choices?: string[] | undefined;
439
+ default_value?: string | number | boolean | undefined;
440
+ }[] | undefined;
441
+ named_arguments?: {
442
+ short_flag?: string | undefined;
443
+ long_flag?: string | undefined;
444
+ requires_value?: boolean | undefined;
445
+ name: string;
446
+ description: string;
447
+ is_required: boolean;
448
+ is_repeatable?: boolean | undefined;
449
+ is_editable?: boolean | undefined;
450
+ choices?: string[] | undefined;
451
+ default_value?: string | number | boolean | undefined;
452
+ }[] | undefined;
453
+ } | undefined;
454
+ environment_variables?: {
455
+ name: string;
456
+ description: string;
457
+ required?: boolean | undefined;
458
+ default_value?: string | undefined;
459
+ }[] | undefined;
460
+ }[] | undefined;
461
+ remotes?: {
462
+ transport_type: "streamable" | "sse" | string;
463
+ url: string;
464
+ }[] | undefined;
465
+ id: string;
466
+ name: string;
467
+ description?: string | undefined;
468
+ repository?: {
469
+ url: string;
470
+ source: "github" | "gitlab" | string;
471
+ id: string;
472
+ } | undefined;
473
+ version_detail: {
474
+ version: string;
475
+ release_date: string;
476
+ is_latest: boolean;
477
+ };
478
+ }, ContentfulStatusCode, "json">)>;
479
+
480
+ /**
481
+ * Handler for POST /api/mcp/:serverId/mcp
385
482
  */
386
483
  export declare const getMcpServerMessageHandler: (c: Context) => Promise<Response>;
387
484
 
@@ -392,6 +489,11 @@ export declare const getMcpServerMessageHandler: (c: Context) => Promise<Respons
392
489
  */
393
490
  export declare const getMcpServerSseHandler: (c: Context) => Promise<Response | undefined>;
394
491
 
492
+ /**
493
+ * Handler for GET /api/mcp/:serverId/tools/:toolId - Get details for a specific tool on an MCP Server
494
+ */
495
+ export declare const getMcpServerToolDetailHandler: (c: Context) => Promise<Response>;
496
+
395
497
  export declare function getMemoryStatusHandler(c: Context): Promise<Response>;
396
498
 
397
499
  export declare function getMessagesHandler(c: Context): Promise<Response>;
@@ -461,6 +563,36 @@ export declare function listenHandler(c: Context): Promise<Response>;
461
563
 
462
564
  export declare function listIndexes(c: Context): Promise<Response>;
463
565
 
566
+ /**
567
+ * Handler for GET /api/mcp/v0/servers - List MCP Servers (Registry Style)
568
+ */
569
+ export declare const listMcpRegistryServersHandler: (c: Context) => Promise<(Response & TypedResponse< {
570
+ error: string;
571
+ }, 500, "json">) | (Response & TypedResponse< {
572
+ servers: {
573
+ id: string;
574
+ name: string;
575
+ description?: string | undefined;
576
+ repository?: {
577
+ url: string;
578
+ source: "github" | "gitlab" | string;
579
+ id: string;
580
+ } | undefined;
581
+ version_detail: {
582
+ version: string;
583
+ release_date: string;
584
+ is_latest: boolean;
585
+ };
586
+ }[];
587
+ next: string | null;
588
+ total_count: number;
589
+ }, ContentfulStatusCode, "json">)>;
590
+
591
+ /**
592
+ * Handler for GET /api/mcp/:serverId/tools - List tools for a specific MCP Server
593
+ */
594
+ export declare const listMcpServerToolsHandler: (c: Context) => Promise<Response>;
595
+
464
596
  /**
465
597
  * Creates TGZ packages for workspace dependencies in the workspace-module directory
466
598
  */
@@ -217,6 +217,11 @@ export declare function errorHandler(err: Error, c: Context): Response;
217
217
 
218
218
  export declare function executeAgentToolHandler(c: Context): Promise<Response>;
219
219
 
220
+ /**
221
+ * Handler for POST /api/mcp/:serverId/tools/:toolId/execute - Execute a tool on an MCP Server
222
+ */
223
+ export declare const executeMcpServerToolHandler: (c: Context) => Promise<Response>;
224
+
220
225
  export declare function executeToolHandler(tools: Record<string, any>): (c: Context) => Promise<Response>;
221
226
 
222
227
  export declare class FileEnvService extends EnvService {
@@ -381,7 +386,99 @@ export declare function getLogsHandler(c: Context): Promise<Response>;
381
386
  export declare function getLogTransports(c: Context): Promise<Response>;
382
387
 
383
388
  /**
384
- * Handler for POST /api/servers/:serverId/mcp
389
+ * Handler for GET /api/mcp/v0/servers/:id - Get MCP Server Details (Registry Style)
390
+ */
391
+ export declare const getMcpRegistryServerDetailHandler: (c: Context) => Promise<(Response & TypedResponse< {
392
+ error: string;
393
+ }, 500, "json">) | (Response & TypedResponse< {
394
+ error: string;
395
+ }, 404, "json">) | (Response & TypedResponse< {
396
+ package_canonical?: string | undefined;
397
+ packages?: {
398
+ registry_name: "npm" | "docker" | "pypi" | "homebrew" | string;
399
+ name: string;
400
+ version: string;
401
+ command?: {
402
+ name: "npx" | "docker" | "pypi" | "uvx" | string;
403
+ subcommands?: {
404
+ name: string;
405
+ description: string;
406
+ is_required?: boolean | undefined;
407
+ subcommands?: /*elided*/ any[] | undefined;
408
+ positional_arguments?: {
409
+ position: number;
410
+ name: string;
411
+ description: string;
412
+ is_required: boolean;
413
+ is_repeatable?: boolean | undefined;
414
+ is_editable?: boolean | undefined;
415
+ choices?: string[] | undefined;
416
+ default_value?: string | number | boolean | undefined;
417
+ }[] | undefined;
418
+ named_arguments?: {
419
+ short_flag?: string | undefined;
420
+ long_flag?: string | undefined;
421
+ requires_value?: boolean | undefined;
422
+ name: string;
423
+ description: string;
424
+ is_required: boolean;
425
+ is_repeatable?: boolean | undefined;
426
+ is_editable?: boolean | undefined;
427
+ choices?: string[] | undefined;
428
+ default_value?: string | number | boolean | undefined;
429
+ }[] | undefined;
430
+ }[] | undefined;
431
+ positional_arguments?: {
432
+ position: number;
433
+ name: string;
434
+ description: string;
435
+ is_required: boolean;
436
+ is_repeatable?: boolean | undefined;
437
+ is_editable?: boolean | undefined;
438
+ choices?: string[] | undefined;
439
+ default_value?: string | number | boolean | undefined;
440
+ }[] | undefined;
441
+ named_arguments?: {
442
+ short_flag?: string | undefined;
443
+ long_flag?: string | undefined;
444
+ requires_value?: boolean | undefined;
445
+ name: string;
446
+ description: string;
447
+ is_required: boolean;
448
+ is_repeatable?: boolean | undefined;
449
+ is_editable?: boolean | undefined;
450
+ choices?: string[] | undefined;
451
+ default_value?: string | number | boolean | undefined;
452
+ }[] | undefined;
453
+ } | undefined;
454
+ environment_variables?: {
455
+ name: string;
456
+ description: string;
457
+ required?: boolean | undefined;
458
+ default_value?: string | undefined;
459
+ }[] | undefined;
460
+ }[] | undefined;
461
+ remotes?: {
462
+ transport_type: "streamable" | "sse" | string;
463
+ url: string;
464
+ }[] | undefined;
465
+ id: string;
466
+ name: string;
467
+ description?: string | undefined;
468
+ repository?: {
469
+ url: string;
470
+ source: "github" | "gitlab" | string;
471
+ id: string;
472
+ } | undefined;
473
+ version_detail: {
474
+ version: string;
475
+ release_date: string;
476
+ is_latest: boolean;
477
+ };
478
+ }, ContentfulStatusCode, "json">)>;
479
+
480
+ /**
481
+ * Handler for POST /api/mcp/:serverId/mcp
385
482
  */
386
483
  export declare const getMcpServerMessageHandler: (c: Context) => Promise<Response>;
387
484
 
@@ -392,6 +489,11 @@ export declare const getMcpServerMessageHandler: (c: Context) => Promise<Respons
392
489
  */
393
490
  export declare const getMcpServerSseHandler: (c: Context) => Promise<Response | undefined>;
394
491
 
492
+ /**
493
+ * Handler for GET /api/mcp/:serverId/tools/:toolId - Get details for a specific tool on an MCP Server
494
+ */
495
+ export declare const getMcpServerToolDetailHandler: (c: Context) => Promise<Response>;
496
+
395
497
  export declare function getMemoryStatusHandler(c: Context): Promise<Response>;
396
498
 
397
499
  export declare function getMessagesHandler(c: Context): Promise<Response>;
@@ -461,6 +563,36 @@ export declare function listenHandler(c: Context): Promise<Response>;
461
563
 
462
564
  export declare function listIndexes(c: Context): Promise<Response>;
463
565
 
566
+ /**
567
+ * Handler for GET /api/mcp/v0/servers - List MCP Servers (Registry Style)
568
+ */
569
+ export declare const listMcpRegistryServersHandler: (c: Context) => Promise<(Response & TypedResponse< {
570
+ error: string;
571
+ }, 500, "json">) | (Response & TypedResponse< {
572
+ servers: {
573
+ id: string;
574
+ name: string;
575
+ description?: string | undefined;
576
+ repository?: {
577
+ url: string;
578
+ source: "github" | "gitlab" | string;
579
+ id: string;
580
+ } | undefined;
581
+ version_detail: {
582
+ version: string;
583
+ release_date: string;
584
+ is_latest: boolean;
585
+ };
586
+ }[];
587
+ next: string | null;
588
+ total_count: number;
589
+ }, ContentfulStatusCode, "json">)>;
590
+
591
+ /**
592
+ * Handler for GET /api/mcp/:serverId/tools - List tools for a specific MCP Server
593
+ */
594
+ export declare const listMcpServerToolsHandler: (c: Context) => Promise<Response>;
595
+
464
596
  /**
465
597
  * Creates TGZ packages for workspace dependencies in the workspace-module directory
466
598
  */
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var chunk6J52IX4J_cjs = require('../chunk-6J52IX4J.cjs');
3
+ var chunkHHZDRBPV_cjs = require('../chunk-HHZDRBPV.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "analyzeBundle", {
8
8
  enumerable: true,
9
- get: function () { return chunk6J52IX4J_cjs.analyzeBundle; }
9
+ get: function () { return chunkHHZDRBPV_cjs.analyzeBundle; }
10
10
  });
@@ -1 +1 @@
1
- export { analyzeBundle } from '../chunk-QJQ2V3Z2.js';
1
+ export { analyzeBundle } from '../chunk-EHPJDSR3.js';
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunkKCX3UGHY_cjs = require('../chunk-KCX3UGHY.cjs');
3
+ var chunkWHD7NHLX_cjs = require('../chunk-WHD7NHLX.cjs');
4
4
  var chunk3R6WDRBB_cjs = require('../chunk-3R6WDRBB.cjs');
5
- var chunk6J52IX4J_cjs = require('../chunk-6J52IX4J.cjs');
5
+ var chunkHHZDRBPV_cjs = require('../chunk-HHZDRBPV.cjs');
6
6
  var chunkIMGVLBV7_cjs = require('../chunk-IMGVLBV7.cjs');
7
7
  var chunk4VC5Z4YR_cjs = require('../chunk-4VC5Z4YR.cjs');
8
8
 
@@ -10,15 +10,15 @@ var chunk4VC5Z4YR_cjs = require('../chunk-4VC5Z4YR.cjs');
10
10
 
11
11
  Object.defineProperty(exports, "createWatcher", {
12
12
  enumerable: true,
13
- get: function () { return chunkKCX3UGHY_cjs.createWatcher; }
13
+ get: function () { return chunkWHD7NHLX_cjs.createWatcher; }
14
14
  });
15
15
  Object.defineProperty(exports, "getServerOptions", {
16
16
  enumerable: true,
17
- get: function () { return chunkKCX3UGHY_cjs.getServerOptions; }
17
+ get: function () { return chunkWHD7NHLX_cjs.getServerOptions; }
18
18
  });
19
19
  Object.defineProperty(exports, "getWatcherInputOptions", {
20
20
  enumerable: true,
21
- get: function () { return chunkKCX3UGHY_cjs.getInputOptions; }
21
+ get: function () { return chunkWHD7NHLX_cjs.getInputOptions; }
22
22
  });
23
23
  Object.defineProperty(exports, "writeTelemetryConfig", {
24
24
  enumerable: true,
@@ -26,7 +26,7 @@ Object.defineProperty(exports, "writeTelemetryConfig", {
26
26
  });
27
27
  Object.defineProperty(exports, "analyzeBundle", {
28
28
  enumerable: true,
29
- get: function () { return chunk6J52IX4J_cjs.analyzeBundle; }
29
+ get: function () { return chunkHHZDRBPV_cjs.analyzeBundle; }
30
30
  });
31
31
  Object.defineProperty(exports, "createBundler", {
32
32
  enumerable: true,
@@ -1,5 +1,5 @@
1
- export { createWatcher, getServerOptions, getInputOptions as getWatcherInputOptions } from '../chunk-ABTWXYGO.js';
1
+ export { createWatcher, getServerOptions, getInputOptions as getWatcherInputOptions } from '../chunk-U5VNUAES.js';
2
2
  export { writeTelemetryConfig } from '../chunk-TUMXQX4H.js';
3
- export { analyzeBundle } from '../chunk-QJQ2V3Z2.js';
3
+ export { analyzeBundle } from '../chunk-EHPJDSR3.js';
4
4
  export { createBundler, getInputOptions as getBundlerInputOptions } from '../chunk-AOSWYZKN.js';
5
5
  export { Deps, FileService } from '../chunk-UV4RQQ3R.js';
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var chunkFA7LXQU6_cjs = require('../chunk-FA7LXQU6.cjs');
3
+ var chunkBQAYAQTU_cjs = require('../chunk-BQAYAQTU.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "Bundler", {
8
8
  enumerable: true,
9
- get: function () { return chunkFA7LXQU6_cjs.Bundler; }
9
+ get: function () { return chunkBQAYAQTU_cjs.Bundler; }
10
10
  });
@@ -1 +1 @@
1
- export { Bundler } from '../chunk-37LFSIVL.js';
1
+ export { Bundler } from '../chunk-YU2QBGOU.js';
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chunk3R6WDRBB_cjs = require('./chunk-3R6WDRBB.cjs');
4
- var chunk6J52IX4J_cjs = require('./chunk-6J52IX4J.cjs');
4
+ var chunkHHZDRBPV_cjs = require('./chunk-HHZDRBPV.cjs');
5
5
  var chunkIMGVLBV7_cjs = require('./chunk-IMGVLBV7.cjs');
6
6
  var chunk4VC5Z4YR_cjs = require('./chunk-4VC5Z4YR.cjs');
7
7
  var fs = require('fs');
@@ -130,7 +130,7 @@ var Bundler = class extends bundler.MastraBundler {
130
130
  }
131
131
  async writeInstrumentationFile(outputDirectory) {
132
132
  const instrumentationFile = path.join(outputDirectory, "instrumentation.mjs");
133
- const __dirname = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-FA7LXQU6.cjs', document.baseURI).href))));
133
+ const __dirname = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-BQAYAQTU.cjs', document.baseURI).href))));
134
134
  await fsExtra.copy(path.join(__dirname, "templates", "instrumentation-template.js"), instrumentationFile);
135
135
  }
136
136
  async writePackageJson(outputDirectory, dependencies, resolutions) {
@@ -176,7 +176,7 @@ var Bundler = class extends bundler.MastraBundler {
176
176
  return chunkIMGVLBV7_cjs.createBundler(inputOptions, outputOptions);
177
177
  }
178
178
  async analyze(entry, mastraFile, outputDirectory) {
179
- return await chunk6J52IX4J_cjs.analyzeBundle(entry, mastraFile, path.join(outputDirectory, this.analyzeOutputDir), "node", this.logger);
179
+ return await chunkHHZDRBPV_cjs.analyzeBundle(entry, mastraFile, path.join(outputDirectory, this.analyzeOutputDir), "node", this.logger);
180
180
  }
181
181
  async installDependencies(outputDirectory, rootDir = process.cwd()) {
182
182
  const deps = new chunk4VC5Z4YR_cjs.DepsService(rootDir);
@@ -235,7 +235,7 @@ var Bundler = class extends bundler.MastraBundler {
235
235
  }
236
236
  async _bundle(serverFile, mastraEntryFile, outputDirectory, toolsPaths = [], bundleLocation = path.join(outputDirectory, this.outputDir)) {
237
237
  this.logger.info("Start bundling Mastra");
238
- const analyzedBundleInfo = await chunk6J52IX4J_cjs.analyzeBundle(
238
+ const analyzedBundleInfo = await chunkHHZDRBPV_cjs.analyzeBundle(
239
239
  serverFile,
240
240
  mastraEntryFile,
241
241
  path.join(outputDirectory, this.analyzeOutputDir),
@@ -65,7 +65,17 @@ function validate(file) {
65
65
  }
66
66
  );
67
67
  }
68
- var globalExternals = ["pino", "pino-pretty", "@libsql/client", "pg", "libsql", "jsdom", "sqlite3"];
68
+ var globalExternals = [
69
+ "pino",
70
+ "pino-pretty",
71
+ "@libsql/client",
72
+ "pg",
73
+ "libsql",
74
+ "jsdom",
75
+ "sqlite3",
76
+ "fastembed",
77
+ "nodemailer"
78
+ ];
69
79
  function findExternalImporter(module, external, allOutputs) {
70
80
  const capturedFiles = /* @__PURE__ */ new Set();
71
81
  for (const id of module.imports) {
@@ -75,7 +75,17 @@ function validate(file) {
75
75
  }
76
76
  );
77
77
  }
78
- var globalExternals = ["pino", "pino-pretty", "@libsql/client", "pg", "libsql", "jsdom", "sqlite3"];
78
+ var globalExternals = [
79
+ "pino",
80
+ "pino-pretty",
81
+ "@libsql/client",
82
+ "pg",
83
+ "libsql",
84
+ "jsdom",
85
+ "sqlite3",
86
+ "fastembed",
87
+ "nodemailer"
88
+ ];
79
89
  function findExternalImporter(module, external, allOutputs) {
80
90
  const capturedFiles = /* @__PURE__ */ new Set();
81
91
  for (const id of module.imports) {
@@ -1,5 +1,5 @@
1
1
  import { recursiveRemoveNonReferencedNodes, removeAllOptionsFromMastraExcept } from './chunk-TUMXQX4H.js';
2
- import { aliasHono } from './chunk-QJQ2V3Z2.js';
2
+ import { aliasHono } from './chunk-EHPJDSR3.js';
3
3
  import { getInputOptions } from './chunk-AOSWYZKN.js';
4
4
  import { tsConfigPaths } from './chunk-WVBUOQT6.js';
5
5
  import { watch, rollup } from 'rollup';
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chunk3R6WDRBB_cjs = require('./chunk-3R6WDRBB.cjs');
4
- var chunk6J52IX4J_cjs = require('./chunk-6J52IX4J.cjs');
4
+ var chunkHHZDRBPV_cjs = require('./chunk-HHZDRBPV.cjs');
5
5
  var chunkIMGVLBV7_cjs = require('./chunk-IMGVLBV7.cjs');
6
6
  var chunk54KOF3NB_cjs = require('./chunk-54KOF3NB.cjs');
7
7
  var rollup = require('rollup');
@@ -49,7 +49,7 @@ async function getInputOptions2(entryFile, platform, env) {
49
49
  // @ts-ignore
50
50
  (plugin) => !plugin || !plugin?.name || plugin.name !== "node-resolve"
51
51
  );
52
- inputOptions.plugins.push(chunk6J52IX4J_cjs.aliasHono());
52
+ inputOptions.plugins.push(chunkHHZDRBPV_cjs.aliasHono());
53
53
  }
54
54
  return inputOptions;
55
55
  }
@@ -1,5 +1,5 @@
1
1
  import { writeTelemetryConfig } from './chunk-TUMXQX4H.js';
2
- import { analyzeBundle } from './chunk-QJQ2V3Z2.js';
2
+ import { analyzeBundle } from './chunk-EHPJDSR3.js';
3
3
  import { createBundler, getInputOptions } from './chunk-AOSWYZKN.js';
4
4
  import { DepsService, FileService } from './chunk-UV4RQQ3R.js';
5
5
  import { existsSync } from 'node:fs';
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkFA7LXQU6_cjs = require('./chunk-FA7LXQU6.cjs');
3
+ var chunkBQAYAQTU_cjs = require('./chunk-BQAYAQTU.cjs');
4
4
  var chunk3R6WDRBB_cjs = require('./chunk-3R6WDRBB.cjs');
5
5
  var chunk4VC5Z4YR_cjs = require('./chunk-4VC5Z4YR.cjs');
6
6
  var babel = require('@babel/core');
@@ -33,7 +33,7 @@ var esbuild__default = /*#__PURE__*/_interopDefault(esbuild);
33
33
  var commonjs__default = /*#__PURE__*/_interopDefault(commonjs);
34
34
 
35
35
  // src/deploy/base.ts
36
- var Deployer = class extends chunkFA7LXQU6_cjs.Bundler {
36
+ var Deployer = class extends chunkBQAYAQTU_cjs.Bundler {
37
37
  deps = new chunk4VC5Z4YR_cjs.DepsService();
38
38
  constructor(args) {
39
39
  super(args.name, "DEPLOYER");
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Bundler } from './chunk-37LFSIVL.js';
1
+ import { Bundler } from './chunk-YU2QBGOU.js';
2
2
  import { recursiveRemoveNonReferencedNodes } from './chunk-TUMXQX4H.js';
3
3
  import { DepsService, FileService } from './chunk-UV4RQQ3R.js';
4
4
  export { Deps, FileService, createChildProcessLogger, createPinoStream } from './chunk-UV4RQQ3R.js';
@@ -2984,7 +2984,7 @@ var getMcpServerMessageHandler = async (c2) => {
2984
2984
  try {
2985
2985
  await server.startHTTP({
2986
2986
  url: new URL(c2.req.url),
2987
- httpPath: `/api/servers/${serverId}/mcp`,
2987
+ httpPath: `/api/mcp/${serverId}/mcp`,
2988
2988
  req,
2989
2989
  res,
2990
2990
  options: {
@@ -3005,8 +3005,8 @@ var getMcpServerSseHandler = async (c2) => {
3005
3005
  return c2.json({ error: `MCP server '${serverId}' not found` }, 404);
3006
3006
  }
3007
3007
  const requestUrl = new URL(c2.req.url);
3008
- const sseConnectionPath = `/api/servers/${serverId}/sse`;
3009
- const sseMessagePath = `/api/servers/${serverId}/messages`;
3008
+ const sseConnectionPath = `/api/mcp/${serverId}/sse`;
3009
+ const sseMessagePath = `/api/mcp/${serverId}/messages`;
3010
3010
  try {
3011
3011
  return await server.startHonoSSE({
3012
3012
  url: requestUrl,
@@ -3019,6 +3019,148 @@ var getMcpServerSseHandler = async (c2) => {
3019
3019
  return handleError(error, "Error handling MCP SSE request");
3020
3020
  }
3021
3021
  };
3022
+ var listMcpRegistryServersHandler = async (c2) => {
3023
+ const mastra = getMastra(c2);
3024
+ if (!mastra || typeof mastra.getMCPServers !== "function") {
3025
+ c2.get("logger")?.error("Mastra instance or getMCPServers method not available in listMcpRegistryServersHandler");
3026
+ return c2.json({ error: "Mastra instance or getMCPServers method not available" }, 500);
3027
+ }
3028
+ const mcpServersMap = mastra.getMCPServers();
3029
+ if (!mcpServersMap) {
3030
+ c2.get("logger")?.warn("getMCPServers returned undefined or null in listMcpRegistryServersHandler");
3031
+ return c2.json({ servers: [], next: null, total_count: 0 });
3032
+ }
3033
+ const allServersArray = Array.from(
3034
+ mcpServersMap instanceof Map ? mcpServersMap.values() : Object.values(mcpServersMap)
3035
+ );
3036
+ const limit = parseInt(c2.req.query("limit") || "50", 10);
3037
+ const offset = parseInt(c2.req.query("offset") || "0", 10);
3038
+ const paginatedServers = allServersArray.slice(offset, offset + limit);
3039
+ const serverInfos = paginatedServers.map((server) => server.getServerInfo());
3040
+ const total_count = allServersArray.length;
3041
+ let next = null;
3042
+ if (offset + limit < total_count) {
3043
+ const nextOffset = offset + limit;
3044
+ const currentUrl = new URL(c2.req.url);
3045
+ currentUrl.searchParams.set("offset", nextOffset.toString());
3046
+ currentUrl.searchParams.set("limit", limit.toString());
3047
+ next = currentUrl.toString();
3048
+ }
3049
+ return c2.json({
3050
+ servers: serverInfos,
3051
+ next,
3052
+ total_count
3053
+ });
3054
+ };
3055
+ var getMcpRegistryServerDetailHandler = async (c2) => {
3056
+ const mastra = getMastra(c2);
3057
+ const serverId = c2.req.param("id");
3058
+ const requestedVersion = c2.req.query("version");
3059
+ if (!mastra || typeof mastra.getMCPServer !== "function") {
3060
+ c2.get("logger")?.error("Mastra instance or getMCPServer method not available in getMcpRegistryServerDetailHandler");
3061
+ return c2.json({ error: "Mastra instance or getMCPServer method not available" }, 500);
3062
+ }
3063
+ const server = mastra.getMCPServer(serverId);
3064
+ if (!server) {
3065
+ return c2.json({ error: `MCP server with ID '${serverId}' not found` }, 404);
3066
+ }
3067
+ const serverDetailInfo = server.getServerDetail();
3068
+ if (requestedVersion && serverDetailInfo.version_detail.version !== requestedVersion) {
3069
+ c2.get("logger")?.info(
3070
+ `MCP server with ID '${serverId}' found, but version '${serverDetailInfo.version_detail.version}' does not match requested version '${requestedVersion}'.`
3071
+ );
3072
+ return c2.json(
3073
+ {
3074
+ error: `MCP server with ID '${serverId}' found, but not version '${requestedVersion}'. Available version is '${serverDetailInfo.version_detail.version}'.`
3075
+ },
3076
+ 404
3077
+ // Return 404 as the specific version is not found
3078
+ );
3079
+ }
3080
+ return c2.json(serverDetailInfo);
3081
+ };
3082
+ var listMcpServerToolsHandler = async (c2) => {
3083
+ const mastra = getMastra(c2);
3084
+ const serverId = c2.req.param("serverId");
3085
+ if (!mastra || typeof mastra.getMCPServer !== "function") {
3086
+ c2.get("logger")?.error("Mastra instance or getMCPServer method not available in listMcpServerToolsHandler");
3087
+ return c2.json({ error: "Mastra instance or getMCPServer method not available" }, 500);
3088
+ }
3089
+ const server = mastra.getMCPServer(serverId);
3090
+ if (!server) {
3091
+ return c2.json({ error: `MCP server with ID '${serverId}' not found` }, 404);
3092
+ }
3093
+ if (typeof server.getToolListInfo !== "function") {
3094
+ c2.get("logger")?.error(`MCPServer with ID '${serverId}' does not support getToolListInfo.`);
3095
+ return c2.json({ error: `Server '${serverId}' cannot list tools in this way.` }, 501);
3096
+ }
3097
+ try {
3098
+ const toolListInfo = server.getToolListInfo();
3099
+ return c2.json(toolListInfo);
3100
+ } catch (error) {
3101
+ c2.get("logger")?.error(`Error in listMcpServerToolsHandler for serverId '${serverId}':`, { error: error.message });
3102
+ return handleError(error, `Error listing tools for MCP server '${serverId}'`);
3103
+ }
3104
+ };
3105
+ var getMcpServerToolDetailHandler = async (c2) => {
3106
+ const mastra = getMastra(c2);
3107
+ const serverId = c2.req.param("serverId");
3108
+ const toolId = c2.req.param("toolId");
3109
+ if (!mastra || typeof mastra.getMCPServer !== "function") {
3110
+ c2.get("logger")?.error("Mastra instance or getMCPServer method not available in getMcpServerToolDetailHandler");
3111
+ return c2.json({ error: "Mastra instance or getMCPServer method not available" }, 500);
3112
+ }
3113
+ const server = mastra.getMCPServer(serverId);
3114
+ if (!server) {
3115
+ return c2.json({ error: `MCP server with ID '${serverId}' not found` }, 404);
3116
+ }
3117
+ if (typeof server.getToolInfo !== "function") {
3118
+ c2.get("logger")?.error(`MCPServer with ID '${serverId}' does not support getToolInfo.`);
3119
+ return c2.json({ error: `Server '${serverId}' cannot provide tool details in this way.` }, 501);
3120
+ }
3121
+ try {
3122
+ const toolInfo = server.getToolInfo(toolId);
3123
+ if (!toolInfo) {
3124
+ return c2.json({ error: `Tool with ID '${toolId}' not found on MCP server '${serverId}'` }, 404);
3125
+ }
3126
+ return c2.json(toolInfo);
3127
+ } catch (error) {
3128
+ c2.get("logger")?.error(`Error in getMcpServerToolDetailHandler for serverId '${serverId}', toolId '${toolId}':`, {
3129
+ error: error.message
3130
+ });
3131
+ return handleError(error, `Error getting tool '${toolId}' details for MCP server '${serverId}'`);
3132
+ }
3133
+ };
3134
+ var executeMcpServerToolHandler = async (c2) => {
3135
+ const mastra = getMastra(c2);
3136
+ const serverId = c2.req.param("serverId");
3137
+ const toolId = c2.req.param("toolId");
3138
+ if (!mastra || typeof mastra.getMCPServer !== "function") {
3139
+ c2.get("logger")?.error("Mastra instance or getMCPServer method not available in executeMcpServerToolHandler");
3140
+ return c2.json({ error: "Mastra instance or getMCPServer method not available" }, 500);
3141
+ }
3142
+ const server = mastra.getMCPServer(serverId);
3143
+ if (!server) {
3144
+ return c2.json({ error: `MCP server with ID '${serverId}' not found` }, 404);
3145
+ }
3146
+ if (typeof server.executeTool !== "function") {
3147
+ c2.get("logger")?.error(`MCPServer with ID '${serverId}' does not support executeTool.`);
3148
+ return c2.json({ error: `Server '${serverId}' cannot execute tools in this way.` }, 501);
3149
+ }
3150
+ try {
3151
+ const body = await c2.req.json();
3152
+ const args = body?.data;
3153
+ const runtimeContext = body?.runtimeContext;
3154
+ const result = await server.executeTool(toolId, args, runtimeContext);
3155
+ return c2.json({ result });
3156
+ } catch (error) {
3157
+ c2.get("logger")?.error(`Error executing tool '${toolId}' on server '${serverId}':`, { error: error.message });
3158
+ if (error.name === "ZodError") {
3159
+ return c2.json({ error: "Invalid tool arguments", details: error.errors }, 400);
3160
+ }
3161
+ return handleError(error, `Error executing tool '${toolId}' on MCP server '${serverId}'`);
3162
+ }
3163
+ };
3022
3164
  async function getMemoryStatusHandler(c2) {
3023
3165
  try {
3024
3166
  const mastra = c2.get("mastra");
@@ -5176,7 +5318,7 @@ async function createHonoServer(mastra, options = {}) {
5176
5318
  executeAgentToolHandler
5177
5319
  );
5178
5320
  app.post(
5179
- "/api/servers/:serverId/mcp",
5321
+ "/api/mcp/:serverId/mcp",
5180
5322
  bodyLimit.bodyLimit(bodyLimitOptions),
5181
5323
  h({
5182
5324
  description: "Send a message to an MCP server using Streamable HTTP",
@@ -5203,8 +5345,8 @@ async function createHonoServer(mastra, options = {}) {
5203
5345
  }),
5204
5346
  getMcpServerMessageHandler
5205
5347
  );
5206
- const mcpSseBasePath = "/api/servers/:serverId/sse";
5207
- const mcpSseMessagePath = "/api/servers/:serverId/messages";
5348
+ const mcpSseBasePath = "/api/mcp/:serverId/sse";
5349
+ const mcpSseMessagePath = "/api/mcp/:serverId/messages";
5208
5350
  app.get(
5209
5351
  mcpSseBasePath,
5210
5352
  h({
@@ -5262,6 +5404,158 @@ async function createHonoServer(mastra, options = {}) {
5262
5404
  }),
5263
5405
  getMcpServerSseHandler
5264
5406
  );
5407
+ app.get(
5408
+ "/api/mcp/v0/servers",
5409
+ h({
5410
+ description: "List all available MCP server instances with basic information.",
5411
+ tags: ["mcp"],
5412
+ parameters: [
5413
+ {
5414
+ name: "limit",
5415
+ in: "query",
5416
+ description: "Number of results per page.",
5417
+ required: false,
5418
+ schema: { type: "integer", default: 50, minimum: 1, maximum: 5e3 }
5419
+ },
5420
+ {
5421
+ name: "offset",
5422
+ in: "query",
5423
+ description: "Number of results to skip for pagination.",
5424
+ required: false,
5425
+ schema: { type: "integer", default: 0, minimum: 0 }
5426
+ }
5427
+ ],
5428
+ responses: {
5429
+ 200: {
5430
+ description: "A list of MCP server instances.",
5431
+ content: {
5432
+ "application/json": {
5433
+ schema: {
5434
+ type: "object",
5435
+ properties: {
5436
+ servers: { type: "array", items: { $ref: "#/components/schemas/ServerInfo" } },
5437
+ next: { type: "string", format: "uri", nullable: true },
5438
+ total_count: { type: "integer" }
5439
+ }
5440
+ }
5441
+ }
5442
+ }
5443
+ }
5444
+ }
5445
+ }),
5446
+ listMcpRegistryServersHandler
5447
+ );
5448
+ app.get(
5449
+ "/api/mcp/v0/servers/:id",
5450
+ h({
5451
+ description: "Get detailed information about a specific MCP server instance.",
5452
+ tags: ["mcp"],
5453
+ parameters: [
5454
+ {
5455
+ name: "id",
5456
+ in: "path",
5457
+ required: true,
5458
+ description: "Unique ID of the MCP server instance.",
5459
+ schema: { type: "string" }
5460
+ },
5461
+ {
5462
+ name: "version",
5463
+ in: "query",
5464
+ required: false,
5465
+ description: "Desired MCP server version (currently informational, server returns its actual version).",
5466
+ schema: { type: "string" }
5467
+ }
5468
+ ],
5469
+ responses: {
5470
+ 200: {
5471
+ description: "Detailed information about the MCP server instance.",
5472
+ content: {
5473
+ "application/json": { schema: { $ref: "#/components/schemas/ServerDetailInfo" } }
5474
+ }
5475
+ },
5476
+ 404: {
5477
+ description: "MCP server instance not found.",
5478
+ content: { "application/json": { schema: { type: "object", properties: { error: { type: "string" } } } } }
5479
+ }
5480
+ }
5481
+ }),
5482
+ getMcpRegistryServerDetailHandler
5483
+ );
5484
+ app.get(
5485
+ "/api/mcp/:serverId/tools",
5486
+ h({
5487
+ description: "List all tools available on a specific MCP server instance.",
5488
+ tags: ["mcp"],
5489
+ parameters: [
5490
+ {
5491
+ name: "serverId",
5492
+ in: "path",
5493
+ required: true,
5494
+ description: "Unique ID of the MCP server instance.",
5495
+ schema: { type: "string" }
5496
+ }
5497
+ ],
5498
+ responses: {
5499
+ 200: { description: "A list of tools for the MCP server." },
5500
+ // Define schema if you have one for McpServerToolListResponse
5501
+ 404: { description: "MCP server instance not found." },
5502
+ 501: { description: "Server does not support listing tools." }
5503
+ }
5504
+ }),
5505
+ listMcpServerToolsHandler
5506
+ );
5507
+ app.get(
5508
+ "/api/mcp/:serverId/tools/:toolId",
5509
+ h({
5510
+ description: "Get details for a specific tool on an MCP server.",
5511
+ tags: ["mcp"],
5512
+ parameters: [
5513
+ { name: "serverId", in: "path", required: true, schema: { type: "string" } },
5514
+ { name: "toolId", in: "path", required: true, schema: { type: "string" } }
5515
+ ],
5516
+ responses: {
5517
+ 200: { description: "Details of the specified tool." },
5518
+ // Define schema for McpToolInfo
5519
+ 404: { description: "MCP server or tool not found." },
5520
+ 501: { description: "Server does not support getting tool details." }
5521
+ }
5522
+ }),
5523
+ getMcpServerToolDetailHandler
5524
+ );
5525
+ app.post(
5526
+ "/api/mcp/:serverId/tools/:toolId/execute",
5527
+ bodyLimit.bodyLimit(bodyLimitOptions),
5528
+ h({
5529
+ description: "Execute a specific tool on an MCP server.",
5530
+ tags: ["mcp"],
5531
+ parameters: [
5532
+ { name: "serverId", in: "path", required: true, schema: { type: "string" } },
5533
+ { name: "toolId", in: "path", required: true, schema: { type: "string" } }
5534
+ ],
5535
+ requestBody: {
5536
+ required: true,
5537
+ content: {
5538
+ "application/json": {
5539
+ schema: {
5540
+ type: "object",
5541
+ properties: {
5542
+ data: { type: "object" },
5543
+ runtimeContext: { type: "object" }
5544
+ }
5545
+ }
5546
+ }
5547
+ }
5548
+ // Simplified schema
5549
+ },
5550
+ responses: {
5551
+ 200: { description: "Result of the tool execution." },
5552
+ 400: { description: "Invalid tool arguments." },
5553
+ 404: { description: "MCP server or tool not found." },
5554
+ 501: { description: "Server does not support tool execution." }
5555
+ }
5556
+ }),
5557
+ executeMcpServerToolHandler
5558
+ );
5265
5559
  app.get(
5266
5560
  "/api/memory/status",
5267
5561
  h({
@@ -6615,7 +6909,7 @@ async function createNodeServer(mastra, options = {}) {
6615
6909
  {
6616
6910
  fetch: app.fetch,
6617
6911
  port,
6618
- hostname: serverOptions?.host ?? "localhost"
6912
+ hostname: serverOptions?.host
6619
6913
  },
6620
6914
  () => {
6621
6915
  const logger2 = mastra.getLogger();
@@ -2978,7 +2978,7 @@ var getMcpServerMessageHandler = async (c2) => {
2978
2978
  try {
2979
2979
  await server.startHTTP({
2980
2980
  url: new URL(c2.req.url),
2981
- httpPath: `/api/servers/${serverId}/mcp`,
2981
+ httpPath: `/api/mcp/${serverId}/mcp`,
2982
2982
  req,
2983
2983
  res,
2984
2984
  options: {
@@ -2999,8 +2999,8 @@ var getMcpServerSseHandler = async (c2) => {
2999
2999
  return c2.json({ error: `MCP server '${serverId}' not found` }, 404);
3000
3000
  }
3001
3001
  const requestUrl = new URL(c2.req.url);
3002
- const sseConnectionPath = `/api/servers/${serverId}/sse`;
3003
- const sseMessagePath = `/api/servers/${serverId}/messages`;
3002
+ const sseConnectionPath = `/api/mcp/${serverId}/sse`;
3003
+ const sseMessagePath = `/api/mcp/${serverId}/messages`;
3004
3004
  try {
3005
3005
  return await server.startHonoSSE({
3006
3006
  url: requestUrl,
@@ -3013,6 +3013,148 @@ var getMcpServerSseHandler = async (c2) => {
3013
3013
  return handleError(error, "Error handling MCP SSE request");
3014
3014
  }
3015
3015
  };
3016
+ var listMcpRegistryServersHandler = async (c2) => {
3017
+ const mastra = getMastra(c2);
3018
+ if (!mastra || typeof mastra.getMCPServers !== "function") {
3019
+ c2.get("logger")?.error("Mastra instance or getMCPServers method not available in listMcpRegistryServersHandler");
3020
+ return c2.json({ error: "Mastra instance or getMCPServers method not available" }, 500);
3021
+ }
3022
+ const mcpServersMap = mastra.getMCPServers();
3023
+ if (!mcpServersMap) {
3024
+ c2.get("logger")?.warn("getMCPServers returned undefined or null in listMcpRegistryServersHandler");
3025
+ return c2.json({ servers: [], next: null, total_count: 0 });
3026
+ }
3027
+ const allServersArray = Array.from(
3028
+ mcpServersMap instanceof Map ? mcpServersMap.values() : Object.values(mcpServersMap)
3029
+ );
3030
+ const limit = parseInt(c2.req.query("limit") || "50", 10);
3031
+ const offset = parseInt(c2.req.query("offset") || "0", 10);
3032
+ const paginatedServers = allServersArray.slice(offset, offset + limit);
3033
+ const serverInfos = paginatedServers.map((server) => server.getServerInfo());
3034
+ const total_count = allServersArray.length;
3035
+ let next = null;
3036
+ if (offset + limit < total_count) {
3037
+ const nextOffset = offset + limit;
3038
+ const currentUrl = new URL(c2.req.url);
3039
+ currentUrl.searchParams.set("offset", nextOffset.toString());
3040
+ currentUrl.searchParams.set("limit", limit.toString());
3041
+ next = currentUrl.toString();
3042
+ }
3043
+ return c2.json({
3044
+ servers: serverInfos,
3045
+ next,
3046
+ total_count
3047
+ });
3048
+ };
3049
+ var getMcpRegistryServerDetailHandler = async (c2) => {
3050
+ const mastra = getMastra(c2);
3051
+ const serverId = c2.req.param("id");
3052
+ const requestedVersion = c2.req.query("version");
3053
+ if (!mastra || typeof mastra.getMCPServer !== "function") {
3054
+ c2.get("logger")?.error("Mastra instance or getMCPServer method not available in getMcpRegistryServerDetailHandler");
3055
+ return c2.json({ error: "Mastra instance or getMCPServer method not available" }, 500);
3056
+ }
3057
+ const server = mastra.getMCPServer(serverId);
3058
+ if (!server) {
3059
+ return c2.json({ error: `MCP server with ID '${serverId}' not found` }, 404);
3060
+ }
3061
+ const serverDetailInfo = server.getServerDetail();
3062
+ if (requestedVersion && serverDetailInfo.version_detail.version !== requestedVersion) {
3063
+ c2.get("logger")?.info(
3064
+ `MCP server with ID '${serverId}' found, but version '${serverDetailInfo.version_detail.version}' does not match requested version '${requestedVersion}'.`
3065
+ );
3066
+ return c2.json(
3067
+ {
3068
+ error: `MCP server with ID '${serverId}' found, but not version '${requestedVersion}'. Available version is '${serverDetailInfo.version_detail.version}'.`
3069
+ },
3070
+ 404
3071
+ // Return 404 as the specific version is not found
3072
+ );
3073
+ }
3074
+ return c2.json(serverDetailInfo);
3075
+ };
3076
+ var listMcpServerToolsHandler = async (c2) => {
3077
+ const mastra = getMastra(c2);
3078
+ const serverId = c2.req.param("serverId");
3079
+ if (!mastra || typeof mastra.getMCPServer !== "function") {
3080
+ c2.get("logger")?.error("Mastra instance or getMCPServer method not available in listMcpServerToolsHandler");
3081
+ return c2.json({ error: "Mastra instance or getMCPServer method not available" }, 500);
3082
+ }
3083
+ const server = mastra.getMCPServer(serverId);
3084
+ if (!server) {
3085
+ return c2.json({ error: `MCP server with ID '${serverId}' not found` }, 404);
3086
+ }
3087
+ if (typeof server.getToolListInfo !== "function") {
3088
+ c2.get("logger")?.error(`MCPServer with ID '${serverId}' does not support getToolListInfo.`);
3089
+ return c2.json({ error: `Server '${serverId}' cannot list tools in this way.` }, 501);
3090
+ }
3091
+ try {
3092
+ const toolListInfo = server.getToolListInfo();
3093
+ return c2.json(toolListInfo);
3094
+ } catch (error) {
3095
+ c2.get("logger")?.error(`Error in listMcpServerToolsHandler for serverId '${serverId}':`, { error: error.message });
3096
+ return handleError(error, `Error listing tools for MCP server '${serverId}'`);
3097
+ }
3098
+ };
3099
+ var getMcpServerToolDetailHandler = async (c2) => {
3100
+ const mastra = getMastra(c2);
3101
+ const serverId = c2.req.param("serverId");
3102
+ const toolId = c2.req.param("toolId");
3103
+ if (!mastra || typeof mastra.getMCPServer !== "function") {
3104
+ c2.get("logger")?.error("Mastra instance or getMCPServer method not available in getMcpServerToolDetailHandler");
3105
+ return c2.json({ error: "Mastra instance or getMCPServer method not available" }, 500);
3106
+ }
3107
+ const server = mastra.getMCPServer(serverId);
3108
+ if (!server) {
3109
+ return c2.json({ error: `MCP server with ID '${serverId}' not found` }, 404);
3110
+ }
3111
+ if (typeof server.getToolInfo !== "function") {
3112
+ c2.get("logger")?.error(`MCPServer with ID '${serverId}' does not support getToolInfo.`);
3113
+ return c2.json({ error: `Server '${serverId}' cannot provide tool details in this way.` }, 501);
3114
+ }
3115
+ try {
3116
+ const toolInfo = server.getToolInfo(toolId);
3117
+ if (!toolInfo) {
3118
+ return c2.json({ error: `Tool with ID '${toolId}' not found on MCP server '${serverId}'` }, 404);
3119
+ }
3120
+ return c2.json(toolInfo);
3121
+ } catch (error) {
3122
+ c2.get("logger")?.error(`Error in getMcpServerToolDetailHandler for serverId '${serverId}', toolId '${toolId}':`, {
3123
+ error: error.message
3124
+ });
3125
+ return handleError(error, `Error getting tool '${toolId}' details for MCP server '${serverId}'`);
3126
+ }
3127
+ };
3128
+ var executeMcpServerToolHandler = async (c2) => {
3129
+ const mastra = getMastra(c2);
3130
+ const serverId = c2.req.param("serverId");
3131
+ const toolId = c2.req.param("toolId");
3132
+ if (!mastra || typeof mastra.getMCPServer !== "function") {
3133
+ c2.get("logger")?.error("Mastra instance or getMCPServer method not available in executeMcpServerToolHandler");
3134
+ return c2.json({ error: "Mastra instance or getMCPServer method not available" }, 500);
3135
+ }
3136
+ const server = mastra.getMCPServer(serverId);
3137
+ if (!server) {
3138
+ return c2.json({ error: `MCP server with ID '${serverId}' not found` }, 404);
3139
+ }
3140
+ if (typeof server.executeTool !== "function") {
3141
+ c2.get("logger")?.error(`MCPServer with ID '${serverId}' does not support executeTool.`);
3142
+ return c2.json({ error: `Server '${serverId}' cannot execute tools in this way.` }, 501);
3143
+ }
3144
+ try {
3145
+ const body = await c2.req.json();
3146
+ const args = body?.data;
3147
+ const runtimeContext = body?.runtimeContext;
3148
+ const result = await server.executeTool(toolId, args, runtimeContext);
3149
+ return c2.json({ result });
3150
+ } catch (error) {
3151
+ c2.get("logger")?.error(`Error executing tool '${toolId}' on server '${serverId}':`, { error: error.message });
3152
+ if (error.name === "ZodError") {
3153
+ return c2.json({ error: "Invalid tool arguments", details: error.errors }, 400);
3154
+ }
3155
+ return handleError(error, `Error executing tool '${toolId}' on MCP server '${serverId}'`);
3156
+ }
3157
+ };
3016
3158
  async function getMemoryStatusHandler(c2) {
3017
3159
  try {
3018
3160
  const mastra = c2.get("mastra");
@@ -5170,7 +5312,7 @@ async function createHonoServer(mastra, options = {}) {
5170
5312
  executeAgentToolHandler
5171
5313
  );
5172
5314
  app.post(
5173
- "/api/servers/:serverId/mcp",
5315
+ "/api/mcp/:serverId/mcp",
5174
5316
  bodyLimit(bodyLimitOptions),
5175
5317
  h({
5176
5318
  description: "Send a message to an MCP server using Streamable HTTP",
@@ -5197,8 +5339,8 @@ async function createHonoServer(mastra, options = {}) {
5197
5339
  }),
5198
5340
  getMcpServerMessageHandler
5199
5341
  );
5200
- const mcpSseBasePath = "/api/servers/:serverId/sse";
5201
- const mcpSseMessagePath = "/api/servers/:serverId/messages";
5342
+ const mcpSseBasePath = "/api/mcp/:serverId/sse";
5343
+ const mcpSseMessagePath = "/api/mcp/:serverId/messages";
5202
5344
  app.get(
5203
5345
  mcpSseBasePath,
5204
5346
  h({
@@ -5256,6 +5398,158 @@ async function createHonoServer(mastra, options = {}) {
5256
5398
  }),
5257
5399
  getMcpServerSseHandler
5258
5400
  );
5401
+ app.get(
5402
+ "/api/mcp/v0/servers",
5403
+ h({
5404
+ description: "List all available MCP server instances with basic information.",
5405
+ tags: ["mcp"],
5406
+ parameters: [
5407
+ {
5408
+ name: "limit",
5409
+ in: "query",
5410
+ description: "Number of results per page.",
5411
+ required: false,
5412
+ schema: { type: "integer", default: 50, minimum: 1, maximum: 5e3 }
5413
+ },
5414
+ {
5415
+ name: "offset",
5416
+ in: "query",
5417
+ description: "Number of results to skip for pagination.",
5418
+ required: false,
5419
+ schema: { type: "integer", default: 0, minimum: 0 }
5420
+ }
5421
+ ],
5422
+ responses: {
5423
+ 200: {
5424
+ description: "A list of MCP server instances.",
5425
+ content: {
5426
+ "application/json": {
5427
+ schema: {
5428
+ type: "object",
5429
+ properties: {
5430
+ servers: { type: "array", items: { $ref: "#/components/schemas/ServerInfo" } },
5431
+ next: { type: "string", format: "uri", nullable: true },
5432
+ total_count: { type: "integer" }
5433
+ }
5434
+ }
5435
+ }
5436
+ }
5437
+ }
5438
+ }
5439
+ }),
5440
+ listMcpRegistryServersHandler
5441
+ );
5442
+ app.get(
5443
+ "/api/mcp/v0/servers/:id",
5444
+ h({
5445
+ description: "Get detailed information about a specific MCP server instance.",
5446
+ tags: ["mcp"],
5447
+ parameters: [
5448
+ {
5449
+ name: "id",
5450
+ in: "path",
5451
+ required: true,
5452
+ description: "Unique ID of the MCP server instance.",
5453
+ schema: { type: "string" }
5454
+ },
5455
+ {
5456
+ name: "version",
5457
+ in: "query",
5458
+ required: false,
5459
+ description: "Desired MCP server version (currently informational, server returns its actual version).",
5460
+ schema: { type: "string" }
5461
+ }
5462
+ ],
5463
+ responses: {
5464
+ 200: {
5465
+ description: "Detailed information about the MCP server instance.",
5466
+ content: {
5467
+ "application/json": { schema: { $ref: "#/components/schemas/ServerDetailInfo" } }
5468
+ }
5469
+ },
5470
+ 404: {
5471
+ description: "MCP server instance not found.",
5472
+ content: { "application/json": { schema: { type: "object", properties: { error: { type: "string" } } } } }
5473
+ }
5474
+ }
5475
+ }),
5476
+ getMcpRegistryServerDetailHandler
5477
+ );
5478
+ app.get(
5479
+ "/api/mcp/:serverId/tools",
5480
+ h({
5481
+ description: "List all tools available on a specific MCP server instance.",
5482
+ tags: ["mcp"],
5483
+ parameters: [
5484
+ {
5485
+ name: "serverId",
5486
+ in: "path",
5487
+ required: true,
5488
+ description: "Unique ID of the MCP server instance.",
5489
+ schema: { type: "string" }
5490
+ }
5491
+ ],
5492
+ responses: {
5493
+ 200: { description: "A list of tools for the MCP server." },
5494
+ // Define schema if you have one for McpServerToolListResponse
5495
+ 404: { description: "MCP server instance not found." },
5496
+ 501: { description: "Server does not support listing tools." }
5497
+ }
5498
+ }),
5499
+ listMcpServerToolsHandler
5500
+ );
5501
+ app.get(
5502
+ "/api/mcp/:serverId/tools/:toolId",
5503
+ h({
5504
+ description: "Get details for a specific tool on an MCP server.",
5505
+ tags: ["mcp"],
5506
+ parameters: [
5507
+ { name: "serverId", in: "path", required: true, schema: { type: "string" } },
5508
+ { name: "toolId", in: "path", required: true, schema: { type: "string" } }
5509
+ ],
5510
+ responses: {
5511
+ 200: { description: "Details of the specified tool." },
5512
+ // Define schema for McpToolInfo
5513
+ 404: { description: "MCP server or tool not found." },
5514
+ 501: { description: "Server does not support getting tool details." }
5515
+ }
5516
+ }),
5517
+ getMcpServerToolDetailHandler
5518
+ );
5519
+ app.post(
5520
+ "/api/mcp/:serverId/tools/:toolId/execute",
5521
+ bodyLimit(bodyLimitOptions),
5522
+ h({
5523
+ description: "Execute a specific tool on an MCP server.",
5524
+ tags: ["mcp"],
5525
+ parameters: [
5526
+ { name: "serverId", in: "path", required: true, schema: { type: "string" } },
5527
+ { name: "toolId", in: "path", required: true, schema: { type: "string" } }
5528
+ ],
5529
+ requestBody: {
5530
+ required: true,
5531
+ content: {
5532
+ "application/json": {
5533
+ schema: {
5534
+ type: "object",
5535
+ properties: {
5536
+ data: { type: "object" },
5537
+ runtimeContext: { type: "object" }
5538
+ }
5539
+ }
5540
+ }
5541
+ }
5542
+ // Simplified schema
5543
+ },
5544
+ responses: {
5545
+ 200: { description: "Result of the tool execution." },
5546
+ 400: { description: "Invalid tool arguments." },
5547
+ 404: { description: "MCP server or tool not found." },
5548
+ 501: { description: "Server does not support tool execution." }
5549
+ }
5550
+ }),
5551
+ executeMcpServerToolHandler
5552
+ );
5259
5553
  app.get(
5260
5554
  "/api/memory/status",
5261
5555
  h({
@@ -6609,7 +6903,7 @@ async function createNodeServer(mastra, options = {}) {
6609
6903
  {
6610
6904
  fetch: app.fetch,
6611
6905
  port,
6612
- hostname: serverOptions?.host ?? "localhost"
6906
+ hostname: serverOptions?.host
6613
6907
  },
6614
6908
  () => {
6615
6909
  const logger2 = mastra.getLogger();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/deployer",
3
- "version": "0.3.4-alpha.4",
3
+ "version": "0.3.5-alpha.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "files": [
@@ -107,8 +107,8 @@
107
107
  "rollup-plugin-node-externals": "^8.0.0",
108
108
  "typescript-paths": "^1.5.1",
109
109
  "zod": "^3.24.3",
110
- "@mastra/core": "^0.9.4-alpha.4",
111
- "@mastra/server": "^2.0.4-alpha.4"
110
+ "@mastra/core": "^0.9.5-alpha.0",
111
+ "@mastra/server": "^2.0.5-alpha.0"
112
112
  },
113
113
  "devDependencies": {
114
114
  "@hono/node-server": "^1.13.8",
@@ -127,8 +127,8 @@
127
127
  "type-fest": "^4.37.0",
128
128
  "typescript": "^5.8.2",
129
129
  "vitest": "^2.1.9",
130
- "@internal/lint": "0.0.4",
131
- "@mastra/mcp": "^0.5.0-alpha.6"
130
+ "@mastra/mcp": "^0.5.1-alpha.0",
131
+ "@internal/lint": "0.0.5"
132
132
  },
133
133
  "scripts": {
134
134
  "build": "tsup src/index.ts src/build/index.ts src/server/index.ts src/build/bundler.ts src/build/analyze.ts src/bundler/index.ts src/services/index.ts src/validator/loader.ts src/validator/custom-resolver.ts --format esm,cjs --clean --experimental-dts --treeshake=smallest --splitting --publicDir",