@mastra/mcp 1.10.0 → 1.10.1-alpha.0

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/index.js CHANGED
@@ -7,7 +7,7 @@ import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js';
7
7
  import { StdioClientTransport, getDefaultEnvironment } from '@modelcontextprotocol/sdk/client/stdio.js';
8
8
  import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
9
9
  import { DEFAULT_REQUEST_TIMEOUT_MSEC } from '@modelcontextprotocol/sdk/shared/protocol.js';
10
- import { LoggingMessageNotificationSchema, ListRootsRequestSchema, ListResourcesResultSchema, ReadResourceResultSchema, EmptyResultSchema, ListResourceTemplatesResultSchema, ListPromptsResultSchema, GetPromptResultSchema, PromptListChangedNotificationSchema, ResourceUpdatedNotificationSchema, ResourceListChangedNotificationSchema, ElicitRequestSchema, ProgressNotificationSchema, ListToolsRequestSchema, CallToolRequestSchema, SetLevelRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema, ListResourceTemplatesRequestSchema, SubscribeRequestSchema, UnsubscribeRequestSchema, ListPromptsRequestSchema, PromptSchema, GetPromptRequestSchema, CallToolResultSchema, ErrorCode, JSONRPCMessageSchema } from '@modelcontextprotocol/sdk/types.js';
10
+ import { LoggingMessageNotificationSchema, ListRootsRequestSchema, ListResourcesResultSchema, ReadResourceResultSchema, EmptyResultSchema, ListResourceTemplatesResultSchema, ListPromptsResultSchema, GetPromptResultSchema, PromptListChangedNotificationSchema, ResourceUpdatedNotificationSchema, ResourceListChangedNotificationSchema, ElicitRequestSchema, ProgressNotificationSchema, ListToolsRequestSchema, CallToolRequestSchema, SetLevelRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema, McpError, ErrorCode, ListResourceTemplatesRequestSchema, SubscribeRequestSchema, UnsubscribeRequestSchema, ListPromptsRequestSchema, PromptSchema, GetPromptRequestSchema, CallToolResultSchema, JSONRPCMessageSchema } from '@modelcontextprotocol/sdk/types.js';
11
11
  import { asyncExitHook, gracefulExit } from 'exit-hook';
12
12
  import { createHash, randomUUID } from 'crypto';
13
13
  import { MastraError, ErrorCategory, ErrorDomain } from '@mastra/core/error';
@@ -2350,7 +2350,7 @@ function createSimpleTokenProvider(accessToken, options) {
2350
2350
  });
2351
2351
  }
2352
2352
 
2353
- // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/hono/4.12.18/a4592d669eb2c33e4f24995614864047f2c1a155accc9d64dd2de0f4e8d608a9/node_modules/hono/dist/utils/stream.js
2353
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/hono/4.12.21/c401a6c1b505d0adf80740e6e7d31122a2ebd9abaf1de7e5dee418ae2a608e7a/node_modules/hono/dist/utils/stream.js
2354
2354
  var StreamingApi = class {
2355
2355
  writer;
2356
2356
  encoder;
@@ -2379,7 +2379,9 @@ var StreamingApi = class {
2379
2379
  done ? controller.close() : controller.enqueue(value);
2380
2380
  },
2381
2381
  cancel: () => {
2382
- this.abort();
2382
+ if (!this.closed) {
2383
+ this.abort();
2384
+ }
2383
2385
  }
2384
2386
  });
2385
2387
  }
@@ -2401,11 +2403,11 @@ var StreamingApi = class {
2401
2403
  return new Promise((res) => setTimeout(res, ms));
2402
2404
  }
2403
2405
  async close() {
2406
+ this.closed = true;
2404
2407
  try {
2405
2408
  await this.writer.close();
2406
2409
  } catch {
2407
2410
  }
2408
- this.closed = true;
2409
2411
  }
2410
2412
  async pipe(body) {
2411
2413
  this.writer.releaseLock();
@@ -2427,7 +2429,7 @@ var StreamingApi = class {
2427
2429
  }
2428
2430
  };
2429
2431
 
2430
- // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/hono/4.12.18/a4592d669eb2c33e4f24995614864047f2c1a155accc9d64dd2de0f4e8d608a9/node_modules/hono/dist/helper/streaming/utils.js
2432
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/hono/4.12.21/c401a6c1b505d0adf80740e6e7d31122a2ebd9abaf1de7e5dee418ae2a608e7a/node_modules/hono/dist/helper/streaming/utils.js
2431
2433
  var isOldBunVersion = () => {
2432
2434
  const version = typeof Bun !== "undefined" ? Bun.version : void 0;
2433
2435
  if (version === void 0) {
@@ -2438,7 +2440,7 @@ var isOldBunVersion = () => {
2438
2440
  return result;
2439
2441
  };
2440
2442
 
2441
- // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/hono/4.12.18/a4592d669eb2c33e4f24995614864047f2c1a155accc9d64dd2de0f4e8d608a9/node_modules/hono/dist/utils/html.js
2443
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/hono/4.12.21/c401a6c1b505d0adf80740e6e7d31122a2ebd9abaf1de7e5dee418ae2a608e7a/node_modules/hono/dist/utils/html.js
2442
2444
  var HtmlEscapedCallbackPhase = {
2443
2445
  Stringify: 1};
2444
2446
  var resolveCallback = async (str, phase, preserveCallbacks, context, buffer) => {
@@ -2469,7 +2471,7 @@ var resolveCallback = async (str, phase, preserveCallbacks, context, buffer) =>
2469
2471
  }
2470
2472
  };
2471
2473
 
2472
- // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/hono/4.12.18/a4592d669eb2c33e4f24995614864047f2c1a155accc9d64dd2de0f4e8d608a9/node_modules/hono/dist/helper/streaming/sse.js
2474
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/hono/4.12.21/c401a6c1b505d0adf80740e6e7d31122a2ebd9abaf1de7e5dee418ae2a608e7a/node_modules/hono/dist/helper/streaming/sse.js
2473
2475
  var SSEStreamingApi = class extends StreamingApi {
2474
2476
  constructor(writable, readable) {
2475
2477
  super(writable, readable);
@@ -3356,7 +3358,7 @@ Provided arguments: ${JSON.stringify(request.params.arguments, null, 2)}`
3356
3358
  const resource = resources.find((r) => r.uri === uri);
3357
3359
  if (!resource) {
3358
3360
  this.logger.warn("Unknown resource URI requested", { uri });
3359
- throw new Error(`Resource not found: ${uri}`);
3361
+ throw new McpError(ErrorCode.InvalidParams, `Resource not found: ${uri}`);
3360
3362
  }
3361
3363
  try {
3362
3364
  const resourcesOrResourceContent = await capturedResourceOptions.getResourceContent({ uri, extra });
@@ -3465,7 +3467,7 @@ Provided arguments: ${JSON.stringify(request.params.arguments, null, 2)}`
3465
3467
  if (prompt.arguments) {
3466
3468
  for (const arg of prompt.arguments) {
3467
3469
  if (arg.required && (args?.[arg.name] === void 0 || args?.[arg.name] === null)) {
3468
- throw new Error(`Missing required argument: ${arg.name}`);
3470
+ throw new McpError(ErrorCode.InvalidParams, `Missing required argument: ${arg.name}`);
3469
3471
  }
3470
3472
  }
3471
3473
  }