@mastra/core 0.9.4-alpha.0 → 0.9.4-alpha.2

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.
Files changed (138) hide show
  1. package/dist/agent/index.cjs +2 -2
  2. package/dist/agent/index.d.cts +4 -3
  3. package/dist/agent/index.d.ts +4 -3
  4. package/dist/agent/index.js +1 -1
  5. package/dist/{base-CeEVvwRi.d.ts → base-4Z34GQL8.d.ts} +1 -1
  6. package/dist/{base-VMWGZau0.d.cts → base-BH9nLjiE.d.cts} +159 -16
  7. package/dist/{base-BCnFhShR.d.ts → base-Ds8Er4RI.d.ts} +159 -16
  8. package/dist/{base-D9APQt4V.d.cts → base-H7siSAfu.d.cts} +1 -1
  9. package/dist/base.cjs +2 -2
  10. package/dist/base.d.cts +2 -2
  11. package/dist/base.d.ts +2 -2
  12. package/dist/base.js +1 -1
  13. package/dist/bundler/index.cjs +2 -2
  14. package/dist/bundler/index.d.cts +2 -2
  15. package/dist/bundler/index.d.ts +2 -2
  16. package/dist/bundler/index.js +1 -1
  17. package/dist/{chunk-NDAW47QQ.js → chunk-235X76GC.js} +1 -1
  18. package/dist/{chunk-BMSBIZKD.cjs → chunk-2GXSTMD7.cjs} +2 -2
  19. package/dist/{chunk-Q6ZDDQOB.js → chunk-2OC4YT6C.js} +1 -1
  20. package/dist/{chunk-FXAV2WYX.cjs → chunk-2TW4KTAP.cjs} +47 -26
  21. package/dist/{chunk-ZHCBQ7GF.js → chunk-4OTKXCGD.js} +1 -1
  22. package/dist/{chunk-OGNJRWRQ.cjs → chunk-5DUFC7TV.cjs} +2 -2
  23. package/dist/{chunk-S6OGHYA5.js → chunk-6YUKY7NG.js} +4 -4
  24. package/dist/{chunk-KPOUHZFJ.js → chunk-7BYKMXS2.js} +3 -3
  25. package/dist/{chunk-6YITFTRU.cjs → chunk-7FV65Q6G.cjs} +2 -2
  26. package/dist/{chunk-JIRLIXUC.js → chunk-CLQS5YQO.js} +240 -58
  27. package/dist/{chunk-2BVZNKLX.js → chunk-CMPPXW4U.js} +2 -1
  28. package/dist/{chunk-CPONI4EX.js → chunk-CTKNWYK2.js} +1 -1
  29. package/dist/{chunk-6NUAJ6AB.cjs → chunk-E4FAXBUV.cjs} +2 -2
  30. package/dist/{chunk-RO52JMKQ.cjs → chunk-EG74VBSP.cjs} +6 -6
  31. package/dist/{chunk-JCBDQUQY.js → chunk-EK3WKXRL.js} +1 -1
  32. package/dist/{chunk-5ENQX4BI.cjs → chunk-GXKODTLA.cjs} +42 -9
  33. package/dist/{chunk-UWRSG6F2.cjs → chunk-IIK2DDET.cjs} +2 -2
  34. package/dist/{chunk-QFJY3MEL.js → chunk-JBJ7KXN5.js} +1 -1
  35. package/dist/{chunk-25XLNT54.cjs → chunk-MT4MRB64.cjs} +11 -11
  36. package/dist/{chunk-ZMMZXEOL.cjs → chunk-MUCBDM7Y.cjs} +9 -9
  37. package/dist/{chunk-TCL7XDJL.js → chunk-NLBJOFNG.js} +1 -1
  38. package/dist/{chunk-FVYYXFPR.js → chunk-NOPY74PV.js} +1 -1
  39. package/dist/{chunk-ZQ7FXUGY.js → chunk-NW6LO3QH.js} +46 -24
  40. package/dist/{chunk-O7IW545H.cjs → chunk-O44MSFMZ.cjs} +2 -1
  41. package/dist/{chunk-6SEZATEX.cjs → chunk-OH4OCBZW.cjs} +254 -72
  42. package/dist/{chunk-RE5MNHDE.cjs → chunk-RAQBTCIR.cjs} +2 -2
  43. package/dist/{chunk-CRHH7KRS.cjs → chunk-RGE4UF6A.cjs} +2 -2
  44. package/dist/{chunk-KXWR3FNX.cjs → chunk-S7J63JOG.cjs} +2 -2
  45. package/dist/{chunk-IKZWOULI.js → chunk-SOLXHDNQ.js} +35 -2
  46. package/dist/{chunk-T5V4W7WU.js → chunk-TAFOICHR.js} +1 -1
  47. package/dist/{chunk-T5EDV4ZU.js → chunk-U6I2YTXP.js} +1 -1
  48. package/dist/{chunk-GUMHVPHG.cjs → chunk-V2Q2FEVO.cjs} +2 -2
  49. package/dist/{chunk-DWD7X4KB.js → chunk-W4BSLENO.js} +1 -1
  50. package/dist/{chunk-R2ABCCZR.cjs → chunk-ZPFKNO6J.cjs} +2 -2
  51. package/dist/deployer/index.cjs +2 -2
  52. package/dist/deployer/index.d.cts +2 -2
  53. package/dist/deployer/index.d.ts +2 -2
  54. package/dist/deployer/index.js +1 -1
  55. package/dist/eval/index.d.cts +4 -3
  56. package/dist/eval/index.d.ts +4 -3
  57. package/dist/{index-CquI0inB.d.ts → index-QV27jkxQ.d.cts} +1 -0
  58. package/dist/{index-CquI0inB.d.cts → index-QV27jkxQ.d.ts} +1 -0
  59. package/dist/index.cjs +69 -69
  60. package/dist/index.d.cts +7 -6
  61. package/dist/index.d.ts +7 -6
  62. package/dist/index.js +16 -16
  63. package/dist/integration/index.cjs +3 -3
  64. package/dist/integration/index.d.cts +4 -3
  65. package/dist/integration/index.d.ts +4 -3
  66. package/dist/integration/index.js +1 -1
  67. package/dist/llm/index.d.cts +4 -3
  68. package/dist/llm/index.d.ts +4 -3
  69. package/dist/logger/index.cjs +9 -9
  70. package/dist/logger/index.d.cts +1 -1
  71. package/dist/logger/index.d.ts +1 -1
  72. package/dist/logger/index.js +1 -1
  73. package/dist/mastra/index.cjs +2 -2
  74. package/dist/mastra/index.d.cts +4 -3
  75. package/dist/mastra/index.d.ts +4 -3
  76. package/dist/mastra/index.js +1 -1
  77. package/dist/mcp/index.cjs +42 -0
  78. package/dist/mcp/index.d.cts +26 -0
  79. package/dist/mcp/index.d.ts +26 -0
  80. package/dist/mcp/index.js +40 -0
  81. package/dist/memory/index.cjs +4 -4
  82. package/dist/memory/index.d.cts +4 -3
  83. package/dist/memory/index.d.ts +4 -3
  84. package/dist/memory/index.js +1 -1
  85. package/dist/network/index.cjs +8 -8
  86. package/dist/network/index.d.cts +4 -3
  87. package/dist/network/index.d.ts +4 -3
  88. package/dist/network/index.js +4 -4
  89. package/dist/relevance/index.cjs +4 -4
  90. package/dist/relevance/index.d.cts +4 -3
  91. package/dist/relevance/index.d.ts +4 -3
  92. package/dist/relevance/index.js +1 -1
  93. package/dist/server/index.d.cts +4 -3
  94. package/dist/server/index.d.ts +4 -3
  95. package/dist/storage/index.cjs +2 -2
  96. package/dist/storage/index.d.cts +4 -3
  97. package/dist/storage/index.d.ts +4 -3
  98. package/dist/storage/index.js +1 -1
  99. package/dist/storage/libsql/index.cjs +2 -2
  100. package/dist/storage/libsql/index.d.cts +4 -3
  101. package/dist/storage/libsql/index.d.ts +4 -3
  102. package/dist/storage/libsql/index.js +1 -1
  103. package/dist/telemetry/index.d.cts +4 -3
  104. package/dist/telemetry/index.d.ts +4 -3
  105. package/dist/tools/index.cjs +4 -4
  106. package/dist/tools/index.d.cts +4 -3
  107. package/dist/tools/index.d.ts +4 -3
  108. package/dist/tools/index.js +1 -1
  109. package/dist/tts/index.cjs +2 -2
  110. package/dist/tts/index.d.cts +2 -2
  111. package/dist/tts/index.d.ts +2 -2
  112. package/dist/tts/index.js +1 -1
  113. package/dist/utils.cjs +12 -12
  114. package/dist/utils.d.cts +5 -4
  115. package/dist/utils.d.ts +5 -4
  116. package/dist/utils.js +1 -1
  117. package/dist/vector/index.cjs +2 -2
  118. package/dist/vector/index.d.cts +2 -2
  119. package/dist/vector/index.d.ts +2 -2
  120. package/dist/vector/index.js +1 -1
  121. package/dist/vector/libsql/index.cjs +3 -3
  122. package/dist/vector/libsql/index.d.cts +2 -2
  123. package/dist/vector/libsql/index.d.ts +2 -2
  124. package/dist/vector/libsql/index.js +1 -1
  125. package/dist/voice/index.cjs +4 -4
  126. package/dist/voice/index.d.cts +4 -3
  127. package/dist/voice/index.d.ts +4 -3
  128. package/dist/voice/index.js +1 -1
  129. package/dist/workflows/index.cjs +22 -22
  130. package/dist/workflows/index.d.cts +5 -4
  131. package/dist/workflows/index.d.ts +5 -4
  132. package/dist/workflows/index.js +1 -1
  133. package/dist/workflows/vNext/index.cjs +10 -10
  134. package/dist/workflows/vNext/index.d.cts +5 -4
  135. package/dist/workflows/vNext/index.d.ts +5 -4
  136. package/dist/workflows/vNext/index.js +4 -4
  137. package/mcp.d.ts +1 -0
  138. package/package.json +2 -2
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var chunk6SEZATEX_cjs = require('../chunk-6SEZATEX.cjs');
3
+ var chunkOH4OCBZW_cjs = require('../chunk-OH4OCBZW.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "Agent", {
8
8
  enumerable: true,
9
- get: function () { return chunk6SEZATEX_cjs.Agent; }
9
+ get: function () { return chunkOH4OCBZW_cjs.Agent; }
10
10
  });
