@mastra/mcp 0.14.3 → 0.14.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/index.js CHANGED
@@ -791,6 +791,9 @@ var InternalMastraMCPClient = class extends MastraBase {
791
791
  }
792
792
  );
793
793
  this.log("debug", `Tool executed successfully: ${tool.name}`);
794
+ if (res.structuredContent !== void 0) {
795
+ return res.structuredContent;
796
+ }
794
797
  return res;
795
798
  } catch (e) {
796
799
  this.log("error", `Error calling tool: ${tool.name}`, {
@@ -2991,7 +2994,7 @@ Provided arguments: ${JSON.stringify(request.params.arguments, null, 2)}`
2991
2994
  httpPath,
2992
2995
  req,
2993
2996
  res,
2994
- options = { sessionIdGenerator: () => randomUUID() }
2997
+ options
2995
2998
  }) {
2996
2999
  this.logger.debug(`startHTTP: Received ${req.method} request to ${url.pathname}`);
2997
3000
  if (url.pathname !== httpPath) {
@@ -3000,6 +3003,12 @@ Provided arguments: ${JSON.stringify(request.params.arguments, null, 2)}`
3000
3003
  res.end();
3001
3004
  return;
3002
3005
  }
3006
+ const mergedOptions = {
3007
+ sessionIdGenerator: () => randomUUID(),
3008
+ // default: enabled
3009
+ ...options
3010
+ // user-provided overrides default
3011
+ };
3003
3012
  const sessionId = req.headers["mcp-session-id"];
3004
3013
  let transport;
3005
3014
  this.logger.debug(
@@ -3046,8 +3055,8 @@ Provided arguments: ${JSON.stringify(request.params.arguments, null, 2)}`
3046
3055
  if (isInitializeRequest(body)) {
3047
3056
  this.logger.debug("startHTTP: Received Streamable HTTP initialize request, creating new transport.");
3048
3057
  transport = new StreamableHTTPServerTransport({
3049
- ...options,
3050
- sessionIdGenerator: () => randomUUID(),
3058
+ ...mergedOptions,
3059
+ sessionIdGenerator: mergedOptions.sessionIdGenerator,
3051
3060
  onsessioninitialized: (id) => {
3052
3061
  this.streamableHTTPTransports.set(id, transport);
3053
3062
  }