@frontmcp/sdk 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (226) hide show
  1. package/README.md +3 -3
  2. package/package.json +8 -19
  3. package/src/adapter/adapter.instance.js +5 -0
  4. package/src/adapter/adapter.instance.js.map +1 -1
  5. package/src/auth/authorization/authorization.class.d.ts +1 -4
  6. package/src/auth/authorization/authorization.class.js +6 -13
  7. package/src/auth/authorization/authorization.class.js.map +1 -1
  8. package/src/auth/flows/session.verify.flow.d.ts +1 -0
  9. package/src/auth/flows/session.verify.flow.js +11 -1
  10. package/src/auth/flows/session.verify.flow.js.map +1 -1
  11. package/src/auth/flows/well-known.jwks.flow.js +2 -2
  12. package/src/auth/flows/well-known.jwks.flow.js.map +1 -1
  13. package/src/auth/jwks/dev-key-persistence.d.ts +63 -0
  14. package/src/auth/jwks/dev-key-persistence.js +219 -0
  15. package/src/auth/jwks/dev-key-persistence.js.map +1 -0
  16. package/src/auth/jwks/index.d.ts +1 -0
  17. package/src/auth/jwks/index.js +1 -0
  18. package/src/auth/jwks/index.js.map +1 -1
  19. package/src/auth/jwks/jwks.service.d.ts +7 -4
  20. package/src/auth/jwks/jwks.service.js +81 -12
  21. package/src/auth/jwks/jwks.service.js.map +1 -1
  22. package/src/auth/jwks/jwks.types.d.ts +7 -0
  23. package/src/auth/jwks/jwks.types.js.map +1 -1
  24. package/src/auth/machine-id.d.ts +5 -0
  25. package/src/auth/machine-id.js +32 -0
  26. package/src/auth/machine-id.js.map +1 -0
  27. package/src/auth/session/index.d.ts +1 -0
  28. package/src/auth/session/index.js +3 -1
  29. package/src/auth/session/index.js.map +1 -1
  30. package/src/auth/session/record/session.base.js +5 -3
  31. package/src/auth/session/record/session.base.js.map +1 -1
  32. package/src/auth/session/record/session.stateless.d.ts +2 -2
  33. package/src/auth/session/record/session.stateless.js +5 -3
  34. package/src/auth/session/record/session.stateless.js.map +1 -1
  35. package/src/auth/session/redis-session.store.d.ts +64 -0
  36. package/src/auth/session/redis-session.store.js +204 -0
  37. package/src/auth/session/redis-session.store.js.map +1 -0
  38. package/src/auth/session/session.service.d.ts +0 -2
  39. package/src/auth/session/session.service.js +1 -7
  40. package/src/auth/session/session.service.js.map +1 -1
  41. package/src/auth/session/transport-session.manager.js +3 -5
  42. package/src/auth/session/transport-session.manager.js.map +1 -1
  43. package/src/auth/session/transport-session.types.d.ts +4 -0
  44. package/src/auth/session/transport-session.types.js +4 -3
  45. package/src/auth/session/transport-session.types.js.map +1 -1
  46. package/src/auth/session/utils/session-id.utils.d.ts +12 -1
  47. package/src/auth/session/utils/session-id.utils.js +48 -9
  48. package/src/auth/session/utils/session-id.utils.js.map +1 -1
  49. package/src/auth/ui/base-layout.d.ts +0 -8
  50. package/src/auth/ui/base-layout.js +1 -14
  51. package/src/auth/ui/base-layout.js.map +1 -1
  52. package/src/auth/ui/index.d.ts +3 -4
  53. package/src/auth/ui/index.js +10 -11
  54. package/src/auth/ui/index.js.map +1 -1
  55. package/src/auth/ui/{htmx-templates.d.ts → templates.d.ts} +5 -6
  56. package/src/auth/ui/{htmx-templates.js → templates.js} +8 -15
  57. package/src/auth/ui/templates.js.map +1 -0
  58. package/src/common/decorators/decorator-utils.js.map +1 -1
  59. package/src/common/decorators/front-mcp.decorator.js +28 -2
  60. package/src/common/decorators/front-mcp.decorator.js.map +1 -1
  61. package/src/common/index.d.ts +0 -1
  62. package/src/common/index.js +0 -1
  63. package/src/common/index.js.map +1 -1
  64. package/src/common/interfaces/adapter.interface.d.ts +6 -0
  65. package/src/common/interfaces/adapter.interface.js.map +1 -1
  66. package/src/common/interfaces/execution-context.interface.d.ts +52 -3
  67. package/src/common/interfaces/execution-context.interface.js +88 -3
  68. package/src/common/interfaces/execution-context.interface.js.map +1 -1
  69. package/src/common/interfaces/flow.interface.d.ts +13 -0
  70. package/src/common/interfaces/flow.interface.js +24 -0
  71. package/src/common/interfaces/flow.interface.js.map +1 -1
  72. package/src/common/interfaces/server.interface.d.ts +9 -0
  73. package/src/common/interfaces/server.interface.js.map +1 -1
  74. package/src/common/metadata/app.metadata.d.ts +108 -0
  75. package/src/common/metadata/front-mcp.metadata.d.ts +659 -2
  76. package/src/common/metadata/front-mcp.metadata.js +3 -1
  77. package/src/common/metadata/front-mcp.metadata.js.map +1 -1
  78. package/src/common/metadata/provider.metadata.d.ts +14 -0
  79. package/src/common/metadata/provider.metadata.js +18 -2
  80. package/src/common/metadata/provider.metadata.js.map +1 -1
  81. package/src/common/metadata/tool.metadata.d.ts +33 -1
  82. package/src/common/metadata/tool.metadata.js.map +1 -1
  83. package/src/common/migrate/auth-transport.migrate.d.ts +62 -0
  84. package/src/common/migrate/auth-transport.migrate.js +140 -0
  85. package/src/common/migrate/auth-transport.migrate.js.map +1 -0
  86. package/src/common/migrate/index.d.ts +1 -0
  87. package/src/common/migrate/index.js +6 -0
  88. package/src/common/migrate/index.js.map +1 -0
  89. package/src/common/schemas/http-output.schema.d.ts +10 -2
  90. package/src/common/schemas/index.d.ts +1 -0
  91. package/src/common/schemas/index.js +1 -0
  92. package/src/common/schemas/index.js.map +1 -1
  93. package/src/common/schemas/session-header.schema.d.ts +16 -0
  94. package/src/common/schemas/session-header.schema.js +42 -0
  95. package/src/common/schemas/session-header.schema.js.map +1 -0
  96. package/src/common/tokens/front-mcp.tokens.js +3 -1
  97. package/src/common/tokens/front-mcp.tokens.js.map +1 -1
  98. package/src/common/types/options/auth.options.d.ts +233 -3
  99. package/src/common/types/options/auth.options.js +29 -40
  100. package/src/common/types/options/auth.options.js.map +1 -1
  101. package/src/common/types/options/index.d.ts +2 -0
  102. package/src/common/types/options/index.js +2 -0
  103. package/src/common/types/options/index.js.map +1 -1
  104. package/src/common/types/options/redis.options.d.ts +22 -0
  105. package/src/common/types/options/redis.options.js +45 -0
  106. package/src/common/types/options/redis.options.js.map +1 -0
  107. package/src/common/types/options/transport.options.d.ts +84 -0
  108. package/src/common/types/options/transport.options.js +121 -0
  109. package/src/common/types/options/transport.options.js.map +1 -0
  110. package/src/completion/flows/complete.flow.d.ts +17 -2
  111. package/src/context/frontmcp-context-storage.d.ts +94 -0
  112. package/src/context/frontmcp-context-storage.js +183 -0
  113. package/src/context/frontmcp-context-storage.js.map +1 -0
  114. package/src/context/frontmcp-context.d.ts +269 -0
  115. package/src/context/frontmcp-context.js +360 -0
  116. package/src/context/frontmcp-context.js.map +1 -0
  117. package/src/context/frontmcp-context.provider.d.ts +43 -0
  118. package/src/context/frontmcp-context.provider.js +61 -0
  119. package/src/context/frontmcp-context.provider.js.map +1 -0
  120. package/src/context/index.d.ts +34 -0
  121. package/src/context/index.js +64 -0
  122. package/src/context/index.js.map +1 -0
  123. package/src/context/request-context-storage.d.ts +89 -0
  124. package/src/context/request-context-storage.js +183 -0
  125. package/src/context/request-context-storage.js.map +1 -0
  126. package/src/context/request-context.d.ts +184 -0
  127. package/src/context/request-context.js +209 -0
  128. package/src/context/request-context.js.map +1 -0
  129. package/src/context/request-context.provider.d.ts +37 -0
  130. package/src/context/request-context.provider.js +51 -0
  131. package/src/context/request-context.provider.js.map +1 -0
  132. package/src/context/session-key.provider.d.ts +45 -0
  133. package/src/context/session-key.provider.js +65 -0
  134. package/src/context/session-key.provider.js.map +1 -0
  135. package/src/context/trace-context.d.ts +43 -0
  136. package/src/context/trace-context.js +142 -0
  137. package/src/context/trace-context.js.map +1 -0
  138. package/src/errors/index.d.ts +1 -1
  139. package/src/errors/index.js +3 -1
  140. package/src/errors/index.js.map +1 -1
  141. package/src/errors/mcp.error.d.ts +7 -0
  142. package/src/errors/mcp.error.js +11 -1
  143. package/src/errors/mcp.error.js.map +1 -1
  144. package/src/flows/flow.instance.d.ts +16 -0
  145. package/src/flows/flow.instance.js +166 -80
  146. package/src/flows/flow.instance.js.map +1 -1
  147. package/src/flows/flow.registry.d.ts +5 -0
  148. package/src/flows/flow.registry.js +45 -3
  149. package/src/flows/flow.registry.js.map +1 -1
  150. package/src/front-mcp/front-mcp.d.ts +12 -0
  151. package/src/front-mcp/front-mcp.js +22 -3
  152. package/src/front-mcp/front-mcp.js.map +1 -1
  153. package/src/front-mcp/front-mcp.providers.d.ts +266 -1
  154. package/src/front-mcp/front-mcp.providers.js +2 -1
  155. package/src/front-mcp/front-mcp.providers.js.map +1 -1
  156. package/src/front-mcp/serverless-handler.d.ts +28 -0
  157. package/src/front-mcp/serverless-handler.js +61 -0
  158. package/src/front-mcp/serverless-handler.js.map +1 -0
  159. package/src/hooks/hooks.utils.d.ts +1 -1
  160. package/src/hooks/hooks.utils.js +10 -3
  161. package/src/hooks/hooks.utils.js.map +1 -1
  162. package/src/index.d.ts +8 -4
  163. package/src/index.js +20 -1
  164. package/src/index.js.map +1 -1
  165. package/src/logger/instances/instance.logger.js +0 -1
  166. package/src/logger/instances/instance.logger.js.map +1 -1
  167. package/src/logging/flows/set-level.flow.d.ts +17 -2
  168. package/src/notification/notification.service.js +5 -1
  169. package/src/notification/notification.service.js.map +1 -1
  170. package/src/prompt/flows/get-prompt.flow.d.ts +97 -2
  171. package/src/prompt/flows/prompts-list.flow.d.ts +12 -1
  172. package/src/provider/provider.registry.d.ts +97 -5
  173. package/src/provider/provider.registry.js +306 -9
  174. package/src/provider/provider.registry.js.map +1 -1
  175. package/src/provider/provider.types.d.ts +21 -3
  176. package/src/provider/provider.types.js.map +1 -1
  177. package/src/resource/flows/read-resource.flow.d.ts +22 -3
  178. package/src/resource/flows/resource-templates-list.flow.d.ts +20 -1
  179. package/src/resource/flows/resources-list.flow.d.ts +20 -1
  180. package/src/resource/flows/subscribe-resource.flow.d.ts +17 -2
  181. package/src/resource/flows/unsubscribe-resource.flow.d.ts +17 -2
  182. package/src/scope/flows/http.request.flow.js +43 -7
  183. package/src/scope/flows/http.request.flow.js.map +1 -1
  184. package/src/scope/scope.instance.js +12 -5
  185. package/src/scope/scope.instance.js.map +1 -1
  186. package/src/server/adapters/base.host.adapter.d.ts +9 -0
  187. package/src/server/adapters/base.host.adapter.js.map +1 -1
  188. package/src/server/adapters/express.host.adapter.d.ts +12 -0
  189. package/src/server/adapters/express.host.adapter.js +21 -1
  190. package/src/server/adapters/express.host.adapter.js.map +1 -1
  191. package/src/server/server.instance.d.ts +3 -0
  192. package/src/server/server.instance.js +14 -7
  193. package/src/server/server.instance.js.map +1 -1
  194. package/src/tool/flows/call-tool.flow.d.ts +118 -13
  195. package/src/tool/flows/call-tool.flow.js +240 -194
  196. package/src/tool/flows/call-tool.flow.js.map +1 -1
  197. package/src/tool/flows/tools-list.flow.d.ts +25 -11
  198. package/src/tool/flows/tools-list.flow.js +82 -31
  199. package/src/tool/flows/tools-list.flow.js.map +1 -1
  200. package/src/tool/tool.instance.d.ts +1 -4
  201. package/src/transport/adapters/transport.streamable-http.adapter.js +1 -0
  202. package/src/transport/adapters/transport.streamable-http.adapter.js.map +1 -1
  203. package/src/transport/flows/handle.sse.flow.js +9 -2
  204. package/src/transport/flows/handle.sse.flow.js.map +1 -1
  205. package/src/transport/flows/handle.streamable-http.flow.js +63 -6
  206. package/src/transport/flows/handle.streamable-http.flow.js.map +1 -1
  207. package/src/transport/mcp-handlers/complete-request.handler.d.ts +27 -1
  208. package/src/transport/mcp-handlers/get-prompt-request.handler.d.ts +52 -1
  209. package/src/transport/mcp-handlers/index.d.ts +413 -7
  210. package/src/transport/mcp-handlers/initialize-request.handler.js +12 -2
  211. package/src/transport/mcp-handlers/initialize-request.handler.js.map +1 -1
  212. package/src/transport/mcp-handlers/list-prompts-request.handler.d.ts +27 -1
  213. package/src/transport/mcp-handlers/list-resource-templates-request.handler.d.ts +32 -1
  214. package/src/transport/mcp-handlers/list-resources-request.handler.d.ts +32 -1
  215. package/src/transport/mcp-handlers/list-tools-request.handler.d.ts +30 -1
  216. package/src/transport/mcp-handlers/logging-set-level-request.handler.d.ts +20 -0
  217. package/src/transport/mcp-handlers/read-resource-request.handler.d.ts +27 -1
  218. package/src/transport/mcp-handlers/subscribe-request.handler.d.ts +20 -0
  219. package/src/transport/mcp-handlers/unsubscribe-request.handler.d.ts +20 -0
  220. package/src/transport/transport.registry.d.ts +68 -4
  221. package/src/transport/transport.registry.js +313 -11
  222. package/src/transport/transport.registry.js.map +1 -1
  223. package/src/auth/ui/htmx-templates.js.map +0 -1
  224. package/src/common/providers/session.provider.d.ts +0 -13
  225. package/src/common/providers/session.provider.js +0 -27
  226. package/src/common/providers/session.provider.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"auth.options.js","sourceRoot":"","sources":["../../../../../src/common/types/options/auth.options.ts"],"names":[],"mappings":";AAAA,uCAAuC;;;AAyuBvC,4CAEC;AAKD,oCAEC;AAKD,8CAEC;AAKD,gDAEC;AAKD,kDAEC;AAKD,oDAEC;AAKD,gDAKC;AAtxBD,6BAAwB;AACxB,kCAA6E;AAE7E,2FAA+F;AAE/F,+CAA+C;AAC/C,iBAAiB;AACjB,+CAA+C;AAE/C;;GAEG;AACU,QAAA,wBAAwB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC/C;;;OAGG;IACH,KAAK,EAAE,OAAC,CAAC,KAAK,CAAC,CAAC,OAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IAEtE;;;OAGG;IACH,OAAO,EAAE,OAAC,CAAC,KAAK,CAAC,CAAC,OAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IAExE;;;OAGG;IACH,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;CAClC,CAAC,CAAC;AAEH;;GAEG;AACU,QAAA,wBAAwB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC/C;;;OAGG;IACH,OAAO,EAAE,gBAAS,CAAC,EAAE,CAAC,OAAC,CAA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CAAC","sourcesContent":["// common/types/options/auth.options.ts\n\nimport { z } from 'zod';\nimport { JSONWebKeySet, jsonWebKeySetSchema, JWK, jwkSchema } from '../auth';\nimport { RawZodShape } from '../common.types';\nimport { RedisConfig, redisConfigSchema } from '../../../auth/session/transport-session.types';\n\n// ============================================\n// SHARED SCHEMAS\n// ============================================\n\n/**\n * Public access configuration for tools/prompts\n */\nexport const publicAccessConfigSchema = z.object({\n /**\n * Allow all tools or explicit whitelist\n * @default 'all'\n */\n tools: z.union([z.literal('all'), z.array(z.string())]).default('all'),\n\n /**\n * Allow all prompts or explicit whitelist\n * @default 'all'\n */\n prompts: z.union([z.literal('all'), z.array(z.string())]).default('all'),\n\n /**\n * Rate limit per IP per minute\n * @default 60\n */\n rateLimit: z.number().default(60),\n});\n\n/**\n * Local signing configuration (for orchestrated local type)\n */\nexport const localSigningConfigSchema = z.object({\n /**\n * Private key for signing orchestrated tokens\n * @default auto-generated\n */\n signKey: jwkSchema.or(z.instanceof(Uint8Array)).optional(),\n\n /**\n * JWKS for token verification\n * @default auto-generated\n */\n jwks: jsonWebKeySetSchema.optional(),\n\n /**\n * Issuer identifier for orchestrated tokens\n * @default auto-derived from server URL\n */\n issuer: z.string().optional(),\n});\n\n/**\n * Remote OAuth provider configuration (for orchestrated remote and transparent)\n */\nexport const remoteProviderConfigSchema = z.object({\n /**\n * OAuth provider base URL\n * @example 'https://auth.example.com'\n */\n provider: z.string().url(),\n\n /**\n * Provider display name\n */\n name: z.string().optional(),\n\n /**\n * Unique identifier for this provider\n * @default derived from provider URL\n */\n id: z.string().optional(),\n\n /**\n * Inline JWKS for offline token verification\n * Falls back to fetching from provider's /.well-known/jwks.json\n */\n jwks: jsonWebKeySetSchema.optional(),\n\n /**\n * Custom JWKS URI if not at standard path\n */\n jwksUri: z.string().url().optional(),\n\n /**\n * Client ID for this MCP server (for orchestrated mode)\n */\n clientId: z.string().optional(),\n\n /**\n * Client secret (for confidential clients in orchestrated mode)\n */\n clientSecret: z.string().optional(),\n\n /**\n * Scopes to request from the upstream provider\n */\n scopes: z.array(z.string()).optional(),\n\n /**\n * Enable Dynamic Client Registration (DCR)\n * @default false\n */\n dcrEnabled: z.boolean().default(false),\n\n /**\n * Authorization endpoint override\n */\n authEndpoint: z.string().url().optional(),\n\n /**\n * Token endpoint override\n */\n tokenEndpoint: z.string().url().optional(),\n\n /**\n * Registration endpoint override (for DCR)\n */\n registrationEndpoint: z.string().url().optional(),\n\n /**\n * User info endpoint override\n */\n userInfoEndpoint: z.string().url().optional(),\n});\n\n/**\n * Token storage configuration for orchestrated mode\n */\nexport const tokenStorageConfigSchema = z.discriminatedUnion('type', [\n z.object({ type: z.literal('memory') }),\n z.object({ type: z.literal('redis'), config: redisConfigSchema }),\n]);\n\n/**\n * Token refresh configuration\n */\nexport const tokenRefreshConfigSchema = z.object({\n /**\n * Enable automatic token refresh\n * @default true\n */\n enabled: z.boolean().default(true),\n\n /**\n * Refresh token before expiry by this many seconds\n * @default 60\n */\n skewSeconds: z.number().default(60),\n});\n\n/**\n * Behavior when a tool from a skipped (not yet authorized) app is called\n */\nexport const skippedAppBehaviorSchema = z.enum(['anonymous', 'require-auth']);\n\n/**\n * Consent configuration for tool selection\n * Allows users to choose which MCP tools to expose to the LLM\n *\n * Note: This schema is the canonical definition. It is duplicated in\n * auth/consent/consent.types.ts for domain-specific use. Both schemas\n * MUST be kept in sync. The duplication exists to avoid circular\n * dependencies between common/ and auth/ modules.\n */\nexport const consentConfigSchema = z.object({\n /**\n * Enable consent flow for tool selection\n * When enabled, users can choose which tools to expose to the LLM\n * @default false\n */\n enabled: z.boolean().default(false),\n\n /**\n * Group tools by app in the consent UI\n * @default true\n */\n groupByApp: z.boolean().default(true),\n\n /**\n * Show tool descriptions in consent UI\n * @default true\n */\n showDescriptions: z.boolean().default(true),\n\n /**\n * Allow selecting all tools at once\n * @default true\n */\n allowSelectAll: z.boolean().default(true),\n\n /**\n * Require at least one tool to be selected\n * @default true\n */\n requireSelection: z.boolean().default(true),\n\n /**\n * Custom message to display on consent page\n */\n customMessage: z.string().optional(),\n\n /**\n * Remember consent for future sessions\n * @default true\n */\n rememberConsent: z.boolean().default(true),\n\n /**\n * Tools to exclude from consent (always available)\n * Useful for essential tools that should always be accessible\n */\n excludedTools: z.array(z.string()).optional(),\n\n /**\n * Tools to always include in consent (pre-selected)\n */\n defaultSelectedTools: z.array(z.string()).optional(),\n});\n\n/**\n * Progressive/Incremental authorization configuration\n * Allows users to authorize apps one at a time after initial auth\n */\nexport const incrementalAuthConfigSchema = z.object({\n /**\n * Enable incremental (progressive) authorization\n * When enabled, users can skip app authorizations during initial auth\n * and authorize individual apps later when needed\n * @default true\n */\n enabled: z.boolean().default(true),\n\n /**\n * Behavior when a tool from a skipped app is called\n * - 'anonymous': If app supports anonymous access, use it; otherwise require auth\n * - 'require-auth': Always require authorization (return auth_url)\n * @default 'anonymous'\n */\n skippedAppBehavior: skippedAppBehaviorSchema.default('anonymous'),\n\n /**\n * Allow users to skip app authorization during initial auth flow\n * @default true\n */\n allowSkip: z.boolean().default(true),\n\n /**\n * Show all apps in a single authorization page (vs step-by-step)\n * @default true\n */\n showAllAppsAtOnce: z.boolean().default(true),\n});\n\n// ============================================\n// TRANSPORT CONFIG\n// Protocol enablement and behavior settings\n// ============================================\n\n/**\n * Transport protocol configuration\n * Controls which transport protocols are enabled and their behavior\n */\nexport const transportConfigSchema = z.object({\n /**\n * Enable legacy SSE transport (old HTTP+SSE protocol)\n * @default false\n */\n enableLegacySSE: z.boolean().default(false),\n\n /**\n * Enable SSE listener for server-initiated messages (GET /mcp with Accept: text/event-stream)\n * @default true\n */\n enableSseListener: z.boolean().default(true),\n\n /**\n * Enable streamable HTTP transport (POST with SSE response)\n * @default true\n */\n enableStreamableHttp: z.boolean().default(true),\n\n /**\n * Enable stateless HTTP mode (requests without session ID)\n * When enabled, allows requests without prior initialize\n * Uses shared singleton transport for anonymous, per-token singleton for authenticated\n * @default false\n */\n enableStatelessHttp: z.boolean().default(false),\n\n /**\n * Enable stateful HTTP transport (JSON-only responses)\n * @default false\n */\n enableStatefulHttp: z.boolean().default(false),\n\n /**\n * Require session ID for streamable HTTP (non-stateless mode)\n * When false, streamable HTTP requests don't require prior initialize\n * @default true\n */\n requireSessionForStreamable: z.boolean().default(true),\n});\n\n// ============================================\n// PUBLIC MODE\n// No authentication required, anonymous access\n// ============================================\n\nexport const publicAuthOptionsSchema = z.object({\n mode: z.literal('public'),\n\n /**\n * Issuer identifier for anonymous JWTs\n * @default auto-derived from server URL\n */\n issuer: z.string().optional(),\n\n /**\n * Anonymous session TTL in seconds\n * @default 3600 (1 hour)\n */\n sessionTtl: z.number().default(3600),\n\n /**\n * Scopes granted to anonymous sessions\n * @default ['anonymous']\n */\n anonymousScopes: z.array(z.string()).default(['anonymous']),\n\n /**\n * Tool/prompt access configuration for anonymous users\n */\n publicAccess: publicAccessConfigSchema.optional(),\n\n /**\n * JWKS for token verification\n * @default auto-generated\n */\n jwks: jsonWebKeySetSchema.optional(),\n\n /**\n * Private key for signing anonymous tokens\n * @default auto-generated\n */\n signKey: jwkSchema.or(z.instanceof(Uint8Array)).optional(),\n\n /**\n * Transport protocol configuration\n * Controls which transports are enabled and their behavior\n */\n transport: transportConfigSchema.optional(),\n});\n\n// ============================================\n// TRANSPARENT MODE\n// Pass-through OAuth tokens from remote provider\n// ============================================\n\nexport const transparentAuthOptionsSchema = z.object({\n mode: z.literal('transparent'),\n\n /**\n * Remote OAuth provider configuration (required)\n */\n remote: remoteProviderConfigSchema,\n\n /**\n * Expected token audience\n * If not set, defaults to the resource URL\n */\n expectedAudience: z.union([z.string(), z.array(z.string())]).optional(),\n\n /**\n * Required scopes for access\n * Empty array means any valid token is accepted\n * @default []\n */\n requiredScopes: z.array(z.string()).default([]),\n\n /**\n * Allow anonymous fallback when no token is provided\n * @default false\n */\n allowAnonymous: z.boolean().default(false),\n\n /**\n * Scopes granted to anonymous sessions (when allowAnonymous=true)\n * @default ['anonymous']\n */\n anonymousScopes: z.array(z.string()).default(['anonymous']),\n\n /**\n * Public access config for anonymous users (when allowAnonymous=true)\n */\n publicAccess: publicAccessConfigSchema.optional(),\n\n /**\n * Transport protocol configuration\n * Controls which transports are enabled and their behavior\n */\n transport: transportConfigSchema.optional(),\n});\n\n// ============================================\n// ORCHESTRATED MODE\n// Local auth server that can proxy to remote or be fully local\n// ============================================\n\n/**\n * Orchestrated mode with local authentication only\n */\nexport const orchestratedLocalSchema = z.object({\n mode: z.literal('orchestrated'),\n type: z.literal('local'),\n\n /**\n * Local signing configuration\n */\n local: localSigningConfigSchema.optional(),\n\n /**\n * Token storage configuration\n * @default { type: 'memory' }\n */\n tokenStorage: tokenStorageConfigSchema.default({ type: 'memory' }),\n\n /**\n * Session storage mode\n * - 'stateful': Store sessions in Redis/memory, JWT contains only reference\n * - 'stateless': All state encrypted in JWT\n * @default 'stateful'\n */\n sessionMode: z.enum(['stateful', 'stateless']).default('stateful'),\n\n /**\n * Allow default public access for unauthenticated requests\n * When true: all tools are public by default, only tools marked with scopes require auth\n * When false: all tools require authentication by default\n * @default false\n */\n allowDefaultPublic: z.boolean().default(false),\n\n /**\n * Scopes granted to anonymous sessions (when allowDefaultPublic=true)\n * @default ['anonymous']\n */\n anonymousScopes: z.array(z.string()).default(['anonymous']),\n\n /**\n * Public access config (when allowDefaultPublic=true)\n */\n publicAccess: publicAccessConfigSchema.optional(),\n\n /**\n * Consent flow configuration for tool selection\n * Allows users to choose which MCP tools to expose to the LLM\n * @default { enabled: false }\n */\n consent: consentConfigSchema.optional(),\n\n /**\n * Token refresh settings\n */\n refresh: tokenRefreshConfigSchema.optional(),\n\n /**\n * Expected token audience for validation\n */\n expectedAudience: z.union([z.string(), z.array(z.string())]).optional(),\n\n /**\n * Incremental (progressive) authorization configuration\n * Allows users to skip app authorizations initially and authorize later\n * @default { enabled: true, skippedAppBehavior: 'anonymous' }\n */\n incrementalAuth: incrementalAuthConfigSchema.optional(),\n\n /**\n * Transport protocol configuration\n * Controls which transports are enabled and their behavior\n */\n transport: transportConfigSchema.optional(),\n});\n\n/**\n * Orchestrated mode with remote OAuth provider\n */\nexport const orchestratedRemoteSchema = z.object({\n mode: z.literal('orchestrated'),\n type: z.literal('remote'),\n\n /**\n * Remote OAuth provider configuration (required for remote type)\n */\n remote: remoteProviderConfigSchema,\n\n /**\n * Local signing configuration (for issuing local tokens after upstream auth)\n */\n local: localSigningConfigSchema.optional(),\n\n /**\n * Token storage configuration\n * @default { type: 'memory' }\n */\n tokenStorage: tokenStorageConfigSchema.default({ type: 'memory' }),\n\n /**\n * Session storage mode\n * - 'stateful': Store sessions in Redis/memory, JWT contains only reference\n * - 'stateless': All state encrypted in JWT\n * @default 'stateful'\n */\n sessionMode: z.enum(['stateful', 'stateless']).default('stateful'),\n\n /**\n * Allow default public access for unauthenticated requests\n * When true: all tools are public by default, only tools marked with scopes require auth\n * When false: all tools require authentication by default\n * @default false\n */\n allowDefaultPublic: z.boolean().default(false),\n\n /**\n * Scopes granted to anonymous sessions (when allowDefaultPublic=true)\n * @default ['anonymous']\n */\n anonymousScopes: z.array(z.string()).default(['anonymous']),\n\n /**\n * Public access config (when allowDefaultPublic=true)\n */\n publicAccess: publicAccessConfigSchema.optional(),\n\n /**\n * Consent flow configuration for tool selection\n * Allows users to choose which MCP tools to expose to the LLM\n * @default { enabled: false }\n */\n consent: consentConfigSchema.optional(),\n\n /**\n * Token refresh settings\n */\n refresh: tokenRefreshConfigSchema.optional(),\n\n /**\n * Expected token audience for validation\n */\n expectedAudience: z.union([z.string(), z.array(z.string())]).optional(),\n\n /**\n * Incremental (progressive) authorization configuration\n * Allows users to skip app authorizations initially and authorize later\n * @default { enabled: true, skippedAppBehavior: 'anonymous' }\n */\n incrementalAuth: incrementalAuthConfigSchema.optional(),\n\n /**\n * Transport protocol configuration\n * Controls which transports are enabled and their behavior\n */\n transport: transportConfigSchema.optional(),\n});\n\n// Combined orchestrated schema\nexport const orchestratedAuthOptionsSchema = z.discriminatedUnion('type', [\n orchestratedLocalSchema,\n orchestratedRemoteSchema,\n]);\n\n// ============================================\n// UNIFIED AUTH OPTIONS\n// ============================================\n\n/**\n * Main auth options schema - discriminated by 'mode'\n *\n * Uses z.union because we have nested discriminators (orchestrated has 'type')\n */\nexport const authOptionsSchema = z.union([\n publicAuthOptionsSchema,\n transparentAuthOptionsSchema,\n orchestratedLocalSchema,\n orchestratedRemoteSchema,\n]);\n\n// ============================================\n// TYPE EXPORTS\n// ============================================\n\n/**\n * Public access configuration\n */\nexport type PublicAccessConfig = z.infer<typeof publicAccessConfigSchema>;\nexport type PublicAccessConfigInput = z.input<typeof publicAccessConfigSchema>;\n\n/**\n * Local signing configuration\n */\nexport type LocalSigningConfig = z.infer<typeof localSigningConfigSchema>;\nexport type LocalSigningConfigInput = z.input<typeof localSigningConfigSchema>;\n\n/**\n * Remote provider configuration\n */\nexport type RemoteProviderConfig = z.infer<typeof remoteProviderConfigSchema>;\nexport type RemoteProviderConfigInput = z.input<typeof remoteProviderConfigSchema>;\n\n/**\n * Token storage configuration\n */\nexport type TokenStorageConfig = z.infer<typeof tokenStorageConfigSchema>;\nexport type TokenStorageConfigInput = z.input<typeof tokenStorageConfigSchema>;\n\n/**\n * Token refresh configuration\n */\nexport type TokenRefreshConfig = z.infer<typeof tokenRefreshConfigSchema>;\nexport type TokenRefreshConfigInput = z.input<typeof tokenRefreshConfigSchema>;\n\n/**\n * Incremental (progressive) authorization configuration\n */\nexport type IncrementalAuthConfig = z.infer<typeof incrementalAuthConfigSchema>;\nexport type IncrementalAuthConfigInput = z.input<typeof incrementalAuthConfigSchema>;\n\n/**\n * Skipped app behavior type\n */\nexport type SkippedAppBehavior = z.infer<typeof skippedAppBehaviorSchema>;\n\n/**\n * Consent configuration for tool selection\n */\nexport type ConsentConfig = z.infer<typeof consentConfigSchema>;\nexport type ConsentConfigInput = z.input<typeof consentConfigSchema>;\n\n/**\n * Transport protocol configuration\n */\nexport type TransportConfig = z.infer<typeof transportConfigSchema>;\nexport type TransportConfigInput = z.input<typeof transportConfigSchema>;\n\n/**\n * Public mode options (output type with defaults applied)\n */\nexport type PublicAuthOptions = z.infer<typeof publicAuthOptionsSchema>;\nexport type PublicAuthOptionsInput = z.input<typeof publicAuthOptionsSchema>;\n\n/**\n * Transparent mode options (output type with defaults applied)\n */\nexport type TransparentAuthOptions = z.infer<typeof transparentAuthOptionsSchema>;\nexport type TransparentAuthOptionsInput = z.input<typeof transparentAuthOptionsSchema>;\n\n/**\n * Orchestrated local mode options\n */\nexport type OrchestratedLocalOptions = z.infer<typeof orchestratedLocalSchema>;\nexport type OrchestratedLocalOptionsInput = z.input<typeof orchestratedLocalSchema>;\n\n/**\n * Orchestrated remote mode options\n */\nexport type OrchestratedRemoteOptions = z.infer<typeof orchestratedRemoteSchema>;\nexport type OrchestratedRemoteOptionsInput = z.input<typeof orchestratedRemoteSchema>;\n\n/**\n * Orchestrated mode options (union of local and remote)\n */\nexport type OrchestratedAuthOptions = z.infer<typeof orchestratedAuthOptionsSchema>;\nexport type OrchestratedAuthOptionsInput = z.input<typeof orchestratedAuthOptionsSchema>;\n\n/**\n * Auth options (output type with defaults applied)\n * Use this type when working with parsed/validated options\n */\nexport type AuthOptions = z.infer<typeof authOptionsSchema>;\n\n/**\n * Auth options input (input type for user configuration)\n * Use this type for the @frontmcp configuration\n */\nexport type AuthOptionsInput = z.input<typeof authOptionsSchema>;\n\n/**\n * Authentication mode\n */\nexport type AuthMode = 'public' | 'transparent' | 'orchestrated';\n\n/**\n * Orchestrated type (local or remote)\n */\nexport type OrchestratedType = 'local' | 'remote';\n\n// ============================================\n// APP-LEVEL AUTH OPTIONS (with standalone)\n// ============================================\n\ntype StandaloneOption = {\n /**\n * If the provider is standalone, it will register an OAuth service provider\n * on app's entry path. If not standalone, it will be registered as a child\n * provider under the root provider.\n * @default false\n */\n standalone?: boolean;\n\n /**\n * If the provider should be excluded from the parent provider's discovery.\n * Used for standalone providers.\n * @default false\n */\n excludeFromParent?: boolean;\n};\n\nconst standaloneOptionSchema = {\n standalone: z.boolean().optional(),\n excludeFromParent: z.boolean().optional(),\n} satisfies RawZodShape<StandaloneOption>;\n\nexport const appAuthOptionsSchema = z.union([\n publicAuthOptionsSchema.extend(standaloneOptionSchema),\n transparentAuthOptionsSchema.extend(standaloneOptionSchema),\n orchestratedLocalSchema.extend(standaloneOptionSchema),\n orchestratedRemoteSchema.extend(standaloneOptionSchema),\n]);\n\nexport type AppAuthOptions = z.infer<typeof appAuthOptionsSchema>;\nexport type AppAuthOptionsInput = z.input<typeof appAuthOptionsSchema>;\n\n// ============================================\n// HELPER FUNCTIONS\n// ============================================\n\n/**\n * Parse and validate auth options with defaults\n */\nexport function parseAuthOptions(input: AuthOptionsInput): AuthOptions {\n return authOptionsSchema.parse(input);\n}\n\n/**\n * Check if options are public mode\n */\nexport function isPublicMode(options: AuthOptions | AuthOptionsInput): options is PublicAuthOptions {\n return options.mode === 'public';\n}\n\n/**\n * Check if options are transparent mode\n */\nexport function isTransparentMode(options: AuthOptions | AuthOptionsInput): options is TransparentAuthOptions {\n return options.mode === 'transparent';\n}\n\n/**\n * Check if options are orchestrated mode\n */\nexport function isOrchestratedMode(options: AuthOptions | AuthOptionsInput): options is OrchestratedAuthOptions {\n return options.mode === 'orchestrated';\n}\n\n/**\n * Check if orchestrated options are local type\n */\nexport function isOrchestratedLocal(options: OrchestratedAuthOptions): options is OrchestratedLocalOptions {\n return options.type === 'local';\n}\n\n/**\n * Check if orchestrated options are remote type\n */\nexport function isOrchestratedRemote(options: OrchestratedAuthOptions): options is OrchestratedRemoteOptions {\n return options.type === 'remote';\n}\n\n/**\n * Check if options allow public/anonymous access\n */\nexport function allowsPublicAccess(options: AuthOptions): boolean {\n if (options.mode === 'public') return true;\n if (options.mode === 'transparent') return options.allowAnonymous;\n if (options.mode === 'orchestrated') return options.allowDefaultPublic;\n return false;\n}\n"]}
