@mastra/server 1.66.0-alpha.2 → 1.66.0-alpha.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.
Files changed (38) hide show
  1. package/dist/{conversations-DtnawNGm.js → conversations-D89Io31L.js} +2 -2
  2. package/dist/{conversations-DtnawNGm.js.map → conversations-D89Io31L.js.map} +1 -1
  3. package/dist/{conversations-PF0eKhIu.cjs → conversations-DJybpnE5.cjs} +2 -2
  4. package/dist/{conversations-PF0eKhIu.cjs.map → conversations-DJybpnE5.cjs.map} +1 -1
  5. package/dist/docs/SKILL.md +1 -1
  6. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  7. package/dist/docs/references/reference-observability-tracing-trace-query.md +42 -0
  8. package/dist/dynamic-workflows-Cn9MXevC.js.map +1 -1
  9. package/dist/dynamic-workflows-DSg9_yec.cjs.map +1 -1
  10. package/dist/{memory-D0prxytx.cjs → memory-CVODqy7m.cjs} +19 -1
  11. package/dist/memory-CVODqy7m.cjs.map +1 -0
  12. package/dist/{memory-CBLqn9xl.js → memory-CjWJYFVI.js} +2 -2
  13. package/dist/memory-CjWJYFVI.js.map +1 -0
  14. package/dist/schedules-BcEUUuX_.js.map +1 -1
  15. package/dist/schedules-fj9U0_tA.cjs.map +1 -1
  16. package/dist/server/handlers/agent-controller.cjs +86 -31
  17. package/dist/server/handlers/agent-controller.cjs.map +1 -1
  18. package/dist/server/handlers/agent-controller.d.ts +57 -0
  19. package/dist/server/handlers/agent-controller.d.ts.map +1 -1
  20. package/dist/server/handlers/agent-controller.js +86 -31
  21. package/dist/server/handlers/agent-controller.js.map +1 -1
  22. package/dist/server/handlers/authorship.cjs.map +1 -1
  23. package/dist/server/handlers/authorship.js.map +1 -1
  24. package/dist/server/handlers/conversations.cjs +1 -1
  25. package/dist/server/handlers/conversations.js +1 -1
  26. package/dist/server/handlers/mcp.cjs.map +1 -1
  27. package/dist/server/handlers/mcp.js.map +1 -1
  28. package/dist/server/handlers/memory.cjs +1 -1
  29. package/dist/server/handlers/memory.js +1 -1
  30. package/dist/server/schemas/index.cjs +5 -2
  31. package/dist/server/schemas/index.js +3 -3
  32. package/dist/server/schemas/memory.d.ts +36 -0
  33. package/dist/server/schemas/memory.d.ts.map +1 -1
  34. package/dist/server/server-adapter/index.cjs.map +1 -1
  35. package/dist/server/server-adapter/index.js.map +1 -1
  36. package/package.json +6 -6
  37. package/dist/memory-CBLqn9xl.js.map +0 -1
  38. package/dist/memory-D0prxytx.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"authorship.js","names":[],"sources":["../../../src/server/handlers/authorship.ts"],"sourcesContent":["import { matchesPermission } from '@mastra/core/auth/ee';\nimport type { RequestContext } from '@mastra/core/di';\n\nimport { MASTRA_RESOURCE_ID_KEY, MASTRA_USER_KEY, MASTRA_USER_PERMISSIONS_KEY } from '../constants';\nimport { HTTPException } from '../http-exception';\n\n/**\n * Shape of a stored record that carries ownership + visibility metadata.\n * Used by `matchesAuthorFilter` and the access-assertion helpers.\n */\nexport type OwnedRecord = {\n authorId?: string | null;\n visibility?: 'private' | 'public';\n};\n\n/**\n * Returns the author id associated with the authenticated caller, or `null`\n * if auth is not configured / the caller cannot be resolved.\n *\n * Prefers `MASTRA_RESOURCE_ID_KEY` (set by `authConfig.mapUserToResourceId`)\n * and falls back to `user.id` on the authenticated user object.\n */\nexport function getCallerAuthorId(requestContext: RequestContext): string | null {\n const resourceId = requestContext.get(MASTRA_RESOURCE_ID_KEY);\n if (typeof resourceId === 'string' && resourceId.length > 0) {\n return resourceId;\n }\n\n const user = requestContext.get(MASTRA_USER_KEY);\n if (user && typeof user === 'object' && 'id' in user) {\n const id = (user as { id: unknown }).id;\n if (typeof id === 'string' && id.length > 0) {\n return id;\n }\n }\n\n return null;\n}\n\n/**\n * Returns the list of permission strings currently attached to the caller by\n * the RBAC provider. Returns an empty array when RBAC isn't configured.\n */\nexport function getCallerPermissions(requestContext: RequestContext): string[] {\n const raw = requestContext.get(MASTRA_USER_PERMISSIONS_KEY);\n if (Array.isArray(raw)) {\n return raw.filter((p): p is string => typeof p === 'string');\n }\n return [];\n}\n\n/**\n * True if the caller holds a wildcard permission that lets them manage a\n * resource they don't own (e.g. admins listing agents across tenants).\n *\n * Recognizes `*`, `<resource>:*`, and `<resource>:admin`.\n */\nexport function hasAdminBypass(requestContext: RequestContext, resource: string): boolean {\n const permissions = getCallerPermissions(requestContext);\n if (permissions.length === 0) return false;\n const wildcardAll = '*';\n const resourceWildcard = `${resource}:*`;\n const resourceAdmin = `${resource}:admin`;\n return permissions.some(p => p === wildcardAll || p === resourceWildcard || p === resourceAdmin);\n}\n\n/**\n * True if the caller holds a permission explicitly scoped to a specific\n * resource id — e.g. `agents:read:agent-123` or `agents:*:agent-123`.\n *\n * Broad grants without a resource-id segment (e.g. the role-default\n * `agents:execute`) are intentionally NOT treated as satisfying ownership\n * overrides. Those broad grants already gate route access at the\n * `requiresPermission` layer; giving them a second life as per-record\n * overrides would defeat the owner/visibility model.\n *\n * When called without `resourceId` (the legacy shape), falls back to the\n * original \"any matching permission\" behavior.\n */\nexport function hasScopedPermission(args: {\n requestContext: RequestContext;\n resource: string;\n action: string;\n resourceId?: string;\n}): boolean {\n const { requestContext, resource, action, resourceId } = args;\n const permissions = getCallerPermissions(requestContext);\n if (permissions.length === 0) return false;\n\n if (!resourceId) {\n const required = `${resource}:${action}`;\n return permissions.some(p => matchesPermission(p, required));\n }\n\n const required = `${resource}:${action}:${resourceId}`;\n return permissions.some(p => {\n // Only honor grants that explicitly name a resource id. A granted\n // permission with just `<resource>:<action>` (no id segment) is\n // considered a broad role grant, not a per-record override.\n const parts = p.split(':');\n if (parts.length < 3) return false;\n return matchesPermission(p, required);\n });\n}\n\nexport type AuthorFilter =\n | { kind: 'unrestricted' }\n | { kind: 'exact'; authorId: string }\n | { kind: 'ownedOrPublic'; callerAuthorId: string }\n | { kind: 'publicOnly' }\n | { kind: 'ownedOrPublicOthers'; callerAuthorId: string; queryAuthorId: string };\n\n/**\n * Resolves the filter to apply when listing owner-scoped records.\n *\n * Behavior matrix:\n * - Admin bypass + no query overrides → `unrestricted`.\n * - Admin bypass + `authorId=X` → `exact` (all of X's rows).\n * - `visibility=public` (any caller) → `publicOnly` (aggregate public rows across owners).\n * - `authorId=X`, caller === X → `exact` (all of caller's rows).\n * - `authorId=X`, caller !== X (non-admin) → `ownedOrPublicOthers` (only X's public rows).\n * - No caller (auth off) → `unrestricted` (or `exact` if query supplied).\n * - Default → `ownedOrPublic` (caller's rows + legacy unowned + any public rows).\n */\nexport function resolveAuthorFilter(args: {\n requestContext: RequestContext;\n resource: string;\n queryAuthorId?: string;\n queryVisibility?: 'public';\n}): AuthorFilter {\n const { requestContext, resource, queryAuthorId, queryVisibility } = args;\n const callerAuthorId = getCallerAuthorId(requestContext);\n const bypass = hasAdminBypass(requestContext, resource);\n\n if (queryVisibility === 'public' && !queryAuthorId) {\n return { kind: 'publicOnly' };\n }\n\n if (bypass) {\n return queryAuthorId ? { kind: 'exact', authorId: queryAuthorId } : { kind: 'unrestricted' };\n }\n\n // Auth isn't configured (no caller) → treat as unrestricted. The route's\n // `requiresAuth`/`requiresPermission` is what gates access in that mode.\n if (!callerAuthorId) {\n return queryAuthorId ? { kind: 'exact', authorId: queryAuthorId } : { kind: 'unrestricted' };\n }\n\n if (queryAuthorId) {\n if (queryAuthorId === callerAuthorId) {\n return { kind: 'exact', authorId: callerAuthorId };\n }\n // Non-owner asking about another user: only that user's public rows are visible.\n return { kind: 'ownedOrPublicOthers', callerAuthorId, queryAuthorId };\n }\n\n return { kind: 'ownedOrPublic', callerAuthorId };\n}\n\n/**\n * Returns `true` if the record is visible to the caller given the resolved\n * filter. See `resolveAuthorFilter` for the filter semantics.\n *\n * Legacy rows with `authorId == null` are treated as public (visible to all).\n */\nexport function matchesAuthorFilter(record: OwnedRecord, filter: AuthorFilter): boolean {\n const owner = record.authorId ?? null;\n const isPublic = record.visibility === 'public';\n\n switch (filter.kind) {\n case 'unrestricted':\n return true;\n case 'exact':\n return owner === filter.authorId;\n case 'ownedOrPublic':\n return owner === null || owner === filter.callerAuthorId || isPublic;\n case 'publicOnly':\n return owner === null || isPublic;\n case 'ownedOrPublicOthers':\n // Filtering by another author's rows: only expose their public ones.\n // Legacy unowned rows match if the query is for `null`; here the query\n // is always for a concrete id, so unowned rows don't match.\n return owner === filter.queryAuthorId && isPublic;\n }\n}\n\n/**\n * Asserts the caller has read access to the record. Throws 404 if not.\n *\n * Read access is granted when:\n * - The record has no owner (legacy/public), OR\n * - The record is marked `visibility: 'public'`, OR\n * - The caller owns the record, OR\n * - The caller has admin bypass (`*`, `<resource>:*`, `<resource>:admin`), OR\n * - The caller holds `<resource>:read` or `<resource>:read:<resourceId>`.\n */\nexport function assertReadAccess(args: {\n requestContext: RequestContext;\n resource: string;\n resourceId?: string;\n record: OwnedRecord;\n}): void {\n const { requestContext, resource, resourceId, record } = args;\n const owner = record.authorId ?? null;\n\n if (owner === null) return;\n if (record.visibility === 'public') return;\n if (hasAdminBypass(requestContext, resource)) return;\n\n const callerAuthorId = getCallerAuthorId(requestContext);\n // No authenticated user on the request context means auth is not configured\n // (single-user/dev mode). When auth IS configured, coreAuthMiddleware\n // rejects unauthenticated requests with 401 before they reach handlers,\n // so an absent user here genuinely means no auth provider.\n if (!callerAuthorId && !requestContext.get(MASTRA_USER_KEY)) return;\n if (callerAuthorId === owner) return;\n\n if (hasScopedPermission({ requestContext, resource, action: 'read', resourceId })) {\n return;\n }\n\n throw new HTTPException(404, { message: 'Not found' });\n}\n\n/**\n * Asserts the caller has execute access to the record. Throws 404 if not.\n *\n * Execute access is granted when:\n * - The record has no owner (legacy/public), OR\n * - The record is marked `visibility: 'public'`, OR\n * - The caller owns the record, OR\n * - The caller has admin bypass (`*`, `<resource>:*`, `<resource>:admin`), OR\n * - The caller holds `<resource>:execute` / `<resource>:execute:<resourceId>`, OR\n * - The caller holds `<resource>:read` / `<resource>:read:<resourceId>`\n * (read implies the ability to consume/chat with the resource).\n */\nexport function assertExecuteAccess(args: {\n requestContext: RequestContext;\n resource: string;\n resourceId?: string;\n record: OwnedRecord;\n}): void {\n const { requestContext, resource, resourceId, record } = args;\n const owner = record.authorId ?? null;\n\n if (owner === null) return;\n if (record.visibility === 'public') return;\n if (hasAdminBypass(requestContext, resource)) return;\n\n const callerAuthorId = getCallerAuthorId(requestContext);\n if (!callerAuthorId && !requestContext.get(MASTRA_USER_KEY)) return; // No auth configured (see assertReadAccess)\n if (callerAuthorId === owner) return;\n\n if (hasScopedPermission({ requestContext, resource, action: 'execute', resourceId })) {\n return;\n }\n if (hasScopedPermission({ requestContext, resource, action: 'read', resourceId })) {\n return;\n }\n\n throw new HTTPException(404, { message: 'Not found' });\n}\n\n/**\n * Asserts the caller has write access (edit or delete) to the record.\n * Throws 404 if not.\n *\n * Write access is granted when:\n * - The record has no owner (legacy), OR\n * - The caller owns the record, OR\n * - The caller has admin bypass, OR\n * - The caller holds `<resource>:<action>` or `<resource>:<action>:<resourceId>`.\n *\n * `visibility: 'public'` alone does NOT grant write access.\n */\nexport function assertWriteAccess(args: {\n requestContext: RequestContext;\n resource: string;\n resourceId?: string;\n action: 'edit' | 'delete' | 'write';\n record: OwnedRecord;\n}): void {\n const { requestContext, resource, resourceId, action, record } = args;\n const owner = record.authorId ?? null;\n\n if (owner === null) return;\n if (hasAdminBypass(requestContext, resource)) return;\n\n const callerAuthorId = getCallerAuthorId(requestContext);\n if (!callerAuthorId && !requestContext.get(MASTRA_USER_KEY)) return; // No auth configured (see assertReadAccess)\n if (callerAuthorId === owner) return;\n\n if (hasScopedPermission({ requestContext, resource, action, resourceId })) {\n return;\n }\n\n throw new HTTPException(404, { message: 'Not found' });\n}\n\n/**\n * Asserts the caller has share access to the record. Throws 404 if not.\n *\n * Share access controls who can change a record's audience/visibility\n * (e.g. flipping `private` ↔ `public`). It is intentionally separate from\n * `write`: a caller with only `<resource>:write` MUST NOT be able to flip\n * visibility — that would let any editor expose private records.\n *\n * Share access is granted when:\n * - The record has no owner (legacy), OR\n * - The caller owns the record (creators can share their own records), OR\n * - The caller has admin bypass (`*`, `<resource>:*`, `<resource>:admin`), OR\n * - The caller holds `<resource>:share` / `<resource>:share:<resourceId>`\n * (or any pattern that matches it, e.g. `*:share`).\n *\n * `visibility: 'public'` does NOT grant share access — being readable doesn't\n * imply the right to change who else can read.\n */\nexport function assertShareAccess(args: {\n requestContext: RequestContext;\n resource: string;\n resourceId?: string;\n record: OwnedRecord;\n}): void {\n const { requestContext, resource, resourceId, record } = args;\n const owner = record.authorId ?? null;\n\n if (owner === null) return;\n if (hasAdminBypass(requestContext, resource)) return;\n\n const callerAuthorId = getCallerAuthorId(requestContext);\n if (!callerAuthorId && !requestContext.get(MASTRA_USER_KEY)) return; // No auth configured (see assertReadAccess)\n if (callerAuthorId === owner) return;\n\n if (hasScopedPermission({ requestContext, resource, action: 'share', resourceId })) {\n return;\n }\n\n throw new HTTPException(404, { message: 'Not found' });\n}\n\n/**\n * Alias for `assertWriteAccess` with `action: 'edit'`. Prefer `assertWriteAccess`\n * in new code so the action is explicit.\n */\nexport function assertOwnership(args: {\n requestContext: RequestContext;\n resource: string;\n resourceId?: string;\n record: OwnedRecord;\n}): void {\n assertWriteAccess({ ...args, action: 'edit' });\n}\n"],"mappings":";;;;;;;;;;;AAsBA,SAAgB,kBAAkB,gBAA+C;CAC/E,MAAM,aAAa,eAAe,IAAI,sBAAsB;CAC5D,IAAI,OAAO,eAAe,YAAY,WAAW,SAAS,GACxD,OAAO;CAGT,MAAM,OAAO,eAAe,IAAI,eAAe;CAC/C,IAAI,QAAQ,OAAO,SAAS,YAAY,QAAQ,MAAM;EACpD,MAAM,KAAM,KAAyB;EACrC,IAAI,OAAO,OAAO,YAAY,GAAG,SAAS,GACxC,OAAO;CAEX;CAEA,OAAO;AACT;;;;;AAMA,SAAgB,qBAAqB,gBAA0C;CAC7E,MAAM,MAAM,eAAe,IAAI,2BAA2B;CAC1D,IAAI,MAAM,QAAQ,GAAG,GACnB,O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QAAQ;CAAO,CAAC;AAC/C"}
