@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.
- package/dist/client/actions/resource.d.ts +9 -59
- package/dist/client/actions/resource.d.ts.map +1 -1
- package/dist/client/client.d.ts +71 -124
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/configuration.d.ts +30 -120
- package/dist/client/configuration.d.ts.map +1 -1
- package/dist/client/error-utils.d.ts +9 -0
- package/dist/client/error-utils.d.ts.map +1 -1
- package/dist/client/index.d.ts +2 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/oauth-callback-server.d.ts +8 -4
- package/dist/client/oauth-callback-server.d.ts.map +1 -1
- package/dist/client/oauth-provider.d.ts +91 -45
- package/dist/client/oauth-provider.d.ts.map +1 -1
- package/dist/client/server-proxy.d.ts +26 -46
- package/dist/client/server-proxy.d.ts.map +1 -1
- package/dist/client/types.d.ts +106 -143
- package/dist/client/types.d.ts.map +1 -1
- package/dist/conformance/fixture.d.ts +3 -0
- package/dist/conformance/fixture.d.ts.map +1 -0
- package/dist/conformance/run.d.ts +2 -0
- package/dist/conformance/run.d.ts.map +1 -0
- package/dist/conformance/stdio-server.d.ts +2 -0
- package/dist/conformance/stdio-server.d.ts.map +1 -0
- package/dist/docs/SKILL.md +2 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/reference-migrations-mcp-v2.md +268 -0
- package/dist/docs/references/reference-tools-mcp-client.md +36 -14
- package/dist/docs/references/reference-tools-mcp-server.md +24 -83
- package/dist/index.cjs +1561 -3323
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1564 -3327
- package/dist/index.js.map +1 -1
- package/dist/server/actions.d.ts +34 -0
- package/dist/server/actions.d.ts.map +1 -0
- package/dist/server/oauth-middleware.d.ts +1 -1
- package/dist/server/request.d.ts +54 -0
- package/dist/server/request.d.ts.map +1 -0
- package/dist/server/server.d.ts +112 -808
- package/dist/server/server.d.ts.map +1 -1
- package/dist/server/types.d.ts +82 -138
- package/dist/server/types.d.ts.map +1 -1
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/oauth-types.d.ts +3 -3
- package/dist/shared/oauth-types.d.ts.map +1 -1
- package/dist/shared/trace-context.d.ts +20 -0
- package/dist/shared/trace-context.d.ts.map +1 -0
- package/package.json +11 -16
- package/dist/_types/hono/dist/types/client/client.d.ts +0 -4
- package/dist/_types/hono/dist/types/client/fetch-result-please.d.ts +0 -35
- package/dist/_types/hono/dist/types/client/index.d.ts +0 -7
- package/dist/_types/hono/dist/types/client/types.d.ts +0 -229
- package/dist/_types/hono/dist/types/client/utils.d.ts +0 -18
- package/dist/_types/hono/dist/types/context.d.ts +0 -459
- package/dist/_types/hono/dist/types/helper/streaming/index.d.ts +0 -8
- package/dist/_types/hono/dist/types/helper/streaming/sse.d.ts +0 -13
- package/dist/_types/hono/dist/types/helper/streaming/stream.d.ts +0 -3
- package/dist/_types/hono/dist/types/helper/streaming/text.d.ts +0 -3
- package/dist/_types/hono/dist/types/hono-base.d.ts +0 -221
- package/dist/_types/hono/dist/types/hono.d.ts +0 -19
- package/dist/_types/hono/dist/types/index.d.ts +0 -37
- package/dist/_types/hono/dist/types/request/constants.d.ts +0 -1
- package/dist/_types/hono/dist/types/request.d.ts +0 -324
- package/dist/_types/hono/dist/types/router.d.ts +0 -97
- package/dist/_types/hono/dist/types/types.d.ts +0 -573
- package/dist/_types/hono/dist/types/utils/body.d.ts +0 -79
- package/dist/_types/hono/dist/types/utils/headers.d.ts +0 -8
- package/dist/_types/hono/dist/types/utils/http-status.d.ts +0 -32
- package/dist/_types/hono/dist/types/utils/mime.d.ts +0 -70
- package/dist/_types/hono/dist/types/utils/stream.d.ts +0 -31
- package/dist/_types/hono/dist/types/utils/types.d.ts +0 -74
- package/dist/_types/hono/package.json +0 -1
- package/dist/_types/hono-mcp-server-sse-transport/build/index.d.ts +0 -1
- package/dist/_types/hono-mcp-server-sse-transport/build/sse.d.ts +0 -25
- package/dist/_types/hono-mcp-server-sse-transport/package.json +0 -1
- package/dist/client/actions/elicitation.d.ts +0 -63
- package/dist/client/actions/elicitation.d.ts.map +0 -1
- package/dist/server/__tests__/mock-extra.d.ts +0 -15
- package/dist/server/__tests__/mock-extra.d.ts.map +0 -1
- package/dist/server/mrtrElicitation.d.ts +0 -39
- package/dist/server/mrtrElicitation.d.ts.map +0 -1
- package/dist/server/notificationBroadcast.d.ts +0 -24
- package/dist/server/notificationBroadcast.d.ts.map +0 -1
- package/dist/server/promptActions.d.ts +0 -49
- package/dist/server/promptActions.d.ts.map +0 -1
- package/dist/server/resourceActions.d.ts +0 -72
- package/dist/server/resourceActions.d.ts.map +0 -1
- package/dist/server/toolActions.d.ts +0 -84
- 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 {
|
|
3
|
+
import type { MCPToolExecutionResultV2, MCPToolType, ServerDetailInfo, ServerInfo } from '@mastra/core/mcp';
|
|
4
4
|
import type { InternalMastraMCPClient } from './client.js';
|
|
5
|
-
type
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
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
|
-
*
|
|
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
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
|
|
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,
|
|
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,EAAE,wBAAwB,EAAE,WAAW,EAAE,gBAAgB,EAAE,U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AAE,UAAU,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAM,GACxD,OAAO,CAAC,wBAAwB,CAAC,CAYnC;IAEY,aAAa,IAAI,OAAO,CAAC;QACpC,SAAS,EAAE,KAAK,CAAC;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,WAAW,CAAC,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;SAAE,CAAC,CAAC;KAC3H,CAAC,CAYD;IAEY,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,QAAQ,EAAE,KAAK,CAAC;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE,CAAC,CAUlH;IAEY,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAEvC;IAEY,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAEtC;IAEY,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAGlC;IAEM,aAAa,IAAI,UAAU,CAWjC;IAEM,eAAe,IAAI,gBAAgB,CAMzC;CACF"}
|
package/dist/client/types.d.ts
CHANGED
|
@@ -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 {
|
|
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
|
-
*
|
|
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
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
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
|
|
85
|
-
/**
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
|
|
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?:
|
|
147
|
-
/**
|
|
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
|
-
*
|
|
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'`:
|
|
210
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
247
|
-
*
|
|
248
|
-
*
|
|
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
|
-
*
|
|
255
|
-
*
|
|
256
|
-
*
|
|
257
|
-
*
|
|
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
|
-
|
|
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
|
|
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,
|
|
353
|
-
*
|
|
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
|
|
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,
|
|
402
|
-
*
|
|
403
|
-
*
|
|
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`
|
|
424
|
-
*
|
|
425
|
-
*
|
|
426
|
-
*
|
|
427
|
-
*
|
|
428
|
-
*
|
|
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
|
|
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
|
|
506
|
+
/** Server version reported during discovery, if any. */
|
|
544
507
|
version?: string;
|
|
545
|
-
/** Instructions the server returned during
|
|
508
|
+
/** Instructions the server returned during discovery, if any. */
|
|
546
509
|
instructions?: string;
|
|
547
510
|
};
|
|
548
511
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EACV,oCAAoC,EACpC,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,EACZ,YAAY,EACZ,oBAAoB,EACpB,eAAe,EACf,mBAAmB,EACpB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG/D,YAAY,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAG9D,YAAY,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE,YAAY,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAEjE,mEAAmE;AACnE,eAAO,MAAM,2BAA2B,EAAG,YAAqB,CAAC;AAEjE;;;;;;;;;;GAUG;AACH,MAAM,MAAM,wBAAwB,GAAG,O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IG;AACH,MAAM,MAAM,0BAA0B,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAC,CAAC"}
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/conformance/run.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdio-server.d.ts","sourceRoot":"","sources":["../../src/conformance/stdio-server.ts"],"names":[],"mappings":""}
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -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: "
|
|
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.
|