@@ -1,12 +1,12 @@
1
1
  export { Message as AiMessageType } from 'ai';
2
2
  import 'json-schema';
3
3
  import 'zod';
4
- export { F as Agent, G as AgentConfig, be as AgentGenerateOptions, bf as AgentStreamOptions, bd as DynamicArgument, b1 as MastraLanguageModel, b3 as ToolsInput, bc as ToolsetsInput } from '../base-VMWGZau0.cjs';
5
- import '../base-D9APQt4V.cjs';
4
+ export { F as Agent, G as AgentConfig, bj as AgentGenerateOptions, bk as AgentStreamOptions, bi as DynamicArgument, b2 as MastraLanguageModel, b4 as ToolsInput, bh as ToolsetsInput } from '../base-BH9nLjiE.cjs';
5
+ import '../base-H7siSAfu.cjs';
6
6
  import '../types-BtMyV38I.cjs';
7
7
  import '../runtime-context/index.cjs';
8
8
  import 'sift';
9
- import '../index-CquI0inB.cjs';
9
+ import '../index-QV27jkxQ.cjs';
10
10
  import 'stream';
11
11
  import 'pino';
12
12
  import '@opentelemetry/api';
@@ -16,6 +16,7 @@ import '../vector/index.cjs';
16
16
  import '../vector/filter/index.cjs';