1
+ {"version":3,"file":"authorship.js","names":[],"sources":["../../../src/server/handlers/authorship.ts"],"sourcesContent":["import { matchesPermission } from '@mastra/core/auth/ee';\nimport type { RequestContext } from '@mastra/core/di';\n\nimport { MASTRA_RESOURCE_ID_KEY, MASTRA_USER_KEY, MASTRA_USER_PERMISSIONS_KEY } from '../constants';\nimport { HTTPException } from '../http-exception';\n\n/**\n * Shape of a stored record that carries ownership + visibility metadata.\n * Used by `matchesAuthorFilter` and the access-assertion helpers.\n */\nexport type OwnedRecord = {\n authorId?: string | null;\n visibility?: 'private' | 'public';\n};\n\n/**\n * Returns the author id associated with the authenticated caller, or `null`\n * if auth is not configured / the caller cannot be resolved.\n *\n * Prefers `MASTRA_RESOURCE_ID_KEY` (set by `authConfig.mapUserToResourceId`)\n * and falls back to `user.id` on the authenticated user object.\n */\nexport function getCallerAuthorId(requestContext: RequestContext): string | null {\n const resourceId = requestContext.get(MASTRA_RESOURCE_ID_KEY);\n if (typeof resourceId === 'string' && resourceId.length > 0) {\n return resourceId;\n }\n\n const user = requestContext.get(MASTRA_USER_KEY);\n if (user && typeof user === 'object' && 'id' in user) {\n const id = user.id;\n if (typeof id === 'string' && id.length > 0) {\n return id;\n }\n }\n\n return null;\n}\n\n/**\n * Returns the list of permission strings currently attached to the caller by\n * the RBAC provider. Returns an empty array when RBAC isn't configured.\n */\nexport function getCallerPermissions(requestContext: RequestContext): string[] {\n const raw = requestContext.get(MASTRA_USER_PERMISSIONS_KEY);\n if (Array.isArray(raw)) {\n return raw.filter((p): p is string => typeof p === 'string');\n }\n return [];\n}\n\n/**\n * True if the caller holds a wildcard permission that lets them manage a\n * resource they don't own (e.g. admins listing agents across tenants).\n *\n * Recognizes `*`, `<resource>:*`, and `<resource>:admin`.\n */\nexport function hasAdminBypass(requestContext: RequestContext, resource: string): boolean {\n const permissions = getCallerPermissions(requestContext);\n if (permissions.length === 0) return false;\n const wildcardAll = '*';\n const resourceWildcard = `${resource}:*`;\n const resourceAdmin = `${resource}:admin`;\n return permissions.some(p => p === wildcardAll || p === resourceWildcard || p === resourceAdmin);\n}\n\n/**\n * True if the caller holds a permission explicitly scoped to a specific\n * resource id — e.g. `agents:read:agent-123` or `agents:*:agent-123`.\n *\n * Broad grants without a resource-id segment (e.g. the role-default\n * `agents:execute`) are intentionally NOT treated as satisfying ownership\n * overrides. Those broad grants already gate route access at the\n * `requiresPermission` layer; giving them a second life as per-record\n * overrides would defeat the owner/visibility model.\n *\n * When called without `resourceId` (the legacy shape), falls back to the\n * original \"any matching permission\" behavior.\n */\nexport function hasScopedPermission(args: {\n requestContext: RequestContext;\n resource: string;\n action: string;\n resourceId?: string;\n}): boolean {\n const { requestContext, resource, action, resourceId } = args;\n const permissions = getCallerPermissions(requestContext);\n if (permissions.length === 0) return false;\n\n if (!resourceId) {\n const required = `${resource}:${action}`;\n return permissions.some(p => matchesPermission(p, required));\n }\n\n const required = `${resource}:${action}:${resourceId}`;\n return permissions.some(p => {\n // Only honor grants that explicitly name a resource id. A granted\n // permission with just `<resource>:<action>` (no id segment) is\n // considered a broad role grant, not a per-record override.\n const parts = p.split(':');\n if (parts.length < 3) return false;\n return matchesPermission(p, required);\n });\n}\n\nexport type AuthorFilter =\n | { kind: 'unrestricted' }\n | { kind: 'exact'; authorId: string }\n | { kind: 'ownedOrPublic'; callerAuthorId: string }\n | { kind: 'publicOnly' }\n | { kind: 'ownedOrPublicOthers'; callerAuthorId: string; queryAuthorId: string };\n\n/**\n * Resolves the filter to apply when listing owner-scoped records.\n *\n * Behavior matrix:\n * - Admin bypass + no query overrides → `unrestricted`.\n * - Admin bypass + `authorId=X` → `exact` (all of X's rows).\n * - `visibility=public` (any caller) → `publicOnly` (aggregate public rows across owners).\n * - `authorId=X`, caller === X → `exact` (all of caller's rows).\n * - `authorId=X`, caller !== X (non-admin) → `ownedOrPublicOthers` (only X's public rows).\n * - No caller (auth off) → `unrestricted` (or `exact` if query supplied).\n * - Default → `ownedOrPublic` (caller's rows + legacy unowned + any public rows).\n */\nexport function resolveAuthorFilter(args: {\n requestContext: RequestContext;\n resource: string;\n queryAuthorId?: string;\n queryVisibility?: 'public';\n}): AuthorFilter {\n const { requestContext, resource, queryAuthorId, queryVisibility } = args;\n const callerAuthorId = getCallerAuthorId(requestContext);\n const bypass = hasAdminBypass(requestContext, resource);\n\n if (queryVisibility === 'public' && !queryAuthorId) {\n return { kind: 'publicOnly' };\n }\n\n if (bypass) {\n return queryAuthorId ? { kind: 'exact', authorId: queryAuthorId } : { kind: 'unrestricted' };\n }\n\n // Auth isn't configured (no caller) → treat as unrestricted. The route's\n // `requiresAuth`/`requiresPermission` is what gates access in that mode.\n if (!callerAuthorId) {\n return queryAuthorId ? { kind: 'exact', authorId: queryAuthorId } : { kind: 'unrestricted' };\n }\n\n if (queryAuthorId) {\n if (queryAuthorId === callerAuthorId) {\n return { kind: 'exact', authorId: callerAuthorId };\n }\n // Non-owner asking about another user: only that user's public rows are visible.\n return { kind: 'ownedOrPublicOthers', callerAuthorId, queryAuthorId };\n }\n\n return { kind: 'ownedOrPublic', callerAuthorId };\n}\n\n/**\n * Returns `true` if the record is visible to the caller given the resolved\n * filter. See `resolveAuthorFilter` for the filter semantics.\n *\n * Legacy rows with `authorId == null` are treated as public (visible to all).\n */\nexport function matchesAuthorFilter(record: OwnedRecord, filter: AuthorFilter): boolean {\n const owner = record.authorId ?? null;\n const isPublic = record.visibility === 'public';\n\n switch (filter.kind) {\n case 'unrestricted':\n return true;\n case 'exact':\n return owner === filter.authorId;\n case 'ownedOrPublic':\n return owner === null || owner === filter.callerAuthorId || isPublic;\n case 'publicOnly':\n return owner === null || isPublic;\n case 'ownedOrPublicOthers':\n // Filtering by another author's rows: only expose their public ones.\n // Legacy unowned rows match if the query is for `null`; here the query\n // is always for a concrete id, so unowned rows don't match.\n return owner === filter.queryAuthorId && isPublic;\n }\n}\n\n/**\n * Asserts the caller has read access to the record. Throws 404 if not.\n *\n * Read access is granted when:\n * - The record has no owner (legacy/public), OR\n * - The record is marked `visibility: 'public'`, OR\n * - The caller owns the record, OR\n * - The caller has admin bypass (`*`, `<resource>:*`, `<resource>:admin`), OR\n * - The caller holds `<resource>:read` or `<resource>:read:<resourceId>`.\n */\nexport function assertReadAccess(args: {\n requestContext: RequestContext;\n resource: string;\n resourceId?: string;\n record: OwnedRecord;\n}): void {\n const { requestContext, resource, resourceId, record } = args;\n const owner = record.authorId ?? null;\n\n if (owner === null) return;\n if (record.visibility === 'public') return;\n if (hasAdminBypass(requestContext, resource)) return;\n\n const callerAuthorId = getCallerAuthorId(requestContext);\n // No authenticated user on the request context means auth is not configured\n // (single-user/dev mode). When auth IS configured, coreAuthMiddleware\n // rejects unauthenticated requests with 401 before they reach handlers,\n // so an absent user here genuinely means no auth provider.\n if (!callerAuthorId && !requestContext.get(MASTRA_USER_KEY)) return;\n if (callerAuthorId === owner) return;\n\n if (hasScopedPermission({ requestContext, resource, action: 'read', resourceId })) {\n return;\n }\n\n throw new HTTPException(404, { message: 'Not found' });\n}\n\n/**\n * Asserts the caller has execute access to the record. Throws 404 if not.\n *\n * Execute access is granted when:\n * - The record has no owner (legacy/public), OR\n * - The record is marked `visibility: 'public'`, OR\n * - The caller owns the record, OR\n * - The caller has admin bypass (`*`, `<resource>:*`, `<resource>:admin`), OR\n * - The caller holds `<resource>:execute` / `<resource>:execute:<resourceId>`, OR\n * - The caller holds `<resource>:read` / `<resource>:read:<resourceId>`\n * (read implies the ability to consume/chat with the resource).\n */\nexport function assertExecuteAccess(args: {\n requestContext: RequestContext;\n resource: string;\n resourceId?: string;\n record: OwnedRecord;\n}): void {\n const { requestContext, resource, resourceId, record } = args;\n const owner = record.authorId ?? null;\n\n if (owner === null) return;\n if (record.visibility === 'public') return;\n if (hasAdminBypass(requestContext, resource)) return;\n\n const callerAuthorId = getCallerAuthorId(requestContext);\n if (!callerAuthorId && !requestContext.get(MASTRA_USER_KEY)) return; // No auth configured (see assertReadAccess)\n if (callerAuthorId === owner) return;\n\n if (hasScopedPermission({ requestContext, resource, action: 'execute', resourceId })) {\n return;\n }\n if (hasScopedPermission({ requestContext, resource, action: 'read', resourceId })) {\n return;\n }\n\n throw new HTTPException(404, { message: 'Not found' });\n}\n\n/**\n * Asserts the caller has write access (edit or delete) to the record.\n * Throws 404 if not.\n *\n * Write access is granted when:\n * - The record has no owner (legacy), OR\n * - The caller owns the record, OR\n * - The caller has admin bypass, OR\n * - The caller holds `<resource>:<action>` or `<resource>:<action>:<resourceId>`.\n *\n * `visibility: 'public'` alone does NOT grant write access.\n */\nexport function assertWriteAccess(args: {\n requestContext: RequestContext;\n resource: string;\n resourceId?: string;\n action: 'edit' | 'delete' | 'write';\n record: OwnedRecord;\n}): void {\n const { requestContext, resource, resourceId, action, record } = args;\n const owner = record.authorId ?? null;\n\n if (owner === null) return;\n if (hasAdminBypass(requestContext, resource)) return;\n\n const callerAuthorId = getCallerAuthorId(requestContext);\n if (!callerAuthorId && !requestContext.get(MASTRA_USER_KEY)) return; // No auth configured (see assertReadAccess)\n if (callerAuthorId === owner) return;\n\n if (hasScopedPermission({ requestContext, resource, action, resourceId })) {\n return;\n }\n\n throw new HTTPException(404, { message: 'Not found' });\n}\n\n/**\n * Asserts the caller has share access to the record. Throws 404 if not.\n *\n * Share access controls who can change a record's audience/visibility\n * (e.g. flipping `private` ↔ `public`). It is intentionally separate from\n * `write`: a caller with only `<resource>:write` MUST NOT be able to flip\n * visibility — that would let any editor expose private records.\n *\n * Share access is granted when:\n * - The record has no owner (legacy), OR\n * - The caller owns the record (creators can share their own records), OR\n * - The caller has admin bypass (`*`, `<resource>:*`, `<resource>:admin`), OR\n * - The caller holds `<resource>:share` / `<resource>:share:<resourceId>`\n * (or any pattern that matches it, e.g. `*:share`).\n *\n * `visibility: 'public'` does NOT grant share access — being readable doesn't\n * imply the right to change who else can read.\n */\nexport function assertShareAccess(args: {\n requestContext: RequestContext;\n resource: string;\n resourceId?: string;\n record: OwnedRecord;\n}): void {\n const { requestContext, resource, resourceId, record } = args;\n const owner = record.authorId ?? null;\n\n if (owner === null) return;\n if (hasAdminBypass(requestContext, resource)) return;\n\n const callerAuthorId = getCallerAuthorId(requestContext);\n if (!callerAuthorId && !requestContext.get(MASTRA_USER_KEY)) return; // No auth configured (see assertReadAccess)\n if (callerAuthorId === owner) return;\n\n if (hasScopedPermission({ requestContext, resource, action: 'share', resourceId })) {\n return;\n }\n\n throw new HTTPException(404, { message: 'Not found' });\n}\n\n/**\n * Alias for `assertWriteAccess` with `action: 'edit'`. Prefer `assertWriteAccess`\n * in new code so the action is explicit.\n */\nexport function assertOwnership(args: {\n requestContext: RequestContext;\n resource: string;\n resourceId?: string;\n record: OwnedRecord;\n}): void {\n assertWriteAccess({ ...args, action: 'edit' });\n}\n"],"mappings":";;;;;;;;;;;AAsBA,SAAgB,kBAAkB,gBAA+C;CAC/E,MAAM,aAAa,eAAe,IAAI,sBAAsB;CAC5D,IAAI,OAAO,eAAe,YAAY,WAAW,SAAS,GACxD,OAAO;CAGT,MAAM,OAAO,eAAe,IAAI,eAAe;CAC/C,IAAI,QAAQ,OAAO,SAAS,YAAY,QAAQ,MAAM;EACpD,MAAM,KAAK,KAAK;EAChB,IAAI,OAAO,OAAO,YAAY,GAAG,SAAS,GACxC,OAAO;CAEX;CAEA,OAAO;AACT;;;;;AAMA,SAAgB,qBAAqB,gBAA0C;CAC7E,MAAM,MAAM,eAAe,IAAI,2BAA2B;CAC1D,IAAI,MAAM,QAAQ,GAAG,GACnB,OAAO,IAAI,QAAQ,MAAmB,OAAO,MAAM,QAAQ;CAE7D,OAAO,CAAC;AACV;;;;;;;AAQA,SAAgB,eAAe,gBAAgC,UAA2B;CACxF,MAAM,cAAc,qBAAqB,cAAc;CACvD,IAAI,YAAY,WAAW,GAAG,OAAO;CACrC,MAAM,cAAc;CACpB,MAAM,mBAAmB,GAAG,SAAS;CACrC,MAAM,gBAAgB,GAAG,SAAS;CAClC,OAAO,YAAY,MAAK,MAAK,MAAM,eAAe,MAAM,oBAAoB,M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AMzB;CACP,MAAM,EAAE,gBAAgB,UAAU,YAAY,QAAQ,WAAW;CACjE,MAAM,QAAQ,OAAO,YAAY;CAEjC,IAAI,UAAU,MAAM;CACpB,IAAI,eAAe,gBAAgB,QAAQ,GAAG;CAE9C,MAAM,iBAAiB,kBAAkB,cAAc;CACvD,IAAI,CAAC,kBAAkB,CAAC,eAAe,IAAA,cAAmB,GAAG;CAC7D,IAAI,mBAAmB,OAAO;CAE9B,IAAI,oBAAoB;EAAE;EAAgB;EAAU;EAAQ;CAAW,CAAC,GACtE;CAGF,MAAM,IAAI,cAAc,KAAK,EAAE,SAAS,YAAY,CAAC;AACvD;;;;;;;;;;;;;;;;;;;AAoBA,SAAgB,kBAAkB,MAKzB;CACP,MAAM,EAAE,gBAAgB,UAAU,YAAY,WAAW;CACzD,MAAM,QAAQ,OAAO,YAAY;CAEjC,IAAI,UAAU,MAAM;CACpB,IAAI,eAAe,gBAAgB,QAAQ,GAAG;CAE9C,MAAM,iBAAiB,kBAAkB,cAAc;CACvD,IAAI,CAAC,kBAAkB,CAAC,eAAe,IAAA,cAAmB,GAAG;CAC7D,IAAI,mBAAmB,OAAO;CAE9B,IAAI,oBAAoB;EAAE;EAAgB;EAAU,QAAQ;EAAS;CAAW,CAAC,GAC/E;CAGF,MAAM,IAAI,cAAc,KAAK,EAAE,SAAS,YAAY,CAAC;AACvD;;;;;AAMA,SAAgB,gBAAgB,MAKvB;CACP,kBAAkB;EAAE,GAAG;EAAM,QAAQ;CAAO,CAAC;AAC/C"}
@@ -5,7 +5,7 @@ const require_route_builder = require("../../route-builder-C8n4ugUf.cjs");
5
5
  const require_server_handlers_error = require("./error.cjs");
6
6
  const require_utils = require("../../utils-DJMUhfvY.cjs");
7
7
  const require_server_handlers_agents = require("./agents.cjs");
8
- const require_conversations = require("../../conversations-PF0eKhIu.cjs");
8
+ const require_conversations = require("../../conversations-DJybpnE5.cjs");
9
9
  const require_server_handlers_responses_adapter = require("./responses.adapter.cjs");
10
10
  const require_server_handlers_responses_storage = require("./responses.storage.cjs");
11
11
  let crypto = require("crypto");
@@ -4,7 +4,7 @@ import { n as createRoute } from "../../route-builder-BveLN9LU.js";
4
4
  import { handleError } from "./error.js";
5
5
  import { d as MastraFGAPermissions, n as getEffectiveResourceId } from "../../utils-Hz8Hc2cd.js";
6
6
  import { getAgentFromSystem } from "./agents.js";
7
- import { a as createConversationBodySchema, i as conversationObjectSchema, n as conversationIdPathParams, r as conversationItemsListSchema, t as conversationDeletedSchema } from "../../conversations-DtnawNGm.js";
7
+ import { a as createConversationBodySchema, i as conversationObjectSchema, n as conversationIdPathParams, r as conversationItemsListSchema, t as conversationDeletedSchema } from "../../conversations-D89Io31L.js";
8
8
  import { mapMastraMessagesToConversationItems } from "./responses.adapter.js";
9
9
  import { findConversationThreadAcrossAgents, getAgentMemoryStore } from "./responses.storage.js";
10
10
  import { randomUUID } from "crypto";
