@mastra/mcp 1.18.1-alpha.3 → 2.0.0-alpha.4

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 (90) hide show
  1. package/dist/client/actions/resource.d.ts +9 -59
  2. package/dist/client/actions/resource.d.ts.map +1 -1
  3. package/dist/client/client.d.ts +71 -124
  4. package/dist/client/client.d.ts.map +1 -1
  5. package/dist/client/configuration.d.ts +30 -120
  6. package/dist/client/configuration.d.ts.map +1 -1
  7. package/dist/client/error-utils.d.ts +9 -0
  8. package/dist/client/error-utils.d.ts.map +1 -1
  9. package/dist/client/index.d.ts +2 -1
  10. package/dist/client/index.d.ts.map +1 -1
  11. package/dist/client/oauth-callback-server.d.ts +8 -4
  12. package/dist/client/oauth-callback-server.d.ts.map +1 -1
  13. package/dist/client/oauth-provider.d.ts +91 -45
  14. package/dist/client/oauth-provider.d.ts.map +1 -1
  15. package/dist/client/server-proxy.d.ts +26 -46
  16. package/dist/client/server-proxy.d.ts.map +1 -1
  17. package/dist/client/types.d.ts +106 -143
  18. package/dist/client/types.d.ts.map +1 -1
  19. package/dist/conformance/fixture.d.ts +3 -0
  20. package/dist/conformance/fixture.d.ts.map +1 -0
  21. package/dist/conformance/run.d.ts +2 -0
  22. package/dist/conformance/run.d.ts.map +1 -0
  23. package/dist/conformance/stdio-server.d.ts +2 -0
  24. package/dist/conformance/stdio-server.d.ts.map +1 -0
  25. package/dist/docs/SKILL.md +2 -1
  26. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  27. package/dist/docs/references/reference-migrations-mcp-v2.md +268 -0
  28. package/dist/docs/references/reference-tools-mcp-client.md +36 -14
  29. package/dist/docs/references/reference-tools-mcp-server.md +24 -83
  30. package/dist/index.cjs +1561 -3323
  31. package/dist/index.cjs.map +1 -1
  32. package/dist/index.js +1564 -3327
  33. package/dist/index.js.map +1 -1
  34. package/dist/server/actions.d.ts +34 -0
  35. package/dist/server/actions.d.ts.map +1 -0
  36. package/dist/server/oauth-middleware.d.ts +1 -1
  37. package/dist/server/request.d.ts +54 -0
  38. package/dist/server/request.d.ts.map +1 -0
  39. package/dist/server/server.d.ts +112 -808
  40. package/dist/server/server.d.ts.map +1 -1
  41. package/dist/server/types.d.ts +82 -138
  42. package/dist/server/types.d.ts.map +1 -1
  43. package/dist/shared/index.d.ts +1 -0
  44. package/dist/shared/index.d.ts.map +1 -1
  45. package/dist/shared/oauth-types.d.ts +3 -3
  46. package/dist/shared/oauth-types.d.ts.map +1 -1
  47. package/dist/shared/trace-context.d.ts +20 -0
  48. package/dist/shared/trace-context.d.ts.map +1 -0
  49. package/package.json +11 -16
  50. package/dist/_types/hono/dist/types/client/client.d.ts +0 -4
  51. package/dist/_types/hono/dist/types/client/fetch-result-please.d.ts +0 -35
  52. package/dist/_types/hono/dist/types/client/index.d.ts +0 -7
  53. package/dist/_types/hono/dist/types/client/types.d.ts +0 -229
  54. package/dist/_types/hono/dist/types/client/utils.d.ts +0 -18
  55. package/dist/_types/hono/dist/types/context.d.ts +0 -459
  56. package/dist/_types/hono/dist/types/helper/streaming/index.d.ts +0 -8
  57. package/dist/_types/hono/dist/types/helper/streaming/sse.d.ts +0 -13
  58. package/dist/_types/hono/dist/types/helper/streaming/stream.d.ts +0 -3
  59. package/dist/_types/hono/dist/types/helper/streaming/text.d.ts +0 -3
  60. package/dist/_types/hono/dist/types/hono-base.d.ts +0 -221
  61. package/dist/_types/hono/dist/types/hono.d.ts +0 -19
  62. package/dist/_types/hono/dist/types/index.d.ts +0 -37
  63. package/dist/_types/hono/dist/types/request/constants.d.ts +0 -1
  64. package/dist/_types/hono/dist/types/request.d.ts +0 -324
  65. package/dist/_types/hono/dist/types/router.d.ts +0 -97
  66. package/dist/_types/hono/dist/types/types.d.ts +0 -573
  67. package/dist/_types/hono/dist/types/utils/body.d.ts +0 -79
  68. package/dist/_types/hono/dist/types/utils/headers.d.ts +0 -8
  69. package/dist/_types/hono/dist/types/utils/http-status.d.ts +0 -32
  70. package/dist/_types/hono/dist/types/utils/mime.d.ts +0 -70
  71. package/dist/_types/hono/dist/types/utils/stream.d.ts +0 -31
  72. package/dist/_types/hono/dist/types/utils/types.d.ts +0 -74
  73. package/dist/_types/hono/package.json +0 -1
  74. package/dist/_types/hono-mcp-server-sse-transport/build/index.d.ts +0 -1
  75. package/dist/_types/hono-mcp-server-sse-transport/build/sse.d.ts +0 -25
  76. package/dist/_types/hono-mcp-server-sse-transport/package.json +0 -1
  77. package/dist/client/actions/elicitation.d.ts +0 -63
  78. package/dist/client/actions/elicitation.d.ts.map +0 -1
  79. package/dist/server/__tests__/mock-extra.d.ts +0 -15
  80. package/dist/server/__tests__/mock-extra.d.ts.map +0 -1
  81. package/dist/server/mrtrElicitation.d.ts +0 -39
  82. package/dist/server/mrtrElicitation.d.ts.map +0 -1
  83. package/dist/server/notificationBroadcast.d.ts +0 -24
  84. package/dist/server/notificationBroadcast.d.ts.map +0 -1
  85. package/dist/server/promptActions.d.ts +0 -49
  86. package/dist/server/promptActions.d.ts.map +0 -1
  87. package/dist/server/resourceActions.d.ts +0 -72
  88. package/dist/server/resourceActions.d.ts.map +0 -1
  89. package/dist/server/toolActions.d.ts +0 -84
  90. package/dist/server/toolActions.d.ts.map +0 -1