17
17
  import '@opentelemetry/sdk-trace-base';
18
18
  import '../tts/index.cjs';
19
+ import 'node:http';
19
20
  import 'events';
20
21
  import '../deployer/index.cjs';
21
22
  import '../bundler/index.cjs';
@@ -1,12 +1,12 @@
1
1
  export { Message as AiMessageType } from 'ai';
2
2
  import 'json-schema';
3
3
  import 'zod';
4
- export { F as Agent, G as AgentConfig, be as AgentGenerateOptions, bf as AgentStreamOptions, bd as DynamicArgument, b1 as MastraLanguageModel, b3 as ToolsInput, bc as ToolsetsInput } from '../base-BCnFhShR.js';
5
- import '../base-CeEVvwRi.js';
4
+ export { F as Agent, G as AgentConfig, bj as AgentGenerateOptions, bk as AgentStreamOptions, bi as DynamicArgument, b2 as MastraLanguageModel, b4 as ToolsInput, bh as ToolsetsInput } from '../base-Ds8Er4RI.js';
5
+ import '../base-4Z34GQL8.js';
6
6
  import '../types-BtMyV38I.js';
7
7
  import '../runtime-context/index.js';
8
8
  import 'sift';
9
- import '../index-CquI0inB.js';
9
+ import '../index-QV27jkxQ.js';
10
10
  import 'stream';
11
11
  import 'pino';
12
12
  import '@opentelemetry/api';
@@ -16,6 +16,7 @@ import '../vector/index.js';
16
16
  import '../vector/filter/index.js';
17
17
  import '@opentelemetry/sdk-trace-base';
18
18
  import '../tts/index.js';
19
+ import 'node:http';
19
20
  import 'events';
20
21
  import '../deployer/index.js';
21
22
  import '../bundler/index.js';
@@ -1 +1 @@
1
- export { Agent } from '../chunk-JIRLIXUC.js';
1
+ export { Agent } from '../chunk-CLQS5YQO.js';
@@ -1,6 +1,6 @@
1
1
  import * as _opentelemetry_api from '@opentelemetry/api';
2
2
  import { Tracer, Span, BaggageEntry, Context } from '@opentelemetry/api';
3
- import { R as RegisteredLogger, L as Logger } from './index-CquI0inB.js';
3
+ import { R as RegisteredLogger, L as Logger } from './index-QV27jkxQ.js';
4
4
  import { SpanExporter } from '@opentelemetry/sdk-trace-base';
5
5
 
6
6
  /** Sampling strategy configuration for OpenTelemetry */
@@ -1,11 +1,11 @@
1
1
  import * as ai from 'ai';
2
2
  import { Tool as Tool$1, Schema, ToolExecutionOptions, LanguageModelV1, CoreMessage as CoreMessage$1, GenerateTextResult, GenerateObjectResult, StreamTextResult, StreamObjectResult, EmbeddingModel, Message, UserContent, AssistantContent, LanguageModel as LanguageModel$1, DeepPartial, generateText, generateObject, streamText, streamObject, TelemetrySettings, CoreSystemMessage as CoreSystemMessage$1, CoreAssistantMessage as CoreAssistantMessage$1, CoreUserMessage as CoreUserMessage$1, CoreToolMessage as CoreToolMessage$1, EmbedResult as EmbedResult$1, EmbedManyResult as EmbedManyResult$1, GenerateTextOnStepFinishCallback, StreamTextOnFinishCallback, StreamObjectOnFinishCallback, StreamTextOnStepFinishCallback, ToolContent } from 'ai';
3
- import { M as MastraBase, T as Telemetry, O as OtelConfig } from './base-D9APQt4V.cjs';
3
+ import { M as MastraBase, T as Telemetry, O as OtelConfig } from './base-H7siSAfu.cjs';
4
4
  import { a as Metric, M as MetricResult, T as TestInfo } from './types-BtMyV38I.cjs';
5
5
  import { Query } from 'sift';
6
6
  import { z, ZodSchema } from 'zod';
7
7
  import { JSONSchema7Type, JSONSchema7 } from 'json-schema';
8
- import { B as BaseLogMessage, R as RegisteredLogger, L as Logger, d as Run$1 } from './index-CquI0inB.cjs';
8
+ import { B as BaseLogMessage, R as RegisteredLogger, L as Logger, d as Run$1 } from './index-QV27jkxQ.cjs';
9
9
  import { RuntimeContext } from './runtime-context/index.cjs';
