@mastra/mcp 2.8.0-alpha.0 → 2.8.0-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.
- package/dist/client/client.d.ts +6 -1
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/tasks/suspend.d.ts +25 -0
- package/dist/client/tasks/suspend.d.ts.map +1 -0
- package/dist/client/tasks/wait.d.ts +14 -0
- package/dist/client/tasks/wait.d.ts.map +1 -1
- package/dist/client/types.d.ts +30 -0
- package/dist/client/types.d.ts.map +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/reference-tools-mcp-client.md +45 -1
- package/dist/docs/references/reference-tools-mcp-server.md +67 -0
- package/dist/index.cjs +325 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +325 -18
- package/dist/index.js.map +1 -1
- package/dist/server/model-output-to-mcp.d.ts +14 -0
- package/dist/server/model-output-to-mcp.d.ts.map +1 -0
- package/dist/server/server.d.ts +14 -1
- package/dist/server/server.d.ts.map +1 -1
- package/dist/server/types.d.ts +31 -1
- package/dist/server/types.d.ts.map +1 -1
- package/package.json +8 -8
package/dist/client/client.d.ts
CHANGED
|
@@ -368,7 +368,12 @@ export declare class InternalMastraMCPClient extends MastraBase {
|
|
|
368
368
|
* remote task, and must never be retried, as a retry would start a second task.
|
|
369
369
|
*/
|
|
370
370
|
private taskToolBackgroundConfig;
|
|
371
|
-
/**
|
|
371
|
+
/**
|
|
372
|
+
* Waits for a remote task created by a tool call and returns its `CallToolResult`.
|
|
373
|
+
*
|
|
374
|
+
* When the task needs input that no `inputRequests` handler answers and the caller can `suspend`,
|
|
375
|
+
* suspends with the requests and returns `undefined`, leaving the task open for the answers.
|
|
376
|
+
*/
|
|
372
377
|
private awaitToolTask;
|
|
373
378
|
private stampServerIdInMeta;
|
|
374
379
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAA8B,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAG7E,OAAO,KAAK,EAAmB,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAShE,OAAO,KAAK,EAGV,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,2BAA2B,EAG3B,kBAAkB,EAMnB,MAAM,8BAA8B,CAAC;AAatC,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACvB,gBAAgB,EAChB,4BAA4B,EAC5B,qBAAqB,EACrB,8BAA8B,EAC/B,MAAM,kBAAkB,CAAC;AAO1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAGpD,OAAO,KAAK,EAAc,kBAAkB,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAIrH,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAA8B,WAAW,EAAE,MAAM,oBAAoB,CAAC;AA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E5D;IAED;;;OAGG;IACH,OAAO,CAAC,wBAAwB;IAShC;;;;;OAKG;YACW,aAAa;IA6F3B,OAAO,CAAC,mBAAmB;CAQ5B"}
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { LoggingLevel, LogMessage, LogHandler, MastraMCPServerDefinition, MCPClientCapabilities, MCPClientInfo, MCPClientProtocolVersion, MCPClientTasksOptions, MCPTaskProgress, MCPInputRequest, MCPInputRequestHandler, MCPServerImplementation, ProgressHandler, InternalMastraMCPClientOptions, RequireToolApproval, RequireToolApprovalFn, RequireToolApprovalContext, ToolAnnotations, SerializableMCPToolDefinition, SerializableMCPToolCatalog, MCPServerMap, MCPClientServers, MCPClientTools, MCPClientToolsets, } from './types.js';
|
|
1
|
+
export type { LoggingLevel, LogMessage, LogHandler, MastraMCPServerDefinition, MCPClientCapabilities, MCPClientInfo, MCPClientProtocolVersion, MCPClientTasksOptions, MCPTaskProgress, MCPInputRequestSuspendPayload, MCPInputRequestResumeData, MCPInputRequest, MCPInputRequestHandler, MCPServerImplementation, ProgressHandler, InternalMastraMCPClientOptions, RequireToolApproval, RequireToolApprovalFn, RequireToolApprovalContext, ToolAnnotations, SerializableMCPToolDefinition, SerializableMCPToolCatalog, MCPServerMap, MCPClientServers, MCPClientTools, MCPClientToolsets, } from './types.js';
|
|
2
2
|
export { MCP_CLIENT_PROTOCOL_VERSION } from './types.js';
|
|
3
3
|
export * from './client.js';
|
|
4
4
|
export type * from './events/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,YAAY,EACZ,UAAU,EACV,UAAU,EACV,yBAAyB,EACzB,qBAAqB,EACrB,aAAa,EACb,wBAAwB,EACxB,qBAAqB,EACrB,eAAe,EACf,eAAe,EACf,sBAAsB,EACtB,uBAAuB,EACvB,eAAe,EACf,8BAA8B,EAC9B,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AE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAC9D,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { MCPInputRequestResumeData, MCPInputRequestSuspendPayload } from '../types.js';
|
|
2
|
+
export declare const MCP_INPUT_REQUEST_SUSPEND_TYPE = "mcp-input-request";
|
|
3
|
+
/** Where an agent or workflow hands a tool its suspend function and, on resume, what it suspended with. */
|
|
4
|
+
export interface ToolSuspendHost {
|
|
5
|
+
suspend?: (payload: MCPInputRequestSuspendPayload) => Promise<void>;
|
|
6
|
+
resumeData?: unknown;
|
|
7
|
+
suspendPayload?: unknown;
|
|
8
|
+
}
|
|
9
|
+
export type InputRequestResume = {
|
|
10
|
+
ok: true;
|
|
11
|
+
payload: MCPInputRequestSuspendPayload;
|
|
12
|
+
inputResponses: MCPInputRequestResumeData['inputResponses'];
|
|
13
|
+
} | {
|
|
14
|
+
ok: false;
|
|
15
|
+
reason: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Reads a resume of a tool call that suspended on MCP task input. Returns `undefined` when the call
|
|
19
|
+
* didn't suspend that way, so other resumes (tool approval, for one) take the normal path.
|
|
20
|
+
*/
|
|
21
|
+
export declare function readInputRequestResume(host: ToolSuspendHost | undefined, expected: {
|
|
22
|
+
serverName: string;
|
|
23
|
+
toolName: string;
|
|
24
|
+
}): InputRequestResume | undefined;
|
|
25
|
+
//# sourceMappingURL=suspend.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suspend.d.ts","sourceRoot":"","sources":["../../../src/client/tasks/suspend.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,yBAAyB,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAEzF,eAAO,MAAM,8BAA8B,sBAAsB,CAAC;AAElE,2GAA2G;AAC3G,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,6BAA6B,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAsBD,MAAM,MAAM,kBAAkB,GAC1B;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,6BAA6B,CAAC;IAAC,cAAc,EAAE,yBAAyB,CAAC,gBAAgB,CAAC,CAAA;CAAE,GACjH;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAElC;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,eAAe,GAAG,SAAS,EACjC,QAAQ,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACjD,kBAAkB,GAAG,SAAS,CAwBhC"}
|
|
@@ -4,6 +4,10 @@ import type { MCPInputRequestHandler } from '../types.js';
|
|
|
4
4
|
export type MCPTerminalTask = Extract<MCPDetailedTask, {
|
|
5
5
|
status: 'completed' | 'failed' | 'cancelled';
|
|
6
6
|
}>;
|
|
7
|
+
/** A task waiting for input, listing only the requests nobody has answered yet. */
|
|
8
|
+
export type MCPInputRequiredTask = Extract<MCPDetailedTask, {
|
|
9
|
+
status: 'input_required';
|
|
10
|
+
}>;
|
|
7
11
|
export interface TaskWaitPort {
|
|
8
12
|
get(taskId: string, options: {
|
|
9
13
|
signal?: AbortSignal;
|
|
@@ -25,6 +29,13 @@ export interface TaskWaitOptions {
|
|
|
25
29
|
signal?: AbortSignal;
|
|
26
30
|
/** Answers `input_required` task requests. Without one, such a task stops the wait. */
|
|
27
31
|
inputRequests?: MCPInputRequestHandler;
|
|
32
|
+
/**
|
|
33
|
+
* Without an `inputRequests` handler, return a task that needs input (with its unanswered requests)
|
|
34
|
+
* instead of failing, and leave the remote task open so the caller can answer it later.
|
|
35
|
+
*/
|
|
36
|
+
stopAtInput?: boolean;
|
|
37
|
+
/** Answers already given, sent with `tasks/update` the first time the task lists their keys. */
|
|
38
|
+
inputResponses?: MCPTaskInputResponses;
|
|
28
39
|
/** Interval used when the server suggests none. */
|
|
29
40
|
pollIntervalMs?: number;
|
|
30
41
|
/** Stops waiting, and cancels the remote task, after this long. */
|
|
@@ -56,5 +67,8 @@ export declare const MAX_TASK_POLL_INTERVAL_MS = 3600000;
|
|
|
56
67
|
* Aborting the signal or exceeding `maxWaitMs` sends `tasks/cancel` (fire-and-forget) and rejects.
|
|
57
68
|
* Each input request key is answered at most once, however many polls list it.
|
|
58
69
|
*/
|
|
70
|
+
export declare function waitForTask(port: TaskWaitPort, created: MCPTask, options: TaskWaitOptions & {
|
|
71
|
+
stopAtInput: boolean;
|
|
72
|
+
}): Promise<MCPTerminalTask | MCPInputRequiredTask>;
|
|
59
73
|
export declare function waitForTask(port: TaskWaitPort, created: MCPTask, options?: TaskWaitOptions): Promise<MCPTerminalTask>;
|
|
60
74
|
//# sourceMappingURL=wait.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wait.d.ts","sourceRoot":"","sources":["../../../src/client/tasks/wait.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,OAAO,EAAuB,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC/G,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAEvD,6CAA6C;AAC7C,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,EAAE;IAAE,MAAM,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAA;CAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"wait.d.ts","sourceRoot":"","sources":["../../../src/client/tasks/wait.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,OAAO,EAAuB,qBAAqB,EAA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H,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qFAAqF;IACrF,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,iBAAiB;IACjB,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5D,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAED,uDAAuD;AACvD,qBAAa,aAAc,SAAQ,KAAK;IAEpC,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,iBAAiB,GAAG,mBAAmB,GAAG,SAAS,GAAG,aAAa;IAEhG,QAAQ,CAAC,IAAI,EAAE,OAAO;IAHxB,YACW,MAAM,EAAE,SAAS,GAAG,iBAAiB,GAAG,mBAAmB,GAAG,SAAS,GAAG,aAAa,EAChG,OAAO,EAAE,MAAM,EACN,IAAI,EAAE,OAAO,EACtB,KAAK,CAAC,EAAE,OAAO,EAIhB;CACF;AAID,sHAAsH;AACtH,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAC7C,+DAA+D;AAC/D,eAAO,MAAM,yBAAyB,UAAY,CAAC;AAgBnD;;;;;GAKG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,eAAe,GAAG;IAAE,WAAW,EAAE,OAAO,CAAA;CAAE,GAClD,OAAO,CAAC,eAAe,GAAG,oBAAoB,CAAC,CAAC;AACnD,wBAAsB,WAAW,CAC/B,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,eAAe,CAAC,CAAC"}
|
package/dist/client/types.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { IOType } from 'node:child_process';
|
|
|
2
2
|
import type { RequestContext } from '@mastra/core/di';
|
|
3
3
|
import type { Tool } from '@mastra/core/tools';
|
|
4
4
|
import type { CallToolResult, StreamableHTTPClientTransportOptions, ClientCapabilities, ElicitRequestParams, ElicitResult, LoggingLevel, ProgressNotification, ToolAnnotations, jsonSchemaValidator } from '@modelcontextprotocol/client';
|
|
5
|
+
import type { MCPTaskInputRequests } from '../shared/tasks/index.js';
|
|
5
6
|
import type { MCPTraceContext } from '../shared/trace-context.js';
|
|
6
7
|
import type { EventsWebhookSetup } from './events/types.js';
|
|
7
8
|
/** Published tool input and structured-output snapshot for each configured server. */
|
|
@@ -371,6 +372,35 @@ export interface MCPTaskProgress {
|
|
|
371
372
|
createdAt: string;
|
|
372
373
|
serverName: string;
|
|
373
374
|
}
|
|
375
|
+
/**
|
|
376
|
+
* What a tool call suspends with when its MCP task needs input and no `inputRequests` handler is
|
|
377
|
+
* configured. Resume the call with {@link MCPInputRequestResumeData} to answer `requests`.
|
|
378
|
+
*
|
|
379
|
+
* @experimental SEP-2663 extension; this API may change.
|
|
380
|
+
*/
|
|
381
|
+
export interface MCPInputRequestSuspendPayload {
|
|
382
|
+
type: 'mcp-input-request';
|
|
383
|
+
serverName: string;
|
|
384
|
+
toolName: string;
|
|
385
|
+
/** The MCP task id issued by the server, which the answers are sent to. */
|
|
386
|
+
taskId: string;
|
|
387
|
+
createdAt: string;
|
|
388
|
+
/**
|
|
389
|
+
* When the call suspended on these requests. Unlike `createdAt`, it differs for each time the same task
|
|
390
|
+
* asks again, so a UI can tell a new request from one it already answered.
|
|
391
|
+
*/
|
|
392
|
+
requestedAt: string;
|
|
393
|
+
/** The requests still waiting for an answer, keyed as the server sent them. */
|
|
394
|
+
requests: MCPTaskInputRequests;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Resume data answering an {@link MCPInputRequestSuspendPayload}: one answer per request key.
|
|
398
|
+
*
|
|
399
|
+
* @experimental SEP-2663 extension; this API may change.
|
|
400
|
+
*/
|
|
401
|
+
export interface MCPInputRequestResumeData {
|
|
402
|
+
inputResponses: Record<string, ElicitResult>;
|
|
403
|
+
}
|
|
374
404
|
/**
|
|
375
405
|
* Options for consuming MCP tasks from one server.
|
|
376
406
|
*
|
|
@@ -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,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,KAAK,EACV,cAAc,EACd,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;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,sFAAsF;AACtF,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CAAC;AAE1G;;;GAGG;AACH,MAAM,MAAM,gBAAgB,CAAC,QAAQ,IAAI;KAAG,MAAM,IAAI,MAAM,QAAQ,GAAG,YAAY,CAAC,MAAM,CAAC;CAAE,CAAC;AAE9F,KAAK,aAAa,CAAC,KAAK,EAAE,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,SAAS,CAAC,GAAG;IACpG,OAAO,CAAC,EAAE,CACR,KAAK,EAAE,KAAK,EACZ,OAAO,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,KA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;;;GAIG;AACH,MAAM,MAAM,0BAA0B,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAC,CAAC"}
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -1225,7 +1225,7 @@ With `tasks` set, the client tells the server it accepts tasks. The server decid
|
|
|
1225
1225
|
When a tool call returns a task, the tool keeps its usual shape:
|
|
1226
1226
|
|
|
1227
1227
|
- The client polls the task at the interval the server suggests until it finishes, then returns the tool result.
|
|
1228
|
-
- A task that needs input is answered through `inputRequests`, once per request key. The client sends the answers with `tasks/update` and keeps polling the same task. It never sends `tools/call` again. Without a handler the call fails with `MCP_CLIENT_TOOL_TASK_INPUT_UNHANDLED`, and the task stays open on the server until its TTL ends.
|
|
1228
|
+
- A task that needs input is answered through `inputRequests`, once per request key. The client sends the answers with `tasks/update` and keeps polling the same task. It never sends `tools/call` again. Without a handler, a tool call from an agent or workflow suspends so the user can answer (see [Answering task input from the agent chat](#answering-task-input-from-the-agent-chat)). A direct `tool.execute()` call fails with `MCP_CLIENT_TOOL_TASK_INPUT_UNHANDLED`, and the task stays open on the server until its TTL ends.
|
|
1229
1229
|
- Aborting the tool call sends `tasks/cancel`. Reaching `maxWaitMs` sends it too, and fails the call with `MCP_CLIENT_TOOL_TASK_TIMEOUT`. Both end the call right away, even while a poll or your input handler is still running. A late answer from either is dropped.
|
|
1230
1230
|
- A disconnect while the client polls ends the call with `MCP_CLIENT_TOOL_TASK_POLL_FAILED` and doesn't reconnect.
|
|
1231
1231
|
- If the server can't be reached while the client polls, for example during a restart or deploy, the client reconnects and keeps polling with growing delays of up to 30 seconds. Refused connections and HTTP 502, 503, and 504 from a proxy count as unreachable. After 5 minutes without an answer, or when `maxWaitMs` or the task's TTL ends first, the call fails with `MCP_CLIENT_TOOL_TASK_POLL_FAILED`. The task may still finish on the server. The TTL counts from the task's `createdAt`. If the client can't read that timestamp, it counts from when it started waiting.
|
|
@@ -1236,6 +1236,50 @@ When a tool call returns a task, the tool keeps its usual shape:
|
|
|
1236
1236
|
|
|
1237
1237
|
On an agent with [background tasks](https://mastra.ai/docs/harness/background-tasks) enabled, tools from a server with `tasks` set run as deferred background tasks with no retries. The agent keeps working while the remote task runs, and cancelling the background task cancels the remote task. Override this per tool with the agent's `backgroundTasks.tools`.
|
|
1238
1238
|
|
|
1239
|
+
#### Answering task input from the agent chat
|
|
1240
|
+
|
|
1241
|
+
When a task needs input, no `inputRequests` handler is configured, and the tool runs in an agent or workflow, the tool call suspends like any tool that calls `suspend()`. The remote task stays open on the server. The suspend payload (`MCPInputRequestSuspendPayload`) carries the requests still waiting for an answer:
|
|
1242
|
+
|
|
1243
|
+
```typescript
|
|
1244
|
+
const payload: MCPInputRequestSuspendPayload = {
|
|
1245
|
+
type: 'mcp-input-request',
|
|
1246
|
+
serverName: 'reports',
|
|
1247
|
+
toolName: 'approve_and_send',
|
|
1248
|
+
taskId: 'Zx81…', // the MCP task the answers go to
|
|
1249
|
+
createdAt: '2026-10-30T10:00:00.000Z', // when the task was created
|
|
1250
|
+
requestedAt: '2026-10-30T10:00:04.000Z', // when the call suspended; new each time the task asks again
|
|
1251
|
+
requests: {
|
|
1252
|
+
approve: {
|
|
1253
|
+
method: 'elicitation/create',
|
|
1254
|
+
params: {
|
|
1255
|
+
mode: 'form',
|
|
1256
|
+
message: 'Send it?',
|
|
1257
|
+
requestedSchema: {
|
|
1258
|
+
type: 'object',
|
|
1259
|
+
properties: { ok: { type: 'boolean' } },
|
|
1260
|
+
required: ['ok'],
|
|
1261
|
+
},
|
|
1262
|
+
},
|
|
1263
|
+
},
|
|
1264
|
+
},
|
|
1265
|
+
}
|
|
1266
|
+
```
|
|
1267
|
+
|
|
1268
|
+
Resume the tool call with one answer per request key (`MCPInputRequestResumeData`), for example through `agent.resumeStream()` in the foreground, or `backgroundTaskManager.resume()` for a deferred background task:
|
|
1269
|
+
|
|
1270
|
+
```typescript
|
|
1271
|
+
await agent.resumeStream(
|
|
1272
|
+
{ inputResponses: { approve: { action: 'accept', content: { ok: true } } } },
|
|
1273
|
+
{ runId, toolCallId },
|
|
1274
|
+
)
|
|
1275
|
+
```
|
|
1276
|
+
|
|
1277
|
+
On resume the client sends the answers to the same task with `tasks/update` and keeps polling it. It never sends `tools/call` again. If the server asks again, the call suspends again with the new requests. If the task ended meanwhile, the call fails with the usual task error, such as `MCP_CLIENT_TOOL_TASK_CANCELLED`, or `MCP_CLIENT_TOOL_TASK_POLL_FAILED` when the server no longer knows the task. Resume data that isn't `{ inputResponses: { [key]: { action: 'accept' | 'decline' | 'cancel', content? } } }`, or that leaves a request unanswered, fails with `MCP_CLIENT_TOOL_TASK_RESUME_INVALID` without contacting the server.
|
|
1278
|
+
|
|
1279
|
+
A configured `inputRequests` handler takes precedence: the call then never suspends.
|
|
1280
|
+
|
|
1281
|
+
The payload holds the MCP task id, which grants access to the task. It's stored with the suspended tool call, so treat it like the rest of the thread's data.
|
|
1282
|
+
|
|
1239
1283
|
#### `tasks.get(serverName: string, taskId: string)`
|
|
1240
1284
|
|
|
1241
1285
|
Returns the task's current state (`MCPDetailedTask`), including `result` once it's `completed` and `inputRequests` while it's `input_required`. Fails with `MCP_CLIENT_GET_TASK_FAILED`; an unknown task, or one created by another caller, has `error.cause.code` `-32602`.
|
|
@@ -95,6 +95,8 @@ The constructor accepts an `MCPServerConfig` object with the following propertie
|
|
|
95
95
|
|
|
96
96
|
**legacy** (`'reject' | 'stateless'`): How HTTP requests from 2025-era clients (those that open with initialize, such as VS Code and Cursor) are served. 'reject' (default) answers them with an unsupported-protocol-version error. 'stateless' answers each request without a session: listing and calling tools, reading resources and getting prompts work, GET and DELETE session requests get 405, and features that need 2026-07-28 (suspend/resume, subscriptions/listen, events) aren't available to these clients.
|
|
97
97
|
|
|
98
|
+
**toolResult** (`MCPServerToolResultOptions`): Controls how completed tool calls become MCP results. modelOutput: true builds the result content from each tool's toModelOutput, so tools can return images, audio, and files. transform rewrites a result before it's sent. See Tool results for details.
|
|
99
|
+
|
|
98
100
|
**jsonSchemaValidator** (`jsonSchemaValidator`): Custom JSON Schema validator used for tool input, output and continuation answers, for runtimes where the SDK default is unavailable.
|
|
99
101
|
|
|
100
102
|
**repository** (`Repository`): Optional repository information for the server's source code.
|
|
@@ -115,6 +117,71 @@ The constructor accepts an `MCPServerConfig` object with the following propertie
|
|
|
115
117
|
|
|
116
118
|
**appResources** (`AppResources`): A map of ui:// URIs to app resource configurations. Each entry defines an interactive HTML UI served via the MCP Apps extension (SEP-1865). See the MCP Apps section for details.
|
|
117
119
|
|
|
120
|
+
## Tool results
|
|
121
|
+
|
|
122
|
+
By default, a tool's output is sent to the MCP client as a single text block. A string is sent as-is and any other value as JSON. A tool with an `outputSchema` also returns the value as `structuredContent`.
|
|
123
|
+
|
|
124
|
+
Use the `toolResult` option to send the model-facing output of a tool instead, or to rewrite results before they're sent.
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
import { MCPServer } from '@mastra/mcp'
|
|
128
|
+
import { screenshotTool } from '../tools/screenshot'
|
|
129
|
+
|
|
130
|
+
const server = new MCPServer({
|
|
131
|
+
id: 'media-server',
|
|
132
|
+
name: 'Media Server',
|
|
133
|
+
version: '1.0.0',
|
|
134
|
+
tools: { screenshotTool },
|
|
135
|
+
toolResult: {
|
|
136
|
+
modelOutput: true,
|
|
137
|
+
},
|
|
138
|
+
})
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
**modelOutput** (`boolean`): Builds the result content from the tool's \`toModelOutput\`, the same output an agent would send to its model. Tools without toModelOutput, and mappers that return undefined or an unrecognized shape, keep the default result. (Default: `false`)
|
|
142
|
+
|
|
143
|
+
**transform** (`(context: { toolName: string; output: unknown; result: CallToolResult; requestContext: RequestContext }) => CallToolResult | undefined | Promise<CallToolResult | undefined>`): Rewrites the result of every completed tool call, including ask\_\* agent tools and run\_\* workflow tools. output is the raw tool output and result is the result the server would send, after modelOutput mapping. Return undefined to keep result. It runs for direct calls and tool tasks, but not for thrown tool errors or workflow tasks.
|
|
144
|
+
|
|
145
|
+
> **Warning:** The default of `modelOutput` becomes `true` in the next major version of `@mastra/mcp`. If your MCP clients parse the raw JSON text of tools that define `toModelOutput`, set `modelOutput: false` now to keep the current behavior.
|
|
146
|
+
|
|
147
|
+
With `modelOutput: true`, the server maps `toModelOutput` values to MCP content:
|
|
148
|
+
|
|
149
|
+
| `toModelOutput` value | MCP result |
|
|
150
|
+
| ----------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
|
|
151
|
+
| `{ type: 'text', value }` | Text block |
|
|
152
|
+
| `{ type: 'json', value }` | Text block with the JSON value |
|
|
153
|
+
| `{ type: 'error-text' }` or `{ type: 'error-json' }` | Text block with `isError: true` |
|
|
154
|
+
| `content` part `text` | Text block |
|
|
155
|
+
| `content` part `media`, `image-data`, or `file-data` | `image` block for `image/*`, `audio` block for `audio/*`, otherwise an embedded `resource` with a `blob` |
|
|
156
|
+
| `content` part `image-url` or `file-url` with a `data:` URI | Same as media |
|
|
157
|
+
| `content` part `image-url` or `file-url` with a remote URL | Text block with the URL |
|
|
158
|
+
|
|
159
|
+
For a tool with an `outputSchema`, the result keeps `structuredContent` and its JSON text block first, and the mapped blocks follow. If `toModelOutput` or `transform` throws, the client receives the tool error result.
|
|
160
|
+
|
|
161
|
+
Use `transform` to forward results that are already MCP-shaped, for example from tools proxied through an `MCPClient`:
|
|
162
|
+
|
|
163
|
+
```typescript
|
|
164
|
+
import { MCPClient, MCPServer, type MCPServerToolResultContext } from '@mastra/mcp'
|
|
165
|
+
|
|
166
|
+
const upstream = new MCPClient({
|
|
167
|
+
servers: { files: { url: new URL('https://files.example.com/mcp') } },
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
const server = new MCPServer({
|
|
171
|
+
id: 'proxy-server',
|
|
172
|
+
name: 'Proxy Server',
|
|
173
|
+
version: '1.0.0',
|
|
174
|
+
tools: await upstream.listTools(),
|
|
175
|
+
toolResult: {
|
|
176
|
+
// Unstructured upstream tools return the upstream MCP result as their output
|
|
177
|
+
transform: ({ output }) => {
|
|
178
|
+
const upstreamResult = output as MCPServerToolResultContext['result']
|
|
179
|
+
return Array.isArray(upstreamResult?.content) ? upstreamResult : undefined
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
})
|
|
183
|
+
```
|
|
184
|
+
|
|
118
185
|
## Exposing agents as tools
|
|
119
186
|
|
|
120
187
|
A powerful feature of `MCPServer` is its ability to automatically expose your Mastra Agents as callable tools. When you provide agents in the `agents` property of the configuration:
|