@@ -1 +1 @@
1
- {"version":3,"file":"mcp.cjs","names":["createRoute","listMcpServersQuerySchema","listMcpServersResponseSchema","HTTPException","mcpServerDetailPathParams","getMcpServerDetailQuerySchema","serverDetailSchema","mcpServerIdPathParams","listMcpServerToolsResponseSchema","mcpServerToolPathParams","mcpToolInfoSchema","executeToolBodySchema","executeToolResponseSchema","mcpServerResourcePathParams","listResourcesResponseSchema","readResourceBodySchema","readResourceResponseSchema"],"sources":["../../../src/server/handlers/mcp.ts"],"sourcesContent":["import type { MCPServerBase as MastraMCPServerImplementation, ServerInfo } from '@mastra/core/mcp';\nimport { HTTPException } from '../http-exception';\nimport {\n mcpServerDetailPathParams,\n mcpServerToolPathParams,\n executeToolBodySchema,\n listMcpServersQuerySchema,\n getMcpServerDetailQuerySchema,\n listMcpServersResponseSchema,\n serverDetailSchema,\n mcpServerIdPathParams,\n listMcpServerToolsResponseSchema,\n mcpToolInfoSchema,\n executeToolResponseSchema,\n mcpServerResourcePathParams,\n readResourceBodySchema,\n readResourceResponseSchema,\n listResourcesResponseSchema,\n} from '../schemas/mcp';\nimport type { ServerContext } from '../server-adapter';\nimport type { SetMcpRequestAuth } from '../server-adapter/mcp-auth';\nimport { createRoute } from '../server-adapter/routes/route-builder';\n\n// ============================================================================\n// Route Definitions (createRoute pattern for server adapters)\n// ============================================================================\n\nexport const LIST_MCP_SERVERS_ROUTE = createRoute({\n method: 'GET',\n path: '/mcp/v0/servers',\n responseType: 'json',\n queryParamSchema: listMcpServersQuerySchema,\n responseSchema: listMcpServersResponseSchema,\n summary: 'List MCP servers',\n description: 'Returns a list of registered MCP servers with pagination support',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({\n mastra,\n routePrefix,\n page,\n perPage,\n limit,\n offset,\n }: ServerContext & { page?: number; perPage?: number; limit?: number; offset?: number }) => {\n if (!mastra || typeof mastra.listMCPServers !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or listMCPServers method not available' });\n }\n\n const servers = mastra.listMCPServers();\n\n if (!servers) {\n return { servers: [], total_count: 0, next: null };\n }\n\n const serverList = Object.values(servers) as MastraMCPServerImplementation[];\n const totalCount = serverList.length;\n\n // Support both page/perPage and limit/offset for backwards compatibility\n // Detect which format user is using - prefer page/perPage if both provided\n const useLegacyFormat =\n (limit !== undefined || offset !== undefined) && page === undefined && perPage === undefined;\n\n // If perPage provided, use it; otherwise fall back to limit\n const finalPerPage = perPage ?? limit;\n // If page provided, use it; otherwise convert from offset\n let finalPage = page;\n if (finalPage === undefined && offset !== undefined && finalPerPage !== undefined && finalPerPage > 0) {\n finalPage = Math.floor(offset / finalPerPage);\n }\n\n // Calculate offset from page/perPage\n const actualOffset = finalPage !== undefined && finalPerPage !== undefined ? finalPage * finalPerPage : 0;\n\n // Apply pagination\n let paginatedServers = serverList;\n let nextUrl: string | null = null;\n\n if (finalPerPage !== undefined) {\n paginatedServers = serverList.slice(actualOffset, actualOffset + finalPerPage);\n\n // Calculate next URL if there are more results\n if (actualOffset + finalPerPage < totalCount) {\n const nextPage = (finalPage ?? 0) + 1;\n // Return next URL in same format as request (legacy limit/offset or page/perPage)\n const prefix = routePrefix ?? '';\n if (useLegacyFormat) {\n const nextOffset = actualOffset + finalPerPage;\n nextUrl = `${prefix}/mcp/v0/servers?limit=${finalPerPage}&offset=${nextOffset}`;\n } else {\n nextUrl = `${prefix}/mcp/v0/servers?perPage=${finalPerPage}&page=${nextPage}`;\n }\n }\n }\n\n // Get server info for each server\n const serverInfoList: ServerInfo[] = paginatedServers.map(server => server.getServerInfo());\n\n return {\n servers: serverInfoList,\n total_count: totalCount,\n next: nextUrl,\n };\n },\n});\n\nexport const GET_MCP_SERVER_DETAIL_ROUTE = createRoute({\n method: 'GET',\n path: '/mcp/v0/servers/:id',\n responseType: 'json',\n pathParamSchema: mcpServerDetailPathParams,\n queryParamSchema: getMcpServerDetailQuerySchema,\n responseSchema: serverDetailSchema,\n summary: 'Get MCP server details',\n description: 'Returns detailed information about a specific MCP server',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({ mastra, id, version }: ServerContext & { id: string; version?: string }) => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(id);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server with ID '${id}' not found` });\n }\n\n const serverDetail = server.getServerDetail();\n\n // If a specific version was requested, check if it matches\n if (version && serverDetail.version_detail.version !== version) {\n throw new HTTPException(404, {\n message: `MCP server with ID '${id}' found, but not version '${version}'. Available version: ${serverDetail.version_detail.version}`,\n });\n }\n\n return serverDetail;\n },\n});\n\nexport const LIST_MCP_SERVER_TOOLS_ROUTE = createRoute({\n method: 'GET',\n path: '/mcp/:serverId/tools',\n responseType: 'json',\n pathParamSchema: mcpServerIdPathParams,\n responseSchema: listMcpServerToolsResponseSchema,\n summary: 'List MCP server tools',\n description: 'Returns a list of tools available on the specified MCP server',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({ mastra, serverId, requestContext }: ServerContext & { serverId: string }) => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(serverId);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server with ID '${serverId}' not found` });\n }\n\n if (typeof server.getToolListInfo !== 'function') {\n throw new HTTPException(501, { message: `Server '${serverId}' cannot list tools in this way.` });\n }\n\n return await server.getToolListInfo(requestContext);\n },\n});\n\nexport const GET_MCP_SERVER_TOOL_DETAIL_ROUTE = createRoute({\n method: 'GET',\n path: '/mcp/:serverId/tools/:toolId',\n responseType: 'json',\n pathParamSchema: mcpServerToolPathParams,\n responseSchema: mcpToolInfoSchema,\n summary: 'Get MCP server tool details',\n description: 'Returns detailed information about a specific tool on the MCP server',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({ mastra, serverId, toolId }: ServerContext & { serverId: string; toolId: string }) => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(serverId);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server with ID '${serverId}' not found` });\n }\n\n if (typeof server.getToolInfo !== 'function') {\n throw new HTTPException(501, { message: `Server '${serverId}' cannot provide tool details in this way.` });\n }\n\n const toolInfo = await server.getToolInfo(toolId);\n if (!toolInfo) {\n throw new HTTPException(404, { message: `Tool with ID '${toolId}' not found on MCP server '${serverId}'` });\n }\n\n return toolInfo;\n },\n});\n\nexport const EXECUTE_MCP_SERVER_TOOL_ROUTE = createRoute({\n method: 'POST',\n path: '/mcp/:serverId/tools/:toolId/execute',\n responseType: 'json',\n pathParamSchema: mcpServerToolPathParams,\n bodySchema: executeToolBodySchema,\n responseSchema: executeToolResponseSchema,\n summary: 'Execute MCP server tool',\n description: 'Executes a tool on the specified MCP server with the provided arguments',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({\n mastra,\n serverId,\n toolId,\n data,\n requestContext,\n }: ServerContext & { serverId: string; toolId: string; data?: unknown }) => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(serverId);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server with ID '${serverId}' not found` });\n }\n\n if (typeof server.executeTool !== 'function') {\n throw new HTTPException(501, { message: `Server '${serverId}' cannot execute tools in this way.` });\n }\n\n const result = await server.executeTool(toolId, data, { requestContext });\n return { result };\n },\n});\n\n// ============================================================================\n// MCP Resource Routes\n// ============================================================================\n\nexport const LIST_MCP_SERVER_RESOURCES_ROUTE = createRoute({\n method: 'GET',\n path: '/mcp/:serverId/resources',\n responseType: 'json',\n pathParamSchema: mcpServerResourcePathParams,\n responseSchema: listResourcesResponseSchema,\n summary: 'List MCP server resources',\n description: 'Returns a list of resources available on the MCP server, including ui:// app resources',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({ mastra, serverId }: ServerContext & { serverId: string }) => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(serverId);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server with ID '${serverId}' not found` });\n }\n\n if (typeof server.listResources !== 'function') {\n return { resources: [] };\n }\n\n return server.listResources();\n },\n});\n\nexport const READ_MCP_SERVER_RESOURCE_ROUTE = createRoute({\n method: 'POST',\n path: '/mcp/:serverId/resources/read',\n responseType: 'json',\n pathParamSchema: mcpServerResourcePathParams,\n bodySchema: readResourceBodySchema,\n responseSchema: readResourceResponseSchema,\n summary: 'Read MCP server resource content',\n description: 'Reads the content of a resource by URI, used for rendering MCP App ui:// resources',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({ mastra, serverId, uri }: ServerContext & { serverId: string; uri: string }) => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(serverId);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server with ID '${serverId}' not found` });\n }\n\n if (typeof server.readResource !== 'function') {\n throw new HTTPException(501, { message: `Server '${serverId}' does not support reading resources` });\n }\n\n try {\n return await server.readResource(uri);\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n if (message.includes('not found') || message.includes('not configured')) {\n throw new HTTPException(404, { message: `Resource '${uri}' not found on server '${serverId}'` });\n }\n throw error;\n }\n },\n});\n\n// ============================================================================\n// MCP Transport Routes (Streamable HTTP and SSE)\n// ============================================================================\n\n/**\n * MCP transport options that can be passed to startHTTP() or startSSE().\n * Includes serverless mode for running in stateless environments like Cloudflare Workers or Vercel Edge.\n */\nexport interface MCPTransportOptions {\n /**\n * When true, runs in stateless mode without session management.\n * Ideal for serverless environments where you can't maintain persistent connections.\n */\n serverless?: boolean;\n /**\n * Custom session ID generator function.\n */\n sessionIdGenerator?: () => string;\n /**\n * Sets `req.auth` before the MCP transport reads it. Overrides the default\n * bridge that forwards the principal resolved by `server.auth`.\n */\n setRequestAuth?: SetMcpRequestAuth;\n}\n\n/**\n * MCP HTTP Transport response type.\n * Adapters use this to set up the HTTP transport via MCPServer.startHTTP()\n */\nexport interface MCPHttpTransportResult {\n server: MastraMCPServerImplementation;\n httpPath: string;\n /**\n * Optional MCP transport options for this specific route.\n * These override any class-level mcpOptions configured on the adapter.\n */\n mcpOptions?: MCPTransportOptions;\n}\n\n/**\n * MCP SSE Transport response type.\n * Adapters use this to set up the SSE transport via MCPServer.startSSE() or startHonoSSE()\n *\n * Note: SSE transport is inherently stateful and doesn't support serverless mode.\n */\nexport interface MCPSseTransportResult {\n server: MastraMCPServerImplementation;\n ssePath: string;\n messagePath: string;\n}\n\nexport const MCP_HTTP_TRANSPORT_ROUTE = createRoute({\n method: 'ALL',\n path: '/mcp/:serverId/mcp',\n responseType: 'mcp-http',\n pathParamSchema: mcpServerIdPathParams,\n summary: 'MCP HTTP Transport',\n description: 'Streamable HTTP transport endpoint for MCP protocol communication',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({ mastra, serverId }: ServerContext & { serverId: string }): Promise<MCPHttpTransportResult> => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(serverId);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server '${serverId}' not found` });\n }\n\n return {\n server,\n httpPath: `/mcp/${serverId}/mcp`,\n };\n },\n});\n\nexport const MCP_SSE_TRANSPORT_ROUTE = createRoute({\n method: 'ALL',\n path: '/mcp/:serverId/sse',\n responseType: 'mcp-sse',\n pathParamSchema: mcpServerIdPathParams,\n summary: 'MCP SSE Transport',\n description: 'SSE transport endpoint for MCP protocol communication',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({ mastra, serverId }: ServerContext & { serverId: string }): Promise<MCPSseTransportResult> => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(serverId);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server '${serverId}' not found` });\n }\n\n return {\n server,\n ssePath: `/mcp/${serverId}/sse`,\n messagePath: `/mcp/${serverId}/messages`,\n };\n },\n});\n\nexport const MCP_SSE_MESSAGES_ROUTE = createRoute({\n method: 'POST',\n path: '/mcp/:serverId/messages',\n responseType: 'mcp-sse',\n pathParamSchema: mcpServerIdPathParams,\n summary: 'MCP SSE Messages',\n description: 'Message endpoint for SSE transport (posts messages to active SSE streams)',\n tags: ['MCP'],\n requiresAuth: true,\n handler: MCP_SSE_TRANSPORT_ROUTE.handler,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;AA2BA,MAAa,yBAAyBA,sBAAAA,YAAY;CAChD,QAAQ;CACR,MAAM;CACN,cAAc;CACd,kBAAkBC,YAAAA;CAClB,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B,YAChD,MAAM,IAAIJ,uBAAAA,cAAc,KAAK,EAAE,SAAS,2DAA2D,CAAC;EAGtG,MAAM,SAAS,OAAO,iBAAiB,QAAQ;EAE/C,IAAI,CAAC,QACH,MAAM,IAAIA,uBAAAA,cAAc,KAAK,EAAE,SAAS,eAAe,SAAS,aAAa,CAAC;EAGhF,OAAO;GACL;GACA,SAAS,QAAQ,SAAS;GAC1B,aAAa,QAAQ,SAAS;EAChC;CACF;AACF,CAAC;AAED,MAAa,yBAAyBH,sBAAAA,YAAY;CAChD,QAAQ;CACR,MAAM;CACN,cAAc;CACd,iBAAiBO,YAAAA;CACjB,SAAS;CACT,aAAa;CACb,MAAM,CAAC,KAAK;CACZ,cAAc;CACd,SAAS,wBAAwB;AACnC,CAAC"}
1
+ {"version":3,"file":"mcp.cjs","names":["createRoute","listMcpServersQuerySchema","listMcpServersResponseSchema","HTTPException","mcpServerDetailPathParams","getMcpServerDetailQuerySchema","serverDetailSchema","mcpServerIdPathParams","listMcpServerToolsResponseSchema","mcpServerToolPathParams","mcpToolInfoSchema","executeToolBodySchema","executeToolResponseSchema","mcpServerResourcePathParams","listResourcesResponseSchema","readResourceBodySchema","readResourceResponseSchema"],"sources":["../../../src/server/handlers/mcp.ts"],"sourcesContent":["import type { MCPServerBase as MastraMCPServerImplementation, ServerInfo } from '@mastra/core/mcp';\nimport { HTTPException } from '../http-exception';\nimport {\n mcpServerDetailPathParams,\n mcpServerToolPathParams,\n executeToolBodySchema,\n listMcpServersQuerySchema,\n getMcpServerDetailQuerySchema,\n listMcpServersResponseSchema,\n serverDetailSchema,\n mcpServerIdPathParams,\n listMcpServerToolsResponseSchema,\n mcpToolInfoSchema,\n executeToolResponseSchema,\n mcpServerResourcePathParams,\n readResourceBodySchema,\n readResourceResponseSchema,\n listResourcesResponseSchema,\n} from '../schemas/mcp';\nimport type { ServerContext } from '../server-adapter';\nimport type { SetMcpRequestAuth } from '../server-adapter/mcp-auth';\nimport { createRoute } from '../server-adapter/routes/route-builder';\n\n// ============================================================================\n// Route Definitions (createRoute pattern for server adapters)\n// ============================================================================\n\nexport const LIST_MCP_SERVERS_ROUTE = createRoute({\n method: 'GET',\n path: '/mcp/v0/servers',\n responseType: 'json',\n queryParamSchema: listMcpServersQuerySchema,\n responseSchema: listMcpServersResponseSchema,\n summary: 'List MCP servers',\n description: 'Returns a list of registered MCP servers with pagination support',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({\n mastra,\n routePrefix,\n page,\n perPage,\n limit,\n offset,\n }: ServerContext & { page?: number; perPage?: number; limit?: number; offset?: number }) => {\n if (!mastra || typeof mastra.listMCPServers !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or listMCPServers method not available' });\n }\n\n const servers = mastra.listMCPServers();\n\n if (!servers) {\n return { servers: [], total_count: 0, next: null };\n }\n\n const serverList = Object.values(servers);\n const totalCount = serverList.length;\n\n // Support both page/perPage and limit/offset for backwards compatibility\n // Detect which format user is using - prefer page/perPage if both provided\n const useLegacyFormat =\n (limit !== undefined || offset !== undefined) && page === undefined && perPage === undefined;\n\n // If perPage provided, use it; otherwise fall back to limit\n const finalPerPage = perPage ?? limit;\n // If page provided, use it; otherwise convert from offset\n let finalPage = page;\n if (finalPage === undefined && offset !== undefined && finalPerPage !== undefined && finalPerPage > 0) {\n finalPage = Math.floor(offset / finalPerPage);\n }\n\n // Calculate offset from page/perPage\n const actualOffset = finalPage !== undefined && finalPerPage !== undefined ? finalPage * finalPerPage : 0;\n\n // Apply pagination\n let paginatedServers = serverList;\n let nextUrl: string | null = null;\n\n if (finalPerPage !== undefined) {\n paginatedServers = serverList.slice(actualOffset, actualOffset + finalPerPage);\n\n // Calculate next URL if there are more results\n if (actualOffset + finalPerPage < totalCount) {\n const nextPage = (finalPage ?? 0) + 1;\n // Return next URL in same format as request (legacy limit/offset or page/perPage)\n const prefix = routePrefix ?? '';\n if (useLegacyFormat) {\n const nextOffset = actualOffset + finalPerPage;\n nextUrl = `${prefix}/mcp/v0/servers?limit=${finalPerPage}&offset=${nextOffset}`;\n } else {\n nextUrl = `${prefix}/mcp/v0/servers?perPage=${finalPerPage}&page=${nextPage}`;\n }\n }\n }\n\n // Get server info for each server\n const serverInfoList: ServerInfo[] = paginatedServers.map(server => server.getServerInfo());\n\n return {\n servers: serverInfoList,\n total_count: totalCount,\n next: nextUrl,\n };\n },\n});\n\nexport const GET_MCP_SERVER_DETAIL_ROUTE = createRoute({\n method: 'GET',\n path: '/mcp/v0/servers/:id',\n responseType: 'json',\n pathParamSchema: mcpServerDetailPathParams,\n queryParamSchema: getMcpServerDetailQuerySchema,\n responseSchema: serverDetailSchema,\n summary: 'Get MCP server details',\n description: 'Returns detailed information about a specific MCP server',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({ mastra, id, version }: ServerContext & { id: string; version?: string }) => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(id);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server with ID '${id}' not found` });\n }\n\n const serverDetail = server.getServerDetail();\n\n // If a specific version was requested, check if it matches\n if (version && serverDetail.version_detail.version !== version) {\n throw new HTTPException(404, {\n message: `MCP server with ID '${id}' found, but not version '${version}'. Available version: ${serverDetail.version_detail.version}`,\n });\n }\n\n return serverDetail;\n },\n});\n\nexport const LIST_MCP_SERVER_TOOLS_ROUTE = createRoute({\n method: 'GET',\n path: '/mcp/:serverId/tools',\n responseType: 'json',\n pathParamSchema: mcpServerIdPathParams,\n responseSchema: listMcpServerToolsResponseSchema,\n summary: 'List MCP server tools',\n description: 'Returns a list of tools available on the specified MCP server',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({ mastra, serverId, requestContext }: ServerContext & { serverId: string }) => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(serverId);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server with ID '${serverId}' not found` });\n }\n\n if (typeof server.getToolListInfo !== 'function') {\n throw new HTTPException(501, { message: `Server '${serverId}' cannot list tools in this way.` });\n }\n\n return await server.getToolListInfo(requestContext);\n },\n});\n\nexport const GET_MCP_SERVER_TOOL_DETAIL_ROUTE = createRoute({\n method: 'GET',\n path: '/mcp/:serverId/tools/:toolId',\n responseType: 'json',\n pathParamSchema: mcpServerToolPathParams,\n responseSchema: mcpToolInfoSchema,\n summary: 'Get MCP server tool details',\n description: 'Returns detailed information about a specific tool on the MCP server',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({ mastra, serverId, toolId }: ServerContext & { serverId: string; toolId: string }) => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(serverId);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server with ID '${serverId}' not found` });\n }\n\n if (typeof server.getToolInfo !== 'function') {\n throw new HTTPException(501, { message: `Server '${serverId}' cannot provide tool details in this way.` });\n }\n\n const toolInfo = await server.getToolInfo(toolId);\n if (!toolInfo) {\n throw new HTTPException(404, { message: `Tool with ID '${toolId}' not found on MCP server '${serverId}'` });\n }\n\n return toolInfo;\n },\n});\n\nexport const EXECUTE_MCP_SERVER_TOOL_ROUTE = createRoute({\n method: 'POST',\n path: '/mcp/:serverId/tools/:toolId/execute',\n responseType: 'json',\n pathParamSchema: mcpServerToolPathParams,\n bodySchema: executeToolBodySchema,\n responseSchema: executeToolResponseSchema,\n summary: 'Execute MCP server tool',\n description: 'Executes a tool on the specified MCP server with the provided arguments',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({\n mastra,\n serverId,\n toolId,\n data,\n requestContext,\n }: ServerContext & { serverId: string; toolId: string; data?: unknown }) => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(serverId);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server with ID '${serverId}' not found` });\n }\n\n if (typeof server.executeTool !== 'function') {\n throw new HTTPException(501, { message: `Server '${serverId}' cannot execute tools in this way.` });\n }\n\n const result = await server.executeTool(toolId, data, { requestContext });\n return { result };\n },\n});\n\n// ============================================================================\n// MCP Resource Routes\n// ============================================================================\n\nexport const LIST_MCP_SERVER_RESOURCES_ROUTE = createRoute({\n method: 'GET',\n path: '/mcp/:serverId/resources',\n responseType: 'json',\n pathParamSchema: mcpServerResourcePathParams,\n responseSchema: listResourcesResponseSchema,\n summary: 'List MCP server resources',\n description: 'Returns a list of resources available on the MCP server, including ui:// app resources',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({ mastra, serverId }: ServerContext & { serverId: string }) => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(serverId);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server with ID '${serverId}' not found` });\n }\n\n if (typeof server.listResources !== 'function') {\n return { resources: [] };\n }\n\n return server.listResources();\n },\n});\n\nexport const READ_MCP_SERVER_RESOURCE_ROUTE = createRoute({\n method: 'POST',\n path: '/mcp/:serverId/resources/read',\n responseType: 'json',\n pathParamSchema: mcpServerResourcePathParams,\n bodySchema: readResourceBodySchema,\n responseSchema: readResourceResponseSchema,\n summary: 'Read MCP server resource content',\n description: 'Reads the content of a resource by URI, used for rendering MCP App ui:// resources',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({ mastra, serverId, uri }: ServerContext & { serverId: string; uri: string }) => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(serverId);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server with ID '${serverId}' not found` });\n }\n\n if (typeof server.readResource !== 'function') {\n throw new HTTPException(501, { message: `Server '${serverId}' does not support reading resources` });\n }\n\n try {\n return await server.readResource(uri);\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n if (message.includes('not found') || message.includes('not configured')) {\n throw new HTTPException(404, { message: `Resource '${uri}' not found on server '${serverId}'` });\n }\n throw error;\n }\n },\n});\n\n// ============================================================================\n// MCP Transport Routes (Streamable HTTP and SSE)\n// ============================================================================\n\n/**\n * MCP transport options that can be passed to startHTTP() or startSSE().\n * Includes serverless mode for running in stateless environments like Cloudflare Workers or Vercel Edge.\n */\nexport interface MCPTransportOptions {\n /**\n * When true, runs in stateless mode without session management.\n * Ideal for serverless environments where you can't maintain persistent connections.\n */\n serverless?: boolean;\n /**\n * Custom session ID generator function.\n */\n sessionIdGenerator?: () => string;\n /**\n * Sets `req.auth` before the MCP transport reads it. Overrides the default\n * bridge that forwards the principal resolved by `server.auth`.\n */\n setRequestAuth?: SetMcpRequestAuth;\n}\n\n/**\n * MCP HTTP Transport response type.\n * Adapters use this to set up the HTTP transport via MCPServer.startHTTP()\n */\nexport interface MCPHttpTransportResult {\n server: MastraMCPServerImplementation;\n httpPath: string;\n /**\n * Optional MCP transport options for this specific route.\n * These override any class-level mcpOptions configured on the adapter.\n */\n mcpOptions?: MCPTransportOptions;\n}\n\n/**\n * MCP SSE Transport response type.\n * Adapters use this to set up the SSE transport via MCPServer.startSSE() or startHonoSSE()\n *\n * Note: SSE transport is inherently stateful and doesn't support serverless mode.\n */\nexport interface MCPSseTransportResult {\n server: MastraMCPServerImplementation;\n ssePath: string;\n messagePath: string;\n}\n\nexport const MCP_HTTP_TRANSPORT_ROUTE = createRoute({\n method: 'ALL',\n path: '/mcp/:serverId/mcp',\n responseType: 'mcp-http',\n pathParamSchema: mcpServerIdPathParams,\n summary: 'MCP HTTP Transport',\n description: 'Streamable HTTP transport endpoint for MCP protocol communication',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({ mastra, serverId }: ServerContext & { serverId: string }): Promise<MCPHttpTransportResult> => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(serverId);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server '${serverId}' not found` });\n }\n\n return {\n server,\n httpPath: `/mcp/${serverId}/mcp`,\n };\n },\n});\n\nexport const MCP_SSE_TRANSPORT_ROUTE = createRoute({\n method: 'ALL',\n path: '/mcp/:serverId/sse',\n responseType: 'mcp-sse',\n pathParamSchema: mcpServerIdPathParams,\n summary: 'MCP SSE Transport',\n description: 'SSE transport endpoint for MCP protocol communication',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({ mastra, serverId }: ServerContext & { serverId: string }): Promise<MCPSseTransportResult> => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(serverId);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server '${serverId}' not found` });\n }\n\n return {\n server,\n ssePath: `/mcp/${serverId}/sse`,\n messagePath: `/mcp/${serverId}/messages`,\n };\n },\n});\n\nexport const MCP_SSE_MESSAGES_ROUTE = createRoute({\n method: 'POST',\n path: '/mcp/:serverId/messages',\n responseType: 'mcp-sse',\n pathParamSchema: mcpServerIdPathParams,\n summary: 'MCP SSE Messages',\n description: 'Message endpoint for SSE transport (posts messages to active SSE streams)',\n tags: ['MCP'],\n requiresAuth: true,\n handler: MCP_SSE_TRANSPORT_ROUTE.handler,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;AA2BA,MAAa,yBAAyBA,sBAAAA,YAAY;CAChD,QAAQ;CACR,MAAM;CACN,cAAc;CACd,kBAAkBC,YAAAA;CAClB,gBAAgBC,YAAAA;CAChB,SAAS;CACT,aAAa;CACb,MAAM,CAAC,KAAK;CACZ,cAAc;CACd,SAAS,OAAO,EACd,QACA,aACA,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AQ;EAE/C,IAAI,CAAC,QACH,MAAM,IAAIA,uBAAAA,cAAc,KAAK,EAAE,SAAS,eAAe,SAAS,aAAa,CAAC;EAGhF,OAAO;GACL;GACA,SAAS,QAAQ,SAAS;GAC1B,aAAa,QAAQ,SAAS;EAChC;CACF;AACF,CAAC;AAED,MAAa,yBAAyBH,sBAAAA,YAAY;CAChD,QAAQ;CACR,MAAM;CACN,cAAc;CACd,iBAAiBO,YAAAA;CACjB,SAAS;CACT,aAAa;CACb,MAAM,CAAC,KAAK;CACZ,cAAc;CACd,SAAS,wBAAwB;AACnC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"mcp.js","names":[],"sources":["../../../src/server/handlers/mcp.ts"],"sourcesContent":["import type { MCPServerBase as MastraMCPServerImplementation, ServerInfo } from '@mastra/core/mcp';\nimport { HTTPException } from '../http-exception';\nimport {\n mcpServerDetailPathParams,\n mcpServerToolPathParams,\n executeToolBodySchema,\n listMcpServersQuerySchema,\n getMcpServerDetailQuerySchema,\n listMcpServersResponseSchema,\n serverDetailSchema,\n mcpServerIdPathParams,\n listMcpServerToolsResponseSchema,\n mcpToolInfoSchema,\n executeToolResponseSchema,\n mcpServerResourcePathParams,\n readResourceBodySchema,\n readResourceResponseSchema,\n listResourcesResponseSchema,\n} from '../schemas/mcp';\nimport type { ServerContext } from '../server-adapter';\nimport type { SetMcpRequestAuth } from '../server-adapter/mcp-auth';\nimport { createRoute } from '../server-adapter/routes/route-builder';\n\n// ============================================================================\n// Route Definitions (createRoute pattern for server adapters)\n// ============================================================================\n\nexport const LIST_MCP_SERVERS_ROUTE = createRoute({\n method: 'GET',\n path: '/mcp/v0/servers',\n responseType: 'json',\n queryParamSchema: listMcpServersQuerySchema,\n responseSchema: listMcpServersResponseSchema,\n summary: 'List MCP servers',\n description: 'Returns a list of registered MCP servers with pagination support',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({\n mastra,\n routePrefix,\n page,\n perPage,\n limit,\n offset,\n }: ServerContext & { page?: number; perPage?: number; limit?: number; offset?: number }) => {\n if (!mastra || typeof mastra.listMCPServers !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or listMCPServers method not available' });\n }\n\n const servers = mastra.listMCPServers();\n\n if (!servers) {\n return { servers: [], total_count: 0, next: null };\n }\n\n const serverList = Object.values(servers) as MastraMCPServerImplementation[];\n const totalCount = serverList.length;\n\n // Support both page/perPage and limit/offset for backwards compatibility\n // Detect which format user is using - prefer page/perPage if both provided\n const useLegacyFormat =\n (limit !== undefined || offset !== undefined) && page === undefined && perPage === undefined;\n\n // If perPage provided, use it; otherwise fall back to limit\n const finalPerPage = perPage ?? limit;\n // If page provided, use it; otherwise convert from offset\n let finalPage = page;\n if (finalPage === undefined && offset !== undefined && finalPerPage !== undefined && finalPerPage > 0) {\n finalPage = Math.floor(offset / finalPerPage);\n }\n\n // Calculate offset from page/perPage\n const actualOffset = finalPage !== undefined && finalPerPage !== undefined ? finalPage * finalPerPage : 0;\n\n // Apply pagination\n let paginatedServers = serverList;\n let nextUrl: string | null = null;\n\n if (finalPerPage !== undefined) {\n paginatedServers = serverList.slice(actualOffset, actualOffset + finalPerPage);\n\n // Calculate next URL if there are more results\n if (actualOffset + finalPerPage < totalCount) {\n const nextPage = (finalPage ?? 0) + 1;\n // Return next URL in same format as request (legacy limit/offset or page/perPage)\n const prefix = routePrefix ?? '';\n if (useLegacyFormat) {\n const nextOffset = actualOffset + finalPerPage;\n nextUrl = `${prefix}/mcp/v0/servers?limit=${finalPerPage}&offset=${nextOffset}`;\n } else {\n nextUrl = `${prefix}/mcp/v0/servers?perPage=${finalPerPage}&page=${nextPage}`;\n }\n }\n }\n\n // Get server info for each server\n const serverInfoList: ServerInfo[] = paginatedServers.map(server => server.getServerInfo());\n\n return {\n servers: serverInfoList,\n total_count: totalCount,\n next: nextUrl,\n };\n },\n});\n\nexport const GET_MCP_SERVER_DETAIL_ROUTE = createRoute({\n method: 'GET',\n path: '/mcp/v0/servers/:id',\n responseType: 'json',\n pathParamSchema: mcpServerDetailPathParams,\n queryParamSchema: getMcpServerDetailQuerySchema,\n responseSchema: serverDetailSchema,\n summary: 'Get MCP server details',\n description: 'Returns detailed information about a specific MCP server',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({ mastra, id, version }: ServerContext & { id: string; version?: string }) => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(id);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server with ID '${id}' not found` });\n }\n\n const serverDetail = server.getServerDetail();\n\n // If a specific version was requested, check if it matches\n if (version && serverDetail.version_detail.version !== version) {\n throw new HTTPException(404, {\n message: `MCP server with ID '${id}' found, but not version '${version}'. Available version: ${serverDetail.version_detail.version}`,\n });\n }\n\n return serverDetail;\n },\n});\n\nexport const LIST_MCP_SERVER_TOOLS_ROUTE = createRoute({\n method: 'GET',\n path: '/mcp/:serverId/tools',\n responseType: 'json',\n pathParamSchema: mcpServerIdPathParams,\n responseSchema: listMcpServerToolsResponseSchema,\n summary: 'List MCP server tools',\n description: 'Returns a list of tools available on the specified MCP server',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({ mastra, serverId, requestContext }: ServerContext & { serverId: string }) => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(serverId);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server with ID '${serverId}' not found` });\n }\n\n if (typeof server.getToolListInfo !== 'function') {\n throw new HTTPException(501, { message: `Server '${serverId}' cannot list tools in this way.` });\n }\n\n return await server.getToolListInfo(requestContext);\n },\n});\n\nexport const GET_MCP_SERVER_TOOL_DETAIL_ROUTE = createRoute({\n method: 'GET',\n path: '/mcp/:serverId/tools/:toolId',\n responseType: 'json',\n pathParamSchema: mcpServerToolPathParams,\n responseSchema: mcpToolInfoSchema,\n summary: 'Get MCP server tool details',\n description: 'Returns detailed information about a specific tool on the MCP server',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({ mastra, serverId, toolId }: ServerContext & { serverId: string; toolId: string }) => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(serverId);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server with ID '${serverId}' not found` });\n }\n\n if (typeof server.getToolInfo !== 'function') {\n throw new HTTPException(501, { message: `Server '${serverId}' cannot provide tool details in this way.` });\n }\n\n const toolInfo = await server.getToolInfo(toolId);\n if (!toolInfo) {\n throw new HTTPException(404, { message: `Tool with ID '${toolId}' not found on MCP server '${serverId}'` });\n }\n\n return toolInfo;\n },\n});\n\nexport const EXECUTE_MCP_SERVER_TOOL_ROUTE = createRoute({\n method: 'POST',\n path: '/mcp/:serverId/tools/:toolId/execute',\n responseType: 'json',\n pathParamSchema: mcpServerToolPathParams,\n bodySchema: executeToolBodySchema,\n responseSchema: executeToolResponseSchema,\n summary: 'Execute MCP server tool',\n description: 'Executes a tool on the specified MCP server with the provided arguments',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({\n mastra,\n serverId,\n toolId,\n data,\n requestContext,\n }: ServerContext & { serverId: string; toolId: string; data?: unknown }) => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(serverId);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server with ID '${serverId}' not found` });\n }\n\n if (typeof server.executeTool !== 'function') {\n throw new HTTPException(501, { message: `Server '${serverId}' cannot execute tools in this way.` });\n }\n\n const result = await server.executeTool(toolId, data, { requestContext });\n return { result };\n },\n});\n\n// ============================================================================\n// MCP Resource Routes\n// ============================================================================\n\nexport const LIST_MCP_SERVER_RESOURCES_ROUTE = createRoute({\n method: 'GET',\n path: '/mcp/:serverId/resources',\n responseType: 'json',\n pathParamSchema: mcpServerResourcePathParams,\n responseSchema: listResourcesResponseSchema,\n summary: 'List MCP server resources',\n description: 'Returns a list of resources available on the MCP server, including ui:// app resources',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({ mastra, serverId }: ServerContext & { serverId: string }) => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(serverId);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server with ID '${serverId}' not found` });\n }\n\n if (typeof server.listResources !== 'function') {\n return { resources: [] };\n }\n\n return server.listResources();\n },\n});\n\nexport const READ_MCP_SERVER_RESOURCE_ROUTE = createRoute({\n method: 'POST',\n path: '/mcp/:serverId/resources/read',\n responseType: 'json',\n pathParamSchema: mcpServerResourcePathParams,\n bodySchema: readResourceBodySchema,\n responseSchema: readResourceResponseSchema,\n summary: 'Read MCP server resource content',\n description: 'Reads the content of a resource by URI, used for rendering MCP App ui:// resources',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({ mastra, serverId, uri }: ServerContext & { serverId: string; uri: string }) => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(serverId);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server with ID '${serverId}' not found` });\n }\n\n if (typeof server.readResource !== 'function') {\n throw new HTTPException(501, { message: `Server '${serverId}' does not support reading resources` });\n }\n\n try {\n return await server.readResource(uri);\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n if (message.includes('not found') || message.includes('not configured')) {\n throw new HTTPException(404, { message: `Resource '${uri}' not found on server '${serverId}'` });\n }\n throw error;\n }\n },\n});\n\n// ============================================================================\n// MCP Transport Routes (Streamable HTTP and SSE)\n// ============================================================================\n\n/**\n * MCP transport options that can be passed to startHTTP() or startSSE().\n * Includes serverless mode for running in stateless environments like Cloudflare Workers or Vercel Edge.\n */\nexport interface MCPTransportOptions {\n /**\n * When true, runs in stateless mode without session management.\n * Ideal for serverless environments where you can't maintain persistent connections.\n */\n serverless?: boolean;\n /**\n * Custom session ID generator function.\n */\n sessionIdGenerator?: () => string;\n /**\n * Sets `req.auth` before the MCP transport reads it. Overrides the default\n * bridge that forwards the principal resolved by `server.auth`.\n */\n setRequestAuth?: SetMcpRequestAuth;\n}\n\n/**\n * MCP HTTP Transport response type.\n * Adapters use this to set up the HTTP transport via MCPServer.startHTTP()\n */\nexport interface MCPHttpTransportResult {\n server: MastraMCPServerImplementation;\n httpPath: string;\n /**\n * Optional MCP transport options for this specific route.\n * These override any class-level mcpOptions configured on the adapter.\n */\n mcpOptions?: MCPTransportOptions;\n}\n\n/**\n * MCP SSE Transport response type.\n * Adapters use this to set up the SSE transport via MCPServer.startSSE() or startHonoSSE()\n *\n * Note: SSE transport is inherently stateful and doesn't support serverless mode.\n */\nexport interface MCPSseTransportResult {\n server: MastraMCPServerImplementation;\n ssePath: string;\n messagePath: string;\n}\n\nexport const MCP_HTTP_TRANSPORT_ROUTE = createRoute({\n method: 'ALL',\n path: '/mcp/:serverId/mcp',\n responseType: 'mcp-http',\n pathParamSchema: mcpServerIdPathParams,\n summary: 'MCP HTTP Transport',\n description: 'Streamable HTTP transport endpoint for MCP protocol communication',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({ mastra, serverId }: ServerContext & { serverId: string }): Promise<MCPHttpTransportResult> => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(serverId);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server '${serverId}' not found` });\n }\n\n return {\n server,\n httpPath: `/mcp/${serverId}/mcp`,\n };\n },\n});\n\nexport const MCP_SSE_TRANSPORT_ROUTE = createRoute({\n method: 'ALL',\n path: '/mcp/:serverId/sse',\n responseType: 'mcp-sse',\n pathParamSchema: mcpServerIdPathParams,\n summary: 'MCP SSE Transport',\n description: 'SSE transport endpoint for MCP protocol communication',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({ mastra, serverId }: ServerContext & { serverId: string }): Promise<MCPSseTransportResult> => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(serverId);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server '${serverId}' not found` });\n }\n\n return {\n server,\n ssePath: `/mcp/${serverId}/sse`,\n messagePath: `/mcp/${serverId}/messages`,\n };\n },\n});\n\nexport const MCP_SSE_MESSAGES_ROUTE = createRoute({\n method: 'POST',\n path: '/mcp/:serverId/messages',\n responseType: 'mcp-sse',\n pathParamSchema: mcpServerIdPathParams,\n summary: 'MCP SSE Messages',\n description: 'Message endpoint for SSE transport (posts messages to active SSE streams)',\n tags: ['MCP'],\n requiresAuth: true,\n handler: MCP_SSE_TRANSPORT_ROUTE.handler,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;AA2BA,MAAa,yBAAyB,YAAY;CAChD,QAAQ;CACR,MAAM;CACN,cAAc;CACd,kBAAkB;CAClB,gBAAgB;CAChB,SAAS;CACT,aAAa;CACb,MAAM,CAAC,KAAK;CACZ,cAAc;CACd,SAAS,OAAO,EACd,QACA,aACA,MACA,SACA,OACA,aAC0F;EAC1F,IAAI,CAAC,UAAU,OAAO,OAAO,mBAAmB,YAC9C,MAAM,IAAI,cAAc,KAAK,EAAE,SAAS,yDAAyD,CAAC;EAGpG,MAAM,UAAU,OAAO,eAAe;EAEtC,IAAI,CAAC,SACH,OAAO;GAAE,SAAS,CAAC;GAAG,aAAa;GAAG,MAAM;EAAK;EAGnD,MAAM,aAAa,OAAO,OAAO,OAAO;EACxC,MAAM,aAAa,WAAW;EAI9B,MAAM,mBACH,UAAU,KAAA,KAAa,WAAW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,IAAI,CAAC,QACH,MAAM,IAAI,cAAc,KAAK,EAAE,SAAS,eAAe,SAAS,aAAa,CAAC;EAGhF,OAAO;GACL;GACA,UAAU,QAAQ,SAAS;EAC7B;CACF;AACF,CAAC;AAED,MAAa,0BAA0B,YAAY;CACjD,QAAQ;CACR,MAAM;CACN,cAAc;CACd,iBAAiB;CACjB,SAAS;CACT,aAAa;CACb,MAAM,CAAC,KAAK;CACZ,cAAc;CACd,SAAS,OAAO,EAAE,QAAQ,eAAqF;EAC7G,IAAI,CAAC,UAAU,OAAO,OAAO,qBAAqB,YAChD,MAAM,IAAI,cAAc,KAAK,EAAE,SAAS,2DAA2D,CAAC;EAGtG,MAAM,SAAS,OAAO,iBAAiB,QAAQ;EAE/C,IAAI,CAAC,QACH,MAAM,IAAI,cAAc,KAAK,EAAE,SAAS,eAAe,SAAS,aAAa,CAAC;EAGhF,OAAO;GACL;GACA,SAAS,QAAQ,SAAS;GAC1B,aAAa,QAAQ,SAAS;EAChC;CACF;AACF,CAAC;AAED,MAAa,yBAAyB,YAAY;CAChD,QAAQ;CACR,MAAM;CACN,cAAc;CACd,iBAAiB;CACjB,SAAS;CACT,aAAa;CACb,MAAM,CAAC,KAAK;CACZ,cAAc;CACd,SAAS,wBAAwB;AACnC,CAAC"}
1
+ {"version":3,"file":"mcp.js","names":[],"sources":["../../../src/server/handlers/mcp.ts"],"sourcesContent":["import type { MCPServerBase as MastraMCPServerImplementation, ServerInfo } from '@mastra/core/mcp';\nimport { HTTPException } from '../http-exception';\nimport {\n mcpServerDetailPathParams,\n mcpServerToolPathParams,\n executeToolBodySchema,\n listMcpServersQuerySchema,\n getMcpServerDetailQuerySchema,\n listMcpServersResponseSchema,\n serverDetailSchema,\n mcpServerIdPathParams,\n listMcpServerToolsResponseSchema,\n mcpToolInfoSchema,\n executeToolResponseSchema,\n mcpServerResourcePathParams,\n readResourceBodySchema,\n readResourceResponseSchema,\n listResourcesResponseSchema,\n} from '../schemas/mcp';\nimport type { ServerContext } from '../server-adapter';\nimport type { SetMcpRequestAuth } from '../server-adapter/mcp-auth';\nimport { createRoute } from '../server-adapter/routes/route-builder';\n\n// ============================================================================\n// Route Definitions (createRoute pattern for server adapters)\n// ============================================================================\n\nexport const LIST_MCP_SERVERS_ROUTE = createRoute({\n method: 'GET',\n path: '/mcp/v0/servers',\n responseType: 'json',\n queryParamSchema: listMcpServersQuerySchema,\n responseSchema: listMcpServersResponseSchema,\n summary: 'List MCP servers',\n description: 'Returns a list of registered MCP servers with pagination support',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({\n mastra,\n routePrefix,\n page,\n perPage,\n limit,\n offset,\n }: ServerContext & { page?: number; perPage?: number; limit?: number; offset?: number }) => {\n if (!mastra || typeof mastra.listMCPServers !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or listMCPServers method not available' });\n }\n\n const servers = mastra.listMCPServers();\n\n if (!servers) {\n return { servers: [], total_count: 0, next: null };\n }\n\n const serverList = Object.values(servers);\n const totalCount = serverList.length;\n\n // Support both page/perPage and limit/offset for backwards compatibility\n // Detect which format user is using - prefer page/perPage if both provided\n const useLegacyFormat =\n (limit !== undefined || offset !== undefined) && page === undefined && perPage === undefined;\n\n // If perPage provided, use it; otherwise fall back to limit\n const finalPerPage = perPage ?? limit;\n // If page provided, use it; otherwise convert from offset\n let finalPage = page;\n if (finalPage === undefined && offset !== undefined && finalPerPage !== undefined && finalPerPage > 0) {\n finalPage = Math.floor(offset / finalPerPage);\n }\n\n // Calculate offset from page/perPage\n const actualOffset = finalPage !== undefined && finalPerPage !== undefined ? finalPage * finalPerPage : 0;\n\n // Apply pagination\n let paginatedServers = serverList;\n let nextUrl: string | null = null;\n\n if (finalPerPage !== undefined) {\n paginatedServers = serverList.slice(actualOffset, actualOffset + finalPerPage);\n\n // Calculate next URL if there are more results\n if (actualOffset + finalPerPage < totalCount) {\n const nextPage = (finalPage ?? 0) + 1;\n // Return next URL in same format as request (legacy limit/offset or page/perPage)\n const prefix = routePrefix ?? '';\n if (useLegacyFormat) {\n const nextOffset = actualOffset + finalPerPage;\n nextUrl = `${prefix}/mcp/v0/servers?limit=${finalPerPage}&offset=${nextOffset}`;\n } else {\n nextUrl = `${prefix}/mcp/v0/servers?perPage=${finalPerPage}&page=${nextPage}`;\n }\n }\n }\n\n // Get server info for each server\n const serverInfoList: ServerInfo[] = paginatedServers.map(server => server.getServerInfo());\n\n return {\n servers: serverInfoList,\n total_count: totalCount,\n next: nextUrl,\n };\n },\n});\n\nexport const GET_MCP_SERVER_DETAIL_ROUTE = createRoute({\n method: 'GET',\n path: '/mcp/v0/servers/:id',\n responseType: 'json',\n pathParamSchema: mcpServerDetailPathParams,\n queryParamSchema: getMcpServerDetailQuerySchema,\n responseSchema: serverDetailSchema,\n summary: 'Get MCP server details',\n description: 'Returns detailed information about a specific MCP server',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({ mastra, id, version }: ServerContext & { id: string; version?: string }) => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(id);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server with ID '${id}' not found` });\n }\n\n const serverDetail = server.getServerDetail();\n\n // If a specific version was requested, check if it matches\n if (version && serverDetail.version_detail.version !== version) {\n throw new HTTPException(404, {\n message: `MCP server with ID '${id}' found, but not version '${version}'. Available version: ${serverDetail.version_detail.version}`,\n });\n }\n\n return serverDetail;\n },\n});\n\nexport const LIST_MCP_SERVER_TOOLS_ROUTE = createRoute({\n method: 'GET',\n path: '/mcp/:serverId/tools',\n responseType: 'json',\n pathParamSchema: mcpServerIdPathParams,\n responseSchema: listMcpServerToolsResponseSchema,\n summary: 'List MCP server tools',\n description: 'Returns a list of tools available on the specified MCP server',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({ mastra, serverId, requestContext }: ServerContext & { serverId: string }) => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(serverId);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server with ID '${serverId}' not found` });\n }\n\n if (typeof server.getToolListInfo !== 'function') {\n throw new HTTPException(501, { message: `Server '${serverId}' cannot list tools in this way.` });\n }\n\n return await server.getToolListInfo(requestContext);\n },\n});\n\nexport const GET_MCP_SERVER_TOOL_DETAIL_ROUTE = createRoute({\n method: 'GET',\n path: '/mcp/:serverId/tools/:toolId',\n responseType: 'json',\n pathParamSchema: mcpServerToolPathParams,\n responseSchema: mcpToolInfoSchema,\n summary: 'Get MCP server tool details',\n description: 'Returns detailed information about a specific tool on the MCP server',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({ mastra, serverId, toolId }: ServerContext & { serverId: string; toolId: string }) => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(serverId);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server with ID '${serverId}' not found` });\n }\n\n if (typeof server.getToolInfo !== 'function') {\n throw new HTTPException(501, { message: `Server '${serverId}' cannot provide tool details in this way.` });\n }\n\n const toolInfo = await server.getToolInfo(toolId);\n if (!toolInfo) {\n throw new HTTPException(404, { message: `Tool with ID '${toolId}' not found on MCP server '${serverId}'` });\n }\n\n return toolInfo;\n },\n});\n\nexport const EXECUTE_MCP_SERVER_TOOL_ROUTE = createRoute({\n method: 'POST',\n path: '/mcp/:serverId/tools/:toolId/execute',\n responseType: 'json',\n pathParamSchema: mcpServerToolPathParams,\n bodySchema: executeToolBodySchema,\n responseSchema: executeToolResponseSchema,\n summary: 'Execute MCP server tool',\n description: 'Executes a tool on the specified MCP server with the provided arguments',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({\n mastra,\n serverId,\n toolId,\n data,\n requestContext,\n }: ServerContext & { serverId: string; toolId: string; data?: unknown }) => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(serverId);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server with ID '${serverId}' not found` });\n }\n\n if (typeof server.executeTool !== 'function') {\n throw new HTTPException(501, { message: `Server '${serverId}' cannot execute tools in this way.` });\n }\n\n const result = await server.executeTool(toolId, data, { requestContext });\n return { result };\n },\n});\n\n// ============================================================================\n// MCP Resource Routes\n// ============================================================================\n\nexport const LIST_MCP_SERVER_RESOURCES_ROUTE = createRoute({\n method: 'GET',\n path: '/mcp/:serverId/resources',\n responseType: 'json',\n pathParamSchema: mcpServerResourcePathParams,\n responseSchema: listResourcesResponseSchema,\n summary: 'List MCP server resources',\n description: 'Returns a list of resources available on the MCP server, including ui:// app resources',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({ mastra, serverId }: ServerContext & { serverId: string }) => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(serverId);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server with ID '${serverId}' not found` });\n }\n\n if (typeof server.listResources !== 'function') {\n return { resources: [] };\n }\n\n return server.listResources();\n },\n});\n\nexport const READ_MCP_SERVER_RESOURCE_ROUTE = createRoute({\n method: 'POST',\n path: '/mcp/:serverId/resources/read',\n responseType: 'json',\n pathParamSchema: mcpServerResourcePathParams,\n bodySchema: readResourceBodySchema,\n responseSchema: readResourceResponseSchema,\n summary: 'Read MCP server resource content',\n description: 'Reads the content of a resource by URI, used for rendering MCP App ui:// resources',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({ mastra, serverId, uri }: ServerContext & { serverId: string; uri: string }) => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(serverId);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server with ID '${serverId}' not found` });\n }\n\n if (typeof server.readResource !== 'function') {\n throw new HTTPException(501, { message: `Server '${serverId}' does not support reading resources` });\n }\n\n try {\n return await server.readResource(uri);\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n if (message.includes('not found') || message.includes('not configured')) {\n throw new HTTPException(404, { message: `Resource '${uri}' not found on server '${serverId}'` });\n }\n throw error;\n }\n },\n});\n\n// ============================================================================\n// MCP Transport Routes (Streamable HTTP and SSE)\n// ============================================================================\n\n/**\n * MCP transport options that can be passed to startHTTP() or startSSE().\n * Includes serverless mode for running in stateless environments like Cloudflare Workers or Vercel Edge.\n */\nexport interface MCPTransportOptions {\n /**\n * When true, runs in stateless mode without session management.\n * Ideal for serverless environments where you can't maintain persistent connections.\n */\n serverless?: boolean;\n /**\n * Custom session ID generator function.\n */\n sessionIdGenerator?: () => string;\n /**\n * Sets `req.auth` before the MCP transport reads it. Overrides the default\n * bridge that forwards the principal resolved by `server.auth`.\n */\n setRequestAuth?: SetMcpRequestAuth;\n}\n\n/**\n * MCP HTTP Transport response type.\n * Adapters use this to set up the HTTP transport via MCPServer.startHTTP()\n */\nexport interface MCPHttpTransportResult {\n server: MastraMCPServerImplementation;\n httpPath: string;\n /**\n * Optional MCP transport options for this specific route.\n * These override any class-level mcpOptions configured on the adapter.\n */\n mcpOptions?: MCPTransportOptions;\n}\n\n/**\n * MCP SSE Transport response type.\n * Adapters use this to set up the SSE transport via MCPServer.startSSE() or startHonoSSE()\n *\n * Note: SSE transport is inherently stateful and doesn't support serverless mode.\n */\nexport interface MCPSseTransportResult {\n server: MastraMCPServerImplementation;\n ssePath: string;\n messagePath: string;\n}\n\nexport const MCP_HTTP_TRANSPORT_ROUTE = createRoute({\n method: 'ALL',\n path: '/mcp/:serverId/mcp',\n responseType: 'mcp-http',\n pathParamSchema: mcpServerIdPathParams,\n summary: 'MCP HTTP Transport',\n description: 'Streamable HTTP transport endpoint for MCP protocol communication',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({ mastra, serverId }: ServerContext & { serverId: string }): Promise<MCPHttpTransportResult> => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(serverId);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server '${serverId}' not found` });\n }\n\n return {\n server,\n httpPath: `/mcp/${serverId}/mcp`,\n };\n },\n});\n\nexport const MCP_SSE_TRANSPORT_ROUTE = createRoute({\n method: 'ALL',\n path: '/mcp/:serverId/sse',\n responseType: 'mcp-sse',\n pathParamSchema: mcpServerIdPathParams,\n summary: 'MCP SSE Transport',\n description: 'SSE transport endpoint for MCP protocol communication',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({ mastra, serverId }: ServerContext & { serverId: string }): Promise<MCPSseTransportResult> => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(serverId);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server '${serverId}' not found` });\n }\n\n return {\n server,\n ssePath: `/mcp/${serverId}/sse`,\n messagePath: `/mcp/${serverId}/messages`,\n };\n },\n});\n\nexport const MCP_SSE_MESSAGES_ROUTE = createRoute({\n method: 'POST',\n path: '/mcp/:serverId/messages',\n responseType: 'mcp-sse',\n pathParamSchema: mcpServerIdPathParams,\n summary: 'MCP SSE Messages',\n description: 'Message endpoint for SSE transport (posts messages to active SSE streams)',\n tags: ['MCP'],\n requiresAuth: true,\n handler: MCP_SSE_TRANSPORT_ROUTE.handler,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;AA2BA,MAAa,yBAAyB,YAAY;CAChD,QAAQ;CACR,MAAM;CACN,cAAc;CACd,kBAAkB;CAClB,gBAAgB;CAChB,SAAS;CACT,aAAa;CACb,MAAM,CA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w.cjs");
4
4
  const require_route_builder = require("../../route-builder-C8n4ugUf.cjs");
5
5
  const require_server_handlers_error = require("./error.cjs");
6
6
  const require_utils = require("../../utils-DJMUhfvY.cjs");
7
- const require_memory = require("../../memory-D0prxytx.cjs");
7
+ const require_memory = require("../../memory-CVODqy7m.cjs");
8
8
  const require_server_handlers_gateway_memory_client = require("./gateway-memory-client.cjs");
9
9
  let _mastra_core_agent = require("@mastra/core/agent");
10
10
  let _mastra_core_utils = require("@mastra/core/utils");
@@ -3,7 +3,7 @@ import { t as HTTPException } from "../../http-exception-CyfxZB6W.js";
3
3
  import { n as createRoute } from "../../route-builder-BveLN9LU.js";
4
4
  import { handleError } from "./error.js";
5
5
  import { c as validateBody, d as MastraFGAPermissions, n as getEffectiveResourceId, r as getEffectiveThreadId, t as enforceThreadAccess } from "../../utils-Hz8Hc2cd.js";
6
- import { A as listThreadsResponseSchema, B as updateThreadBodySchema, C as getWorkingMemoryQuerySchema, D as listMessagesResponseSchema, E as listMessagesQuerySchema, F as saveMessagesNetworkQuerySchema, H as updateWorkingMemoryBodySchema, I as saveMessagesResponseSchema, L as searchMemoryQuerySchema, M as memoryStatusResponseSchema, O as listThreadsNetworkQuerySchema, P as saveMessagesBodySchema, R as searchMemoryResponseSchema, S as getThreadByIdResponseSchema, T as listMessagesNetworkQuerySchema, U as updateWorkingMemoryResponseSchema, V as updateThreadNetworkQuerySchema, _ as getMemoryStatusQuerySchema, a as cloneThreadResponseSchema, b as getThreadByIdNetworkQuerySchema, c as deleteMessagesBodySchema, d as deleteMessagesResponseSchema, f as deleteThreadNetworkQuerySchema, g as getMemoryStatusNetworkQuerySchema, h as getMemoryConfigQuerySchema, i as cloneThreadBodySchema, j as memoryConfigResponseSchema, k as listThreadsQuerySchema, l as deleteMessagesNetworkQuerySchema, m as deleteThreadResponseSchema, n as awaitBufferStatusBodySchema, o as createThreadBodySchema, p as deleteThreadQuerySchema, r as awaitBufferStatusResponseSchema, s as createThreadNetworkQuerySchema, t as agentIdQuerySchema, u as deleteMessagesQuerySchema, v as getObservationalMemoryQuerySchema, w as getWorkingMemoryResponseSchema, x as getThreadByIdQuerySchema, y as getObservationalMemoryResponseSchema, z as threadIdPathParams } from "../../memory-CBLqn9xl.js";
6
+ import { A as listThreadsNetworkQuerySchema, B as searchMemoryQuerySchema, C as getThreadByIdResponseSchema, D as listMessagesNetworkQuerySchema, G as updateWorkingMemoryBodySchema, H as threadIdPathParams, K as updateWorkingMemoryResponseSchema, L as saveMessagesBodySchema, M as listThreadsResponseSchema, N as memoryConfigResponseSchema, O as listMessagesQuerySchema, P as memoryStatusResponseSchema, R as saveMessagesNetworkQuerySchema, S as getThreadByIdQuerySchema, T as getWorkingMemoryResponseSchema, U as updateThreadBodySchema, V as searchMemoryResponseSchema, W as updateThreadNetworkQuerySchema, _ as getMemoryStatusNetworkQuerySchema, a as cloneThreadResponseSchema, b as getObservationalMemoryResponseSchema, c as deleteMessagesBodySchema, d as deleteMessagesResponseSchema, f as deleteThreadNetworkQuerySchema, g as getMemoryConfigQuerySchema, i as cloneThreadBodySchema, j as listThreadsQuerySchema, k as listMessagesResponseSchema, l as deleteMessagesNetworkQuerySchema, m as deleteThreadResponseSchema, n as awaitBufferStatusBodySchema, o as createThreadBodySchema, p as deleteThreadQuerySchema, r as awaitBufferStatusResponseSchema, s as createThreadNetworkQuerySchema, t as agentIdQuerySchema, u as deleteMessagesQuerySchema, v as getMemoryStatusQuerySchema, w as getWorkingMemoryQuerySchema, x as getThreadByIdNetworkQuerySchema, y as getObservationalMemoryQuerySchema, z as saveMessagesResponseSchema } from "../../memory-CjWJYFVI.js";
7
7
  import { getGatewayClient, isGatewayAgentAsync, toLocalMessage, toLocalOMRecord, toLocalThread } from "./gateway-memory-client.js";
8
8
  import { Agent } from "@mastra/core/agent";
9
9
  import { generateEmptyFromSchema } from "@mastra/core/utils";
@@ -13,9 +13,9 @@ const require_tool_providers = require("../../tool-providers-DFQkhO4R.cjs");
13
13
  const require_workspace = require("../../workspace-Cz9hE2ei.cjs");
14
14
  const require_a2a = require("../../a2a-MPoM5lzS.cjs");
15
15
  const require_auth = require("../../auth-B8fQdEg-.cjs");
16
- const require_memory = require("../../memory-D0prxytx.cjs");
16
+ const require_memory = require("../../memory-CVODqy7m.cjs");
17
17
  const require_responses = require("../../responses-CKNdSRkS.cjs");
18
- const require_conversations = require("../../conversations-PF0eKhIu.cjs");
18
+ const require_conversations = require("../../conversations-DJybpnE5.cjs");
19
19
  const require_logs = require("../../logs-BDuGFqxu.cjs");
20
20
  const require_mcp = require("../../mcp-Buvksst5.cjs");
21
21
  const require_scores = require("../../scores-C_Au9jSw.cjs");
@@ -205,6 +205,7 @@ exports.experimentSummaryResponseSchema = require_datasets.experimentSummaryResp
205
205
  exports.exportStoredAgentBodySchema = require_stored_agents.exportStoredAgentBodySchema;
206
206
  exports.exportStoredAgentResponseSchema = require_stored_agents.exportStoredAgentResponseSchema;
207
207
  exports.fileEntrySchema = require_workspace.fileEntrySchema;
208
+ exports.filterSchema = require_memory.filterSchema;
208
209
  exports.fsDeleteQuerySchema = require_workspace.fsDeleteQuerySchema;
209
210
  exports.fsDeleteResponseSchema = require_workspace.fsDeleteResponseSchema;
210
211
  exports.fsListQuerySchema = require_workspace.fsListQuerySchema;
@@ -250,6 +251,7 @@ exports.getToolProviderToolSchemaResponseSchema = require_tool_providers.getTool
250
251
  exports.getVersionResponseSchema = require_agent_versions.getVersionResponseSchema;
251
252
  exports.getWorkingMemoryQuerySchema = require_memory.getWorkingMemoryQuerySchema;
252
253
  exports.getWorkingMemoryResponseSchema = require_memory.getWorkingMemoryResponseSchema;
254
+ exports.includeSchema = require_memory.includeSchema;
253
255
  exports.indexBodySchema = require_workspace.indexBodySchema;
254
256
  exports.indexResponseSchema = require_workspace.indexResponseSchema;
255
257
  exports.infrastructureStatusResponseSchema = require_editor_builder.infrastructureStatusResponseSchema;
@@ -337,6 +339,7 @@ exports.mcpServerToolPathParams = require_mcp.mcpServerToolPathParams;
337
339
  exports.mcpToolInfoSchema = require_mcp.mcpToolInfoSchema;
338
340
  exports.memoryConfigResponseSchema = require_memory.memoryConfigResponseSchema;
339
341
  exports.memoryStatusResponseSchema = require_memory.memoryStatusResponseSchema;
342
+ exports.messageOrderBySchema = require_memory.messageOrderBySchema;
340
343
  exports.messageResponseSchema = require_common.messageResponseSchema;
341
344
  exports.messageSendBodySchema = require_a2a.messageSendBodySchema;
342
345
  exports.modelConfigIdPathParams = require_agents.modelConfigIdPathParams;
@@ -11,9 +11,9 @@ import { C as toolProviderConnectionPathParams, D as toolSlugPathParams, E as to
11
11
  import { A as skillMetadataWithPathSchema, B as skillsShPopularQuerySchema, C as searchQuerySchema, D as searchSkillsResponseSchema, E as searchSkillsQuerySchema, F as skillSearchResultSchema, G as skillsShSearchQuerySchema, H as skillsShPreviewResponseSchema, I as skillSourceSchema, J as skillsShSourceSchema, K as skillsShSearchResponseSchema, L as skillsShInstallBodySchema, M as skillReferencePathParams, N as skillReferenceResponseSchema, O as skillDisambiguationQuerySchema, P as skillSchema, Q as workspaceInfoResponseSchema, R as skillsShInstallResponseSchema, S as mountInfoSchema, T as searchResultSchema, U as skillsShRemoveBodySchema, V as skillsShPreviewQuerySchema, W as skillsShRemoveResponseSchema, X as skillsShUpdateResponseSchema, Y as skillsShUpdateBodySchema, Z as workspaceIdPathParams, _ as indexBodySchema, a as fsListResponseSchema, b as listSkillsResponseSchema, c as fsPathParams, d as fsStatQuerySchema, f as fsStatResponseSchema, g as getSkillResponseSchema, h as getAgentSkillResponseSchema, i as fsListQuerySchema, j as skillNamePathParams, k as skillMetadataSchema, l as fsReadQuerySchema, m as fsWriteResponseSchema, n as fsDeleteQuerySchema, o as fsMkdirBodySchema, p as fsWriteBodySchema, q as skillsShSkillSchema, r as fsDeleteResponseSchema, s as fsMkdirResponseSchema, t as fileEntrySchema, u as fsReadResponseSchema, v as indexResponseSchema, w as searchResponseSchema, x as listWorkspacesResponseSchema, y as listReferencesResponseSchema, z as skillsShListResponseSchema } from "../../workspace-S5GiJ3Nx.js";
12
12
  import { a as agentExecutionResponseSchema, c as taskResponseSchema, i as agentExecutionBodySchema, n as a2aTaskPathParams, o as messageSendBodySchema, r as agentCardResponseSchema, s as taskQueryBodySchema, t as a2aAgentIdPathParams } from "../../a2a-8C4O2dVJ.js";
13
13
  import { _ as ssoLoginQuerySchema, a as credentialsResponseSchema, c as currentUserResponseSchema, d as permissionPatternsResponseSchema, f as publicCapabilitiesSchema, g as ssoConfigSchema, h as ssoCallbackResponseSchema, i as capabilityFlagsSchema, l as loginConfigSchema, m as ssoCallbackQuerySchema, n as authenticatedUserSchema, o as credentialsSignInBodySchema, p as refreshResponseSchema, r as capabilitiesResponseSchema, s as credentialsSignUpBodySchema, t as authenticatedCapabilitiesSchema, u as logoutResponseSchema, v as ssoLoginResponseSchema, y as userAccessSchema } from "../../auth-CZFXpwba.js";
14
- import { A as listThreadsResponseSchema, B as updateThreadBodySchema, C as getWorkingMemoryQuerySchema, D as listMessagesResponseSchema, E as listMessagesQuerySchema, F as saveMessagesNetworkQuerySchema, H as updateWorkingMemoryBodySchema, I as saveMessagesResponseSchema, L as searchMemoryQuerySchema, M as memoryStatusResponseSchema, N as optionalAgentIdQuerySchema, O as listThreadsNetworkQuerySchema, P as saveMessagesBodySchema, R as searchMemoryResponseSchema, S as getThreadByIdResponseSchema, T as listMessagesNetworkQuerySchema, U as updateWorkingMemoryResponseSchema, V as updateThreadNetworkQuerySchema, _ as getMemoryStatusQuerySchema, a as cloneThreadResponseSchema, b as getThreadByIdNetworkQuerySchema, c as deleteMessagesBodySchema, d as deleteMessagesResponseSchema, f as deleteThreadNetworkQuerySchema, g as getMemoryStatusNetworkQuerySchema, h as getMemoryConfigQuerySchema, i as cloneThreadBodySchema, j as memoryConfigResponseSchema, k as listThreadsQuerySchema, l as deleteMessagesNetworkQuerySchema, m as deleteThreadResponseSchema, n as awaitBufferStatusBodySchema, o as createThreadBodySchema, p as deleteThreadQuerySchema, r as awaitBufferStatusResponseSchema, s as createThreadNetworkQuerySchema, t as agentIdQuerySchema, u as deleteMessagesQuerySchema, v as getObservationalMemoryQuerySchema, w as getWorkingMemoryResponseSchema, x as getThreadByIdQuerySchema, y as getObservationalMemoryResponseSchema, z as threadIdPathParams } from "../../memory-CBLqn9xl.js";
14
+ import { A as listThreadsNetworkQuerySchema, B as searchMemoryQuerySchema, C as getThreadByIdResponseSchema, D as listMessagesNetworkQuerySchema, E as includeSchema, F as messageOrderBySchema, G as updateWorkingMemoryBodySchema, H as threadIdPathParams, I as optionalAgentIdQuerySchema, K as updateWorkingMemoryResponseSchema, L as saveMessagesBodySchema, M as listThreadsResponseSchema, N as memoryConfigResponseSchema, O as listMessagesQuerySchema, P as memoryStatusResponseSchema, R as saveMessagesNetworkQuerySchema, S as getThreadByIdQuerySchema, T as getWorkingMemoryResponseSchema, U as updateThreadBodySchema, V as searchMemoryResponseSchema, W as updateThreadNetworkQuerySchema, _ as getMemoryStatusNetworkQuerySchema, a as cloneThreadResponseSchema, b as getObservationalMemoryResponseSchema, c as deleteMessagesBodySchema, d as deleteMessagesResponseSchema, f as deleteThreadNetworkQuerySchema, g as getMemoryConfigQuerySchema, h as filterSchema, i as cloneThreadBodySchema, j as listThreadsQuerySchema, k as listMessagesResponseSchema, l as deleteMessagesNetworkQuerySchema, m as deleteThreadResponseSchema, n as awaitBufferStatusBodySchema, o as createThreadBodySchema, p as deleteThreadQuerySchema, r as awaitBufferStatusResponseSchema, s as createThreadNetworkQuerySchema, t as agentIdQuerySchema, u as deleteMessagesQuerySchema, v as getMemoryStatusQuerySchema, w as getWorkingMemoryQuerySchema, x as getThreadByIdNetworkQuerySchema, y as getObservationalMemoryQuerySchema, z as saveMessagesResponseSchema } from "../../memory-CjWJYFVI.js";
15
15
  import { _ as responseToolSchema, a as deleteResponseSchema, c as responseInputTextContentSchema, d as responseOutputFunctionCallOutputSchema, f as responseOutputFunctionCallSchema, g as responseTextFormatSchema, h as responseOutputTextSchema, i as createResponseBodySchema, l as responseInputTextPartSchema, m as responseOutputMessageSchema, n as conversationItemSchema, o as responseIdPathParams, p as responseOutputItemSchema, r as conversationMessageContentSchema, s as responseInputMessageSchema, t as conversationItemMessageSchema, u as responseObjectSchema, v as responseUsageSchema } from "../../responses-DJNJgCTg.js";
16
- import { a as createConversationBodySchema, i as conversationObjectSchema, n as conversationIdPathParams, r as conversationItemsListSchema, t as conversationDeletedSchema } from "../../conversations-DtnawNGm.js";
16
+ import { a as createConversationBodySchema, i as conversationObjectSchema, n as conversationIdPathParams, r as conversationItemsListSchema, t as conversationDeletedSchema } from "../../conversations-D89Io31L.js";
17
17
  import { n as listLogsQuerySchema, r as listLogsResponseSchema, t as listLogTransportsResponseSchema } from "../../logs-Cz5NiwGP.js";
18
18
  import { _ as serverInfoSchema, a as listMcpServerToolsResponseSchema, f as mcpServerToolPathParams, g as serverDetailSchema, i as jsonRpcErrorSchema, l as mcpServerDetailPathParams, n as executeToolResponseSchema$1, o as listMcpServersQuerySchema, p as mcpToolInfoSchema, r as getMcpServerDetailQuerySchema, s as listMcpServersResponseSchema, t as executeToolBodySchema$1, u as mcpServerIdPathParams, v as versionDetailSchema } from "../../mcp-oOFVSK8L.js";
19
19
  import { a as listScoresByScorerIdQuerySchema, c as scorerEntrySchema, i as listScoresByRunIdQuerySchema, l as scorerIdPathParams, n as listScorersResponseSchema, o as saveScoreBodySchema, r as listScoresByEntityIdQuerySchema, s as saveScoreResponseSchema, t as entityPathParams, u as scoresWithPaginationResponseSchema } from "../../scores-B1IdMcDj.js";
@@ -32,4 +32,4 @@ import { a as listStoredPromptBlocksQuerySchema, c as storedPromptBlockSchema, i
32
32
  import { a as listStoredScorersQuerySchema, c as storedScorerSchema, i as getStoredScorerResponseSchema, l as updateStoredScorerBodySchema, n as createStoredScorerResponseSchema, o as listStoredScorersResponseSchema, r as deleteStoredScorerResponseSchema, s as storedScorerIdPathParams, t as createStoredScorerBodySchema, u as updateStoredScorerResponseSchema } from "../../stored-scorers-BA4suzgn.js";
33
33
  import { a as deleteStoredSkillResponseSchema, c as listStoredSkillsResponseSchema, d as readSkillOrigin, f as skillOriginSchema, g as updateStoredSkillResponseSchema, h as updateStoredSkillBodySchema, i as createStoredSkillResponseSchema, l as publishStoredSkillBodySchema, m as storedSkillSchema, n as buildOriginMetadata, o as getStoredSkillResponseSchema, p as storedSkillIdPathParams, r as createStoredSkillBodySchema, s as listStoredSkillsQuerySchema, t as SKILL_ORIGIN_METADATA_KEY, u as publishStoredSkillResponseSchema } from "../../stored-skills-JTWbMybs.js";
34
34
  import { a as editorSourceSchema, c as observabilityStorageCapabilitiesSchema, i as editorSourceCapabilitiesSchema, l as systemPackagesResponseSchema, n as apiSchemaManifestRouteSchema, o as mastraPackageSchema, r as apiSchemaResponseShapeSchema, s as observabilityRuntimeStrategySchema, t as apiSchemaManifestResponseSchema } from "../../system-DT2JfUun.js";
35
- export { SKILL_ORIGIN_METADATA_KEY, agentExecutionBodySchema as a2aAgentExecutionBodySchema, a2aAgentIdPathParams, a2aTaskPathParams, abortAgentThreadBodySchema, abortAgentThreadResponseSchema, actionIdPathParams, actionRunPathParams, activateMCPClientVersionResponseSchema, activatePromptBlockVersionResponseSchema, activateScorerVersionResponseSchema, activateVersionResponseSchema, addItemBodySchema, agentCardResponseSchema, agentConfigurationSchema, agentExecutionBodySchema$1 as agentExecutionBodySchema, agentExecutionLegacyBodySchema, agentExecutionResponseSchema, agentFeaturesSchema, agentIdPathParams, agentIdQuerySchema, agentModelsSchema, agentPlanQuerySchema, agentPlanResponseSchema, agentSkillPathParams, agentToolPathParams, agentVersionPathParams, agentVersionQuerySchema, agentVersionSchema, apiSchemaManifestResponseSchema, apiSchemaManifestRouteSchema, apiSchemaResponseShapeSchema, approveNetworkToolCallBodySchema, approveToolCallBodySchema, authStatusToolProviderResponseSchema, authenticatedCapabilitiesSchema, authenticatedUserSchema, authorizeToolProviderBodySchema, authorizeToolProviderResponseSchema, awaitBufferStatusBodySchema, awaitBufferStatusResponseSchema, baseLogMessageSchema, batchDeleteItemsBodySchema, batchDeleteItemsResponseSchema, batchInsertItemsBodySchema, batchInsertItemsResponseSchema, buildOriginMetadata, builderAvailableModelsResponseSchema, builderModelPolicySchema, builderPickerSchema, builderSettingsResponseSchema, capabilitiesResponseSchema, capabilityFlagsSchema, cloneThreadBodySchema, cloneThreadResponseSchema, clusterFailuresBodySchema, clusterFailuresResponseSchema, compareExperimentsBodySchema, compareMCPClientVersionsQuerySchema, compareMCPClientVersionsResponseSchema, comparePromptBlockVersionsQuerySchema, comparePromptBlockVersionsResponseSchema, compareScorerVersionsQuerySchema, compareScorerVersionsResponseSchema, compareVersionsQuerySchema, compareVersionsResponseSchema, comparisonResponseSchema, conditionalFieldSchema, connectionSchema, connectionScopeSchema, connectionStatusToolProviderBodySchema, connectionStatusToolProviderResponseSchema, connectionUsageQuerySchema, connectionUsageResponseSchema, conversationDeletedSchema, conversationIdPathParams, conversationItemMessageSchema, conversationItemSchema, conversationItemsListSchema, conversationMessageContentSchema, conversationObjectSchema, coreMessageSchema, createCombinedPaginationSchema, createCompareVersionsResponseSchema, createConversationBodySchema, createDatasetBodySchema, createIndexBodySchema, createIndexResponseSchema, createListVersionsResponseSchema, createMCPClientVersionBodySchema, createMCPClientVersionResponseSchema, createPagePaginationSchema, createPromptBlockVersionBodySchema, createPromptBlockVersionResponseSchema, createResponseBodySchema, createScorerVersionBodySchema, createScorerVersionResponseSchema, createStoredAgentBodySchema, createStoredAgentResponseSchema, createStoredMCPClientBodySchema, createStoredMCPClientResponseSchema, createStoredPromptBlockBodySchema, createStoredPromptBlockResponseSchema, createStoredScorerBodySchema, createStoredScorerResponseSchema, createStoredSkillBodySchema, createStoredSkillResponseSchema, createStoredWorkspaceBodySchema, createStoredWorkspaceResponseSchema, createThreadBodySchema, createThreadNetworkQuerySchema, createVersionBodySchema, createVersionResponseSchema, createWorkflowRunResponseSchema, credentialsResponseSchema, credentialsSignInBodySchema, credentialsSignUpBodySchema, currentUserResponseSchema, datasetAndExperimentIdPathParams, datasetAndItemIdPathParams, datasetExperimentAndItemIdPathParams, datasetIdPathParams, datasetItemResponseSchema, datasetItemVersionPathParams, datasetResponseSchema, datasetVersionResponseSchema, declineNetworkToolCallBodySchema, declineToolCallBodySchema, defaultModelEntrySchema, defaultOptionsSchema, deleteIndexResponseSchema, deleteMCPClientVersionResponseSchema, deleteMessagesBodySchema, deleteMessagesNetworkQuerySchema, deleteMessagesQuerySchema, deleteMessagesResponseSchema, deletePromptBlockVersionResponseSchema, deleteResponseSchema, deleteScorerVersionResponseSchema, deleteStoredAgentResponseSchema, deleteStoredMCPClientResponseSchema, deleteStoredPromptBlockResponseSchema, deleteStoredScorerResponseSchema, deleteStoredSkillResponseSchema, deleteStoredWorkspaceResponseSchema, deleteThreadNetworkQuerySchema, deleteThreadQuerySchema, deleteThreadResponseSchema, deleteVersionResponseSchema, describeIndexResponseSchema, disconnectConnectionQuerySchema, disconnectConnectionResponseSchema, editorSourceCapabilitiesSchema, editorSourceSchema, enhanceInstructionsBodySchema, enhanceInstructionsResponseSchema, entityPathParams, executeProcessorBodySchema, executeProcessorResponseSchema, executeToolBodySchema, executeToolContextBodySchema, executeToolResponseSchema, experimentIdPathParams, experimentResponseSchema, experimentResultIdPathParams, experimentResultResponseSchema, experimentReviewCountsSchema, experimentSummaryResponseSchema, exportStoredAgentBodySchema, exportStoredAgentResponseSchema, fileEntrySchema, fsDeleteQuerySchema, fsDeleteResponseSchema, fsListQuerySchema, fsListResponseSchema, fsMkdirBodySchema, fsMkdirResponseSchema, fsPathParams, fsReadQuerySchema, fsReadResponseSchema, fsStatQuerySchema, fsStatResponseSchema, fsWriteBodySchema, fsWriteResponseSchema, generateItemsBodySchema, generateItemsResponseSchema, generateResponseSchema, generateSpeechBodySchema, getAgentSkillResponseSchema, getListenerResponseSchema, getMCPClientVersionResponseSchema, getMcpServerDetailQuerySchema, getMemoryConfigQuerySchema, getMemoryStatusNetworkQuerySchema, getMemoryStatusQuerySchema, getObservationalMemoryQuerySchema, getObservationalMemoryResponseSchema, getProcessorProviderResponseSchema, getProcessorProvidersResponseSchema, getPromptBlockVersionResponseSchema, getScorerVersionResponseSchema, getSkillResponseSchema, getStoredAgentDependentsResponseSchema, getStoredAgentResponseSchema, getStoredMCPClientResponseSchema, getStoredPromptBlockResponseSchema, getStoredScorerResponseSchema, getStoredSkillResponseSchema, getStoredWorkspaceResponseSchema, getThreadByIdNetworkQuerySchema, getThreadByIdQuerySchema, getThreadByIdResponseSchema, getToolProviderToolSchemaResponseSchema, getVersionResponseSchema, getWorkingMemoryQuerySchema, getWorkingMemoryResponseSchema, indexBodySchema, indexResponseSchema, infrastructureStatusResponseSchema, instructionsSchema, itemIdPathParams, itemVersionResponseSchema, jsonRpcErrorSchema, listAgentsResponseSchema, listConnectionFieldsQuerySchema, listConnectionFieldsResponseSchema, listConnectionsQuerySchema, listConnectionsResponseSchema, listDatasetVersionsResponseSchema, listDatasetsResponseSchema, listEmbeddersResponseSchema, listExperimentResultsQuerySchema, listExperimentResultsResponseSchema, listExperimentsQuerySchema, listExperimentsResponseSchema, listIndexesResponseSchema, listItemVersionsResponseSchema, listItemsQuerySchema, listItemsResponseSchema, listLogTransportsResponseSchema, listLogsQuerySchema, listLogsResponseSchema, listMCPClientVersionsQuerySchema, listMCPClientVersionsResponseSchema, listMcpServerToolsResponseSchema, listMcpServersQuerySchema, listMcpServersResponseSchema, listMessagesNetworkQuerySchema, listMessagesQuerySchema, listMessagesResponseSchema, listProcessorsResponseSchema, listPromptBlockVersionsQuerySchema, listPromptBlockVersionsResponseSchema, listReferencesResponseSchema, listScorerVersionsQuerySchema, listScorerVersionsResponseSchema, listScorersResponseSchema, listScoresByEntityIdQuerySchema, listScoresByRunIdQuerySchema, listScoresByScorerIdQuerySchema, listSkillsResponseSchema, listStoredAgentsQuerySchema, listStoredAgentsResponseSchema, listStoredMCPClientsQuerySchema, listStoredMCPClientsResponseSchema, listStoredPromptBlocksQuerySchema, listStoredPromptBlocksResponseSchema, listStoredScorersQuerySchema, listStoredScorersResponseSchema, listStoredSkillsQuerySchema, listStoredSkillsResponseSchema, listStoredWorkspacesQuerySchema, listStoredWorkspacesResponseSchema, listSuspendedRunsQuerySchema, listSuspendedRunsResponseSchema, listThreadsNetworkQuerySchema, listThreadsQuerySchema, listThreadsResponseSchema, listToolProviderToolkitsResponseSchema, listToolProviderToolsQuerySchema, listToolProviderToolsResponseSchema, listToolProvidersResponseSchema, listToolsResponseSchema, listVectorsResponseSchema, listVersionsQuerySchema, listVersionsResponseSchema, listWorkflowRunsQuerySchema, listWorkflowsResponseSchema, listWorkspacesResponseSchema, loginConfigSchema, logoutResponseSchema, mastraPackageSchema, mcpClientVersionIdPathParams, mcpClientVersionPathParams, mcpClientVersionSchema, executeToolBodySchema$1 as mcpExecuteToolBodySchema, executeToolResponseSchema$1 as mcpExecuteToolResponseSchema, mcpServerDetailPathParams, mcpServerIdPathParams, mcpServerToolPathParams, mcpToolInfoSchema, memoryConfigResponseSchema, memoryStatusResponseSchema, messageResponseSchema, messageSendBodySchema, modelConfigIdPathParams, modelConfigSchema, modelManagementResponseSchema, mountInfoSchema, observabilityRuntimeStrategySchema, observabilityStorageCapabilitiesSchema, observeAgentBodySchema, observeAgentResponseSchema, openStoredAgentChangeRequestBodySchema, openStoredAgentChangeRequestResponseSchema, optionalAgentIdQuerySchema, optionalRunIdSchema, paginationInfoSchema, paginationQuerySchema, partialQuerySchema, permissionPatternsResponseSchema, pickerAllowlistSchema, previewInstructionsBodySchema, previewInstructionsResponseSchema, processorConfigurationSchema, processorGraphEntrySchema, processorGraphStepSchema, processorIdPathParams, processorPhaseSchema, processorProviderIdPathParams, serializedProcessorSchema as processorSerializedSchema, promptBlockVersionIdPathParams, promptBlockVersionPathParams, promptBlockVersionSchema, providerModelEntrySchema, providerSchema, providersResponseSchema, publicCapabilitiesSchema, publishStoredSkillBodySchema, publishStoredSkillResponseSchema, queryVectorsBodySchema, queryVectorsResponseSchema, queueAgentMessageBodySchema, readSkillOrigin, recoverBodySchema, refreshResponseSchema, reorderAgentModelListBodySchema, resolvedAuthorSchema, responseIdPathParams, responseInputMessageSchema, responseInputTextContentSchema, responseInputTextPartSchema, responseObjectSchema, responseOutputFunctionCallOutputSchema, responseOutputFunctionCallSchema, responseOutputItemSchema, responseOutputMessageSchema, responseOutputTextSchema, responseTextFormatSchema, responseToolSchema, responseUsageSchema, restoreMCPClientVersionResponseSchema, restorePromptBlockVersionResponseSchema, restoreScorerVersionResponseSchema, restoreVersionResponseSchema, resumeAgentBuilderBodySchema, resumeStreamBodySchema, resumeStreamUntilIdleBodySchema, reviewSummaryResponseSchema, ruleGroupSchema, ruleSchema, runExperimentItemBodySchema, runExperimentItemResponseSchema, runIdSchema, saveMessagesBodySchema, saveMessagesNetworkQuerySchema, saveMessagesResponseSchema, saveScoreBodySchema, saveScoreResponseSchema, scorerConfigSchema, scorerEntrySchema, scorerIdPathParams, scorerResultSchema, scorerVersionIdPathParams, scorerVersionPathParams, scorerVersionSchema, scoresWithPaginationResponseSchema, searchMemoryQuerySchema, searchMemoryResponseSchema, searchQuerySchema, searchResponseSchema, searchResultSchema, searchSkillsQuerySchema, searchSkillsResponseSchema, semanticRecallSchema, sendAgentMessageBodySchema, sendAgentSignalBodySchema, sendToolApprovalBodySchema, sendToolApprovalResponseSchema, sendWorkflowRunEventBodySchema, serializedAgentDefinitionSchema, serializedAgentSchema, serializedAgentWithIdSchema, serializedMemoryConfigSchema, serializedObservationConfigSchema, serializedObservationalMemoryConfigObjectSchema, serializedObservationalMemoryConfigSchema, serializedProcessorDetailSchema, serializedProcessorSchema$1 as serializedProcessorSchema, serializedReflectionConfigSchema, serializedToolSchema, serializedWorkflowSchema, serverDetailSchema, serverInfoSchema, skillDisambiguationQuerySchema, skillMetadataSchema, skillMetadataWithPathSchema, skillNamePathParams, skillOriginSchema, skillReferencePathParams, skillReferenceResponseSchema, skillSchema, skillSearchResultSchema, skillSourceSchema, skillsShInstallBodySchema, skillsShInstallResponseSchema, skillsShListResponseSchema, skillsShPopularQuerySchema, skillsShPreviewQuerySchema, skillsShPreviewResponseSchema, skillsShRemoveBodySchema, skillsShRemoveResponseSchema, skillsShSearchQuerySchema, skillsShSearchResponseSchema, skillsShSkillSchema, skillsShSourceSchema, skillsShUpdateBodySchema, skillsShUpdateResponseSchema, snapshotConfigSchema, speakResponseSchema, ssoCallbackQuerySchema, ssoCallbackResponseSchema, ssoConfigSchema, ssoLoginQuerySchema, ssoLoginResponseSchema, startAsyncAgentBuilderBodySchema, statusQuerySchema, storedAgentIdPathParams, storedAgentSchema, storedMCPClientIdPathParams, storedMCPClientSchema, storedProcessorGraphSchema, storedPromptBlockIdPathParams, storedPromptBlockSchema, storedScorerIdPathParams, storedScorerSchema, storedSkillIdPathParams, storedSkillSchema, storedWorkspaceIdPathParams, storedWorkspaceSchema, streamAgentBuilderBodySchema, streamLegacyAgentBuilderBodySchema, streamResponseSchema, streamUntilIdleBodySchema, submitExperimentResultBodySchema, subscribeAgentThreadBodySchema, successResponseSchema, systemPackagesResponseSchema, taskQueryBodySchema, taskResponseSchema, tenancyQuerySchema, threadIdPathParams, titleGenerationSchema, toolCallResponseSchema, toolConfigSchema, toolIdPathParams, toolProviderAuthStatusPathParams, toolProviderConfigSchema, toolProviderConnectionPathParams, toolProviderHealthResponseSchema, toolProviderIdPathParams, toolProvidersSchema, toolSlugPathParams, toolsConfigSchema, tracingOptionsSchema, transcribeSpeechBodySchema, transcribeSpeechResponseSchema, triggerExperimentBodySchema, typedPermissive, updateAgentModelBodySchema, updateAgentModelInModelListBodySchema, updateConnectionBodySchema, updateConnectionResponseSchema, updateDatasetBodySchema, updateExperimentBodySchema, updateExperimentResultBodySchema, updateItemBodySchema, updateStoredAgentBodySchema, updateStoredAgentResponseSchema, updateStoredMCPClientBodySchema, updateStoredMCPClientResponseSchema, updateStoredPromptBlockBodySchema, updateStoredPromptBlockResponseSchema, updateStoredScorerBodySchema, updateStoredScorerResponseSchema, updateStoredSkillBodySchema, updateStoredSkillResponseSchema, updateStoredWorkspaceBodySchema, updateStoredWorkspaceResponseSchema, updateThreadBodySchema, updateThreadNetworkQuerySchema, updateWorkingMemoryBodySchema, updateWorkingMemoryResponseSchema, upsertVectorsBodySchema, upsertVectorsResponseSchema, userAccessSchema, vectorIndexPathParams, vectorNamePathParams, versionDetailSchema, versionDiffEntrySchema, versionIdPathParams, versionOrderBySchema, voiceSpeakersResponseSchema, workflowControlResponseSchema, workflowExecutionResultSchema, workflowInfoSchema, workflowRunResultQuerySchema, workflowRunResultSchema, workflowRunsResponseSchema, workspaceIdPathParams, workspaceInfoResponseSchema, snapshotConfigSchema$1 as workspaceSnapshotConfigSchema };
35
+ export { SKILL_ORIGIN_METADATA_KEY, agentExecutionBodySchema as a2aAgentExecutionBodySchema, a2aAgentIdPathParams, a2aTaskPathParams, abortAgentThreadBodySchema, abortAgentThreadResponseSchema, actionIdPathParams, actionRunPathParams, activateMCPClientVersionResponseSchema, activatePromptBlockVersionResponseSchema, activateScorerVersionResponseSchema, activateVersionResponseSchema, addItemBodySchema, agentCardResponseSchema, agentConfigurationSchema, agentExecutionBodySchema$1 as agentExecutionBodySchema, agentExecutionLegacyBodySchema, agentExecutionResponseSchema, agentFeaturesSchema, agentIdPathParams, agentIdQuerySchema, agentModelsSchema, agentPlanQuerySchema, agentPlanResponseSchema, agentSkillPathParams, agentToolPathParams, agentVersionPathParams, agentVersionQuerySchema, agentVersionSchema, apiSchemaManifestResponseSchema, apiSchemaManifestRouteSchema, apiSchemaResponseShapeSchema, approveNetworkToolCallBodySchema, approveToolCallBodySchema, authStatusToolProviderResponseSchema, authenticatedCapabilitiesSchema, authenticatedUserSchema, authorizeToolProviderBodySchema, authorizeToolProviderResponseSchema, awaitBufferStatusBodySchema, awaitBufferStatusResponseSchema, baseLogMessageSchema, batchDeleteItemsBodySchema, batchDeleteItemsResponseSchema, batchInsertItemsBodySchema, batchInsertItemsResponseSchema, buildOriginMetadata, builderAvailableModelsResponseSchema, builderModelPolicySchema, builderPickerSchema, builderSettingsResponseSchema, capabilitiesResponseSchema, capabilityFlagsSchema, cloneThreadBodySchema, cloneThreadResponseSchema, clusterFailuresBodySchema, clusterFailuresResponseSchema, compareExperimentsBodySchema, compareMCPClientVersionsQuerySchema, compareMCPClientVersionsResponseSchema, comparePromptBlockVersionsQuerySchema, comparePromptBlockVersionsResponseSchema, compareScorerVersionsQuerySchema, compareScorerVersionsResponseSchema, compareVersionsQuerySchema, compareVersionsResponseSchema, comparisonResponseSchema, conditionalFieldSchema, connectionSchema, connectionScopeSchema, connectionStatusToolProviderBodySchema, connectionStatusToolProviderResponseSchema, connectionUsageQuerySchema, connectionUsageResponseSchema, conversationDeletedSchema, conversationIdPathParams, conversationItemMessageSchema, conversationItemSchema, conversationItemsListSchema, conversationMessageContentSchema, conversationObjectSchema, coreMessageSchema, createCombinedPaginationSchema, createCompareVersionsResponseSchema, createConversationBodySchema, createDatasetBodySchema, createIndexBodySchema, createIndexResponseSchema, createListVersionsResponseSchema, createMCPClientVersionBodySchema, createMCPClientVersionResponseSchema, createPagePaginationSchema, createPromptBlockVersionBodySchema, createPromptBlockVersionResponseSchema, createResponseBodySchema, createScorerVersionBodySchema, createScorerVersionResponseSchema, createStoredAgentBodySchema, createStoredAgentResponseSchema, createStoredMCPClientBodySchema, createStoredMCPClientResponseSchema, createStoredPromptBlockBodySchema, createStoredPromptBlockResponseSchema, createStoredScorerBodySchema, createStoredScorerResponseSchema, createStoredSkillBodySchema, createStoredSkillResponseSchema, createStoredWorkspaceBodySchema, createStoredWorkspaceResponseSchema, createThreadBodySchema, createThreadNetworkQuerySchema, createVersionBodySchema, createVersionResponseSchema, createWorkflowRunResponseSchema, credentialsResponseSchema, credentialsSignInBodySchema, credentialsSignUpBodySchema, currentUserResponseSchema, datasetAndExperimentIdPathParams, datasetAndItemIdPathParams, datasetExperimentAndItemIdPathParams, datasetIdPathParams, datasetItemResponseSchema, datasetItemVersionPathParams, datasetResponseSchema, datasetVersionResponseSchema, declineNetworkToolCallBodySchema, declineToolCallBodySchema, defaultModelEntrySchema, defaultOptionsSchema, deleteIndexResponseSchema, deleteMCPClientVersionResponseSchema, deleteMessagesBodySchema, deleteMessagesNetworkQuerySchema, deleteMessagesQuerySchema, deleteMessagesResponseSchema, deletePromptBlockVersionResponseSchema, deleteResponseSchema, deleteScorerVersionResponseSchema, deleteStoredAgentResponseSchema, deleteStoredMCPClientResponseSchema, deleteStoredPromptBlockResponseSchema, deleteStoredScorerResponseSchema, deleteStoredSkillResponseSchema, deleteStoredWorkspaceResponseSchema, deleteThreadNetworkQuerySchema, deleteThreadQuerySchema, deleteThreadResponseSchema, deleteVersionResponseSchema, describeIndexResponseSchema, disconnectConnectionQuerySchema, disconnectConnectionResponseSchema, editorSourceCapabilitiesSchema, editorSourceSchema, enhanceInstructionsBodySchema, enhanceInstructionsResponseSchema, entityPathParams, executeProcessorBodySchema, executeProcessorResponseSchema, executeToolBodySchema, executeToolContextBodySchema, executeToolResponseSchema, experimentIdPathParams, experimentResponseSchema, experimentResultIdPathParams, experimentResultResponseSchema, experimentReviewCountsSchema, experimentSummaryResponseSchema, exportStoredAgentBodySchema, exportStoredAgentResponseSchema, fileEntrySchema, filterSchema, fsDeleteQuerySchema, fsDeleteResponseSchema, fsListQuerySchema, fsListResponseSchema, fsMkdirBodySchema, fsMkdirResponseSchema, fsPathParams, fsReadQuerySchema, fsReadResponseSchema, fsStatQuerySchema, fsStatResponseSchema, fsWriteBodySchema, fsWriteResponseSchema, generateItemsBodySchema, generateItemsResponseSchema, generateResponseSchema, generateSpeechBodySchema, getAgentSkillResponseSchema, getListenerResponseSchema, getMCPClientVersionResponseSchema, getMcpServerDetailQuerySchema, getMemoryConfigQuerySchema, getMemoryStatusNetworkQuerySchema, getMemoryStatusQuerySchema, getObservationalMemoryQuerySchema, getObservationalMemoryResponseSchema, getProcessorProviderResponseSchema, getProcessorProvidersResponseSchema, getPromptBlockVersionResponseSchema, getScorerVersionResponseSchema, getSkillResponseSchema, getStoredAgentDependentsResponseSchema, getStoredAgentResponseSchema, getStoredMCPClientResponseSchema, getStoredPromptBlockResponseSchema, getStoredScorerResponseSchema, getStoredSkillResponseSchema, getStoredWorkspaceResponseSchema, getThreadByIdNetworkQuerySchema, getThreadByIdQuerySchema, getThreadByIdResponseSchema, getToolProviderToolSchemaResponseSchema, getVersionResponseSchema, getWorkingMemoryQuerySchema, getWorkingMemoryResponseSchema, includeSchema, indexBodySchema, indexResponseSchema, infrastructureStatusResponseSchema, instructionsSchema, itemIdPathParams, itemVersionResponseSchema, jsonRpcErrorSchema, listAgentsResponseSchema, listConnectionFieldsQuerySchema, listConnectionFieldsResponseSchema, listConnectionsQuerySchema, listConnectionsResponseSchema, listDatasetVersionsResponseSchema, listDatasetsResponseSchema, listEmbeddersResponseSchema, listExperimentResultsQuerySchema, listExperimentResultsResponseSchema, listExperimentsQuerySchema, listExperimentsResponseSchema, listIndexesResponseSchema, listItemVersionsResponseSchema, listItemsQuerySchema, listItemsResponseSchema, listLogTransportsResponseSchema, listLogsQuerySchema, listLogsResponseSchema, listMCPClientVersionsQuerySchema, listMCPClientVersionsResponseSchema, listMcpServerToolsResponseSchema, listMcpServersQuerySchema, listMcpServersResponseSchema, listMessagesNetworkQuerySchema, listMessagesQuerySchema, listMessagesResponseSchema, listProcessorsResponseSchema, listPromptBlockVersionsQuerySchema, listPromptBlockVersionsResponseSchema, listReferencesResponseSchema, listScorerVersionsQuerySchema, listScorerVersionsResponseSchema, listScorersResponseSchema, listScoresByEntityIdQuerySchema, listScoresByRunIdQuerySchema, listScoresByScorerIdQuerySchema, listSkillsResponseSchema, listStoredAgentsQuerySchema, listStoredAgentsResponseSchema, listStoredMCPClientsQuerySchema, listStoredMCPClientsResponseSchema, listStoredPromptBlocksQuerySchema, listStoredPromptBlocksResponseSchema, listStoredScorersQuerySchema, listStoredScorersResponseSchema, listStoredSkillsQuerySchema, listStoredSkillsResponseSchema, listStoredWorkspacesQuerySchema, listStoredWorkspacesResponseSchema, listSuspendedRunsQuerySchema, listSuspendedRunsResponseSchema, listThreadsNetworkQuerySchema, listThreadsQuerySchema, listThreadsResponseSchema, listToolProviderToolkitsResponseSchema, listToolProviderToolsQuerySchema, listToolProviderToolsResponseSchema, listToolProvidersResponseSchema, listToolsResponseSchema, listVectorsResponseSchema, listVersionsQuerySchema, listVersionsResponseSchema, listWorkflowRunsQuerySchema, listWorkflowsResponseSchema, listWorkspacesResponseSchema, loginConfigSchema, logoutResponseSchema, mastraPackageSchema, mcpClientVersionIdPathParams, mcpClientVersionPathParams, mcpClientVersionSchema, executeToolBodySchema$1 as mcpExecuteToolBodySchema, executeToolResponseSchema$1 as mcpExecuteToolResponseSchema, mcpServerDetailPathParams, mcpServerIdPathParams, mcpServerToolPathParams, mcpToolInfoSchema, memoryConfigResponseSchema, memoryStatusResponseSchema, messageOrderBySchema, messageResponseSchema, messageSendBodySchema, modelConfigIdPathParams, modelConfigSchema, modelManagementResponseSchema, mountInfoSchema, observabilityRuntimeStrategySchema, observabilityStorageCapabilitiesSchema, observeAgentBodySchema, observeAgentResponseSchema, openStoredAgentChangeRequestBodySchema, openStoredAgentChangeRequestResponseSchema, optionalAgentIdQuerySchema, optionalRunIdSchema, paginationInfoSchema, paginationQuerySchema, partialQuerySchema, permissionPatternsResponseSchema, pickerAllowlistSchema, previewInstructionsBodySchema, previewInstructionsResponseSchema, processorConfigurationSchema, processorGraphEntrySchema, processorGraphStepSchema, processorIdPathParams, processorPhaseSchema, processorProviderIdPathParams, serializedProcessorSchema as processorSerializedSchema, promptBlockVersionIdPathParams, promptBlockVersionPathParams, promptBlockVersionSchema, providerModelEntrySchema, providerSchema, providersResponseSchema, publicCapabilitiesSchema, publishStoredSkillBodySchema, publishStoredSkillResponseSchema, queryVectorsBodySchema, queryVectorsResponseSchema, queueAgentMessageBodySchema, readSkillOrigin, recoverBodySchema, refreshResponseSchema, reorderAgentModelListBodySchema, resolvedAuthorSchema, responseIdPathParams, responseInputMessageSchema, responseInputTextContentSchema, responseInputTextPartSchema, responseObjectSchema, responseOutputFunctionCallOutputSchema, responseOutputFunctionCallSchema, responseOutputItemSchema, responseOutputMessageSchema, responseOutputTextSchema, responseTextFormatSchema, responseToolSchema, responseUsageSchema, restoreMCPClientVersionResponseSchema, restorePromptBlockVersionResponseSchema, restoreScorerVersionResponseSchema, restoreVersionResponseSchema, resumeAgentBuilderBodySchema, resumeStreamBodySchema, resumeStreamUntilIdleBodySchema, reviewSummaryResponseSchema, ruleGroupSchema, ruleSchema, runExperimentItemBodySchema, runExperimentItemResponseSchema, runIdSchema, saveMessagesBodySchema, saveMessagesNetworkQuerySchema, saveMessagesResponseSchema, saveScoreBodySchema, saveScoreResponseSchema, scorerConfigSchema, scorerEntrySchema, scorerIdPathParams, scorerResultSchema, scorerVersionIdPathParams, scorerVersionPathParams, scorerVersionSchema, scoresWithPaginationResponseSchema, searchMemoryQuerySchema, searchMemoryResponseSchema, searchQuerySchema, searchResponseSchema, searchResultSchema, searchSkillsQuerySchema, searchSkillsResponseSchema, semanticRecallSchema, sendAgentMessageBodySchema, sendAgentSignalBodySchema, sendToolApprovalBodySchema, sendToolApprovalResponseSchema, sendWorkflowRunEventBodySchema, serializedAgentDefinitionSchema, serializedAgentSchema, serializedAgentWithIdSchema, serializedMemoryConfigSchema, serializedObservationConfigSchema, serializedObservationalMemoryConfigObjectSchema, serializedObservationalMemoryConfigSchema, serializedProcessorDetailSchema, serializedProcessorSchema$1 as serializedProcessorSchema, serializedReflectionConfigSchema, serializedToolSchema, serializedWorkflowSchema, serverDetailSchema, serverInfoSchema, skillDisambiguationQuerySchema, skillMetadataSchema, skillMetadataWithPathSchema, skillNamePathParams, skillOriginSchema, skillReferencePathParams, skillReferenceResponseSchema, skillSchema, skillSearchResultSchema, skillSourceSchema, skillsShInstallBodySchema, skillsShInstallResponseSchema, skillsShListResponseSchema, skillsShPopularQuerySchema, skillsShPreviewQuerySchema, skillsShPreviewResponseSchema, skillsShRemoveBodySchema, skillsShRemoveResponseSchema, skillsShSearchQuerySchema, skillsShSearchResponseSchema, skillsShSkillSchema, skillsShSourceSchema, skillsShUpdateBodySchema, skillsShUpdateResponseSchema, snapshotConfigSchema, speakResponseSchema, ssoCallbackQuerySchema, ssoCallbackResponseSchema, ssoConfigSchema, ssoLoginQuerySchema, ssoLoginResponseSchema, startAsyncAgentBuilderBodySchema, statusQuerySchema, storedAgentIdPathParams, storedAgentSchema, storedMCPClientIdPathParams, storedMCPClientSchema, storedProcessorGraphSchema, storedPromptBlockIdPathParams, storedPromptBlockSchema, storedScorerIdPathParams, storedScorerSchema, storedSkillIdPathParams, storedSkillSchema, storedWorkspaceIdPathParams, storedWorkspaceSchema, streamAgentBuilderBodySchema, streamLegacyAgentBuilderBodySchema, streamResponseSchema, streamUntilIdleBodySchema, submitExperimentResultBodySchema, subscribeAgentThreadBodySchema, successResponseSchema, systemPackagesResponseSchema, taskQueryBodySchema, taskResponseSchema, tenancyQuerySchema, threadIdPathParams, titleGenerationSchema, toolCallResponseSchema, toolConfigSchema, toolIdPathParams, toolProviderAuthStatusPathParams, toolProviderConfigSchema, toolProviderConnectionPathParams, toolProviderHealthResponseSchema, toolProviderIdPathParams, toolProvidersSchema, toolSlugPathParams, toolsConfigSchema, tracingOptionsSchema, transcribeSpeechBodySchema, transcribeSpeechResponseSchema, triggerExperimentBodySchema, typedPermissive, updateAgentModelBodySchema, updateAgentModelInModelListBodySchema, updateConnectionBodySchema, updateConnectionResponseSchema, updateDatasetBodySchema, updateExperimentBodySchema, updateExperimentResultBodySchema, updateItemBodySchema, updateStoredAgentBodySchema, updateStoredAgentResponseSchema, updateStoredMCPClientBodySchema, updateStoredMCPClientResponseSchema, updateStoredPromptBlockBodySchema, updateStoredPromptBlockResponseSchema, updateStoredScorerBodySchema, updateStoredScorerResponseSchema, updateStoredSkillBodySchema, updateStoredSkillResponseSchema, updateStoredWorkspaceBodySchema, updateStoredWorkspaceResponseSchema, updateThreadBodySchema, updateThreadNetworkQuerySchema, updateWorkingMemoryBodySchema, updateWorkingMemoryResponseSchema, upsertVectorsBodySchema, upsertVectorsResponseSchema, userAccessSchema, vectorIndexPathParams, vectorNamePathParams, versionDetailSchema, versionDiffEntrySchema, versionIdPathParams, versionOrderBySchema, voiceSpeakersResponseSchema, workflowControlResponseSchema, workflowExecutionResultSchema, workflowInfoSchema, workflowRunResultQuerySchema, workflowRunResultSchema, workflowRunsResponseSchema, workspaceIdPathParams, workspaceInfoResponseSchema, snapshotConfigSchema$1 as workspaceSnapshotConfigSchema };
@@ -15,6 +15,42 @@ export declare const agentIdQuerySchema: z.ZodObject<{
15
15
  export declare const optionalAgentIdQuerySchema: z.ZodObject<{
16
16
  agentId: z.ZodOptional<z.ZodString>;
17
17
  }, z.core.$strip>;
18
+ /**
19
+ * Storage order by configuration for messages (only have createdAt)
20
+ * Handles JSON parsing from query strings. See `storageOrderBySchema` for why
21
+ * the inner object schema is also `.optional()`.
22
+ */
23
+ export declare const messageOrderBySchema: z.ZodOptional<z.ZodPreprocess<z.ZodOptional<z.ZodObject<{
24
+ field: z.ZodOptional<z.ZodEnum<{
25
+ createdAt: "createdAt";
26
+ }>>;
27
+ direction: z.ZodOptional<z.ZodEnum<{
28
+ ASC: "ASC";
29
+ DESC: "DESC";
30
+ }>>;
31
+ }, z.core.$strip>>>>;
32
+ /**
33
+ * Include schema for message listing - handles JSON parsing from query strings
34
+ */
35
+ export declare const includeSchema: z.ZodOptional<z.ZodPreprocess<z.ZodArray<z.ZodObject<{
36
+ id: z.ZodString;
37
+ threadId: z.ZodOptional<z.ZodString>;
38
+ withPreviousMessages: z.ZodOptional<z.ZodNumber>;
39
+ withNextMessages: z.ZodOptional<z.ZodNumber>;
40
+ }, z.core.$strip>>>>;
41
+ /**
42
+ * Filter schema for message listing - handles JSON parsing from query strings
43
+ */
44
+ export declare const filterSchema: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
45
+ dateRange: z.ZodOptional<z.ZodObject<{
46
+ start: z.ZodOptional<z.ZodCoercedDate<unknown>>;
47
+ end: z.ZodOptional<z.ZodCoercedDate<unknown>>;
48
+ startExclusive: z.ZodOptional<z.ZodBoolean>;
49
+ endExclusive: z.ZodOptional<z.ZodBoolean>;
50
+ }, z.core.$strip>>;
51
+ roles: z.ZodOptional<z.ZodArray<z.ZodString>>;
52
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
53
+ }, z.core.$strip>>>;
18
54
  /**
19
55
  * GET /api/memory/status
20
56
  * Includes optional resourceId and threadId for OM status lookup
@@ -1 +1 @@
1
- {"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../../src/server/schemas/memory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAI3B,eAAO,MAAM,kBAAkB;;iBAE7B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,kBAAkB;;iBAE7B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,0BAA0B;;iBAErC,CAAC;AAuLH;;;GAGG;AACH,eAAO,MAAM,0BAA0B;;;;iBAGrC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,0BAA0B;;iBAAqB,CAAC;AAgC7D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAqBJ,CAAC;AAEhC;;;;GAIG;AACH,eAAO,MAAM,wBAAwB;;;iBAEnC,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAclC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,2BAA2B;;;;iBAItC,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,uBAAuB;;;iBAElC,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,yBAAyB;;;iBAEpC,CAAC;AAMH;;GAEG;AACH,eAAO,MAAM,iCAAiC;;iBAAqB,CAAC;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