10
10
  import { Span } from '@opentelemetry/api';
11
11
  import * as xstate from 'xstate';
@@ -13,6 +13,7 @@ import { Snapshot } from 'xstate';
13
13
  import EventEmitter from 'node:events';
14
14
  import { MastraVector } from './vector/index.cjs';
15
15
  import { MastraTTS } from './tts/index.cjs';
16
+ import * as http from 'node:http';
16
17
  import EventEmitter$1 from 'events';
17
18
  import { MastraDeployer } from './deployer/index.cjs';
18
19
  import { Handler, MiddlewareHandler } from 'hono';
@@ -34,6 +35,19 @@ type CoreTool = {
34
35
  id: `${string}.${string}`;
35
36
  args: Record<string, unknown>;
36
37
  });
38
+ type InternalCoreTool = {
39
+ id?: string;
40
+ description?: string;
41
+ parameters: Schema;
42
+ execute?: (params: any, options: ToolExecutionOptions) => Promise<any>;
43
+ } & ({
44
+ type?: 'function' | undefined;
45
+ id?: string;
46
+ } | {
47
+ type: 'provider-defined';
48
+ id: `${string}.${string}`;
49
+ args: Record<string, unknown>;
50
+ });
37
51
  interface ToolExecutionContext<TSchemaIn extends z.ZodSchema | undefined = undefined> extends IExecutionContext<TSchemaIn> {
38
52
  mastra?: MastraUnion;
39
53
  runtimeContext: RuntimeContext;
@@ -61,6 +75,108 @@ declare function createTool<TSchemaIn extends z.ZodSchema | undefined = undefine
61
75
  execute: (context: TContext) => Promise<any>;
62
76
  } : Tool<TSchemaIn, TSchemaOut, TContext>;
63
77
 
78
+ /**
79
+ * Configuration options for an MCP server
80
+ */
81
+ interface MCPServerConfig {
82
+ /**
83
+ * Name of the MCP server
84
+ */
85
+ name: string;
86
+ /**
87
+ * Version of the MCP server
88
+ */
89
+ version: string;
90
+ /**
91
+ * Tools to register with the MCP server
92
+ */
93
+ tools: ToolsInput;
94
+ }
95
+ type ConvertedTool = {
96
+ name: string;
97
+ description?: string;
98
+ parameters: InternalCoreTool['parameters'];
99
+ execute: InternalCoreTool['execute'];
100
+ };
101
+ /**
102
+ * Options for starting an MCP server with SSE transport
103
+ */
104
+ interface MCPServerSSEOptions {
105
+ /**
106
+ * Parsed URL of the incoming request
107
+ */
108
+ url: URL;
109
+ /**
110
+ * Path for establishing the SSE connection (e.g. '/sse')
111
+ */
112
+ ssePath: string;
113
+ /**
114
+ * Path for POSTing client messages (e.g. '/message')
115
+ */
116
+ messagePath: string;
117
+ /**
118
+ * Incoming HTTP request
119
+ */
120
+ req: http.IncomingMessage;
121
+ /**
122
+ * HTTP response (must support .write/.end)
123
+ */
124
+ res: http.ServerResponse<http.IncomingMessage>;
125
+ }
126
+
127
+ /**
128
+ * Abstract base class for MCP server implementations
129
+ * This provides a common interface for all MCP servers that can be registered with Mastra
130
+ */
131
+ declare abstract class MCPServerBase extends MastraBase {
132
+ /**
133
+ * Name of the MCP server
134
+ */
135
+ readonly name: string;
136
+ /**
137
+ * Version of the MCP server
138
+ */
139
+ readonly version: string;
140
+ /**
141
+ * Tools registered with the MCP server
142
+ */
143
+ readonly convertedTools: Record<string, ConvertedTool>;
144
+ mastra: Mastra | undefined;
145
+ /**
146
+ * Get a read-only view of the registered tools (for testing/introspection).
147
+ */
148
+ tools(): Readonly<Record<string, ConvertedTool>>;
149
+ abstract convertTools(tools: ToolsInput): Record<string, ConvertedTool>;
150
+ __registerMastra(mastra: Mastra): void;
151
+ /**
152
+ * Constructor for the MCPServerBase
153
+ * @param config Configuration options for the MCP server
154
+ */
155
+ constructor(config: MCPServerConfig);
156
+ /**
157
+ * Start the MCP server using stdio transport
158
+ * This is typically used for Windsurf integration
159
+ */
160
+ abstract startStdio(): Promise<void>;
161
+ /**
162
+ * Start the MCP server using SSE transport
163
+ * This is typically used for web integration
164
+ * @param options Options for the SSE transport
165
+ */
166
+ abstract startSSE(options: MCPServerSSEOptions): Promise<void>;
167
+ abstract startHTTP(options: {
168
+ url: URL;
169
+ httpPath: string;
170
+ req: http.IncomingMessage;
171
+ res: http.ServerResponse<http.IncomingMessage>;
172
+ options?: any;
173
+ }): Promise<void>;
174
+ /**
175
+ * Close the MCP server and all its connections
176
+ */
177
+ abstract close(): Promise<void>;
178
+ }
179
+
64
180
  type AgentNetworkConfig = {
65
181
  name: string;
66
182
  agents: Agent[];
@@ -911,11 +1027,6 @@ declare class Machine<TSteps extends Step<any, any, any, any>[] = Step<any, any,
911
1027
  }, xstate.AnyEventObject>;