1
+ {"version":3,"file":"auth.options.js","sourceRoot":"","sources":["../../../../../src/common/types/options/auth.options.ts"],"names":[],"mappings":";AAAA,uCAAuC;;;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;IACrD,IAAI,OAAO,CAAC,IAAI,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC3C,IAAI,OAAO,CAAC,IAAI,KAAK,aAAa;QAAE,OAAO,OAAO,CAAC,cAAc,CAAC;IAClE,IAAI,OAAO,CAAC,IAAI,KAAK,cAAc;QAAE,OAAO,OAAO,CAAC,kBAAkB,CAAC;IACvE,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// common/types/options/auth.options.ts\n\nimport { z } from 'zod';\nimport { JSONWebKeySet, jsonWebKeySetSchema, JWK, jwkSchema } from '../auth';\nimport { RawZodShape } from '../common.types';\nimport { RedisConfig, redisConfigSchema } from '../../../auth/session/transport-session.types';\n\n// ============================================\n// SHARED SCHEMAS\n// ============================================\n\n/**\n * Public access configuration for tools/prompts\n */\nexport const publicAccessConfigSchema = z.object({\n /**\n * Allow all tools or explicit whitelist\n * @default 'all'\n */\n tools: z.union([z.literal('all'), z.array(z.string())]).default('all'),\n\n /**\n * Allow all prompts or explicit whitelist\n * @default 'all'\n */\n prompts: z.union([z.literal('all'), z.array(z.string())]).default('all'),\n\n /**\n * Rate limit per IP per minute\n * @default 60\n */\n rateLimit: z.number().default(60),\n});\n\n/**\n * Local signing configuration (for orchestrated local type)\n */\nexport const localSigningConfigSchema = z.object({\n /**\n * Private key for signing orchestrated tokens\n * @default auto-generated\n */\n signKey: jwkSchema.or(z.instanceof(Uint8Array)).optional(),\n\n /**\n * JWKS for token verification\n * @default auto-generated\n */\n jwks: jsonWebKeySetSchema.optional(),\n\n /**\n * Issuer identifier for orchestrated tokens\n * @default auto-derived from server URL\n */\n issuer: z.string().optional(),\n});\n\n/**\n * Remote OAuth provider configuration (for orchestrated remote and transparent)\n */\nexport const remoteProviderConfigSchema = z.object({\n /**\n * OAuth provider base URL\n * @example 'https://auth.example.com'\n */\n provider: z.string().url(),\n\n /**\n * Provider display name\n */\n name: z.string().optional(),\n\n /**\n * Unique identifier for this provider\n * @default derived from provider URL\n */\n id: z.string().optional(),\n\n /**\n * Inline JWKS for offline token verification\n * Falls back to fetching from provider's /.well-known/jwks.json\n */\n jwks: jsonWebKeySetSchema.optional(),\n\n /**\n * Custom JWKS URI if not at standard path\n */\n jwksUri: z.string().url().optional(),\n\n /**\n * Client ID for this MCP server (for orchestrated mode)\n */\n clientId: z.string().optional(),\n\n /**\n * Client secret (for confidential clients in orchestrated mode)\n */\n clientSecret: z.string().optional(),\n\n /**\n * Scopes to request from the upstream provider\n */\n scopes: z.array(z.string()).optional(),\n\n /**\n * Enable Dynamic Client Registration (DCR)\n * @default false\n */\n dcrEnabled: z.boolean().default(false),\n\n /**\n * Authorization endpoint override\n */\n authEndpoint: z.string().url().optional(),\n\n /**\n * Token endpoint override\n */\n tokenEndpoint: z.string().url().optional(),\n\n /**\n * Registration endpoint override (for DCR)\n */\n registrationEndpoint: z.string().url().optional(),\n\n /**\n * User info endpoint override\n */\n userInfoEndpoint: z.string().url().optional(),\n});\n\n/**\n * Token storage configuration for orchestrated mode\n */\nexport const tokenStorageConfigSchema = z.discriminatedUnion('type', [\n z.object({ type: z.literal('memory') }),\n z.object({ type: z.literal('redis'), config: redisConfigSchema }),\n]);\n\n/**\n * Token refresh configuration\n */\nexport const tokenRefreshConfigSchema = z.object({\n /**\n * Enable automatic token refresh\n * @default true\n */\n enabled: z.boolean().default(true),\n\n /**\n * Refresh token before expiry by this many seconds\n * @default 60\n */\n skewSeconds: z.number().default(60),\n});\n\n/**\n * Behavior when a tool from a skipped (not yet authorized) app is called\n */\nexport const skippedAppBehaviorSchema = z.enum(['anonymous', 'require-auth']);\n\n/**\n * Consent configuration for tool selection\n * Allows users to choose which MCP tools to expose to the LLM\n *\n * Note: This schema is the canonical definition. It is duplicated in\n * auth/consent/consent.types.ts for domain-specific use. Both schemas\n * MUST be kept in sync. The duplication exists to avoid circular\n * dependencies between common/ and auth/ modules.\n */\nexport const consentConfigSchema = z.object({\n /**\n * Enable consent flow for tool selection\n * When enabled, users can choose which tools to expose to the LLM\n * @default false\n */\n enabled: z.boolean().default(false),\n\n /**\n * Group tools by app in the consent UI\n * @default true\n */\n groupByApp: z.boolean().default(true),\n\n /**\n * Show tool descriptions in consent UI\n * @default true\n */\n showDescriptions: z.boolean().default(true),\n\n /**\n * Allow selecting all tools at once\n * @default true\n */\n allowSelectAll: z.boolean().default(true),\n\n /**\n * Require at least one tool to be selected\n * @default true\n */\n requireSelection: z.boolean().default(true),\n\n /**\n * Custom message to display on consent page\n */\n customMessage: z.string().optional(),\n\n /**\n * Remember consent for future sessions\n * @default true\n */\n rememberConsent: z.boolean().default(true),\n\n /**\n * Tools to exclude from consent (always available)\n * Useful for essential tools that should always be accessible\n */\n excludedTools: z.array(z.string()).optional(),\n\n /**\n * Tools to always include in consent (pre-selected)\n */\n defaultSelectedTools: z.array(z.string()).optional(),\n});\n\n/**\n * Progressive/Incremental authorization configuration\n * Allows users to authorize apps one at a time after initial auth\n */\nexport const incrementalAuthConfigSchema = z.object({\n /**\n * Enable incremental (progressive) authorization\n * When enabled, users can skip app authorizations during initial auth\n * and authorize individual apps later when needed\n * @default true\n */\n enabled: z.boolean().default(true),\n\n /**\n * Behavior when a tool from a skipped app is called\n * - 'anonymous': If app supports anonymous access, use it; otherwise require auth\n * - 'require-auth': Always require authorization (return auth_url)\n * @default 'anonymous'\n */\n skippedAppBehavior: skippedAppBehaviorSchema.default('anonymous'),\n\n /**\n * Allow users to skip app authorization during initial auth flow\n * @default true\n */\n allowSkip: z.boolean().default(true),\n\n /**\n * Show all apps in a single authorization page (vs step-by-step)\n * @default true\n */\n showAllAppsAtOnce: z.boolean().default(true),\n});\n\n// ============================================\n// TRANSPORT CONFIG (DEPRECATED)\n// These schemas are kept for backward compatibility during migration.\n// Use top-level transport config instead.\n// DELETE after v1.0.0\n// ============================================\n\n/**\n * @deprecated Use top-level transport config instead. This will be removed in v1.0.0.\n */\nexport const transportRecreationConfigSchema = z\n .object({\n enabled: z.boolean().default(false),\n redis: redisConfigSchema.optional(),\n defaultTtlMs: z.number().int().positive().default(3600000),\n })\n .refine(\n (data) => {\n if (data.enabled && !data.redis) {\n return false;\n }\n return true;\n },\n {\n message: 'Redis configuration is required when transport recreation is enabled',\n path: ['redis'],\n },\n );\n\n/**\n * @deprecated Use top-level transport config instead. This will be removed in v1.0.0.\n */\nexport const transportConfigSchema = z.object({\n enableLegacySSE: z.boolean().default(false),\n enableSseListener: z.boolean().default(true),\n enableStreamableHttp: z.boolean().default(true),\n enableStatelessHttp: z.boolean().default(false),\n enableStatefulHttp: z.boolean().default(false),\n requireSessionForStreamable: z.boolean().default(true),\n recreation: z.lazy(() => transportRecreationConfigSchema).optional(),\n});\n\n// ============================================\n// PUBLIC MODE\n// No authentication required, anonymous access\n// ============================================\n\nexport const publicAuthOptionsSchema = z.object({\n mode: z.literal('public'),\n\n /**\n * Issuer identifier for anonymous JWTs\n * @default auto-derived from server URL\n */\n issuer: z.string().optional(),\n\n /**\n * Anonymous session TTL in seconds\n * @default 3600 (1 hour)\n */\n sessionTtl: z.number().default(3600),\n\n /**\n * Scopes granted to anonymous sessions\n * @default ['anonymous']\n */\n anonymousScopes: z.array(z.string()).default(['anonymous']),\n\n /**\n * Tool/prompt access configuration for anonymous users\n */\n publicAccess: publicAccessConfigSchema.optional(),\n\n /**\n * JWKS for token verification\n * @default auto-generated\n */\n jwks: jsonWebKeySetSchema.optional(),\n\n /**\n * Private key for signing anonymous tokens\n * @default auto-generated\n */\n signKey: jwkSchema.or(z.instanceof(Uint8Array)).optional(),\n\n /**\n * @deprecated Use top-level transport config instead. Kept for backward compatibility.\n */\n transport: transportConfigSchema.optional(),\n});\n\n// ============================================\n// TRANSPARENT MODE\n// Pass-through OAuth tokens from remote provider\n// ============================================\n\nexport const transparentAuthOptionsSchema = z.object({\n mode: z.literal('transparent'),\n\n /**\n * Remote OAuth provider configuration (required)\n */\n remote: remoteProviderConfigSchema,\n\n /**\n * Expected token audience\n * If not set, defaults to the resource URL\n */\n expectedAudience: z.union([z.string(), z.array(z.string())]).optional(),\n\n /**\n * Required scopes for access\n * Empty array means any valid token is accepted\n * @default []\n */\n requiredScopes: z.array(z.string()).default([]),\n\n /**\n * Allow anonymous fallback when no token is provided\n * @default false\n */\n allowAnonymous: z.boolean().default(false),\n\n /**\n * Scopes granted to anonymous sessions (when allowAnonymous=true)\n * @default ['anonymous']\n */\n anonymousScopes: z.array(z.string()).default(['anonymous']),\n\n /**\n * Public access config for anonymous users (when allowAnonymous=true)\n */\n publicAccess: publicAccessConfigSchema.optional(),\n\n /**\n * @deprecated Use top-level transport config instead. Kept for backward compatibility.\n */\n transport: transportConfigSchema.optional(),\n});\n\n// ============================================\n// ORCHESTRATED MODE\n// Local auth server that can proxy to remote or be fully local\n// ============================================\n\n/**\n * Orchestrated mode with local authentication only\n */\nexport const orchestratedLocalSchema = z.object({\n mode: z.literal('orchestrated'),\n type: z.literal('local'),\n\n /**\n * Local signing configuration\n */\n local: localSigningConfigSchema.optional(),\n\n /**\n * Token storage configuration\n * @default { type: 'memory' }\n */\n tokenStorage: tokenStorageConfigSchema.default({ type: 'memory' }),\n\n /**\n * Session storage mode\n * - 'stateful': Store sessions in Redis/memory, JWT contains only reference\n * - 'stateless': All state encrypted in JWT\n * @default 'stateful'\n */\n sessionMode: z.enum(['stateful', 'stateless']).default('stateful'),\n\n /**\n * Allow default public access for unauthenticated requests\n * When true: all tools are public by default, only tools marked with scopes require auth\n * When false: all tools require authentication by default\n * @default false\n */\n allowDefaultPublic: z.boolean().default(false),\n\n /**\n * Scopes granted to anonymous sessions (when allowDefaultPublic=true)\n * @default ['anonymous']\n */\n anonymousScopes: z.array(z.string()).default(['anonymous']),\n\n /**\n * Public access config (when allowDefaultPublic=true)\n */\n publicAccess: publicAccessConfigSchema.optional(),\n\n /**\n * Consent flow configuration for tool selection\n * Allows users to choose which MCP tools to expose to the LLM\n * @default { enabled: false }\n */\n consent: consentConfigSchema.optional(),\n\n /**\n * Token refresh settings\n */\n refresh: tokenRefreshConfigSchema.optional(),\n\n /**\n * Expected token audience for validation\n */\n expectedAudience: z.union([z.string(), z.array(z.string())]).optional(),\n\n /**\n * Incremental (progressive) authorization configuration\n * Allows users to skip app authorizations initially and authorize later\n * @default { enabled: true, skippedAppBehavior: 'anonymous' }\n */\n incrementalAuth: incrementalAuthConfigSchema.optional(),\n\n /**\n * @deprecated Use top-level transport config instead. Kept for backward compatibility.\n */\n transport: transportConfigSchema.optional(),\n});\n\n/**\n * Orchestrated mode with remote OAuth provider\n */\nexport const orchestratedRemoteSchema = z.object({\n mode: z.literal('orchestrated'),\n type: z.literal('remote'),\n\n /**\n * Remote OAuth provider configuration (required for remote type)\n */\n remote: remoteProviderConfigSchema,\n\n /**\n * Local signing configuration (for issuing local tokens after upstream auth)\n */\n local: localSigningConfigSchema.optional(),\n\n /**\n * Token storage configuration\n * @default { type: 'memory' }\n */\n tokenStorage: tokenStorageConfigSchema.default({ type: 'memory' }),\n\n /**\n * Session storage mode\n * - 'stateful': Store sessions in Redis/memory, JWT contains only reference\n * - 'stateless': All state encrypted in JWT\n * @default 'stateful'\n */\n sessionMode: z.enum(['stateful', 'stateless']).default('stateful'),\n\n /**\n * Allow default public access for unauthenticated requests\n * When true: all tools are public by default, only tools marked with scopes require auth\n * When false: all tools require authentication by default\n * @default false\n */\n allowDefaultPublic: z.boolean().default(false),\n\n /**\n * Scopes granted to anonymous sessions (when allowDefaultPublic=true)\n * @default ['anonymous']\n */\n anonymousScopes: z.array(z.string()).default(['anonymous']),\n\n /**\n * Public access config (when allowDefaultPublic=true)\n */\n publicAccess: publicAccessConfigSchema.optional(),\n\n /**\n * Consent flow configuration for tool selection\n * Allows users to choose which MCP tools to expose to the LLM\n * @default { enabled: false }\n */\n consent: consentConfigSchema.optional(),\n\n /**\n * Token refresh settings\n */\n refresh: tokenRefreshConfigSchema.optional(),\n\n /**\n * Expected token audience for validation\n */\n expectedAudience: z.union([z.string(), z.array(z.string())]).optional(),\n\n /**\n * Incremental (progressive) authorization configuration\n * Allows users to skip app authorizations initially and authorize later\n * @default { enabled: true, skippedAppBehavior: 'anonymous' }\n */\n incrementalAuth: incrementalAuthConfigSchema.optional(),\n\n /**\n * @deprecated Use top-level transport config instead. Kept for backward compatibility.\n */\n transport: transportConfigSchema.optional(),\n});\n\n// Combined orchestrated schema\nexport const orchestratedAuthOptionsSchema = z.discriminatedUnion('type', [\n orchestratedLocalSchema,\n orchestratedRemoteSchema,\n]);\n\n// ============================================\n// UNIFIED AUTH OPTIONS\n// ============================================\n\n/**\n * Main auth options schema - discriminated by 'mode'\n *\n * Uses z.union because we have nested discriminators (orchestrated has 'type')\n */\nexport const authOptionsSchema = z.union([\n publicAuthOptionsSchema,\n transparentAuthOptionsSchema,\n orchestratedLocalSchema,\n orchestratedRemoteSchema,\n]);\n\n// ============================================\n// TYPE EXPORTS\n// ============================================\n\n/**\n * Public access configuration\n */\nexport type PublicAccessConfig = z.infer<typeof publicAccessConfigSchema>;\nexport type PublicAccessConfigInput = z.input<typeof publicAccessConfigSchema>;\n\n/**\n * Local signing configuration\n */\nexport type LocalSigningConfig = z.infer<typeof localSigningConfigSchema>;\nexport type LocalSigningConfigInput = z.input<typeof localSigningConfigSchema>;\n\n/**\n * Remote provider configuration\n */\nexport type RemoteProviderConfig = z.infer<typeof remoteProviderConfigSchema>;\nexport type RemoteProviderConfigInput = z.input<typeof remoteProviderConfigSchema>;\n\n/**\n * Token storage configuration\n */\nexport type TokenStorageConfig = z.infer<typeof tokenStorageConfigSchema>;\nexport type TokenStorageConfigInput = z.input<typeof tokenStorageConfigSchema>;\n\n/**\n * Token refresh configuration\n */\nexport type TokenRefreshConfig = z.infer<typeof tokenRefreshConfigSchema>;\nexport type TokenRefreshConfigInput = z.input<typeof tokenRefreshConfigSchema>;\n\n/**\n * Incremental (progressive) authorization configuration\n */\nexport type IncrementalAuthConfig = z.infer<typeof incrementalAuthConfigSchema>;\nexport type IncrementalAuthConfigInput = z.input<typeof incrementalAuthConfigSchema>;\n\n/**\n * Skipped app behavior type\n */\nexport type SkippedAppBehavior = z.infer<typeof skippedAppBehaviorSchema>;\n\n/**\n * Consent configuration for tool selection\n */\nexport type ConsentConfig = z.infer<typeof consentConfigSchema>;\nexport type ConsentConfigInput = z.input<typeof consentConfigSchema>;\n\n/**\n * @deprecated Use TransportOptions from transport.options.ts instead\n */\nexport type TransportConfig = z.infer<typeof transportConfigSchema>;\n/**\n * @deprecated Use TransportOptionsInput from transport.options.ts instead\n */\nexport type TransportConfigInput = z.input<typeof transportConfigSchema>;\n\n/**\n * @deprecated Use TransportPersistenceConfig from transport.options.ts instead\n */\nexport type TransportRecreationConfig = z.infer<typeof transportRecreationConfigSchema>;\n/**\n * @deprecated Use TransportPersistenceConfigInput from transport.options.ts instead\n */\nexport type TransportRecreationConfigInput = z.input<typeof transportRecreationConfigSchema>;\n\n/**\n * Public mode options (output type with defaults applied)\n */\nexport type PublicAuthOptions = z.infer<typeof publicAuthOptionsSchema>;\nexport type PublicAuthOptionsInput = z.input<typeof publicAuthOptionsSchema>;\n\n/**\n * Transparent mode options (output type with defaults applied)\n */\nexport type TransparentAuthOptions = z.infer<typeof transparentAuthOptionsSchema>;\nexport type TransparentAuthOptionsInput = z.input<typeof transparentAuthOptionsSchema>;\n\n/**\n * Orchestrated local mode options\n */\nexport type OrchestratedLocalOptions = z.infer<typeof orchestratedLocalSchema>;\nexport type OrchestratedLocalOptionsInput = z.input<typeof orchestratedLocalSchema>;\n\n/**\n * Orchestrated remote mode options\n */\nexport type OrchestratedRemoteOptions = z.infer<typeof orchestratedRemoteSchema>;\nexport type OrchestratedRemoteOptionsInput = z.input<typeof orchestratedRemoteSchema>;\n\n/**\n * Orchestrated mode options (union of local and remote)\n */\nexport type OrchestratedAuthOptions = z.infer<typeof orchestratedAuthOptionsSchema>;\nexport type OrchestratedAuthOptionsInput = z.input<typeof orchestratedAuthOptionsSchema>;\n\n/**\n * Auth options (output type with defaults applied)\n * Use this type when working with parsed/validated options\n */\nexport type AuthOptions = z.infer<typeof authOptionsSchema>;\n\n/**\n * Auth options input (input type for user configuration)\n * Use this type for the @frontmcp configuration\n */\nexport type AuthOptionsInput = z.input<typeof authOptionsSchema>;\n\n/**\n * Authentication mode\n */\nexport type AuthMode = 'public' | 'transparent' | 'orchestrated';\n\n/**\n * Orchestrated type (local or remote)\n */\nexport type OrchestratedType = 'local' | 'remote';\n\n// ============================================\n// APP-LEVEL AUTH OPTIONS (with standalone)\n// ============================================\n\ntype StandaloneOption = {\n /**\n * If the provider is standalone, it will register an OAuth service provider\n * on app's entry path. If not standalone, it will be registered as a child\n * provider under the root provider.\n * @default false\n */\n standalone?: boolean;\n\n /**\n * If the provider should be excluded from the parent provider's discovery.\n * Used for standalone providers.\n * @default false\n */\n excludeFromParent?: boolean;\n};\n\nconst standaloneOptionSchema = {\n standalone: z.boolean().optional(),\n excludeFromParent: z.boolean().optional(),\n} satisfies RawZodShape<StandaloneOption>;\n\nexport const appAuthOptionsSchema = z.union([\n publicAuthOptionsSchema.extend(standaloneOptionSchema),\n transparentAuthOptionsSchema.extend(standaloneOptionSchema),\n orchestratedLocalSchema.extend(standaloneOptionSchema),\n orchestratedRemoteSchema.extend(standaloneOptionSchema),\n]);\n\nexport type AppAuthOptions = z.infer<typeof appAuthOptionsSchema>;\nexport type AppAuthOptionsInput = z.input<typeof appAuthOptionsSchema>;\n\n// ============================================\n// HELPER FUNCTIONS\n// ============================================\n\n/**\n * Parse and validate auth options with defaults\n */\nexport function parseAuthOptions(input: AuthOptionsInput): AuthOptions {\n return authOptionsSchema.parse(input);\n}\n\n/**\n * Check if options are public mode\n */\nexport function isPublicMode(options: AuthOptions | AuthOptionsInput): options is PublicAuthOptions {\n return options.mode === 'public';\n}\n\n/**\n * Check if options are transparent mode\n */\nexport function isTransparentMode(options: AuthOptions | AuthOptionsInput): options is TransparentAuthOptions {\n return options.mode === 'transparent';\n}\n\n/**\n * Check if options are orchestrated mode\n */\nexport function isOrchestratedMode(options: AuthOptions | AuthOptionsInput): options is OrchestratedAuthOptions {\n return options.mode === 'orchestrated';\n}\n\n/**\n * Check if orchestrated options are local type\n */\nexport function isOrchestratedLocal(options: OrchestratedAuthOptions): options is OrchestratedLocalOptions {\n return options.type === 'local';\n}\n\n/**\n * Check if orchestrated options are remote type\n */\nexport function isOrchestratedRemote(options: OrchestratedAuthOptions): options is OrchestratedRemoteOptions {\n return options.type === 'remote';\n}\n\n/**\n * Check if options allow public/anonymous access\n */\nexport function allowsPublicAccess(options: AuthOptions): boolean {\n if (options.mode === 'public') return true;\n if (options.mode === 'transparent') return options.allowAnonymous;\n if (options.mode === 'orchestrated') return options.allowDefaultPublic;\n return false;\n}\n"]}
@@ -3,3 +3,5 @@ export * from './session.options';
3
3
  export * from './http.options';