@@ -1,65 +1,47 @@
1
1
  import type { ToolsInput } from '@mastra/core/agent';
2
2
  import { MCPServerBase } from '@mastra/core/mcp';
3
- import type { MCPServerConfig, MCPServerHonoSSEOptions, MCPServerHTTPOptions, MCPServerSSEOptions, MCPToolType, ServerDetailInfo, ServerInfo } from '@mastra/core/mcp';
3
+ import type { MCPToolExecutionResultV2, MCPToolType, ServerDetailInfo, ServerInfo } from '@mastra/core/mcp';
4
4
  import type { InternalMastraMCPClient } from './client.js';
5
- type ToolListResult = {
6
- tools: Array<{
7
- id?: string;
8
- name: string;
9
- description?: string;
10
- inputSchema: any;
11
- outputSchema?: any;
12
- toolType?: MCPToolType;
13
- _meta?: Record<string, unknown>;
14
- }>;
5
+ type ToolInfo = {
6
+ id: string;
7
+ name: string;
8
+ description?: string;
9
+ inputSchema: unknown;
10
+ outputSchema?: unknown;
11
+ toolType?: MCPToolType;
12
+ _meta?: Record<string, unknown>;
15
13
  };
16
14
  /**
17
- * A lightweight proxy that wraps a single MCPClient server connection as an
18
- * MCPServerBase instance. This allows external (non-Mastra) MCP servers
19
- * connected through MCPClient to be registered in Mastra's `mcpServers`
20
- * config and appear in Studio alongside native MCPServer instances.
15
+ * Wraps a single MCPClient server connection as an `MCPServerBase` so external
16
+ * (non-Mastra) MCP servers connected through MCPClient can be registered in Mastra's
17
+ * `mcpServers` config and appear in Studio alongside local MCPServer instances.
21
18
  *
22
- * Tool and resource operations are delegated lazily to the underlying
23
- * InternalMastraMCPClient connection.
19
+ * Tool and resource operations are delegated lazily to the underlying connection.
20
+ * The proxy has no transport of its own: it is not served over stdio or HTTP.
24
21
  */
25
22
  export declare class MCPClientServerProxy extends MCPServerBase {
23
+ readonly mcpVersion: 2;
26
24
  private clientGetter;
27
25
  private cachedClient;
28
- private _cachedToolList;
26
+ private cachedToolList;
29
27
  constructor(config: {
30
28
  name: string;
31
29
  version?: string;
32
30
  id?: string;
33
31
  description?: string;
34
32
  }, clientGetter: () => Promise<InternalMastraMCPClient>);
33
+ /** The remote catalogue is fetched lazily; nothing is converted locally. */
34
+ convertTools(_tools: ToolsInput): {};
35
35
  private getClient;
36
36
  private convertSchema;
37
37
  private fetchToolList;
38
- convertTools(_tools: ToolsInput, _agents?: MCPServerConfig['agents'], _workflows?: MCPServerConfig['workflows']): Record<string, any>;
39
- /**
40
- * Returns the cached tool list synchronously, or triggers an async fetch.
41
- * The Studio API handlers are async and will auto-await a returned Promise.
42
- */
43
- getToolListInfo(): ToolListResult | Promise<ToolListResult>;
44
- getToolInfo(toolId: string): {
45
- name: string;
46
- description?: string;
47
- inputSchema: any;
48
- outputSchema?: any;
49
- toolType?: MCPToolType;
50
- _meta?: Record<string, unknown>;
51
- } | undefined | Promise<{
52
- name: string;
53
- description?: string;
54
- inputSchema: any;
55
- outputSchema?: any;
56
- toolType?: MCPToolType;
57
- _meta?: Record<string, unknown>;
58
- } | undefined>;
59
- executeTool(toolId: string, args: any, _executionContext?: {
60
- messages?: any[];
61
- toolCallId?: string;
62
- }): Promise<any>;
38
+ getToolListInfo(): {
39
+ tools: ToolInfo[];
40
+ } | Promise<{
41
+ tools: ToolInfo[];
42
+ }>;
43
+ getToolInfo(toolId: string): ToolInfo | undefined | Promise<ToolInfo | undefined>;
44
+ executeTool(toolId: string, input: unknown, context?: Parameters<MCPServerBase['executeTool']>[2]): Promise<MCPToolExecutionResultV2>;
63
45
  listResources(): Promise<{
64
46
  resources: Array<{
65
47
  uri: string;
@@ -77,9 +59,7 @@ export declare class MCPClientServerProxy extends MCPServerBase {
77
59
  }>;
78
60
  }>;
79
61
  startStdio(): Promise<void>;
80
- startSSE(_options: MCPServerSSEOptions): Promise<void>;
81
- startHonoSSE(_options: MCPServerHonoSSEOptions): Promise<Response | undefined>;
82
- startHTTP(_options: MCPServerHTTPOptions): Promise<void>;
62
+ startHTTP(): Promise<void>;
83
63
  close(): Promise<void>;
84
64
  getServerInfo(): ServerInfo;
85
65
  getServerDetail(): ServerDetailInfo;
@@ -1 +1 @@
1
- {"version":3,"file":"server-proxy.d.ts","sourceRoot":"","sources":["../../src/client/server-proxy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EACV,eAAe,EACf,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACnB,WAAW,EACX,gBAAgB,EAChB,UAAU,EACX,MAAM,kBAAkB,CAAC;AAG1B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAExD,KAAK,cAAc,GAAG;IACpB,KAAK,EAAE,KAAK,CAAC;QACX,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,IAAI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C;IAEM,eAAe,IAAI,gBAAgB,CAMzC;CACF"}
@@ -1,8 +1,24 @@
1
1
  import type { IOType } from 'node:child_process';
2
2
  import type { RequestContext } from '@mastra/core/di';
3
- import type { SSEClientTransportOptions, StreamableHTTPClientTransportOptions, ClientCapabilities, ElicitRequest, ElicitResult, LoggingLevel, ProgressNotification, ToolAnnotations, jsonSchemaValidator } from '@modelcontextprotocol/client';
3
+ import type { StreamableHTTPClientTransportOptions, ClientCapabilities, ElicitRequestParams, ElicitResult, LoggingLevel, ProgressNotification, ToolAnnotations, jsonSchemaValidator } from '@modelcontextprotocol/client';
4
+ import type { MCPTraceContext } from '../shared/trace-context.js';
4
5
  export type { FetchLike } from '@modelcontextprotocol/client';
5
6
  export type { ToolAnnotations } from '@modelcontextprotocol/client';
7
+ export type { LoggingLevel } from '@modelcontextprotocol/client';
8
+ /** The current protocol revision; the one `/mcp` servers speak. */
9
+ export declare const MCP_CLIENT_PROTOCOL_VERSION: '2026-07-28';
10
+ /**
11
+ * Which protocol revision to speak to a server.
12
+ *
13
+ * - `'2026-07-28'`: the current revision only. No probe, no fallback; a server
14
+ * that does not offer it fails to connect.
15
+ * - `'legacy'`: the pre-2026 `initialize` handshake only. Use it for servers known
16
+ * not to have upgraded, to skip the probe.
17
+ *
18
+ * When omitted the client probes with `server/discover` and speaks whichever
19
+ * revision the server offers.
20
+ */
21
+ export type MCPClientProtocolVersion = typeof MCP_CLIENT_PROTOCOL_VERSION | 'legacy';
6
22
  /**
7
23
  * Extended fetch function type that receives the current request context as a third argument.
8
24
  *
@@ -32,7 +48,6 @@ export type { ToolAnnotations } from '@modelcontextprotocol/client';
32
48
  * ```
33
49
  */
34
50
  export type MastraFetchLike = (url: string | URL, init?: RequestInit, requestContext?: RequestContext | null) => Promise<Response>;
35
- export type { LoggingLevel } from '@modelcontextprotocol/client';
36
51
  /**
37
52
  * Log message structure for MCP client logging.
38
53
  */
@@ -53,13 +68,6 @@ export interface LogMessage {
53
68
  * Handler function for processing log messages from MCP servers.
54
69
  */
55
70
  export type LogHandler = (logMessage: LogMessage) => void;
56
- /**
57
- * Handler function for processing elicitation requests from MCP servers.
58
- *
59
- * @param request - The elicitation request parameters including message and schema
60
- * @returns Promise resolving to the user's response (accept/decline/cancel with optional content)
61
- */
62
- export type ElicitationHandler = (request: ElicitRequest['params']) => Promise<ElicitResult>;
63
71
  /**
64
72
  * Handler function for processing progress notifications from MCP servers.
65
73
  *
@@ -67,26 +75,37 @@ export type ElicitationHandler = (request: ElicitRequest['params']) => Promise<E
67
75
  */
68
76
  export type ProgressHandler = (params: ProgressNotification['params']) => void;
69
77
  /**
70
- * Represents a filesystem root that the client exposes to MCP servers.
71
- *
72
- * Per MCP spec (https://modelcontextprotocol.io/specification/2025-11-25/client/roots):
73
- * Roots define the boundaries of where servers can operate within the filesystem,
74
- * allowing them to understand which directories and files they have access to.
78
+ * One keyed input request embedded in an `input_required` result.
75
79
  *
76
- * @example
77
- * ```typescript
78
- * const root: Root = {
79
- * uri: 'file:///home/user/projects/myproject',
80
- * name: 'My Project'
81
- * };
82
- * ```
80
+ * Servers on the 2026-07-28 revision obtain user input by answering `tools/call`,
81
+ * `resources/read`, or `prompts/get` with `input_required` instead of pushing a request
82
+ * to the client. Every embedded request carries the server-chosen `key` it must be
83
+ * answered under; the client retries the originating call with the collected responses.
83
84
  */
84
- export interface Root {
85
- /** Unique identifier for the root. Must be a file:// URI. */
86
- uri: string;
87
- /** Optional human-readable name for display purposes. */
88
- name?: string;
85
+ export interface MCPInputRequest {
86
+ /** Server-chosen key this response is filed under for the retry. */
87
+ key: string;
88
+ /** Elicitation parameters: form mode (`requestedSchema`) or url mode (`url`). */
89
+ params: ElicitRequestParams;
90
+ /** Aborted when the originating call is cancelled or times out. */
91
+ signal: AbortSignal;
89
92
  }
93
+ /**
94
+ * Supplies the response for one embedded input request.
95
+ *
96
+ * Return `{ action: 'accept', content }` with content matching `params.requestedSchema`,
97
+ * or `{ action: 'decline' }` / `{ action: 'cancel' }`. The handler is called once per
98
+ * request per round; earlier rounds' responses are never re-sent.
99
+ */
100
+ export type MCPInputRequestHandler = (request: MCPInputRequest) => Promise<ElicitResult>;
101
+ /**
102
+ * Client capabilities a Mastra MCP client may advertise.
103
+ *
104
+ * `elicitation` is only accepted together with an `inputRequests` handler; it defaults to
105
+ * form support when a handler is configured. The deprecated roots and sampling
106
+ * capabilities are not supported.
107
+ */
108
+ export type MCPClientCapabilities = Pick<ClientCapabilities, 'elicitation' | 'extensions'>;
90
109
  /**
91
110
  * Context passed to `requireToolApproval` when it's a function.
92
111
  * Provides information about the tool call and the current execution environment.
@@ -116,8 +135,6 @@ export interface RequireToolApprovalContext {
116
135
  * This field is `undefined` (not auto-defaulted) when the server omits
117
136
  * annotations entirely, so policies can distinguish "no annotations" from
118
137
  * "annotated as safe".
119
- *
120
- * @see https://modelcontextprotocol.io/specification/2025-11-25/server/tools#tool-annotations
121
138
  */
122
139
  annotations?: ToolAnnotations;
123
140
  }
@@ -140,16 +157,45 @@ export type RequireToolApproval = boolean | RequireToolApprovalFn;
140
157
  export type BaseServerOptions = {
141
158
  /** Optional handler for server log messages */
142
159
  logger?: LogHandler;
160
+ /**
161
+ * Pin the protocol revision instead of probing for it. See {@link MCPClientProtocolVersion}.
162
+ *
163
+ * Features the pre-2026 revisions lack (`subscriptions/listen`, embedded input
164
+ * requests) fail with an error naming the negotiated revision when the server
165
+ * turned out to be legacy.
166
+ */
167
+ protocolVersion?: MCPClientProtocolVersion;
143
168
  /** Optional timeout in milliseconds for server operations */
144
169
  timeout?: number;
145
170
  /** Optional client capabilities to advertise to the server */
146
- capabilities?: ClientCapabilities;
147
- /** Whether to enable server log forwarding (default: true) */
171
+ capabilities?: MCPClientCapabilities;
172
+ /**
173
+ * Whether to opt into per-request server logs (default: true).
174
+ *
175
+ * 2026-07-28 servers only emit `notifications/message` for requests that carry the
176
+ * `io.modelcontextprotocol/logLevel` metadata key; this option attaches it to every
177
+ * request and forwards delivered messages to `logger`.
178
+ */
148
179
  enableServerLogs?: boolean;
180
+ /**
181
+ * Minimum severity requested from the server for per-request logs.
182
+ *
183
+ * @default 'info'
184
+ */
185
+ serverLogLevel?: LoggingLevel;
149
186
  /** Whether to enable progress tracking (default: false) */
150
187
  enableProgressTracking?: boolean;
151
188
  /**
152
- * Whether instructions returned by this MCP server during initialization should
189
+ * Returns the W3C `traceparent`, `tracestate` and `baggage` values to attach
190
+ * to each outgoing MCP request's `_meta`.
191
+ *
192
+ * The provider is called when the request is sent so consumers can read from
193
+ * their own request-local trace carrier without coupling MCP to a tracing SDK.
194
+ * Explicit `_meta` keys supplied for a tool call take precedence.
195
+ */
196
+ traceContext?: () => MCPTraceContext | undefined;
197
+ /**
198
+ * Whether instructions returned by this MCP server during discovery should
153
199
  * be forwarded to agents that use the server's tools.
154
200
  *
155
201
  * Disabled by default: forwarded instructions are injected into the agent's
@@ -206,8 +252,8 @@ export type BaseServerOptions = {
206
252
  * by throwing a `MastraError` that carries the server's `content` text. Tool
207
253
  * spans, stream chunks, scorers, and persisted message parts then reflect the
208
254
  * failure, and the model sees the error text so it can self-correct.
209
- * - `'return'`: preserve the legacy behaviour and resolve successfully with the
210
- * raw result (or `structuredContent`), ignoring `isError`.
255
+ * - `'return'`: resolve successfully with the raw result (or `structuredContent`),
256
+ * ignoring `isError`.
211
257
  *
212
258
  * @default 'throw'
213
259
  */
@@ -221,74 +267,28 @@ export type BaseServerOptions = {
221
267
  * Cloudflare Workers / V8 isolates: the default `AjvJsonSchemaValidator`
222
268
  * compiles validators with `new Function(...)`, which workerd refuses to
223
269
  * evaluate when a tool advertises an `outputSchema`.
224
- *
225
- * @example
226
- * ```typescript
227
- * import { CfWorkerJsonSchemaValidator } from '@modelcontextprotocol/client/validators/cf-worker';
228
- *
229
- * const mcp = new MCPClient({
230
- * servers: {
231
- * upstream: {
232
- * url: new URL('https://example/mcp'),
233
- * jsonSchemaValidator: new CfWorkerJsonSchemaValidator(),
234
- * },
235
- * },
236
- * });
237
- * ```
238
270
  */
239
271
  jsonSchemaValidator?: jsonSchemaValidator;
240
272
  /**
241
- * List of filesystem roots to expose to the MCP server.
242
- *
243
- * Per MCP spec (https://modelcontextprotocol.io/specification/2025-11-25/client/roots):
244
- * Roots define the boundaries of where servers can operate within the filesystem.
273
+ * Answers embedded input requests (`input_required` results) from this server.
245
274
  *
246
- * When configured, the client will:
247
- * 1. Automatically advertise the `roots` capability to the server
248
- * 2. Respond to `roots/list` requests with these roots
249
- * 3. Send `notifications/roots/list_changed` when roots are updated via `setRoots()`
275
+ * Configuring a handler advertises form elicitation support; widen it with
276
+ * `capabilities.elicitation` to accept url-mode requests too. Without a handler
277
+ * an `input_required` result is surfaced as a typed error.
250
278
  *
251
279
  * @example
252
280
  * ```typescript
253
281
  * {
254
- * command: 'npx',
255
- * args: ['-y', '@modelcontextprotocol/server-filesystem', '/tmp'],
256
- * roots: [
257
- * { uri: 'file:///tmp', name: 'Temp Directory' }
258
- * ]
259
- * }
260
- * ```
261
- */
262
- roots?: Root[];
263
- /**
264
- * Opt-in MCP protocol version negotiation.
265
- *
266
- * - Omitted (default): the plain legacy (2025-era) connect sequence,
267
- * byte-identical to a client without this option.
268
- * - `'auto'`: probe the server with `server/discover` at connect time and use
269
- * the stateless `2026-07-28` revision when the server supports it, with a
270
- * conservative fallback to the legacy `initialize` handshake.
271
- * - `'2026-07-28'`: pin to that revision exactly. Connecting to a server that
272
- * does not offer it fails loudly with a typed error — no fallback.
273
- *
274
- * Elicitation handlers work on both eras: on a negotiated `2026-07-28`
275
- * connection, embedded elicitation requests from `input_required` results are
276
- * dispatched through the same registered handler and the originating call is
277
- * retried automatically.
278
- *
279
- * @example
280
- * ```typescript
281
- * const mcp = new MCPClient({
282
- * servers: {
283
- * weather: {
284
- * url: new URL('https://example/mcp'),
285
- * protocolVersion: 'auto',
286
- * },
282
+ * url: new URL('https://example/mcp'),
283
+ * inputRequests: async ({ key, params }) => {
284
+ * if (params.mode === 'url') return { action: 'decline' };
285
+ * const content = await promptUser(key, params.requestedSchema);
286
+ * return { action: 'accept', content };
287
287
  * },
288
- * });
288
+ * }
289
289
  * ```
290
290
  */
291
- protocolVersion?: 'auto' | '2026-07-28';
291
+ inputRequests?: MCPInputRequestHandler;
292
292
  };
293
293
  /**
294
294
  * Configuration for MCP servers using stdio (subprocess) transport.
@@ -335,22 +335,16 @@ export type StdioServerDefinition = BaseServerOptions & {
335
335
  cwd?: string;
336
336
  url?: never;
337
337
  requestInit?: never;
338
- eventSourceInit?: never;
339
338
  authProvider?: never;
340
- reconnectionOptions?: never;
341
- sessionId?: never;
342
339
  connectTimeout?: never;
343
340
  fetch?: never;
344
341
  allowedHosts?: never;
345
342
  };
346
343
  /**
347
- * Configuration for MCP servers using HTTP-based transport (Streamable HTTP or SSE fallback).
348
- *
349
- * Used when connecting to remote MCP servers over HTTP. The client will attempt Streamable HTTP
350
- * transport first and fall back to SSE if that fails.
344
+ * Configuration for MCP servers using the Streamable HTTP transport.
351
345
  *
352
- * When `fetch` is provided, all other HTTP-related options (`requestInit`, `eventSourceInit`, `authProvider`)
353
- * become optional, as the custom fetch function can handle authentication and request customization.
346
+ * When `fetch` is provided, `requestInit` and `authProvider` become optional, as the custom
347
+ * fetch function can handle authentication and request customization.
354
348
  */
355
349
  export type HttpServerDefinition = BaseServerOptions & {
356
350
  /** URL of the MCP server endpoint */
@@ -372,10 +366,7 @@ export type HttpServerDefinition = BaseServerOptions & {
372
366
  *
373
367
  * The third `requestContext` parameter provides access to request-scoped data set by middleware
374
368
  * or passed during agent/tool execution. It is `null` when no context is available (e.g.,
375
- * during the initial connection handshake).
376
- *
377
- * When `fetch` is provided, `requestInit`, `eventSourceInit`, and `authProvider` become optional,
378
- * as you can handle these concerns within your custom fetch function.
369
+ * during the initial connection).
379
370
  *
380
371
  * @example
381
372
  * ```typescript
@@ -398,10 +389,9 @@ export type HttpServerDefinition = BaseServerOptions & {
398
389
  * Optional allowlist of hosts this server's HTTP requests may target.
399
390
  *
400
391
  * When set, every outgoing request made on behalf of this server (initial
401
- * connect, Streamable HTTP POSTs, the SSE fallback and its event stream,
402
- * OAuth discovery/token requests routed through the transport fetch, and
403
- * every redirect hop) is checked against this list. When unset, no
404
- * restriction applies (current behavior).
392
+ * connect, Streamable HTTP POSTs, OAuth discovery/token requests routed
393
+ * through the transport fetch, and every redirect hop) is checked against
394
+ * this list. When unset, no restriction applies.
405
395
  *
406
396
  * Matching semantics:
407
397
  * - Entries are host values matched against `URL.host` — the hostname plus
@@ -420,13 +410,12 @@ export type HttpServerDefinition = BaseServerOptions & {
420
410
  * - On the default path (no custom `fetch`), requests to disallowed hosts —
421
411
  * including redirect hops, via manual redirect following — are blocked
422
412
  * BEFORE being sent.
423
- * - When a custom `fetch` (or a caller-supplied `eventSourceInit.fetch`) is
424
- * in play, the initial URL is checked before the request, but redirect
425
- * hops are validated post-hoc via `response.url`: the outbound hop may
426
- * occur, but the response never reaches the caller or the model. A
427
- * hand-built `Response` with an empty `response.url` skips the post-hoc
428
- * check (documented limitation — custom fetches legitimately construct
429
- * such responses).
413
+ * - When a custom `fetch` is in play, the initial URL is checked before the
414
+ * request, but redirect hops are validated post-hoc via `response.url`:
415
+ * the outbound hop may occur, but the response never reaches the caller
416
+ * or the model. A hand-built `Response` with an empty `response.url` skips
417
+ * the post-hoc check (documented limitation — custom fetches legitimately
418
+ * construct such responses).
430
419
  *
431
420
  * OAuth note: the SDK routes OAuth discovery and token requests through the
432
421
  * transport's fetch, so when using an `authProvider` whose authorization
@@ -435,18 +424,9 @@ export type HttpServerDefinition = BaseServerOptions & {
435
424
  allowedHosts?: string[];
436
425
  /** Optional request configuration for HTTP requests (optional when `fetch` is provided) */
437
426
  requestInit?: StreamableHTTPClientTransportOptions['requestInit'];
438
- /** Optional configuration for SSE fallback (required when using custom headers with SSE, optional when `fetch` is provided) */
439
- eventSourceInit?: SSEClientTransportOptions['eventSourceInit'];
440
427
  /** Optional authentication provider for HTTP requests (optional when `fetch` is provided) */
441
428
  authProvider?: StreamableHTTPClientTransportOptions['authProvider'];
442
- /** Optional reconnection configuration for Streamable HTTP */
443
- reconnectionOptions?: StreamableHTTPClientTransportOptions['reconnectionOptions'];
444
- /** Optional session ID for Streamable HTTP */
445
- sessionId?: StreamableHTTPClientTransportOptions['sessionId'];
446
- /** Optional timeout in milliseconds for the connection phase (default: 3000ms).
447
- * This timeout allows the system to switch MCP streaming protocols during the setup phase.
448
- * The default is set to 3s because the long default timeout would be extremely slow for SSE backwards compat (60s).
449
- */
429
+ /** Optional timeout in milliseconds for the connection phase (default: 3000ms). */
450
430
  connectTimeout?: number;
451
431
  };
452
432
  /**
@@ -471,21 +451,6 @@ export type HttpServerDefinition = BaseServerOptions & {
471
451
  * headers: { Authorization: 'Bearer token' }
472
452
  * }
473
453
  * };
474
- *
475
- * // HTTP server with custom fetch for dynamic auth
476
- * const httpServerWithFetch: MastraMCPServerDefinition = {
477
- * url: new URL('http://localhost:8080/mcp'),
478
- * fetch: async (url, init) => {
479
- * const token = await getAuthToken(); // Refresh token on each request
480
- * return fetch(url, {
481
- * ...init,
482
- * headers: {
483
- * ...init?.headers,
484
- * Authorization: `Bearer ${token}`,
485
- * },
486
- * });
487
- * },
488
- * };
489
454
  * ```
490
455
  */
491
456
  export type MastraMCPServerDefinition = StdioServerDefinition | HttpServerDefinition;
@@ -499,8 +464,6 @@ export type InternalMastraMCPClientOptions = {
499
464
  name: string;
500
465
  /** Server connection configuration */
501
466
  server: MastraMCPServerDefinition;
502
- /** Optional client capabilities to advertise to the server */
503
- capabilities?: ClientCapabilities;
504
467
  /** Optional client version */
505
468
  version?: string;
506
469
  /** Optional timeout in milliseconds */
@@ -540,9 +503,9 @@ export type SerializableMCPToolDefinition = {
540
503
  server: {
541
504
  /** The name this server is configured under. */
542
505
  name: string;
543
- /** Server version reported during the MCP handshake, if any. */
506
+ /** Server version reported during discovery, if any. */
544
507
  version?: string;
545
- /** Instructions the server returned during initialization, if any. */
508
+ /** Instructions the server returned during discovery, if any. */
546
509
  instructions?: string;
547
510
  };
548
511
  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MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC;;;;;;OAMG;IACH,MAAM,EAAE;QACN,gDAAgD;QAChD,IAAI,EAAE,MAAM,CAAC;QACb,wDAAwD;QACxD,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,iEAAiE;QACjE,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACH,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,0BAA0B,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { MCPServer } from '../server/server.js';
2
+ export declare function createConformanceServer(): MCPServer;
3
+ //# sourceMappingURL=fixture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixture.d.ts","sourceRoot":"","sources":["../../src/conformance/fixture.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,wBAAgB,uBAAuB,cAatC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/conformance/run.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=stdio-server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stdio-server.d.ts","sourceRoot":"","sources":["../../src/conformance/stdio-server.ts"],"names":[],"mappings":""}
@@ -3,7 +3,7 @@ name: mastra-mcp
3
3
  description: Documentation for @mastra/mcp. Use when working with @mastra/mcp APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/mcp"
6
- version: "1.18.1-alpha.3"
6
+ version: "2.0.0-alpha.4"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -23,6 +23,7 @@ Read the individual reference documents for detailed explanations and code examp
23
23
  ### Reference
24
24
 
25
25
  - [Reference: Tool configuration](references/reference-editor-tools.md) - Configure Editor agent tools from Mastra, MCP, workspace, and provider sources, including descriptions, display conditions, and resolution order.
26
+ - [Migration: @mastra/mcp v1 to v2](references/reference-migrations-mcp-v2.md) - @mastra/mcp 2.0 serves the MCP 2026-07-28 revision only: self-contained requests, suspend/resume carried as input_required, subscriptions/listen, per-request logging and pre-registered or URL-based OAuth clients. The client speaks 2026-07-28 and still connects to older servers.
26
27
  - [MCP](references/reference-migrations-upgrade-to-v1-mcp.md) - MCP (Model Context Protocol) tool execution context has been reorganized, and deprecated client classes have been removed.
27
28
  - [Reference: MCPClient](references/reference-tools-mcp-client.md) - The MCPClient class provides a way to manage multiple MCP server connections and their tools in a Mastra application.
28
29
  - [Reference: MCPServer](references/reference-tools-mcp-server.md) - The MCPServer class provides the functionality to expose your existing Mastra tools and Agents as a Model Context Protocol (MCP) server.
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.18.1-alpha.3",
2
+ "version": "2.0.0-alpha.4",
3
3
  "package": "@mastra/mcp",
4
4
  "exports": {},
5
5
  "modules": {}