912
1028
  }) => {
913
1029
  mastra?: MastraUnion | undefined;
914
- triggerData: any;
915
- isResume?: {
916
- runId: string;
917
- stepId: string;
918
- } | undefined;
919
1030
  steps: {
920
1031
  [x: string]: {
921
1032
  status: "failed";
@@ -940,8 +1051,13 @@ declare class Machine<TSteps extends Step<any, any, any, any>[] = Step<any, any,
940
1051
  output?: any;
941
1052
  };
942
1053
  };
943
- inputData: Record<string, any>;
944
1054
  attempts: Record<string, number>;
1055
+ inputData: Record<string, any>;
1056
+ triggerData: any;
1057
+ isResume?: {
1058
+ runId: string;
1059
+ stepId: string;
1060
+ } | undefined;
945
1061
  };
946
1062
  readonly states: any;
947
1063
  }> | undefined;
@@ -953,7 +1069,7 @@ interface WorkflowResultReturn<TResult extends z.ZodObject<any>, T extends z.Zod
953
1069
  triggerData?: z.infer<T>;
954
1070
  runtimeContext?: RuntimeContext;
955
1071
  } | undefined) => Promise<WorkflowRunResult<T, TSteps, TResult>>;
956
- watch: (onTransition: (state: Pick<WorkflowRunResult<T, TSteps, TResult>, 'results' | 'activePaths' | 'runId'>) => void) => () => void;
1072
+ watch: (onTransition: (state: Pick<WorkflowRunResult<T, TSteps, TResult>, 'results' | 'activePaths' | 'runId' | 'timestamp'>) => void) => () => void;
957
1073
  resume: (props: {
958
1074
  stepId: string;
959
1075
  context?: Record<string, any>;
@@ -996,8 +1112,8 @@ declare class WorkflowInstance<TSteps extends Step<any, any, any, any>[] = Step<
996
1112
  runtimeContext?: RuntimeContext;
997
1113
  }): Promise<{
998
1114
  runId: string;
999
- timestamp: number;
1000
1115
  result?: z.TypeOf<TResult> | undefined;
1116
+ timestamp: number;
1001
1117
  triggerData?: z.TypeOf<TTriggerSchema> | undefined;
1002
1118
  results: { [K in keyof StepsRecord$1<TSteps>]: StepsRecord$1<TSteps>[K]["outputSchema"] extends undefined ? StepResult$1<unknown> : StepResult$1<z.TypeOf<NonNullable<StepsRecord$1<TSteps>[K]["outputSchema"]>>>; };
1003
1119
  activePaths: Map<TSteps[number]["id"], {
@@ -1087,7 +1203,13 @@ declare class Workflow<TSteps extends Step<string, any, any>[] = Step<string, an
1087
1203
  * @param runId - ID of the run to retrieve
1088
1204
  * @returns The workflow run instance if found, undefined otherwise
1089
1205
  */
1090
- getRun(runId: string): WorkflowInstance<TSteps, TTriggerSchema, any> | undefined;
1206
+ getRun(runId: string): Promise<WorkflowRun | WorkflowInstance<TSteps, TTriggerSchema, any> | null>;
1207
+ /**
1208
+ * Gets a workflow run instance by ID, from memory
1209
+ * @param runId - ID of the run to retrieve
1210
+ * @returns The workflow run instance if found, undefined otherwise
1211
+ */
1212
+ getMemoryRun(runId: string): WorkflowInstance<TSteps, TTriggerSchema, any> | undefined;
1091
1213
  /**
1092
1214
  * Rebuilds the machine with the current steps configuration and validates the workflow
1093
1215
  *
@@ -1403,7 +1525,7 @@ declare class NewWorkflow<TSteps extends NewStep<string, any, any, any, any>[] =
1403
1525
  };
1404
1526
  constructor({ mastra, id, inputSchema, outputSchema, description, executionEngine, retryConfig, steps, }: NewWorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>);
1405
1527
  get runs(): Map<string, Run<TSteps, TInput, TOutput>>;
1406
- get mastra(): Mastra<Record<string, Agent<any, ToolsInput, Record<string, Metric>>>, Record<string, Workflow<Step<string, any, any, StepExecutionContext<any, WorkflowContext<any, Step<string, any, any, any>[], Record<string, any>>>>[], string, any, any>>, Record<string, NewWorkflow<NewStep<string, any, any, any, any>[], string, z.ZodType<any, z.ZodTypeDef, any>, z.ZodType<any, z.ZodTypeDef, any>, z.ZodType<any, z.ZodTypeDef, any>>>, Record<string, MastraVector>, Record<string, MastraTTS>, Logger, Record<string, AgentNetwork>> | undefined;
1528
+ get mastra(): Mastra<Record<string, Agent<any, ToolsInput, Record<string, Metric>>>, Record<string, Workflow<Step<string, any, any, StepExecutionContext<any, WorkflowContext<any, Step<string, any, any, any>[], Record<string, any>>>>[], string, any, any>>, Record<string, NewWorkflow<NewStep<string, any, any, any, any>[], string, z.ZodType<any, z.ZodTypeDef, any>, z.ZodType<any, z.ZodTypeDef, any>, z.ZodType<any, z.ZodTypeDef, any>>>, Record<string, MastraVector>, Record<string, MastraTTS>, Logger, Record<string, AgentNetwork>, Record<string, MCPServerBase>> | undefined;
1407
1529
  __registerMastra(mastra: Mastra): void;
1408
1530
  __registerPrimitives(p: MastraPrimitives): void;
1409
1531
  setStepFlow(stepFlow: StepFlowEntry[]): void;
@@ -2037,6 +2159,7 @@ interface AgentConfig<TAgentId extends string = string, TTools extends ToolsInpu
2037
2159
  instructions: DynamicArgument<string>;
2038
2160
  model: DynamicArgument<MastraLanguageModel>;
2039
2161
  tools?: DynamicArgument<TTools>;
2162
+ workflows?: DynamicArgument<Record<string, NewWorkflow>>;
2040
2163
  defaultGenerateOptions?: AgentGenerateOptions;
2041
2164
  defaultStreamOptions?: AgentStreamOptions;
2042
2165
  mastra?: Mastra;
@@ -2206,7 +2329,7 @@ type ServerConfig = {
2206
2329
  bodySizeLimit?: number;
2207
2330
  };
2208
2331
 
2209
- interface Config<TAgents extends Record<string, Agent<any>> = Record<string, Agent<any>>, TWorkflows extends Record<string, Workflow> = Record<string, Workflow>, TNewWorkflows extends Record<string, NewWorkflow> = Record<string, NewWorkflow>, TVectors extends Record<string, MastraVector> = Record<string, MastraVector>, TTTS extends Record<string, MastraTTS> = Record<string, MastraTTS>, TLogger extends Logger = Logger, TNetworks extends Record<string, AgentNetwork> = Record<string, AgentNetwork>> {
2332
+ interface Config<TAgents extends Record<string, Agent<any>> = Record<string, Agent<any>>, TWorkflows extends Record<string, Workflow> = Record<string, Workflow>, TNewWorkflows extends Record<string, NewWorkflow> = Record<string, NewWorkflow>, TVectors extends Record<string, MastraVector> = Record<string, MastraVector>, TTTS extends Record<string, MastraTTS> = Record<string, MastraTTS>, TLogger extends Logger = Logger, TNetworks extends Record<string, AgentNetwork> = Record<string, AgentNetwork>, TMCPServers extends Record<string, MCPServerBase> = Record<string, MCPServerBase>> {
2210
2333
  agents?: TAgents;
2211
2334
  networks?: TNetworks;
2212
2335
  storage?: MastraStorage;
@@ -2218,6 +2341,7 @@ interface Config<TAgents extends Record<string, Agent<any>> = Record<string, Age
2218
2341
  telemetry?: OtelConfig;
2219
2342
  deployer?: MastraDeployer;
2220
2343
  server?: ServerConfig;
2344
+ mcpServers?: TMCPServers;
2221
2345
  /**
2222
2346
  * Server middleware functions to be applied to API routes
2223
2347
  * Each middleware can specify a path pattern (defaults to '/api/*')
@@ -2229,7 +2353,7 @@ interface Config<TAgents extends Record<string, Agent<any>> = Record<string, Age
2229
2353
  }>;
2230
2354
  memory?: MastraMemory;
2231
2355
  }
2232
- declare class Mastra<TAgents extends Record<string, Agent<any>> = Record<string, Agent<any>>, TWorkflows extends Record<string, Workflow> = Record<string, Workflow>, TNewWorkflows extends Record<string, NewWorkflow> = Record<string, NewWorkflow>, TVectors extends Record<string, MastraVector> = Record<string, MastraVector>, TTTS extends Record<string, MastraTTS> = Record<string, MastraTTS>, TLogger extends Logger = Logger, TNetworks extends Record<string, AgentNetwork> = Record<string, AgentNetwork>> {
2356
+ declare class Mastra<TAgents extends Record<string, Agent<any>> = Record<string, Agent<any>>, TWorkflows extends Record<string, Workflow> = Record<string, Workflow>, TNewWorkflows extends Record<string, NewWorkflow> = Record<string, NewWorkflow>, TVectors extends Record<string, MastraVector> = Record<string, MastraVector>, TTTS extends Record<string, MastraTTS> = Record<string, MastraTTS>, TLogger extends Logger = Logger, TNetworks extends Record<string, AgentNetwork> = Record<string, AgentNetwork>, TMCPServers extends Record<string, MCPServerBase> = Record<string, MCPServerBase>> {
2233
2357
  #private;
2234
2358
  /**
2235
2359
  * @deprecated use getTelemetry() instead
@@ -2243,7 +2367,7 @@ declare class Mastra<TAgents extends Record<string, Agent<any>> = Record<string,
2243
2367
  * @deprecated use getMemory() instead
2244
2368
  */
2245
2369
  get memory(): MastraMemory | undefined;
2246
- constructor(config?: Config<TAgents, TWorkflows, TNewWorkflows, TVectors, TTTS, TLogger>);
2370
+ constructor(config?: Config<TAgents, TWorkflows, TNewWorkflows, TVectors, TTTS, TLogger, TNetworks, TMCPServers>);
2247
2371
  getAgent<TAgentName extends keyof TAgents>(name: TAgentName): TAgents[TAgentName];
2248
2372
  getAgents(): TAgents;
2249
2373
  getVector<TVectorName extends keyof TVectors>(name: TVectorName): TVectors[TVectorName];
@@ -2288,6 +2412,17 @@ declare class Mastra<TAgents extends Record<string, Agent<any>> = Record<string,
2288
2412
  transportId: string;
2289
2413
  }): Promise<BaseLogMessage[] | undefined>;
