@mastra/mcp 1.5.1 → 1.6.0-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
@@ -8,10 +8,9 @@ import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/
8
8
  import { DEFAULT_REQUEST_TIMEOUT_MSEC } from '@modelcontextprotocol/sdk/shared/protocol.js';
9
9
  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
10
  import { asyncExitHook, gracefulExit } from 'exit-hook';
11
+ import { createHash, randomUUID } from 'crypto';
11
12
  import { MastraError, ErrorCategory, ErrorDomain } from '@mastra/core/error';
12
13
  import equal from 'fast-deep-equal';
13
- import { v5 } from 'uuid';
14
- import { randomUUID } from 'crypto';
15
14
  import { MCPServerBase } from '@mastra/core/mcp';
16
15
  import { RequestContext } from '@mastra/core/request-context';
17
16
  import { isStandardSchemaWithJSON, standardSchemaToJSONSchema } from '@mastra/core/schema';
@@ -493,7 +492,8 @@ var InternalMastraMCPClient = class extends MastraBase {
493
492
  version
494
493
  },
495
494
  {
496
- capabilities: clientCapabilities
495
+ capabilities: clientCapabilities,
496
+ ...server.jsonSchemaValidator ? { jsonSchemaValidator: server.jsonSchemaValidator } : {}
497
497
  }
498
498
  );
499
499
  this.setupLogging();
@@ -1589,8 +1589,7 @@ To fix this you have three different options:
1589
1589
  }
1590
1590
  makeId() {
1591
1591
  const text = JSON.stringify(this.serverConfigs).normalize("NFKC");
1592
- const idNamespace = v5(`MCPClient`, v5.DNS);
1593
- return v5(text, idNamespace);
1592
+ return createHash("sha256").update("MCPClient").update(text).digest("hex");
1594
1593
  }
1595
1594
  /**
1596
1595
  * Disconnects from all MCP servers and cleans up resources.
@@ -2488,6 +2487,7 @@ var MCPServer = class extends MCPServerBase {
2488
2487
  resourceOptions;
2489
2488
  definedPrompts;
2490
2489
  promptOptions;
2490
+ jsonSchemaValidator;
2491
2491
  subscriptions = /* @__PURE__ */ new Set();
2492
2492
  currentLoggingLevel;
2493
2493
  /**
@@ -2624,6 +2624,7 @@ var MCPServer = class extends MCPServerBase {
2624
2624
  super(opts);
2625
2625
  this.resourceOptions = opts.resources;
2626
2626
  this.promptOptions = opts.prompts;
2627
+ this.jsonSchemaValidator = opts.jsonSchemaValidator;
2627
2628
  const capabilities = {
2628
2629
  tools: {},
2629
2630
  logging: { enabled: true }
@@ -2641,7 +2642,8 @@ var MCPServer = class extends MCPServerBase {
2641
2642
  },
2642
2643
  {
2643
2644
  capabilities,
2644
- ...this.instructions ? { instructions: this.instructions } : {}
2645
+ ...this.instructions ? { instructions: this.instructions } : {},
2646
+ ...this.jsonSchemaValidator ? { jsonSchemaValidator: this.jsonSchemaValidator } : {}
2645
2647
  }
2646
2648
  );
2647
2649
  this.logger.info("Initialized MCPServer", {
@@ -2750,7 +2752,8 @@ var MCPServer = class extends MCPServerBase {
2750
2752
  },
2751
2753
  {
2752
2754
  capabilities,
2753
- ...this.instructions ? { instructions: this.instructions } : {}
2755
+ ...this.instructions ? { instructions: this.instructions } : {},
2756
+ ...this.jsonSchemaValidator ? { jsonSchemaValidator: this.jsonSchemaValidator } : {}
2754
2757
  }
2755
2758
  );
2756
2759
  this.registerHandlersOnServer(serverInstance);