@mastra/deployer 1.60.0-alpha.7 → 1.60.0-alpha.8

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.
@@ -13,7 +13,7 @@ import process$1, { versions } from "process";
13
13
  import { getMimeType } from "hono/utils/mime";
14
14
  import { html } from "hono/html";
15
15
  import { Tool } from "@mastra/core/tools";
16
- import { MASTRA_FRAMEWORK_PUBLIC_KEY, MastraServer, checkRouteFGA, isZodError, normalizeQueryParams, redactStreamChunk, serializeStreamChunk } from "@mastra/server/server-adapter";
16
+ import { MASTRA_FRAMEWORK_PUBLIC_KEY, MastraServer, applyMcpRequestAuth, checkRouteFGA, isZodError, normalizeQueryParams, redactStreamChunk, serializeStreamChunk } from "@mastra/server/server-adapter";
17
17
  import util from "util";
18
18
  import { Buffer as Buffer$1 } from "buffer";
19
19
  import { bodyLimit } from "hono/body-limit";
@@ -3341,10 +3341,15 @@ var MastraServer$1 = class extends MastraServer {
3341
3341
  else if (route.responseType === "mcp-http") {
3342
3342
  const { server, httpPath, mcpOptions: routeMcpOptions } = result;
3343
3343
  const { req, res } = toReqRes(response.req.raw);
3344
- const options = {
3344
+ const { setRequestAuth, ...options } = {
3345
3345
  ...this.mcpOptions,
3346
3346
  ...routeMcpOptions
3347
3347
  };
3348
+ await applyMcpRequestAuth({
3349
+ req,
3350
+ requestContext: response.get("requestContext"),
3351
+ setRequestAuth
3352
+ });
3348
3353
  server.startHTTP({
3349
3354
  url: new URL(response.req.url),
3350
3355
  httpPath: `${resolvedPrefix}${httpPath}`,
@@ -3374,11 +3379,18 @@ var MastraServer$1 = class extends MastraServer {
3374
3379
  } else if (route.responseType === "mcp-sse") {
3375
3380
  const { server, ssePath, messagePath } = result;
3376
3381
  try {
3382
+ const { req } = toReqRes(response.req.raw);
3383
+ await applyMcpRequestAuth({
3384
+ req,
3385
+ requestContext: response.get("requestContext"),
3386
+ setRequestAuth: this.mcpOptions?.setRequestAuth
3387
+ });
3377
3388
  return await server.startHonoSSE({
3378
3389
  url: new URL(response.req.url),
3379
3390
  ssePath: `${resolvedPrefix}${ssePath}`,
3380
3391
  messagePath: `${resolvedPrefix}${messagePath}`,
3381
- context: response
3392
+ context: response,
3393
+ authInfo: req.auth
3382
3394
  });
3383
3395
  } catch {
3384
3396
  return response.json({ error: "Error handling MCP SSE request" }, 500);