2290
2414
  getLogs(transportId: string): Promise<BaseLogMessage[]>;
2415
+ /**
2416
+ * Get a specific MCP server by ID
2417
+ * @param serverId - The ID of the MCP server to retrieve
2418
+ * @returns The MCP server with the specified ID, or undefined if not found
2419
+ */
2420
+ getMCPServer(serverId: string): MCPServerBase | undefined;
2421
+ /**
2422
+ * Get all registered MCP servers as a Record, with keys being their IDs.
2423
+ * @returns Record of MCP server IDs to MCPServerBase instances, or undefined if none.
2424
+ */
2425
+ getMCPServers(): TMCPServers | undefined;
2291
2426
  }
2292
2427
 
2293
2428
  type MastraPrimitives = {
@@ -2328,6 +2463,9 @@ declare class Agent<TAgentId extends string = string, TTools extends ToolsInput
2328
2463
  hasOwnMemory(): boolean;
2329
2464
  getMemory(): MastraMemory | undefined;
2330
2465
  get voice(): CompositeVoice;
2466
+ getWorkflows({ runtimeContext, }?: {
2467
+ runtimeContext?: RuntimeContext;
2468
+ }): Promise<Record<string, NewWorkflow>>;
2331
2469
  getVoice({ runtimeContext }?: {
2332
2470
  runtimeContext?: RuntimeContext;
2333
2471
  }): Promise<CompositeVoice | DefaultVoice>;
@@ -2386,6 +2524,11 @@ declare class Agent<TAgentId extends string = string, TTools extends ToolsInput
2386
2524
  }>;
