@mastra/client-js 0.0.0-mcp-schema-serializer-20250430202337 → 0.0.0-mcp-server-deploy-20250507160341

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 CHANGED
@@ -1,18 +1,60 @@
1
1
  # @mastra/client-js
2
2
 
3
- ## 0.0.0-mcp-schema-serializer-20250430202337
3
+ ## 0.0.0-mcp-server-deploy-20250507160341
4
4
 
5
5
  ### Patch Changes
6
6
 
7
+ - 4155f47: Add parameters to filter workflow runs
8
+ Add fromDate and toDate to telemetry parameters
7
9
  - 254f5c3: Audit, cleanup MastraClient
8
10
  - 0097d50: Add serializedStepGraph to vNext workflow
9
11
  Return serializedStepGraph from vNext workflow
10
12
  Use serializedStepGraph in vNext workflow graph
11
13
  - 2429c74: Add get workflow runs api to client-js
12
- - Updated dependencies [5316795]
14
+ - Updated dependencies [967b41c]
15
+ - Updated dependencies [26738f4]
16
+ - Updated dependencies [4155f47]
13
17
  - Updated dependencies [b804723]
18
+ - Updated dependencies [ccef9f9]
14
19
  - Updated dependencies [0097d50]
15
- - @mastra/core@0.0.0-mcp-schema-serializer-20250430202337
20
+ - Updated dependencies [17826a9]
21
+ - Updated dependencies [51e6923]
22
+ - @mastra/core@0.0.0-mcp-server-deploy-20250507160341
23
+
24
+ ## 0.1.20-alpha.4
25
+
26
+ ### Patch Changes
27
+
28
+ - Updated dependencies [ccef9f9]
29
+ - Updated dependencies [51e6923]
30
+ - @mastra/core@0.9.2-alpha.4
31
+
32
+ ## 0.1.20-alpha.3
33
+
34
+ ### Patch Changes
35
+
36
+ - 4155f47: Add parameters to filter workflow runs
37
+ Add fromDate and toDate to telemetry parameters
38
+ - Updated dependencies [967b41c]
39
+ - Updated dependencies [4155f47]
40
+ - Updated dependencies [17826a9]
41
+ - @mastra/core@0.9.2-alpha.3
42
+
43
+ ## 0.1.20-alpha.2
44
+
45
+ ### Patch Changes
46
+
47
+ - Updated dependencies [26738f4]
48
+ - @mastra/core@0.9.2-alpha.2
49
+
50
+ ## 0.1.20-alpha.1
51
+
52
+ ### Patch Changes
53
+
54
+ - 254f5c3: Audit, cleanup MastraClient
55
+ - 2429c74: Add get workflow runs api to client-js
56
+ - Updated dependencies [b804723]
57
+ - @mastra/core@0.9.2-alpha.1
16
58
 
17
59
  ## 0.1.20-alpha.0
18
60
 
package/dist/index.cjs CHANGED
@@ -375,10 +375,31 @@ var Workflow = class extends BaseResource {
375
375
  }
376
376
  /**
377
377
  * Retrieves all runs for a workflow
378
+ * @param params - Parameters for filtering runs
378
379
  * @returns Promise containing workflow runs array
379
380
  */