4
4
  export * from './auth.options';
5
5
  export * from './logging.options';
6
+ export * from './redis.options';
7
+ export * from './transport.options';
@@ -6,4 +6,6 @@ tslib_1.__exportStar(require("./session.options"), exports);
6
6
  tslib_1.__exportStar(require("./http.options"), exports);
7
7
  tslib_1.__exportStar(require("./auth.options"), exports);
8
8
  tslib_1.__exportStar(require("./logging.options"), exports);
9
+ tslib_1.__exportStar(require("./redis.options"), exports);
10
+ tslib_1.__exportStar(require("./transport.options"), exports);
9
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/common/types/options/index.ts"],"names":[],"mappings":";;;AAAA,gEAAsC;AACtC,4DAAkC;AAClC,yDAA+B;AAC/B,yDAA+B;AAC/B,4DAAkC","sourcesContent":["export * from './server-info.options';\nexport * from './session.options';\nexport * from './http.options';\nexport * from './auth.options';\nexport * from './logging.options';\n\n\n\n\n\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/common/types/options/index.ts"],"names":[],"mappings":";;;AAAA,gEAAsC;AACtC,4DAAkC;AAClC,yDAA+B;AAC/B,yDAA+B;AAC/B,4DAAkC;AAClC,0DAAgC;AAChC,8DAAoC","sourcesContent":["export * from './server-info.options';\nexport * from './session.options';\nexport * from './http.options';\nexport * from './auth.options';\nexport * from './logging.options';\nexport * from './redis.options';\nexport * from './transport.options';\n"]}
@@ -0,0 +1,22 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Shared Redis configuration
4
+ * Used by transport persistence and auth token storage
5
+ */
6
+ export declare const redisOptionsSchema: z.ZodObject<{
7
+ host: z.ZodString;
8
+ port: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
9
+ password: z.ZodOptional<z.ZodString>;
10
+ db: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
11
+ tls: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
12
+ keyPrefix: z.ZodDefault<z.ZodOptional<z.ZodString>>;
13
+ defaultTtlMs: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
14
+ }, z.core.$strip>;
15
+ /**
16
+ * Redis configuration type (with defaults applied)
17
+ */
18
+ export type RedisOptions = z.infer<typeof redisOptionsSchema>;
19
+ /**
20
+ * Redis configuration input type (for user configuration)
21
+ */
22
+ export type RedisOptionsInput = z.input<typeof redisOptionsSchema>;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ // common/types/options/redis.options.ts
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.redisOptionsSchema = void 0;
5
+ const zod_1 = require("zod");
6
+ /**
7
+ * Shared Redis configuration
8
+ * Used by transport persistence and auth token storage
9
+ */
10
+ exports.redisOptionsSchema = zod_1.z.object({
11
+ /**
12
+ * Redis host
13
+ */
14
+ host: zod_1.z.string().trim().min(1),
15
+ /**
16
+ * Redis port
17
+ * @default 6379
18
+ */
19
+ port: zod_1.z.number().int().positive().max(65535).optional().default(6379),
20
+ /**
21
+ * Redis password (optional)
22
+ */
23
+ password: zod_1.z.string().optional(),
24
+ /**
25
+ * Redis database number
26
+ * @default 0
27
+ */
28
+ db: zod_1.z.number().int().nonnegative().optional().default(0),
29
+ /**
30
+ * Enable TLS connection
31
+ * @default false
32
+ */
33
+ tls: zod_1.z.boolean().optional().default(false),
34
+ /**
35
+ * Key prefix for all Redis keys
36
+ * @default 'mcp:'
37
+ */
38
+ keyPrefix: zod_1.z.string().optional().default('mcp:'),
39
+ /**
40
+ * Default TTL in milliseconds for stored data
41
+ * @default 3600000 (1 hour)
42
+ */
43
+ defaultTtlMs: zod_1.z.number().int().positive().optional().default(3600000),
44
+ });
45
+ //# sourceMappingURL=redis.options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redis.options.js","sourceRoot":"","sources":["../../../../../src/common/types/options/redis.options.ts"],"names":[],"mappings":";AAAA,wCAAwC;;;AAExC,6BAAwB;AAExB;;;GAGG;AACU,QAAA,kBAAkB,GAAG,OAAC,CAAC,MAAM,CAAC;IACzC;;OAEG;IACH,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAE9B;;;OAGG;IACH,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IAErE;;OAEG;IACH,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAE/B;;;OAGG;IACH,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAExD;;;OAGG;IACH,GAAG,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IAE1C;;;OAGG;IACH,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;IAEhD;;;OAGG;IACH,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;CACtE,CAAC,CAAC","sourcesContent":["// common/types/options/redis.options.ts\n\nimport { z } from 'zod';\n\n/**\n * Shared Redis configuration\n * Used by transport persistence and auth token storage\n */\nexport const redisOptionsSchema = z.object({\n /**\n * Redis host\n */\n host: z.string().trim().min(1),\n\n /**\n * Redis port\n * @default 6379\n */\n port: z.number().int().positive().max(65535).optional().default(6379),\n\n /**\n * Redis password (optional)\n */\n password: z.string().optional(),\n\n /**\n * Redis database number\n * @default 0\n */\n db: z.number().int().nonnegative().optional().default(0),\n\n /**\n * Enable TLS connection\n * @default false\n */\n tls: z.boolean().optional().default(false),\n\n /**\n * Key prefix for all Redis keys\n * @default 'mcp:'\n */\n keyPrefix: z.string().optional().default('mcp:'),\n\n /**\n * Default TTL in milliseconds for stored data\n * @default 3600000 (1 hour)\n */\n defaultTtlMs: z.number().int().positive().optional().default(3600000),\n});\n\n/**\n * Redis configuration type (with defaults applied)\n */\nexport type RedisOptions = z.infer<typeof redisOptionsSchema>;\n\n/**\n * Redis configuration input type (for user configuration)\n */\nexport type RedisOptionsInput = z.input<typeof redisOptionsSchema>;\n"]}
@@ -0,0 +1,84 @@
1
+ import { z } from 'zod';
2
+ import { SessionMode, TransportIdMode, PlatformMappingEntry, PlatformDetectionConfig, platformDetectionConfigSchema } from './session.options';
3
+ export type { SessionMode, TransportIdMode, PlatformMappingEntry, PlatformDetectionConfig };
4
+ /**
5
+ * Transport persistence configuration
6
+ * Enables session persistence to Redis and automatic transport recreation after server restart
7
+ */
8
+ export declare const transportPersistenceConfigSchema: z.ZodObject<{
9
+ enabled: z.ZodDefault<z.ZodBoolean>;
10
+ redis: z.ZodOptional<z.ZodObject<{
11
+ host: z.ZodString;
12
+ port: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
13
+ password: z.ZodOptional<z.ZodString>;
14
+ db: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
15
+ tls: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
16
+ keyPrefix: z.ZodDefault<z.ZodOptional<z.ZodString>>;
17
+ defaultTtlMs: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
18
+ }, z.core.$strip>>;
19
+ defaultTtlMs: z.ZodDefault<z.ZodNumber>;
20
+ }, z.core.$strip>;
21
+ /**
22
+ * Transport options schema
23
+ * Consolidates transport protocol config + session lifecycle config
24
+ */
25
+ export declare const transportOptionsSchema: z.ZodObject<{
26
+ sessionMode: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"stateful">, z.ZodLiteral<"stateless">, z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>]>>>;
27
+ transportIdMode: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"uuid">, z.ZodLiteral<"jwt">, z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>]>>>;
28
+ platformDetection: z.ZodOptional<z.ZodObject<{
29
+ mappings: z.ZodOptional<z.ZodArray<z.ZodObject<{
30
+ pattern: z.ZodUnion<readonly [z.ZodString, z.ZodCustom<RegExp, RegExp>]>;
31
+ platform: z.ZodEnum<{
32
+ unknown: "unknown";
33
+ continue: "continue";
34
+ openai: "openai";
35
+ claude: "claude";
36
+ gemini: "gemini";
37
+ cursor: "cursor";
38
+ cody: "cody";
39
+ "generic-mcp": "generic-mcp";
40
+ "ext-apps": "ext-apps";
41
+ }>;
42
+ }, z.core.$strip>>>;
43
+ customOnly: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
44
+ }, z.core.$strip>>;
45
+ enableLegacySSE: z.ZodDefault<z.ZodBoolean>;
46
+ enableSseListener: z.ZodDefault<z.ZodBoolean>;
47
+ enableStreamableHttp: z.ZodDefault<z.ZodBoolean>;
48
+ enableStatelessHttp: z.ZodDefault<z.ZodBoolean>;
49
+ enableStatefulHttp: z.ZodDefault<z.ZodBoolean>;
50
+ requireSessionForStreamable: z.ZodDefault<z.ZodBoolean>;
51
+ persistence: z.ZodOptional<z.ZodObject<{
52
+ enabled: z.ZodDefault<z.ZodBoolean>;
53
+ redis: z.ZodOptional<z.ZodObject<{
54
+ host: z.ZodString;
55
+ port: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
56
+ password: z.ZodOptional<z.ZodString>;
57
+ db: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
58
+ tls: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
59
+ keyPrefix: z.ZodDefault<z.ZodOptional<z.ZodString>>;
60
+ defaultTtlMs: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
61
+ }, z.core.$strip>>;
62
+ defaultTtlMs: z.ZodDefault<z.ZodNumber>;
63
+ }, z.core.$strip>>;
64
+ }, z.core.$strip>;
65
+ /**
66
+ * Transport options type (with defaults applied)
67
+ */
68
+ export type TransportOptions = z.infer<typeof transportOptionsSchema>;
69
+ /**
70
+ * Transport options input type (for user configuration)
71
+ */
72
+ export type TransportOptionsInput = z.input<typeof transportOptionsSchema>;
73
+ /**
74
+ * Transport persistence configuration type
75
+ */
76
+ export type TransportPersistenceConfig = z.infer<typeof transportPersistenceConfigSchema>;
77
+ /**
78
+ * Transport persistence configuration input type
79
+ */
80
+ export type TransportPersistenceConfigInput = z.input<typeof transportPersistenceConfigSchema>;
81
+ /**
82
+ * Platform detection configuration type
83
+ */
84
+ export type PlatformDetectionConfigType = z.infer<typeof platformDetectionConfigSchema>;
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ // common/types/options/transport.options.ts
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.transportOptionsSchema = exports.transportPersistenceConfigSchema = void 0;
5
+ const zod_1 = require("zod");
6
+ const redis_options_1 = require("./redis.options");
7
+ const session_options_1 = require("./session.options");
8
+ // ============================================
9
+ // TRANSPORT PERSISTENCE (from auth.transport.recreation)
10
+ // ============================================
11
+ /**
12
+ * Transport persistence configuration
13
+ * Enables session persistence to Redis and automatic transport recreation after server restart
14
+ */
15
+ exports.transportPersistenceConfigSchema = zod_1.z.object({
16
+ /**
17
+ * Enable transport persistence to Redis
18
+ * When enabled, sessions are persisted to Redis and transports can be recreated after restart
19
+ * @default false
20
+ */
21
+ enabled: zod_1.z.boolean().default(false),
22
+ /**
23
+ * Redis configuration for session storage
24
+ * If omitted when enabled=true, uses top-level redis config
25
+ * Note: Validation for redis presence happens at runtime when persistence is used
26
+ */
27
+ redis: redis_options_1.redisOptionsSchema.optional(),
28
+ /**
29
+ * Default TTL for stored session metadata (milliseconds)
30
+ * @default 3600000 (1 hour)
31
+ */
32
+ defaultTtlMs: zod_1.z.number().int().positive().default(3600000),
33
+ });
34
+ // ============================================
35
+ // TRANSPORT OPTIONS (unified config)
36
+ // ============================================
37
+ /**
38
+ * Transport options schema
39
+ * Consolidates transport protocol config + session lifecycle config
40
+ */
41
+ exports.transportOptionsSchema = zod_1.z.object({
42
+ // ============================================
43
+ // Session Lifecycle (from session.options.ts)
44
+ // ============================================
45
+ /**
46
+ * Defines how the session lifecycle and nested tokens are managed.
47
+ *
48
+ * Modes:
49
+ * - `'stateful'`: Session and nested tokens are stored in a server-side store (e.g., Redis).
50
+ * - `'stateless'`: All session data (including nested tokens) is embedded within a signed/encrypted JWT.
51
+ *
52
+ * @default 'stateful'
53
+ */
54
+ sessionMode: zod_1.z
55
+ .union([zod_1.z.literal('stateful'), zod_1.z.literal('stateless'), zod_1.z.function()])
56
+ .optional()
57
+ .default('stateful'),
58
+ /**
59
+ * Defines how the Transport ID is generated, verified, and used across sessions.
60
+ *
61
+ * Modes:
62
+ * - `'uuid'`: Generates a random UUID per session.
63
+ * - `'jwt'`: Uses a signed JWT for stateless sessions, signed with a generated session key.
64
+ *
65
+ * @default 'uuid'
66
+ */
67
+ transportIdMode: zod_1.z
68
+ .union([zod_1.z.literal('uuid'), zod_1.z.literal('jwt'), zod_1.z.function()])
69
+ .optional()
70
+ .default('uuid'),
71
+ /**
72
+ * Configuration for detecting the AI platform from MCP client info.
73
+ * Allows custom mappings to override or supplement the default keyword-based detection.
74
+ */
75
+ platformDetection: session_options_1.platformDetectionConfigSchema.optional(),
76
+ // ============================================
77
+ // Transport Protocols (from auth.transport)
78
+ // ============================================
79
+ /**
80
+ * Enable legacy SSE transport (old HTTP+SSE protocol)
81
+ * @default false
82
+ */
83
+ enableLegacySSE: zod_1.z.boolean().default(false),
84
+ /**
85
+ * Enable SSE listener for server-initiated messages (GET /mcp with Accept: text/event-stream)
86
+ * @default true
87
+ */
88
+ enableSseListener: zod_1.z.boolean().default(true),
89
+ /**
90
+ * Enable streamable HTTP transport (POST with SSE response)
91
+ * @default true
92
+ */
93
+ enableStreamableHttp: zod_1.z.boolean().default(true),
94
+ /**
95
+ * Enable stateless HTTP mode (requests without session ID)
96
+ * When enabled, allows requests without prior initialize
97
+ * Uses shared singleton transport for anonymous, per-token singleton for authenticated
98
+ * @default false
99
+ */
100
+ enableStatelessHttp: zod_1.z.boolean().default(false),
101
+ /**
102
+ * Enable stateful HTTP transport (JSON-only responses)
103
+ * @default false
104
+ */
105
+ enableStatefulHttp: zod_1.z.boolean().default(false),
106
+ /**
107
+ * Require session ID for streamable HTTP (non-stateless mode)
108
+ * When false, streamable HTTP requests don't require prior initialize
109
+ * @default true
110
+ */
111
+ requireSessionForStreamable: zod_1.z.boolean().default(true),
112
+ // ============================================
113
+ // Transport Persistence
114
+ // ============================================
115
+ /**
116
+ * Transport persistence configuration
117
+ * When enabled, sessions are persisted to Redis and transports can be recreated after server restart
118
+ */
119
+ persistence: exports.transportPersistenceConfigSchema.optional(),
120
+ });
121
+ //# sourceMappingURL=transport.options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport.options.js","sourceRoot":"","sources":["../../../../../src/common/types/options/transport.options.ts"],"names":[],"mappings":";AAAA,4CAA4C;;;AAE5C,6BAAwB;AACxB,mDAAqD;AACrD,uDAO2B;AAK3B,+CAA+C;AAC/C,yDAAyD;AACzD,+CAA+C;AAE/C;;;GAGG;AACU,QAAA,gCAAgC,G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AC;IAE5C;;;OAGG;IACH,oBAAoB,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IAE/C;;;;;OAKG;IACH,mBAAmB,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IAE/C;;;OAGG;IACH,kBAAkB,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IAE9C;;;;OAIG;IACH,2BAA2B,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IAEtD,+CAA+C;IAC/C,wBAAwB;IACxB,+CAA+C;IAE/C;;;OAGG;IACH,WAAW,EAAE,wCAAgC,CAAC,QAAQ,EAAE;CACzD,CAAC,CAAC","sourcesContent":["// common/types/options/transport.options.ts\n\nimport { z } from 'zod';\nimport { redisOptionsSchema } from './redis.options';\nimport {\n SessionMode,\n TransportIdMode,\n PlatformMappingEntry,\n PlatformDetectionConfig,\n platformMappingEntrySchema,\n platformDetectionConfigSchema,\n} from './session.options';\n\n// Re-export session types for convenience (these are the canonical definitions)\nexport type { SessionMode, TransportIdMode, PlatformMappingEntry, PlatformDetectionConfig };\n\n// ============================================\n// TRANSPORT PERSISTENCE (from auth.transport.recreation)\n// ============================================\n\n/**\n * Transport persistence configuration\n * Enables session persistence to Redis and automatic transport recreation after server restart\n */\nexport const transportPersistenceConfigSchema = z.object({\n /**\n * Enable transport persistence to Redis\n * When enabled, sessions are persisted to Redis and transports can be recreated after restart\n * @default false\n */\n enabled: z.boolean().default(false),\n\n /**\n * Redis configuration for session storage\n * If omitted when enabled=true, uses top-level redis config\n * Note: Validation for redis presence happens at runtime when persistence is used\n */\n redis: redisOptionsSchema.optional(),\n\n /**\n * Default TTL for stored session metadata (milliseconds)\n * @default 3600000 (1 hour)\n */\n defaultTtlMs: z.number().int().positive().default(3600000),\n});\n\n// ============================================\n// TRANSPORT OPTIONS (unified config)\n// ============================================\n\n/**\n * Transport options schema\n * Consolidates transport protocol config + session lifecycle config\n */\nexport const transportOptionsSchema = z.object({\n // ============================================\n // Session Lifecycle (from session.options.ts)\n // ============================================\n\n /**\n * Defines how the session lifecycle and nested tokens are managed.\n *\n * Modes:\n * - `'stateful'`: Session and nested tokens are stored in a server-side store (e.g., Redis).\n * - `'stateless'`: All session data (including nested tokens) is embedded within a signed/encrypted JWT.\n *\n * @default 'stateful'\n */\n sessionMode: z\n .union([z.literal('stateful'), z.literal('stateless'), z.function()])\n .optional()\n .default('stateful'),\n\n /**\n * Defines how the Transport ID is generated, verified, and used across sessions.\n *\n * Modes:\n * - `'uuid'`: Generates a random UUID per session.\n * - `'jwt'`: Uses a signed JWT for stateless sessions, signed with a generated session key.\n *\n * @default 'uuid'\n */\n transportIdMode: z\n .union([z.literal('uuid'), z.literal('jwt'), z.function()])\n .optional()\n .default('uuid'),\n\n /**\n * Configuration for detecting the AI platform from MCP client info.\n * Allows custom mappings to override or supplement the default keyword-based detection.\n */\n platformDetection: platformDetectionConfigSchema.optional(),\n\n // ============================================\n // Transport Protocols (from auth.transport)\n // ============================================\n\n /**\n * Enable legacy SSE transport (old HTTP+SSE protocol)\n * @default false\n */\n enableLegacySSE: z.boolean().default(false),\n\n /**\n * Enable SSE listener for server-initiated messages (GET /mcp with Accept: text/event-stream)\n * @default true\n */\n enableSseListener: z.boolean().default(true),\n\n /**\n * Enable streamable HTTP transport (POST with SSE response)\n * @default true\n */\n enableStreamableHttp: z.boolean().default(true),\n\n /**\n * Enable stateless HTTP mode (requests without session ID)\n * When enabled, allows requests without prior initialize\n * Uses shared singleton transport for anonymous, per-token singleton for authenticated\n * @default false\n */\n enableStatelessHttp: z.boolean().default(false),\n\n /**\n * Enable stateful HTTP transport (JSON-only responses)\n * @default false\n */\n enableStatefulHttp: z.boolean().default(false),\n\n /**\n * Require session ID for streamable HTTP (non-stateless mode)\n * When false, streamable HTTP requests don't require prior initialize\n * @default true\n */\n requireSessionForStreamable: z.boolean().default(true),\n\n // ============================================\n // Transport Persistence\n // ============================================\n\n /**\n * Transport persistence configuration\n * When enabled, sessions are persisted to Redis and transports can be recreated after server restart\n */\n persistence: transportPersistenceConfigSchema.optional(),\n});\n\n// ============================================\n// TYPE EXPORTS\n// ============================================\n\n/**\n * Transport options type (with defaults applied)\n */\nexport type TransportOptions = z.infer<typeof transportOptionsSchema>;\n\n/**\n * Transport options input type (for user configuration)\n */\nexport type TransportOptionsInput = z.input<typeof transportOptionsSchema>;\n\n/**\n * Transport persistence configuration type\n */\nexport type TransportPersistenceConfig = z.infer<typeof transportPersistenceConfigSchema>;\n\n/**\n * Transport persistence configuration input type\n */\nexport type TransportPersistenceConfigInput = z.input<typeof transportPersistenceConfigSchema>;\n\n/**\n * Platform detection configuration type\n */\nexport type PlatformDetectionConfigType = z.infer<typeof platformDetectionConfigSchema>;\n"]}
@@ -4,8 +4,15 @@ declare const inputSchema: z.ZodObject<{
4
4
  request: z.ZodObject<{
5
5
  method: z.ZodLiteral<"completion/complete">;
6
6
  params: z.ZodObject<{
7
+ task: z.ZodOptional<z.ZodObject<{
8
+ ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>>;
9
+ pollInterval: z.ZodOptional<z.ZodNumber>;
10
+ }, z.core.$loose>>;
7
11
  _meta: z.ZodOptional<z.ZodObject<{
8
12
  progressToken: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
13
+ "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{
14
+ taskId: z.ZodString;
15
+ }, z.core.$loose>>;
9
16
  }, z.core.$loose>>;
10
17
  ref: z.ZodUnion<readonly [z.ZodObject<{
11
18
  type: z.ZodLiteral<"ref/prompt">;
@@ -26,7 +33,11 @@ declare const inputSchema: z.ZodObject<{
26
33
  ctx: z.ZodUnknown;
27
34
  }, z.core.$strip>;
28
35
  declare const outputSchema: z.ZodObject<{
29
- _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
36
+ _meta: z.ZodOptional<z.ZodObject<{
37
+ "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{
38
+ taskId: z.ZodString;
39
+ }, z.core.$loose>>;
40
+ }, z.core.$loose>>;
30
41
  completion: z.ZodObject<{
31
42
  values: z.ZodArray<z.ZodString>;
32
43
  total: z.ZodOptional<z.ZodNumber>;
@@ -46,7 +57,11 @@ declare const stateSchema: z.ZodObject<{
46
57
  value: z.ZodString;
47
58
  }, z.core.$strip>;
48
59
  output: z.ZodObject<{
49
- _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
60
+ _meta: z.ZodOptional<z.ZodObject<{
61
+ "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{
62
+ taskId: z.ZodString;
63
+ }, z.core.$loose>>;
64
+ }, z.core.$loose>>;
50
65
  completion: z.ZodObject<{
51
66
  values: z.ZodArray<z.ZodString>;
52
67
  total: z.ZodOptional<z.ZodNumber>;
@@ -0,0 +1,94 @@
1
+ /**
2
+ * FrontMcpContextStorage - AsyncLocalStorage wrapper for unified context
3
+ *
4
+ * Provides concurrent-safe context propagation using Node.js AsyncLocalStorage.
5
+ * Access through DI only - never use static imports to access the storage directly.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * // In a flow or middleware
10
+ * const storage = this.get(FrontMcpContextStorage);
11
+ * await storage.runFromHeaders(request.headers, {
12
+ * sessionId: sessionId,
13
+ * scopeId: scope.id,
14
+ * }, async () => {
15
+ * // All code here can access the context via DI
16
+ * const ctx = this.get(FRONTMCP_CONTEXT);
17
+ * });
18
+ * ```
19
+ */
20
+ import { FrontMcpContext, FrontMcpContextArgs } from './frontmcp-context';
21
+ import { AuthInfo } from '@modelcontextprotocol/sdk/server/auth/types.js';
22
+ /**
23
+ * FrontMcpContextStorage provides unified context via AsyncLocalStorage.
24
+ *
25
+ * This is a GLOBAL-scoped provider because it manages the storage itself,
26
+ * not the per-context data. The actual FrontMcpContext is accessed via
27
+ * the FRONTMCP_CONTEXT token which is CONTEXT-scoped.
28
+ */
29
+ export declare class FrontMcpContextStorage {
30
+ /**
31
+ * Run a callback with a new FrontMcpContext.
32
+ *
33
+ * @param args - Arguments to create the context
34
+ * @param fn - Async function to run with the context
35
+ * @returns Result of the callback
36
+ */
37
+ run<T>(args: FrontMcpContextArgs, fn: () => T | Promise<T>): T | Promise<T>;
38
+ /**
39
+ * Run with context extracted from HTTP headers.
40
+ *
41
+ * Automatically parses trace context from headers using W3C Trace Context
42
+ * specification with fallback to x-frontmcp-trace-id.
43
+ *
44
+ * @param headers - HTTP headers
45
+ * @param args - Additional context args (sessionId, scopeId)
46
+ * @param fn - Async function to run
47
+ * @returns Result of the callback
48
+ */
49
+ runFromHeaders<T>(headers: Record<string, unknown>, args: Omit<FrontMcpContextArgs, 'traceContext' | 'metadata'>, fn: () => T | Promise<T>): T | Promise<T>;
50
+ /**
51
+ * Run with an existing FrontMcpContext.
52
+ *
53
+ * Useful when you need to propagate an existing context to a new async scope.
54
+ *
55
+ * @param context - Existing FrontMcpContext
56
+ * @param fn - Async function to run
57
+ * @returns Result of the callback
58
+ */
59
+ runWithContext<T>(context: FrontMcpContext, fn: () => T | Promise<T>): T | Promise<T>;
60
+ /**
61
+ * Get the current FrontMcpContext.
62
+ *
63
+ * @returns Current context or undefined if not in a context scope
64
+ */
65
+ getStore(): FrontMcpContext | undefined;
66
+ /**
67
+ * Get the current FrontMcpContext, throwing if not available.
68
+ *
69
+ * @throws Error if not in a context scope
70
+ */
71
+ getStoreOrThrow(): FrontMcpContext;
72
+ /**
73
+ * Check if currently running within a context.
74
+ *
75
+ * @returns True if a FrontMcpContext is available
76
+ */
77
+ hasContext(): boolean;
78
+ /**
79
+ * Update the authInfo in the current context.
80
+ *
81
+ * This mutates the existing context in place to preserve internal state
82
+ * (marks, store, sessionMetadata) while updating auth info.
83
+ *
84
+ * @param authInfo - Auth info fields to set/update (merged with existing)
85
+ * @param fn - Function to run after update
86
+ * @returns Result of the callback
87
+ */
88
+ updateAuthInfo<T>(authInfo: Partial<AuthInfo>, fn: () => T | Promise<T>): T | Promise<T>;
89
+ }
90
+ /**
91
+ * Alias for backward compatibility.
92
+ * @deprecated Use FrontMcpContextStorage instead
93
+ */
94
+ export { FrontMcpContextStorage as ContextStorage };