@mastra/mcp 1.3.0 → 1.3.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
@@ -409,6 +409,7 @@ var InternalMastraMCPClient = class extends MastraBase {
409
409
  operationContextStore = new AsyncLocalStorage();
410
410
  exitHookUnsubscribe;
411
411
  sigTermHandler;
412
+ sigHupHandler;
412
413
  _roots;
413
414
  /** Provides access to resource operations (list, read, subscribe, etc.) */
414
415
  resources;
@@ -667,6 +668,10 @@ var InternalMastraMCPClient = class extends MastraBase {
667
668
  this.sigTermHandler = () => gracefulExit();
668
669
  process.on("SIGTERM", this.sigTermHandler);
669
670
  }
671
+ if (!this.sigHupHandler) {
672
+ this.sigHupHandler = () => gracefulExit();
673
+ process.on("SIGHUP", this.sigHupHandler);
674
+ }
670
675
  this.log("debug", `Successfully connected to MCP server`);
671
676
  return this.isConnected;
672
677
  }
@@ -723,6 +728,10 @@ var InternalMastraMCPClient = class extends MastraBase {
723
728
  process.off("SIGTERM", this.sigTermHandler);
724
729
  this.sigTermHandler = void 0;
725
730
  }
731
+ if (this.sigHupHandler) {
732
+ process.off("SIGHUP", this.sigHupHandler);
733
+ this.sigHupHandler = void 0;
734
+ }
726
735
  }
727
736
  }
728
737
  /**
@@ -953,7 +962,7 @@ var InternalMastraMCPClient = class extends MastraBase {
953
962
  if (res.structuredContent !== void 0) {
954
963
  return res.structuredContent;
955
964
  }
956
- if (tool.outputSchema && !res.isError) {
965
+ if (!res.isError) {
957
966
  const content = res.content;
958
967
  if (content && content.length === 1 && content[0].type === "text" && content[0].text !== void 0) {
959
968
  try {
@@ -2814,9 +2823,16 @@ Provided arguments: ${JSON.stringify(request.params.arguments, null, 2)}`
2814
2823
  return this.handleElicitationRequest(request2, serverInstance, options);
2815
2824
  }
2816
2825
  };
2826
+ const proxiedContext = new RequestContext();
2827
+ if (extra) {
2828
+ Object.entries(extra).forEach(([key, value]) => {
2829
+ proxiedContext.set(key, value);
2830
+ });
2831
+ }
2817
2832
  const mcpOptions = {
2818
2833
  messages: [],
2819
2834
  toolCallId: "",
2835
+ requestContext: proxiedContext,
2820
2836
  // Pass MCP-specific context through the mcp property
2821
2837
  mcp: {
2822
2838
  elicitation: sessionElicitation,