2387
2525
  private getResponseMessages;
2388
2526
  sanitizeResponseMessages(messages: Array<CoreMessage$1>): Array<CoreMessage$1>;
2527
+ private getMemoryTools;
2528
+ private getAssignedTools;
2529
+ private getToolsets;
2530
+ private getClientTools;
2531
+ private getWorkflowTools;
2389
2532
  private convertTools;
2390
2533
  preExecute({ resourceId, runId, threadId, thread, memoryConfig, messages, systemMessage, }: {
2391
2534
  runId?: string;
@@ -2696,4 +2839,4 @@ declare abstract class MastraStorage extends MastraBase {
2696
2839
  }): Promise<WorkflowRun | null>;
2697
2840
  }
2698
2841
 
2699
- export { type CoreToolMessage as $, type ApiRoute as A, type WatchEvent as B, type ToolAction as C, type DynamicMapping as D, type EvalRow as E, Agent as F, type AgentConfig as G, MastraMemory as H, type ToolExecutionContext as I, Tool as J, Step as K, Workflow as L, type Methods as M, type NewStep as N, type WorkflowOptions as O, type PathsToStringProps as P, type LanguageModel as Q, Run as R, type StorageColumn as S, type TABLE_NAMES as T, type CoreMessage as U, type VariableReference as V, type WorkflowRuns as W, type CoreSystemMessage as X, type CoreAssistantMessage as Y, type ZodPathType as Z, type CoreUserMessage as _, Mastra as a, type WorkflowRunState as a$, type EmbedResult as a0, type EmbedManyResult as a1, type BaseStructuredOutputType as a2, type StructuredOutputType as a3, type StructuredOutputArrayItem as a4, type StructuredOutput as a5, type GenerateReturn as a6, type StreamReturn as a7, type OutputType as a8, type DefaultLLMTextOptions as a9, type BaseCondition as aA, type ActionContext as aB, WhenConditionReturnValue as aC, type StepDef as aD, type StepCondition as aE, type StepConfig as aF, type StepResult$1 as aG, type StepsRecord$1 as aH, type WorkflowRunResult as aI, type WorkflowContext as aJ, type WorkflowLogMessage as aK, type WorkflowEvent as aL, type ResolverFunctionInput as aM, type ResolverFunctionOutput as aN, type SubscriberFunctionOutput as aO, type DependencyCheckOutput as aP, type StepResolverOutput as aQ, type WorkflowActors as aR, type WorkflowActionParams as aS, type WorkflowActions as aT, type WorkflowState as aU, type StepId as aV, type ExtractSchemaFromStep$1 as aW, type ExtractStepResult as aX, type StepInputType as aY, type ExtractSchemaType$1 as aZ, type PathsToStringProps$1 as a_, type DefaultLLMTextObjectOptions as aa, type DefaultLLMStreamOptions as ab, type DefaultLLMStreamObjectOptions as ac, type LLMTextOptions as ad, type LLMTextObjectOptions as ae, type LLMStreamOptions as af, type LLMInnerStreamOptions as ag, type LLMStreamObjectOptions as ah, createMockModel as ai, type Config as aj, type MessageResponse as ak, type MemoryConfig as al, type SharedMemoryConfig as am, type MemoryProcessorOpts as an, MemoryProcessor as ao, memoryDefaultOptions as ap, createTool as aq, type VercelTool as ar, type CoreTool as as, type StepExecutionContext as at, type StepAction as au, type StepVariableType as av, type StepNode as aw, type StepGraph as ax, type RetryConfig as ay, type VariableReference$1 as az, MastraStorage as b, type WorkflowResumeResult as b0, type MastraLanguageModel as b1, type MastraPrimitives as b2, type ToolsInput as b3, AgentNetwork as b4, type AgentNetworkConfig as b5, type VoiceEventType as b6, type VoiceEventMap as b7, type VoiceConfig as b8, MastraVoice as b9, CompositeVoice as ba, DefaultVoice as bb, type ToolsetsInput as bc, type DynamicArgument as bd, type AgentGenerateOptions as be, type AgentStreamOptions as bf, TABLE_WORKFLOW_SNAPSHOT as bg, TABLE_EVALS as bh, TABLE_MESSAGES as bi, TABLE_THREADS as bj, TABLE_TRACES as bk, TABLE_SCHEMAS as bl, type StorageThreadType as c, type MessageType as d, type StorageGetMessagesArg as e, type WorkflowRun as f, ExecutionEngine as g, type StepResult as h, type ExecutionGraph as i, type StepFlowEntry as j, type ExecuteFunction as k, type SerializedStep as l, type SerializedStepFlowEntry as m, createStep as n, cloneStep as o, createWorkflow as p, cloneWorkflow as q, type WorkflowResult as r, type NewWorkflowConfig as s, NewWorkflow as t, type StepSuccess as u, type StepFailure as v, type StepSuspended as w, type StepsRecord as x, type ExtractSchemaType as y, type ExtractSchemaFromStep as z };
2842
+ export { type CoreToolMessage as $, type ApiRoute as A, type WatchEvent as B, type ToolAction as C, type DynamicMapping as D, type EvalRow as E, Agent as F, type AgentConfig as G, MastraMemory as H, type ToolExecutionContext as I, Tool as J, Step as K, Workflow as L, type Methods as M, type NewStep as N, type WorkflowOptions as O, type PathsToStringProps as P, type LanguageModel as Q, Run as R, type StorageColumn as S, type TABLE_NAMES as T, type CoreMessage as U, type VariableReference as V, type WorkflowRuns as W, type CoreSystemMessage as X, type CoreAssistantMessage as Y, type ZodPathType as Z, type CoreUserMessage as _, Mastra as a, type PathsToStringProps$1 as a$, type EmbedResult as a0, type EmbedManyResult as a1, type BaseStructuredOutputType as a2, type StructuredOutputType as a3, type StructuredOutputArrayItem as a4, type StructuredOutput as a5, type GenerateReturn as a6, type StreamReturn as a7, type OutputType as a8, type DefaultLLMTextOptions as a9, type VariableReference$1 as aA, type BaseCondition as aB, type ActionContext as aC, WhenConditionReturnValue as aD, type StepDef as aE, type StepCondition as aF, type StepConfig as aG, type StepResult$1 as aH, type StepsRecord$1 as aI, type WorkflowRunResult as aJ, type WorkflowContext as aK, type WorkflowLogMessage as aL, type WorkflowEvent as aM, type ResolverFunctionInput as aN, type ResolverFunctionOutput as aO, type SubscriberFunctionOutput as aP, type DependencyCheckOutput as aQ, type StepResolverOutput as aR, type WorkflowActors as aS, type WorkflowActionParams as aT, type WorkflowActions as aU, type WorkflowState as aV, type StepId as aW, type ExtractSchemaFromStep$1 as aX, type ExtractStepResult as aY, type StepInputType as aZ, type ExtractSchemaType$1 as a_, type DefaultLLMTextObjectOptions as aa, type DefaultLLMStreamOptions as ab, type DefaultLLMStreamObjectOptions as ac, type LLMTextOptions as ad, type LLMTextObjectOptions as ae, type LLMStreamOptions as af, type LLMInnerStreamOptions as ag, type LLMStreamObjectOptions as ah, createMockModel as ai, type Config as aj, type MessageResponse as ak, type MemoryConfig as al, type SharedMemoryConfig as am, type MemoryProcessorOpts as an, MemoryProcessor as ao, memoryDefaultOptions as ap, createTool as aq, type VercelTool as ar, type CoreTool as as, type InternalCoreTool as at, type StepExecutionContext as au, type StepAction as av, type StepVariableType as aw, type StepNode as ax, type StepGraph as ay, type RetryConfig as az, MastraStorage as b, type WorkflowRunState as b0, type WorkflowResumeResult as b1, type MastraLanguageModel as b2, type MastraPrimitives as b3, type ToolsInput as b4, AgentNetwork as b5, MCPServerBase as b6, type MCPServerConfig as b7, type ConvertedTool as b8, type MCPServerSSEOptions as b9, type AgentNetworkConfig as ba, type VoiceEventType as bb, type VoiceEventMap as bc, type VoiceConfig as bd, MastraVoice as be, CompositeVoice as bf, DefaultVoice as bg, type ToolsetsInput as bh, type DynamicArgument as bi, type AgentGenerateOptions as bj, type AgentStreamOptions as bk, TABLE_WORKFLOW_SNAPSHOT as bl, TABLE_EVALS as bm, TABLE_MESSAGES as bn, TABLE_THREADS as bo, TABLE_TRACES as bp, TABLE_SCHEMAS as bq, type StorageThreadType as c, type MessageType as d, type StorageGetMessagesArg as e, type WorkflowRun as f, ExecutionEngine as g, type StepResult as h, type ExecutionGraph as i, type StepFlowEntry as j, type ExecuteFunction as k, type SerializedStep as l, type SerializedStepFlowEntry as m, createStep as n, cloneStep as o, createWorkflow as p, cloneWorkflow as q, type WorkflowResult as r, type NewWorkflowConfig as s, NewWorkflow as t, type StepSuccess as u, type StepFailure as v, type StepSuspended as w, type StepsRecord as x, type ExtractSchemaType as y, type ExtractSchemaFromStep as z };