380
- runs() {
381
- return this.request(`/api/workflows/${this.workflowId}/runs`);
381
+ runs(params) {
382
+ const searchParams = new URLSearchParams();
383
+ if (params?.fromDate) {
384
+ searchParams.set("fromDate", params.fromDate.toISOString());
385
+ }
386
+ if (params?.toDate) {
387
+ searchParams.set("toDate", params.toDate.toISOString());
388
+ }
389
+ if (params?.limit) {
390
+ searchParams.set("limit", String(params.limit));
391
+ }
392
+ if (params?.offset) {
393
+ searchParams.set("offset", String(params.offset));
394
+ }
395
+ if (params?.resourceId) {
396
+ searchParams.set("resourceId", params.resourceId);
397
+ }
398
+ if (searchParams.size) {
399
+ return this.request(`/api/workflows/${this.workflowId}/runs?${searchParams}`);
400
+ } else {
401
+ return this.request(`/api/workflows/${this.workflowId}/runs`);
402
+ }
382
403
  }
383
404
  /**
384
405
  * @deprecated Use `startAsync` instead
@@ -622,10 +643,31 @@ var VNextWorkflow = class extends BaseResource {
622
643
  }
623
644
  /**
624
645
  * Retrieves all runs for a vNext workflow
646
+ * @param params - Parameters for filtering runs
625
647
  * @returns Promise containing vNext workflow runs array
626
648
  */
627
- runs() {
628
- return this.request(`/api/workflows/v-next/${this.workflowId}/runs`);
649
+ runs(params) {
650
+ const searchParams = new URLSearchParams();
651
+ if (params?.fromDate) {
652
+ searchParams.set("fromDate", params.fromDate.toISOString());
653
+ }
654
+ if (params?.toDate) {
655
+ searchParams.set("toDate", params.toDate.toISOString());
656
+ }
657
+ if (params?.limit) {
658
+ searchParams.set("limit", String(params.limit));
659
+ }
660
+ if (params?.offset) {
661
+ searchParams.set("offset", String(params.offset));
662
+ }
663
+ if (params?.resourceId) {
664
+ searchParams.set("resourceId", params.resourceId);
665
+ }
666
+ if (searchParams.size) {
667
+ return this.request(`/api/workflows/v-next/${this.workflowId}/runs?${searchParams}`);
668
+ } else {
669
+ return this.request(`/api/workflows/v-next/${this.workflowId}/runs`);
670
+ }
629
671
  }
630
672
  /**
631
673
  * Creates a new vNext workflow run
@@ -724,6 +766,21 @@ var VNextWorkflow = class extends BaseResource {
724
766
  }
725
767
  };
726
768
 
769
+ // src/resources/mcp.ts
770
+ var MCPServer = class extends BaseResource {
771
+ constructor(options, serverId) {
772
+ super(options);
773
+ this.serverId = serverId;
774
+ }
775
+ /**
776
+ * Get details about the MCP server
777
+ * @returns Promise containing server details
778
+ */
779
+ details() {
780
+ return this.request(`/api/mcp/servers/${this.serverId}`);
781
+ }
782
+ };
783
+
727
784
  // src/client.ts
728
785
  var MastraClient = class extends BaseResource {
729
786
  constructor(options) {
@@ -868,7 +925,7 @@ var MastraClient = class extends BaseResource {
868
925
  * @returns Promise containing telemetry data
869
926
  */
870
927
  getTelemetry(params) {
871
- const { name, scope, page, perPage, attribute } = params || {};
928
+ const { name, scope, page, perPage, attribute, fromDate, toDate } = params || {};
872
929
  const _attribute = attribute ? Object.entries(attribute).map(([key, value]) => `${key}:${value}`) : [];
873
930
  const searchParams = new URLSearchParams();
874
931
  if (name) {
@@ -892,6 +949,12 @@ var MastraClient = class extends BaseResource {
892
949
  searchParams.set("attribute", _attribute);
893
950
  }
894
951
  }
952
+ if (fromDate) {
953
+ searchParams.set("fromDate", fromDate.toISOString());
954
+ }
955
+ if (toDate) {
956
+ searchParams.set("toDate", toDate.toISOString());
957
+ }
895
958
  if (searchParams.size) {
896
959
  return this.request(`/api/telemetry?${searchParams}`);
897
960
  } else {
@@ -913,6 +976,21 @@ var MastraClient = class extends BaseResource {
913
976
  getNetwork(networkId) {
914
977
  return new Network(this.options, networkId);
915
978
  }
979
+ /**
980
+ * Retrieves all available MCP servers
981
+ * @returns Promise containing map of MCP server IDs to server details
982
+ */
983
+ getMCPServers() {
984
+ return this.request("/api/mcp/servers");
985
+ }
986
+ /**
987
+ * Gets an MCP server instance by ID
988
+ * @param serverId - ID of the MCP server to retrieve
989
+ * @returns MCPServer instance
990
+ */
991
+ getMCPServer(serverId) {
992
+ return new MCPServer(this.options, serverId);
993
+ }
916
994
  };
917
995
 
918
996
  exports.MastraClient = MastraClient;
package/dist/index.d.cts CHANGED
@@ -58,6 +58,13 @@ interface GetWorkflowResponse {
58
58
  stepSubscriberGraph: Record<string, StepGraph>;
59
59
  workflowId?: string;
60
60
  }
61
+ interface GetWorkflowRunsParams {
62
+ fromDate?: Date;
63
+ toDate?: Date;
64
+ limit?: number;
65
+ offset?: number;
66
+ resourceId?: string;
67
+ }
61
68
  type GetWorkflowRunsResponse = WorkflowRuns;
62
69
  type WorkflowRunResult = {
63
70
  activePaths: Record<string, {
@@ -197,6 +204,8 @@ interface GetTelemetryParams {
197
204
  page?: number;
198
205
  perPage?: number;
199
206
  attribute?: Record<string, string>;
207
+ fromDate?: Date;
208
+ toDate?: Date;
200
209
  }
201
210
  interface GetNetworkResponse {
202
211
  name: string;
@@ -212,6 +221,16 @@ interface GetNetworkResponse {
212
221
  };
213
222
  state?: Record<string, any>;
214
223
  }
224
+ interface GetMCPServerResponse {
225
+ id: string;
226
+ name: string;
227
+ description?: string;
228
+ tools: Array<{
229
+ name: string;
230
+ description: string;
231
+ parameters: Record<string, any>;
232
+ }>;
233
+ }
215
234
 
216
235
  declare class BaseResource {
217
236
  readonly options: ClientOptions;
@@ -404,9 +423,10 @@ declare class Workflow extends BaseResource {
404
423
  details(): Promise<GetWorkflowResponse>;
405
424
  /**
406
425
  * Retrieves all runs for a workflow
426
+ * @param params - Parameters for filtering runs
407
427
  * @returns Promise containing workflow runs array
408
428
  */
409
- runs(): Promise<GetWorkflowRunsResponse>;
429
+ runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
410
430
  /**
411
431
  * @deprecated Use `startAsync` instead
412
432
  * Executes the workflow with the provided parameters
@@ -522,9 +542,10 @@ declare class VNextWorkflow extends BaseResource {
522
542
  details(): Promise<GetVNextWorkflowResponse>;
523
543
  /**
524
544
  * Retrieves all runs for a vNext workflow
545
+ * @param params - Parameters for filtering runs
525
546
  * @returns Promise containing vNext workflow runs array
526
547
  */
527
- runs(): Promise<GetWorkflowRunsResponse>;
548
+ runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
528
549
  /**
529
550
  * Creates a new vNext workflow run
530
551
  * @param params - Optional object containing the optional runId
@@ -591,6 +612,19 @@ declare class VNextWorkflow extends BaseResource {
591
612
  }, onRecord: (record: VNextWorkflowWatchResult) => void): Promise<void>;
592
613
  }
593
614
 
615
+ /**
616
+ * MCP Server resource for interacting with MCP servers
617
+ */
618
+ declare class MCPServer extends BaseResource {
619
+ private serverId;
620
+ constructor(options: ClientOptions, serverId: string);
621
+ /**
622
+ * Get details about the MCP server
623
+ * @returns Promise containing server details
624
+ */
625
+ details(): Promise<GetMCPServerResponse>;
626
+ }
627
+
594
628
  declare class MastraClient extends BaseResource {
595
629
  constructor(options: ClientOptions);
596
630
  /**
@@ -710,6 +744,17 @@ declare class MastraClient extends BaseResource {
710
744
  * @returns Network instance
711
745
  */
712
746
  getNetwork(networkId: string): Network;
747
+ /**
748
+ * Retrieves all available MCP servers
749
+ * @returns Promise containing map of MCP server IDs to server details
750
+ */
751
+ getMCPServers(): Promise<Record<string, GetMCPServerResponse>>;
752
+ /**
753
+ * Gets an MCP server instance by ID
754
+ * @param serverId - ID of the MCP server to retrieve
755
+ * @returns MCPServer instance
756
+ */
757
+ getMCPServer(serverId: string): MCPServer;
713
758
  }
714
759
 
715
- export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GenerateParams, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextWorkflowResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunsResponse, MastraClient, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type VNextWorkflowRunResult, type VNextWorkflowWatchResult, type WorkflowRunResult };
760
+ export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GenerateParams, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMCPServerResponse, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextWorkflowResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunsParams, type GetWorkflowRunsResponse, MastraClient, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type VNextWorkflowRunResult, type VNextWorkflowWatchResult, type WorkflowRunResult };
package/dist/index.d.ts CHANGED
@@ -58,6 +58,13 @@ interface GetWorkflowResponse {
58
58
  stepSubscriberGraph: Record<string, StepGraph>;
59
59
  workflowId?: string;
60
60
  }
61
+ interface GetWorkflowRunsParams {
62
+ fromDate?: Date;
63
+ toDate?: Date;
64
+ limit?: number;
65
+ offset?: number;
66
+ resourceId?: string;
67
+ }
61
68
  type GetWorkflowRunsResponse = WorkflowRuns;
62
69
  type WorkflowRunResult = {
63
70
  activePaths: Record<string, {
@@ -197,6 +204,8 @@ interface GetTelemetryParams {
197
204
  page?: number;
198
205
  perPage?: number;
199
206
  attribute?: Record<string, string>;
207
+ fromDate?: Date;
208
+ toDate?: Date;
200
209
  }
201
210
  interface GetNetworkResponse {
202
211
  name: string;
@@ -212,6 +221,16 @@ interface GetNetworkResponse {
212
221
  };
213
222
  state?: Record<string, any>;
214
223
  }
224
+ interface GetMCPServerResponse {
225
+ id: string;
226
+ name: string;
227
+ description?: string;
228
+ tools: Array<{
229
+ name: string;
230
+ description: string;
231
+ parameters: Record<string, any>;
232
+ }>;
233
+ }
215
234
 
216
235
  declare class BaseResource {
217
236
  readonly options: ClientOptions;
@@ -404,9 +423,10 @@ declare class Workflow extends BaseResource {
404
423
  details(): Promise<GetWorkflowResponse>;
405
424
  /**
406
425
  * Retrieves all runs for a workflow
426
+ * @param params - Parameters for filtering runs
407
427
  * @returns Promise containing workflow runs array
408
428
  */
409
- runs(): Promise<GetWorkflowRunsResponse>;
429
+ runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
410
430
  /**
411
431
  * @deprecated Use `startAsync` instead
412
432
  * Executes the workflow with the provided parameters
@@ -522,9 +542,10 @@ declare class VNextWorkflow extends BaseResource {
522
542
  details(): Promise<GetVNextWorkflowResponse>;
523
543
  /**
524
544
  * Retrieves all runs for a vNext workflow
545
+ * @param params - Parameters for filtering runs
525
546
  * @returns Promise containing vNext workflow runs array
526
547
  */
527
- runs(): Promise<GetWorkflowRunsResponse>;
548
+ runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
528
549
  /**
529
550
  * Creates a new vNext workflow run
530
551
  * @param params - Optional object containing the optional runId
@@ -591,6 +612,19 @@ declare class VNextWorkflow extends BaseResource {
591
612
  }, onRecord: (record: VNextWorkflowWatchResult) => void): Promise<void>;
592
613
  }
593
614
 
615
+ /**
616
+ * MCP Server resource for interacting with MCP servers
617
+ */
618
+ declare class MCPServer extends BaseResource {
619
+ private serverId;
620
+ constructor(options: ClientOptions, serverId: string);
621
+ /**
622
+ * Get details about the MCP server
623
+ * @returns Promise containing server details
624
+ */
625
+ details(): Promise<GetMCPServerResponse>;
626
+ }
627
+
594
628
  declare class MastraClient extends BaseResource {
595
629
  constructor(options: ClientOptions);
596
630
  /**
@@ -710,6 +744,17 @@ declare class MastraClient extends BaseResource {
710
744
  * @returns Network instance
711
745
  */
712
746
  getNetwork(networkId: string): Network;
747
+ /**
748
+ * Retrieves all available MCP servers
749
+ * @returns Promise containing map of MCP server IDs to server details
750
+ */
751
+ getMCPServers(): Promise<Record<string, GetMCPServerResponse>>;
752
+ /**
753
+ * Gets an MCP server instance by ID
754
+ * @param serverId - ID of the MCP server to retrieve
755
+ * @returns MCPServer instance
756
+ */
757
+ getMCPServer(serverId: string): MCPServer;
713
758
  }
714
759
 
715
- export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GenerateParams, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextWorkflowResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunsResponse, MastraClient, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type VNextWorkflowRunResult, type VNextWorkflowWatchResult, type WorkflowRunResult };
760
+ export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GenerateParams, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMCPServerResponse, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextWorkflowResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunsParams, type GetWorkflowRunsResponse, MastraClient, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type VNextWorkflowRunResult, type VNextWorkflowWatchResult, type WorkflowRunResult };
package/dist/index.js CHANGED
@@ -373,10 +373,31 @@ var Workflow = class extends BaseResource {
373
373
  }
374
374
  /**
375
375
  * Retrieves all runs for a workflow
376
+ * @param params - Parameters for filtering runs
376
377
  * @returns Promise containing workflow runs array
377
378
  */
378
- runs() {
379
- return this.request(`/api/workflows/${this.workflowId}/runs`);
379
+ runs(params) {
380
+ const searchParams = new URLSearchParams();
381
+ if (params?.fromDate) {
382
+ searchParams.set("fromDate", params.fromDate.toISOString());
383
+ }
384
+ if (params?.toDate) {
385
+ searchParams.set("toDate", params.toDate.toISOString());
386
+ }
387
+ if (params?.limit) {
388
+ searchParams.set("limit", String(params.limit));
389
+ }
390
+ if (params?.offset) {
391
+ searchParams.set("offset", String(params.offset));
392
+ }
393
+ if (params?.resourceId) {
394
+ searchParams.set("resourceId", params.resourceId);
395
+ }
396
+ if (searchParams.size) {
397
+ return this.request(`/api/workflows/${this.workflowId}/runs?${searchParams}`);
398
+ } else {
399
+ return this.request(`/api/workflows/${this.workflowId}/runs`);
400
+ }
380
401
  }
381
402
  /**
382
403
  * @deprecated Use `startAsync` instead
@@ -620,10 +641,31 @@ var VNextWorkflow = class extends BaseResource {
620
641
  }
621
642
  /**
622
643
  * Retrieves all runs for a vNext workflow
644
+ * @param params - Parameters for filtering runs
623
645
  * @returns Promise containing vNext workflow runs array
624
646
  */
625
- runs() {
626
- return this.request(`/api/workflows/v-next/${this.workflowId}/runs`);
647
+ runs(params) {
648
+ const searchParams = new URLSearchParams();
649
+ if (params?.fromDate) {
650
+ searchParams.set("fromDate", params.fromDate.toISOString());
651
+ }
652
+ if (params?.toDate) {
653
+ searchParams.set("toDate", params.toDate.toISOString());
654
+ }
655
+ if (params?.limit) {
656
+ searchParams.set("limit", String(params.limit));
657
+ }
658
+ if (params?.offset) {
659
+ searchParams.set("offset", String(params.offset));
660
+ }
661
+ if (params?.resourceId) {
662
+ searchParams.set("resourceId", params.resourceId);
663
+ }
664
+ if (searchParams.size) {
665
+ return this.request(`/api/workflows/v-next/${this.workflowId}/runs?${searchParams}`);
666
+ } else {
667
+ return this.request(`/api/workflows/v-next/${this.workflowId}/runs`);
668
+ }
627
669
  }
628
670
  /**
629
671
  * Creates a new vNext workflow run
@@ -722,6 +764,21 @@ var VNextWorkflow = class extends BaseResource {
722
764
  }
723
765
  };
724
766
 
767
+ // src/resources/mcp.ts
768
+ var MCPServer = class extends BaseResource {
769
+ constructor(options, serverId) {
770
+ super(options);
771
+ this.serverId = serverId;
772
+ }
773
+ /**
774
+ * Get details about the MCP server
775
+ * @returns Promise containing server details
776
+ */
777
+ details() {
778
+ return this.request(`/api/mcp/servers/${this.serverId}`);
779
+ }
780
+ };
781
+
725
782
  // src/client.ts
726
783
  var MastraClient = class extends BaseResource {
727
784
  constructor(options) {
@@ -866,7 +923,7 @@ var MastraClient = class extends BaseResource {
866
923
  * @returns Promise containing telemetry data
867
924
  */
868
925
  getTelemetry(params) {
869
- const { name, scope, page, perPage, attribute } = params || {};
926
+ const { name, scope, page, perPage, attribute, fromDate, toDate } = params || {};
870
927
  const _attribute = attribute ? Object.entries(attribute).map(([key, value]) => `${key}:${value}`) : [];
871
928
  const searchParams = new URLSearchParams();
872
929
  if (name) {
@@ -890,6 +947,12 @@ var MastraClient = class extends BaseResource {
890
947
  searchParams.set("attribute", _attribute);
891
948
  }
892
949
  }
950
+ if (fromDate) {
951
+ searchParams.set("fromDate", fromDate.toISOString());
952
+ }
953
+ if (toDate) {
954
+ searchParams.set("toDate", toDate.toISOString());
955
+ }
893
956
  if (searchParams.size) {
894
957
  return this.request(`/api/telemetry?${searchParams}`);
895
958
  } else {
@@ -911,6 +974,21 @@ var MastraClient = class extends BaseResource {
911
974
  getNetwork(networkId) {
912
975
  return new Network(this.options, networkId);
913
976
  }
977
+ /**
978
+ * Retrieves all available MCP servers
979
+ * @returns Promise containing map of MCP server IDs to server details
980
+ */
981
+ getMCPServers() {
982
+ return this.request("/api/mcp/servers");
983
+ }
984
+ /**
985
+ * Gets an MCP server instance by ID
986
+ * @param serverId - ID of the MCP server to retrieve
987
+ * @returns MCPServer instance
988
+ */
989
+ getMCPServer(serverId) {
990
+ return new MCPServer(this.options, serverId);
991
+ }
914
992
  };
915
993
 
916
994
  export { MastraClient };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/client-js",
3
- "version": "0.0.0-mcp-schema-serializer-20250430202337",
3
+ "version": "0.0.0-mcp-server-deploy-20250507160341",
4
4
  "description": "The official TypeScript library for the Mastra Client API",
5
5
  "author": "",
6
6
  "type": "module",
@@ -26,7 +26,7 @@
26
26
  "json-schema": "^0.4.0",
27
27
  "zod": "^3.24.2",
28
28
  "zod-to-json-schema": "^3.24.3",
29
- "@mastra/core": "0.0.0-mcp-schema-serializer-20250430202337"
29
+ "@mastra/core": "0.0.0-mcp-server-deploy-20250507160341"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "zod": "^3.24.2"
package/src/client.ts CHANGED
@@ -1,4 +1,14 @@
1
- import { Agent, MemoryThread, Tool, Workflow, Vector, BaseResource, Network, VNextWorkflow } from './resources';
1
+ import {
2
+ Agent,
3
+ MemoryThread,
4
+ Tool,
5
+ Workflow,
6
+ Vector,
7
+ BaseResource,
8
+ Network,
9
+ VNextWorkflow,
10
+ MCPServer,
11
+ } from './resources';
2
12
  import type {
3
13
  ClientOptions,
4
14
  CreateMemoryThreadParams,
@@ -7,6 +17,7 @@ import type {
7
17
  GetLogParams,
8
18
  GetLogsParams,
9
19
  GetLogsResponse,
20
+ GetMCPServerResponse,
10
21
  GetMemoryThreadParams,
11
22
  GetMemoryThreadResponse,
12
23
  GetNetworkResponse,
@@ -180,7 +191,7 @@ export class MastraClient extends BaseResource {
180
191
  * @returns Promise containing telemetry data
181
192
  */
182
193
  public getTelemetry(params?: GetTelemetryParams): Promise<GetTelemetryResponse> {
183
- const { name, scope, page, perPage, attribute } = params || {};
194
+ const { name, scope, page, perPage, attribute, fromDate, toDate } = params || {};
184
195
  const _attribute = attribute ? Object.entries(attribute).map(([key, value]) => `${key}:${value}`) : [];
185
196
 
186
197
  const searchParams = new URLSearchParams();
@@ -205,6 +216,12 @@ export class MastraClient extends BaseResource {
205
216
  searchParams.set('attribute', _attribute);
206
217
  }
207
218
  }
219
+ if (fromDate) {
220
+ searchParams.set('fromDate', fromDate.toISOString());
221
+ }
222
+ if (toDate) {
223
+ searchParams.set('toDate', toDate.toISOString());
224
+ }
208
225
 
209
226
  if (searchParams.size) {
210
227
  return this.request(`/api/telemetry?${searchParams}`);
@@ -229,4 +246,21 @@ export class MastraClient extends BaseResource {
229
246
  public getNetwork(networkId: string) {
230
247
  return new Network(this.options, networkId);
231
248
  }
249
+
250
+ /**
251
+ * Retrieves all available MCP servers
252
+ * @returns Promise containing map of MCP server IDs to server details
253
+ */
254
+ public getMCPServers(): Promise<Record<string, GetMCPServerResponse>> {
255
+ return this.request('/api/mcp/servers');
256
+ }
257
+
258
+ /**
259
+ * Gets an MCP server instance by ID
260
+ * @param serverId - ID of the MCP server to retrieve
261
+ * @returns MCPServer instance
262
+ */
263
+ public getMCPServer(serverId: string) {
264
+ return new MCPServer(this.options, serverId);
265
+ }
232
266
  }
@@ -6,3 +6,4 @@ export * from './workflow';
6
6
  export * from './tool';
7
7
  export * from './base';
8
8
  export * from './vnext-workflow';
9
+ export * from './mcp';
@@ -0,0 +1,22 @@
1
+ import type { ClientOptions, GetMCPServerResponse } from '../types';
2
+ import { BaseResource } from './base';
3
+
4
+ /**
5
+ * MCP Server resource for interacting with MCP servers
6
+ */
7
+ export class MCPServer extends BaseResource {
8
+ constructor(
9
+ options: ClientOptions,
10
+ private serverId: string,
11
+ ) {
12
+ super(options);
13
+ }
14
+
15
+ /**
16
+ * Get details about the MCP server
17
+ * @returns Promise containing server details
18
+ */
19
+ details(): Promise<GetMCPServerResponse> {
20
+ return this.request(`/api/mcp/servers/${this.serverId}`);
21
+ }
22
+ }
@@ -2,6 +2,7 @@ import type { RuntimeContext } from '@mastra/core/runtime-context';
2
2
  import type {
3
3
  ClientOptions,
4
4
  GetVNextWorkflowResponse,
5
+ GetWorkflowRunsParams,
5
6
  GetWorkflowRunsResponse,
6
7
  VNextWorkflowRunResult,
7
8
  VNextWorkflowWatchResult,
@@ -100,10 +101,32 @@ export class VNextWorkflow extends BaseResource {
100
101
 
101
102
  /**
102
103
  * Retrieves all runs for a vNext workflow
104
+ * @param params - Parameters for filtering runs
103
105
  * @returns Promise containing vNext workflow runs array
104
106
  */
105
- runs(): Promise<GetWorkflowRunsResponse> {
106
- return this.request(`/api/workflows/v-next/${this.workflowId}/runs`);
107
+ runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse> {
108
+ const searchParams = new URLSearchParams();
109
+ if (params?.fromDate) {
110
+ searchParams.set('fromDate', params.fromDate.toISOString());
111
+ }
112
+ if (params?.toDate) {
113
+ searchParams.set('toDate', params.toDate.toISOString());
114
+ }
115
+ if (params?.limit) {
116
+ searchParams.set('limit', String(params.limit));
117
+ }
118
+ if (params?.offset) {
119
+ searchParams.set('offset', String(params.offset));
120
+ }
121
+ if (params?.resourceId) {
122
+ searchParams.set('resourceId', params.resourceId);
123
+ }
124
+
125
+ if (searchParams.size) {
126
+ return this.request(`/api/workflows/v-next/${this.workflowId}/runs?${searchParams}`);
127
+ } else {
128
+ return this.request(`/api/workflows/v-next/${this.workflowId}/runs`);
129
+ }
107
130
  }
108
131
 
109
132
  /**
@@ -1,4 +1,10 @@
1
- import type { GetWorkflowResponse, ClientOptions, WorkflowRunResult, GetWorkflowRunsResponse } from '../types';
1
+ import type {
2
+ GetWorkflowResponse,
3
+ ClientOptions,
4
+ WorkflowRunResult,
5
+ GetWorkflowRunsResponse,
6
+ GetWorkflowRunsParams,
7
+ } from '../types';
2
8
 
3
9
  import { BaseResource } from './base';
4
10
 
@@ -22,10 +28,32 @@ export class Workflow extends BaseResource {
22
28
 
23
29
  /**
24
30
  * Retrieves all runs for a workflow
31
+ * @param params - Parameters for filtering runs
25
32
  * @returns Promise containing workflow runs array
26
33
  */
27
- runs(): Promise<GetWorkflowRunsResponse> {
28
- return this.request(`/api/workflows/${this.workflowId}/runs`);
34
+ runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse> {
35
+ const searchParams = new URLSearchParams();
36
+ if (params?.fromDate) {
37
+ searchParams.set('fromDate', params.fromDate.toISOString());
38
+ }
39
+ if (params?.toDate) {
40
+ searchParams.set('toDate', params.toDate.toISOString());
41
+ }
42
+ if (params?.limit) {
43
+ searchParams.set('limit', String(params.limit));
44
+ }
45
+ if (params?.offset) {
46
+ searchParams.set('offset', String(params.offset));
47
+ }
48
+ if (params?.resourceId) {
49
+ searchParams.set('resourceId', params.resourceId);
50
+ }
51
+
52
+ if (searchParams.size) {
53
+ return this.request(`/api/workflows/${this.workflowId}/runs?${searchParams}`);
54
+ } else {
55
+ return this.request(`/api/workflows/${this.workflowId}/runs`);
56
+ }
29
57
  }
30
58
 
31
59
  /**
package/src/types.ts CHANGED
@@ -77,6 +77,14 @@ export interface GetWorkflowResponse {
77
77
  workflowId?: string;
78
78
  }
79
79
 
80
+ export interface GetWorkflowRunsParams {
81
+ fromDate?: Date;
82
+ toDate?: Date;
83
+ limit?: number;
84
+ offset?: number;
85
+ resourceId?: string;
86
+ }
87
+
80
88
  export type GetWorkflowRunsResponse = WorkflowRuns;
81
89
 
82
90
  export type WorkflowRunResult = {
@@ -234,6 +242,8 @@ export interface GetTelemetryParams {
234
242
  page?: number;
235
243
  perPage?: number;
236
244
  attribute?: Record<string, string>;
245
+ fromDate?: Date;
246
+ toDate?: Date;
237
247
  }
238
248
 
239
249
  export interface GetNetworkResponse {
@@ -250,3 +260,14 @@ export interface GetNetworkResponse {
250
260
  };
251
261
  state?: Record<string, any>;
252
262
  }
263
+
264
+ export interface GetMCPServerResponse {
265
+ id: string;
266
+ name: string;
267
+ description?: string;
268
+ tools: Array<{
269
+ name: string;
270
+ description: string;
271
+ parameters: Record<string, any>;
272
+ }>;
273
+ }