@frontmcp/sdk 0.5.1 → 0.6.1

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 (265) hide show
  1. package/README.md +1 -0
  2. package/package.json +12 -16
  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 +2 -0
  28. package/src/auth/session/index.js +5 -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/session/vercel-kv-session.store.d.ts +96 -0
  50. package/src/auth/session/vercel-kv-session.store.js +216 -0
  51. package/src/auth/session/vercel-kv-session.store.js.map +1 -0
  52. package/src/auth/ui/base-layout.d.ts +0 -8
  53. package/src/auth/ui/base-layout.js +1 -14
  54. package/src/auth/ui/base-layout.js.map +1 -1
  55. package/src/auth/ui/index.d.ts +3 -4
  56. package/src/auth/ui/index.js +10 -11
  57. package/src/auth/ui/index.js.map +1 -1
  58. package/src/auth/ui/{htmx-templates.d.ts → templates.d.ts} +5 -6
  59. package/src/auth/ui/{htmx-templates.js → templates.js} +8 -15
  60. package/src/auth/ui/templates.js.map +1 -0
  61. package/src/common/decorators/decorator-utils.js.map +1 -1
  62. package/src/common/decorators/front-mcp.decorator.js +26 -3
  63. package/src/common/decorators/front-mcp.decorator.js.map +1 -1
  64. package/src/common/index.d.ts +0 -1
  65. package/src/common/index.js +0 -1
  66. package/src/common/index.js.map +1 -1
  67. package/src/common/interfaces/adapter.interface.d.ts +6 -0
  68. package/src/common/interfaces/adapter.interface.js.map +1 -1
  69. package/src/common/interfaces/execution-context.interface.d.ts +52 -3
  70. package/src/common/interfaces/execution-context.interface.js +88 -3
  71. package/src/common/interfaces/execution-context.interface.js.map +1 -1
  72. package/src/common/interfaces/flow.interface.d.ts +13 -0
  73. package/src/common/interfaces/flow.interface.js +24 -0
  74. package/src/common/interfaces/flow.interface.js.map +1 -1
  75. package/src/common/interfaces/server.interface.d.ts +9 -0
  76. package/src/common/interfaces/server.interface.js.map +1 -1
  77. package/src/common/metadata/app.metadata.d.ts +108 -0
  78. package/src/common/metadata/front-mcp.metadata.d.ts +1341 -2
  79. package/src/common/metadata/front-mcp.metadata.js +4 -1
  80. package/src/common/metadata/front-mcp.metadata.js.map +1 -1
  81. package/src/common/metadata/prompt.metadata.d.ts +4 -0
  82. package/src/common/metadata/provider.metadata.d.ts +14 -0
  83. package/src/common/metadata/provider.metadata.js +18 -2
  84. package/src/common/metadata/provider.metadata.js.map +1 -1
  85. package/src/common/metadata/resource.metadata.d.ts +8 -0
  86. package/src/common/metadata/tool-ui.metadata.d.ts +2 -2
  87. package/src/common/metadata/tool-ui.metadata.js +1 -1
  88. package/src/common/metadata/tool-ui.metadata.js.map +1 -1
  89. package/src/common/metadata/tool.metadata.d.ts +5 -1
  90. package/src/common/metadata/tool.metadata.js.map +1 -1
  91. package/src/common/migrate/auth-transport.migrate.d.ts +62 -0
  92. package/src/common/migrate/auth-transport.migrate.js +140 -0
  93. package/src/common/migrate/auth-transport.migrate.js.map +1 -0
  94. package/src/common/migrate/index.d.ts +1 -0
  95. package/src/common/migrate/index.js +6 -0
  96. package/src/common/migrate/index.js.map +1 -0
  97. package/src/common/schemas/http-output.schema.d.ts +24 -6
  98. package/src/common/schemas/index.d.ts +1 -0
  99. package/src/common/schemas/index.js +1 -0
  100. package/src/common/schemas/index.js.map +1 -1
  101. package/src/common/schemas/session-header.schema.d.ts +16 -0
  102. package/src/common/schemas/session-header.schema.js +42 -0
  103. package/src/common/schemas/session-header.schema.js.map +1 -0
  104. package/src/common/tokens/front-mcp.tokens.js +4 -1
  105. package/src/common/tokens/front-mcp.tokens.js.map +1 -1
  106. package/src/common/types/options/auth.options.d.ts +233 -3
  107. package/src/common/types/options/auth.options.js +29 -40
  108. package/src/common/types/options/auth.options.js.map +1 -1
  109. package/src/common/types/options/index.d.ts +2 -0
  110. package/src/common/types/options/index.js +2 -0
  111. package/src/common/types/options/index.js.map +1 -1
  112. package/src/common/types/options/redis.options.d.ts +190 -0
  113. package/src/common/types/options/redis.options.js +191 -0
  114. package/src/common/types/options/redis.options.js.map +1 -0
  115. package/src/common/types/options/server-info.options.d.ts +4 -0
  116. package/src/common/types/options/transport.options.d.ts +148 -0
  117. package/src/common/types/options/transport.options.js +121 -0
  118. package/src/common/types/options/transport.options.js.map +1 -0
  119. package/src/common/utils/global-config.utils.d.ts +36 -0
  120. package/src/common/utils/global-config.utils.js +44 -0
  121. package/src/common/utils/global-config.utils.js.map +1 -0
  122. package/src/common/utils/index.d.ts +1 -0
  123. package/src/common/utils/index.js +1 -0
  124. package/src/common/utils/index.js.map +1 -1
  125. package/src/completion/flows/complete.flow.d.ts +6 -8
  126. package/src/context/frontmcp-context-storage.d.ts +94 -0
  127. package/src/context/frontmcp-context-storage.js +183 -0
  128. package/src/context/frontmcp-context-storage.js.map +1 -0
  129. package/src/context/frontmcp-context.d.ts +269 -0
  130. package/src/context/frontmcp-context.js +360 -0
  131. package/src/context/frontmcp-context.js.map +1 -0
  132. package/src/context/frontmcp-context.provider.d.ts +43 -0
  133. package/src/context/frontmcp-context.provider.js +61 -0
  134. package/src/context/frontmcp-context.provider.js.map +1 -0
  135. package/src/context/index.d.ts +34 -0
  136. package/src/context/index.js +64 -0
  137. package/src/context/index.js.map +1 -0
  138. package/src/context/request-context-storage.d.ts +89 -0
  139. package/src/context/request-context-storage.js +183 -0
  140. package/src/context/request-context-storage.js.map +1 -0
  141. package/src/context/request-context.d.ts +184 -0
  142. package/src/context/request-context.js +209 -0
  143. package/src/context/request-context.js.map +1 -0
  144. package/src/context/request-context.provider.d.ts +37 -0
  145. package/src/context/request-context.provider.js +51 -0
  146. package/src/context/request-context.provider.js.map +1 -0
  147. package/src/context/session-key.provider.d.ts +45 -0
  148. package/src/context/session-key.provider.js +65 -0
  149. package/src/context/session-key.provider.js.map +1 -0
  150. package/src/context/trace-context.d.ts +43 -0
  151. package/src/context/trace-context.js +142 -0
  152. package/src/context/trace-context.js.map +1 -0
  153. package/src/errors/index.d.ts +1 -1
  154. package/src/errors/index.js +4 -1
  155. package/src/errors/index.js.map +1 -1
  156. package/src/errors/mcp.error.d.ts +16 -0
  157. package/src/errors/mcp.error.js +29 -1
  158. package/src/errors/mcp.error.js.map +1 -1
  159. package/src/flows/flow.instance.d.ts +16 -0
  160. package/src/flows/flow.instance.js +166 -80
  161. package/src/flows/flow.instance.js.map +1 -1
  162. package/src/flows/flow.registry.d.ts +5 -0
  163. package/src/flows/flow.registry.js +45 -3
  164. package/src/flows/flow.registry.js.map +1 -1
  165. package/src/front-mcp/front-mcp.d.ts +12 -0
  166. package/src/front-mcp/front-mcp.js +22 -3
  167. package/src/front-mcp/front-mcp.js.map +1 -1
  168. package/src/front-mcp/front-mcp.providers.d.ts +474 -1
  169. package/src/front-mcp/front-mcp.providers.js +2 -1
  170. package/src/front-mcp/front-mcp.providers.js.map +1 -1
  171. package/src/front-mcp/index.d.ts +1 -0
  172. package/src/front-mcp/index.js +3 -0
  173. package/src/front-mcp/index.js.map +1 -1
  174. package/src/front-mcp/serverless-handler.d.ts +28 -0
  175. package/src/front-mcp/serverless-handler.js +61 -0
  176. package/src/front-mcp/serverless-handler.js.map +1 -0
  177. package/src/hooks/hooks.utils.d.ts +1 -1
  178. package/src/hooks/hooks.utils.js +10 -3
  179. package/src/hooks/hooks.utils.js.map +1 -1
  180. package/src/index.d.ts +9 -5
  181. package/src/index.js +21 -1
  182. package/src/index.js.map +1 -1
  183. package/src/logger/instances/instance.logger.js +0 -1
  184. package/src/logger/instances/instance.logger.js.map +1 -1
  185. package/src/logging/flows/set-level.flow.d.ts +6 -8
  186. package/src/notification/notification.service.js +5 -1
  187. package/src/notification/notification.service.js.map +1 -1
  188. package/src/prompt/flows/get-prompt.flow.d.ts +14 -8
  189. package/src/prompt/flows/prompts-list.flow.d.ts +8 -7
  190. package/src/provider/provider.registry.d.ts +97 -5
  191. package/src/provider/provider.registry.js +306 -9
  192. package/src/provider/provider.registry.js.map +1 -1
  193. package/src/provider/provider.types.d.ts +21 -3
  194. package/src/provider/provider.types.js.map +1 -1
  195. package/src/resource/flows/read-resource.flow.d.ts +8 -9
  196. package/src/resource/flows/resource-templates-list.flow.d.ts +8 -7
  197. package/src/resource/flows/resources-list.flow.d.ts +8 -7
  198. package/src/resource/flows/subscribe-resource.flow.d.ts +6 -8
  199. package/src/resource/flows/unsubscribe-resource.flow.d.ts +6 -8
  200. package/src/scope/flows/http.request.flow.js +43 -7
  201. package/src/scope/flows/http.request.flow.js.map +1 -1
  202. package/src/scope/scope.instance.js +12 -5
  203. package/src/scope/scope.instance.js.map +1 -1
  204. package/src/server/adapters/base.host.adapter.d.ts +9 -0
  205. package/src/server/adapters/base.host.adapter.js.map +1 -1
  206. package/src/server/adapters/express.host.adapter.d.ts +12 -0
  207. package/src/server/adapters/express.host.adapter.js +21 -1
  208. package/src/server/adapters/express.host.adapter.js.map +1 -1
  209. package/src/server/server.instance.d.ts +3 -0
  210. package/src/server/server.instance.js +14 -7
  211. package/src/server/server.instance.js.map +1 -1
  212. package/src/store/adapters/store.vercel-kv.adapter.d.ts +86 -0
  213. package/src/store/adapters/store.vercel-kv.adapter.js +155 -0
  214. package/src/store/adapters/store.vercel-kv.adapter.js.map +1 -0
  215. package/src/store/index.d.ts +2 -0
  216. package/src/store/index.js +2 -0
  217. package/src/store/index.js.map +1 -1
  218. package/src/store/store.factory.d.ts +86 -0
  219. package/src/store/store.factory.js +194 -0
  220. package/src/store/store.factory.js.map +1 -0
  221. package/src/tool/flows/call-tool.flow.d.ts +38 -19
  222. package/src/tool/flows/call-tool.flow.js +240 -194
  223. package/src/tool/flows/call-tool.flow.js.map +1 -1
  224. package/src/tool/flows/tools-list.flow.d.ts +14 -17
  225. package/src/tool/flows/tools-list.flow.js +84 -33
  226. package/src/tool/flows/tools-list.flow.js.map +1 -1
  227. package/src/tool/tool.instance.d.ts +1 -4
  228. package/src/tool/ui/index.d.ts +4 -4
  229. package/src/tool/ui/index.js +4 -4
  230. package/src/tool/ui/index.js.map +1 -1
  231. package/src/tool/ui/platform-adapters.d.ts +2 -2
  232. package/src/tool/ui/platform-adapters.js +3 -3
  233. package/src/tool/ui/platform-adapters.js.map +1 -1
  234. package/src/tool/ui/template-helpers.d.ts +5 -7
  235. package/src/tool/ui/template-helpers.js +9 -26
  236. package/src/tool/ui/template-helpers.js.map +1 -1
  237. package/src/tool/ui/ui-resource.handler.d.ts +1 -1
  238. package/src/tool/ui/ui-resource.handler.js +5 -5
  239. package/src/tool/ui/ui-resource.handler.js.map +1 -1
  240. package/src/transport/adapters/transport.streamable-http.adapter.js +1 -0
  241. package/src/transport/adapters/transport.streamable-http.adapter.js.map +1 -1
  242. package/src/transport/flows/handle.sse.flow.js +9 -2
  243. package/src/transport/flows/handle.sse.flow.js.map +1 -1
  244. package/src/transport/flows/handle.streamable-http.flow.js +63 -6
  245. package/src/transport/flows/handle.streamable-http.flow.js.map +1 -1
  246. package/src/transport/mcp-handlers/complete-request.handler.d.ts +4 -15
  247. package/src/transport/mcp-handlers/get-prompt-request.handler.d.ts +5 -15
  248. package/src/transport/mcp-handlers/index.d.ts +67 -195
  249. package/src/transport/mcp-handlers/initialize-request.handler.js +12 -2
  250. package/src/transport/mcp-handlers/initialize-request.handler.js.map +1 -1
  251. package/src/transport/mcp-handlers/list-prompts-request.handler.d.ts +5 -15
  252. package/src/transport/mcp-handlers/list-resource-templates-request.handler.d.ts +5 -15
  253. package/src/transport/mcp-handlers/list-resources-request.handler.d.ts +5 -15
  254. package/src/transport/mcp-handlers/list-tools-request.handler.d.ts +5 -15
  255. package/src/transport/mcp-handlers/logging-set-level-request.handler.d.ts +3 -14
  256. package/src/transport/mcp-handlers/read-resource-request.handler.d.ts +4 -15
  257. package/src/transport/mcp-handlers/subscribe-request.handler.d.ts +3 -14
  258. package/src/transport/mcp-handlers/unsubscribe-request.handler.d.ts +3 -14
  259. package/src/transport/transport.registry.d.ts +72 -4
  260. package/src/transport/transport.registry.js +342 -11
  261. package/src/transport/transport.registry.js.map +1 -1
  262. package/src/auth/ui/htmx-templates.js.map +0 -1
  263. package/src/common/providers/session.provider.d.ts +0 -13
  264. package/src/common/providers/session.provider.js +0 -27
  265. package/src/common/providers/session.provider.js.map +0 -1
@@ -12,7 +12,10 @@ exports.frontMcpBaseSchema = zod_1.z.object({
12
12
  apps: zod_1.z.array(schemas_1.annotatedFrontMcpAppSchema),
13
13
  serve: zod_1.z.boolean().optional().default(true),
14
14
  http: types_1.httpOptionsSchema.optional(),
15
- session: types_1.sessionOptionsSchema.optional(),
15
+ redis: types_1.redisOptionsSchema.optional(),
16
+ pubsub: types_1.pubsubOptionsSchema.optional(),
17
+ transport: types_1.transportOptionsSchema.optional().transform((val) => val ?? types_1.transportOptionsSchema.parse({})),
18
+ session: types_1.sessionOptionsSchema.optional(), // @deprecated - kept for backward compatibility
16
19
  logging: types_1.loggingOptionsSchema.optional(),
17
20
  });
18
21
  const frontMcpMultiAppSchema = exports.frontMcpBaseSchema.extend({
@@ -1 +1 @@
1
- {"version":3,"file":"front-mcp.metadata.js","sourceRoot":"","sources":["../../../../src/common/metadata/front-mcp.metadata.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,oCAakB;AAClB,wCAKoB;AA8BP,QAAA,kBAAkB,GAAG,OAAC,CAAC,MAAM,CAAC;IACzC,IAAI,EAAE,+BAAuB;IAC7B,SAAS,EAAE,OAAC,CAAC,KAAK,CAAC,0CAAgC,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IAC3E,KAAK,EAAE,OAAC,CAAC,KAAK,CAAC,sCAA4B,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IACnE,SAAS,EAAE,OAAC,CAAC,KAAK,CAAC,0CAAgC,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IAC3E,IAAI,EAAE,OAAC,CAAC,KAAK,CAAC,oCAA0B,CAAC;IACzC,KAAK,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IAC3C,IAAI,EAAE,yBAAiB,CAAC,QAAQ,EAAE;IAClC,OAAO,EAAE,4BAAoB,CAAC,QAAQ,EAAE;IACxC,OAAO,EAAE,4BAAoB,CAAC,QAAQ,EAAE;CACG,CAAC,CAAC;AAO/C,MAAM,sBAAsB,GAAG,0BAAkB,CAAC,MAAM,CAAC;IACvD,UAAU,EAAE,OAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,kDAAkD,CAAC;IACxG,IAAI,EAAE,yBAAiB,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0DAA0D,CAAC;CAClC,CAAC,CAAC;AAOzE,MAAM,wBAAwB,GAAG,0BAAkB,CAAC,MAAM,CAAC;IACzD,UAAU,EAAE,OAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,6DAA6D,CAAC;IACnG,IAAI,EAAE,OAAC,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE;CAC6C,CAAC,CAAC;AAI9D,QAAA,sBAAsB,GAAG,sBAAsB,CAAC,EAAE,CAAC,wBAAwB,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\nimport {\n AuthOptions,\n authOptionsSchema,\n SessionOptions,\n sessionOptionsSchema,\n ServerInfoOptions,\n serverInfoOptionsSchema,\n HttpOptions,\n httpOptionsSchema,\n LoggingOptions,\n loggingOptionsSchema,\n RawZodShape,\n AuthOptionsInput,\n} from '../types';\nimport {\n annotatedFrontMcpAppSchema,\n annotatedFrontMcpProvidersSchema,\n annotatedFrontMcpResourcesSchema,\n annotatedFrontMcpToolsSchema,\n} from '../schemas';\nimport { AppType, ProviderType, ResourceType, ToolType } from '../interfaces';\n\nexport interface FrontMcpBaseMetadata {\n info: ServerInfoOptions;\n apps: AppType[];\n http?: HttpOptions;\n session?: SessionOptions;\n logging?: LoggingOptions;\n\n serve?: boolean; // default to true\n\n /**\n * Additional providers that are available to all apps.\n */\n providers?: ProviderType[];\n\n /**\n * Shared tools that are available to all apps.\n * These are merged (additively) with app-specific tools.\n */\n tools?: ToolType[];\n\n /**\n * Shared resources that are available to all apps.\n * These are merged (additively) with app-specific resources.\n */\n resources?: ResourceType[];\n}\n\nexport const frontMcpBaseSchema = z.object({\n info: serverInfoOptionsSchema,\n providers: z.array(annotatedFrontMcpProvidersSchema).optional().default([]),\n tools: z.array(annotatedFrontMcpToolsSchema).optional().default([]),\n resources: z.array(annotatedFrontMcpResourcesSchema).optional().default([]),\n apps: z.array(annotatedFrontMcpAppSchema),\n serve: z.boolean().optional().default(true),\n http: httpOptionsSchema.optional(),\n session: sessionOptionsSchema.optional(),\n logging: loggingOptionsSchema.optional(),\n} satisfies RawZodShape<FrontMcpBaseMetadata>);\n\nexport interface FrontMcpMultiAppMetadata extends FrontMcpBaseMetadata {\n splitByApp?: false;\n auth?: AuthOptionsInput;\n}\n\nconst frontMcpMultiAppSchema = frontMcpBaseSchema.extend({\n splitByApp: z.literal(false).default(false).describe('If true, each app gets its own scope & basePath.'),\n auth: authOptionsSchema.optional().describe(\"Configures the server's default authentication provider.\"),\n} satisfies RawZodShape<FrontMcpMultiAppMetadata, FrontMcpBaseMetadata>);\n\nexport interface FrontMcpSplitByAppMetadata extends FrontMcpBaseMetadata {\n splitByApp: true;\n auth?: never;\n}\n\nconst frontMcpSplitByAppSchema = frontMcpBaseSchema.extend({\n splitByApp: z.literal(true).describe('If false, apps are grouped under the same scope & basePath.'),\n auth: z.never().optional(),\n} satisfies RawZodShape<FrontMcpSplitByAppMetadata, FrontMcpBaseMetadata>);\n\nexport type FrontMcpMetadata = FrontMcpMultiAppMetadata | FrontMcpSplitByAppMetadata;\n\nexport const frontMcpMetadataSchema = frontMcpMultiAppSchema.or(frontMcpSplitByAppSchema);\n\nexport type FrontMcpMultiAppConfig = z.infer<typeof frontMcpMultiAppSchema>;\nexport type FrontMcpSplitByAppConfig = z.infer<typeof frontMcpSplitByAppSchema>;\n\nexport type FrontMcpConfigType = z.infer<typeof frontMcpMetadataSchema>;\n\nexport interface AppScopeMetadata extends Omit<FrontMcpSplitByAppMetadata, 'auth' | 'splitByApp'> {\n id: string;\n apps: [AppType];\n auth?: AuthOptions;\n}\n\nexport interface MultiAppScopeMetadata extends FrontMcpMultiAppMetadata {\n id: string;\n apps: AppType[];\n}\n\nexport type ScopeMetadata = AppScopeMetadata | MultiAppScopeMetadata;\n"]}
1
+ {"version":3,"file":"front-mcp.metadata.js","sourceRoot":"","sources":["../../../../src/common/metadata/front-mcp.metadata.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,oCAmBkB;AAClB,wCAKoB;AAuDP,QAAA,kBAAkB,GAAG,OAAC,CAAC,MAAM,CAAC;IACzC,IAAI,EAAE,+BAAuB;IAC7B,SAAS,EAAE,OAAC,CAAC,KAAK,CAAC,0CAAgC,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IAC3E,KAAK,EAAE,OAAC,CAAC,KAAK,CAAC,sCAA4B,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IACnE,SAAS,EAAE,OAAC,CAAC,KAAK,CAAC,0CAAgC,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IAC3E,IAAI,EAAE,OAAC,CAAC,KAAK,CAAC,oCAA0B,CAAC;IACzC,KAAK,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IAC3C,IAAI,EAAE,yBAAiB,CAAC,QAAQ,EAAE;IAClC,KAAK,EAAE,0BAAkB,CAAC,QAAQ,EAAE;IACpC,MAAM,EAAE,2BAAmB,CAAC,QAAQ,EAAE;IACtC,SAAS,EAAE,8BAAsB,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,IAAI,8BAAsB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACxG,OAAO,EAAE,4BAAoB,CAAC,QAAQ,EAAE,EAAE,gDAAgD;IAC1F,OAAO,EAAE,4BAAoB,CAAC,QAAQ,EAAE;CACG,CAAC,CAAC;AAO/C,MAAM,sBAAsB,GAAG,0BAAkB,CAAC,MAAM,CAAC;IACvD,UAAU,EAAE,OAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,kDAAkD,CAAC;IACxG,IAAI,EAAE,yBAAiB,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0DAA0D,CAAC;CAClC,CAAC,CAAC;AAOzE,MAAM,wBAAwB,GAAG,0BAAkB,CAAC,MAAM,CAAC;IACzD,UAAU,EAAE,OAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,6DAA6D,CAAC;IACnG,IAAI,EAAE,OAAC,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE;CAC6C,CAAC,CAAC;AAI9D,QAAA,sBAAsB,GAAG,sBAAsB,CAAC,EAAE,CAAC,wBAAwB,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\nimport {\n AuthOptions,\n authOptionsSchema,\n SessionOptions,\n sessionOptionsSchema,\n ServerInfoOptions,\n serverInfoOptionsSchema,\n HttpOptions,\n httpOptionsSchema,\n LoggingOptions,\n loggingOptionsSchema,\n RawZodShape,\n AuthOptionsInput,\n RedisOptionsInput,\n redisOptionsSchema,\n PubsubOptionsInput,\n pubsubOptionsSchema,\n TransportOptionsInput,\n transportOptionsSchema,\n} from '../types';\nimport {\n annotatedFrontMcpAppSchema,\n annotatedFrontMcpProvidersSchema,\n annotatedFrontMcpResourcesSchema,\n annotatedFrontMcpToolsSchema,\n} from '../schemas';\nimport { AppType, ProviderType, ResourceType, ToolType } from '../interfaces';\n\nexport interface FrontMcpBaseMetadata {\n info: ServerInfoOptions;\n apps: AppType[];\n http?: HttpOptions;\n logging?: LoggingOptions;\n\n serve?: boolean; // default to true\n\n /**\n * Shared storage configuration\n * Used by transport persistence and auth token storage.\n * Supports both Redis and Vercel KV providers.\n */\n redis?: RedisOptionsInput;\n\n /**\n * Pub/Sub configuration (Redis-only)\n * Required for resource subscriptions when using Vercel KV for sessions.\n * Falls back to `redis` config if not specified and redis is configured with Redis provider.\n */\n pubsub?: PubsubOptionsInput;\n\n /**\n * Transport and session lifecycle configuration\n * Controls transport protocols, session management, and persistence\n * @default {} (all transport options use their schema defaults)\n */\n transport?: TransportOptionsInput; // Optional in input, but always defined in output\n\n /**\n * @deprecated Use `transport` instead. Session config has been merged into transport.\n */\n session?: SessionOptions;\n\n /**\n * Additional providers that are available to all apps.\n */\n providers?: ProviderType[];\n\n /**\n * Shared tools that are available to all apps.\n * These are merged (additively) with app-specific tools.\n */\n tools?: ToolType[];\n\n /**\n * Shared resources that are available to all apps.\n * These are merged (additively) with app-specific resources.\n */\n resources?: ResourceType[];\n}\n\nexport const frontMcpBaseSchema = z.object({\n info: serverInfoOptionsSchema,\n providers: z.array(annotatedFrontMcpProvidersSchema).optional().default([]),\n tools: z.array(annotatedFrontMcpToolsSchema).optional().default([]),\n resources: z.array(annotatedFrontMcpResourcesSchema).optional().default([]),\n apps: z.array(annotatedFrontMcpAppSchema),\n serve: z.boolean().optional().default(true),\n http: httpOptionsSchema.optional(),\n redis: redisOptionsSchema.optional(),\n pubsub: pubsubOptionsSchema.optional(),\n transport: transportOptionsSchema.optional().transform((val) => val ?? transportOptionsSchema.parse({})),\n session: sessionOptionsSchema.optional(), // @deprecated - kept for backward compatibility\n logging: loggingOptionsSchema.optional(),\n} satisfies RawZodShape<FrontMcpBaseMetadata>);\n\nexport interface FrontMcpMultiAppMetadata extends FrontMcpBaseMetadata {\n splitByApp?: false;\n auth?: AuthOptionsInput;\n}\n\nconst frontMcpMultiAppSchema = frontMcpBaseSchema.extend({\n splitByApp: z.literal(false).default(false).describe('If true, each app gets its own scope & basePath.'),\n auth: authOptionsSchema.optional().describe(\"Configures the server's default authentication provider.\"),\n} satisfies RawZodShape<FrontMcpMultiAppMetadata, FrontMcpBaseMetadata>);\n\nexport interface FrontMcpSplitByAppMetadata extends FrontMcpBaseMetadata {\n splitByApp: true;\n auth?: never;\n}\n\nconst frontMcpSplitByAppSchema = frontMcpBaseSchema.extend({\n splitByApp: z.literal(true).describe('If false, apps are grouped under the same scope & basePath.'),\n auth: z.never().optional(),\n} satisfies RawZodShape<FrontMcpSplitByAppMetadata, FrontMcpBaseMetadata>);\n\nexport type FrontMcpMetadata = FrontMcpMultiAppMetadata | FrontMcpSplitByAppMetadata;\n\nexport const frontMcpMetadataSchema = frontMcpMultiAppSchema.or(frontMcpSplitByAppSchema);\n\nexport type FrontMcpMultiAppConfig = z.infer<typeof frontMcpMultiAppSchema>;\nexport type FrontMcpSplitByAppConfig = z.infer<typeof frontMcpSplitByAppSchema>;\n\nexport type FrontMcpConfigType = z.infer<typeof frontMcpMetadataSchema>;\n\nexport interface AppScopeMetadata extends Omit<FrontMcpSplitByAppMetadata, 'auth' | 'splitByApp'> {\n id: string;\n apps: [AppType];\n auth?: AuthOptions;\n}\n\nexport interface MultiAppScopeMetadata extends FrontMcpMultiAppMetadata {\n id: string;\n apps: AppType[];\n}\n\nexport type ScopeMetadata = AppScopeMetadata | MultiAppScopeMetadata;\n"]}
@@ -64,6 +64,10 @@ export declare const frontMcpPromptMetadataSchema: z.ZodObject<{
64
64
  src: z.ZodString;
65
65
  mimeType: z.ZodOptional<z.ZodString>;
66
66
  sizes: z.ZodOptional<z.ZodArray<z.ZodString>>;
67
+ theme: z.ZodOptional<z.ZodEnum<{
68
+ light: "light";
69
+ dark: "dark";
70
+ }>>;
67
71
  }, z.core.$strip>>>;
68
72
  }, z.core.$loose>;
69
73
  export { FrontMcpPromptMetadata as PromptMetadata, };
@@ -10,10 +10,24 @@ export interface ProviderMetadata {
10
10
  }
11
11
  /**
12
12
  * Provider lifetime scope semantics.
13
+ *
14
+ * - GLOBAL: Singleton, shared across all requests
15
+ * - CONTEXT: Per-context instance (combines session + request data)
16
+ * - SESSION: deprecated Use CONTEXT instead
17
+ * - REQUEST: deprecated Use CONTEXT instead
13
18
  */
14
19
  export declare enum ProviderScope {
20
+ /** Singleton, shared across all requests */
15
21
  GLOBAL = "global",
22
+ /** Per-context instance (unified session + request scope) */
23
+ CONTEXT = "context",
24
+ /**
25
+ * @deprecated Use CONTEXT instead. Maps to CONTEXT internally.
26
+ */
16
27
  SESSION = "session",
28
+ /**
29
+ * @deprecated Use CONTEXT instead. Maps to CONTEXT internally.
30
+ */
17
31
  REQUEST = "request"
18
32
  }
19
33
  export declare const frontMcpProviderMetadataSchema: z.ZodObject<{
@@ -4,17 +4,33 @@ exports.frontMcpProviderMetadataSchema = exports.ProviderScope = void 0;
4
4
  const zod_1 = require("zod");
5
5
  /**
6
6
  * Provider lifetime scope semantics.
7
+ *
8
+ * - GLOBAL: Singleton, shared across all requests
9
+ * - CONTEXT: Per-context instance (combines session + request data)
10
+ * - SESSION: deprecated Use CONTEXT instead
11
+ * - REQUEST: deprecated Use CONTEXT instead
7
12
  */
8
13
  var ProviderScope;
9
14
  (function (ProviderScope) {
15
+ /** Singleton, shared across all requests */
10
16
  ProviderScope["GLOBAL"] = "global";
17
+ /** Per-context instance (unified session + request scope) */
18
+ ProviderScope["CONTEXT"] = "context";
19
+ /**
20
+ * @deprecated Use CONTEXT instead. Maps to CONTEXT internally.
21
+ */
11
22
  ProviderScope["SESSION"] = "session";
23
+ /**
24
+ * @deprecated Use CONTEXT instead. Maps to CONTEXT internally.
25
+ */
12
26
  ProviderScope["REQUEST"] = "request";
13
27
  })(ProviderScope || (exports.ProviderScope = ProviderScope = {}));
14
- exports.frontMcpProviderMetadataSchema = zod_1.z.object({
28
+ exports.frontMcpProviderMetadataSchema = zod_1.z
29
+ .object({
15
30
  id: zod_1.z.string().optional(),
16
31
  name: zod_1.z.string().min(1),
17
32
  description: zod_1.z.string().optional(),
18
33
  scope: zod_1.z.nativeEnum(ProviderScope).optional().default(ProviderScope.GLOBAL),
19
- }).passthrough();
34
+ })
35
+ .passthrough();
20
36
  //# sourceMappingURL=provider.metadata.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"provider.metadata.js","sourceRoot":"","sources":["../../../../src/common/metadata/provider.metadata.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAcxB;;GAEG;AACH,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,kCAAiB,CAAA;IACjB,oCAAmB,CAAA;IACnB,oCAAmB,CAAA;AACrB,CAAC,EAJW,aAAa,6BAAb,aAAa,QAIxB;AAEY,QAAA,8BAA8B,GAAG,OAAC,CAAC,MAAM,CAAC;IACrD,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACzB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,KAAK,EAAE,OAAC,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC;CACpC,CAAC,CAAC,WAAW,EAAE,CAAC","sourcesContent":["import { z } from 'zod';\nimport { RawZodShape } from '../types';\n\n\n/**\n * Declarative metadata describing what a FrontMcpProvider contributes at app scope.\n */\nexport interface ProviderMetadata {\n id?: string;\n name: string;\n description?: string;\n scope?: ProviderScope;\n}\n\n/**\n * Provider lifetime scope semantics.\n */\nexport enum ProviderScope {\n GLOBAL = 'global',\n SESSION = 'session',\n REQUEST = 'request',\n}\n\nexport const frontMcpProviderMetadataSchema = z.object({\n id: z.string().optional(),\n name: z.string().min(1),\n description: z.string().optional(),\n scope: z.nativeEnum(ProviderScope).optional().default(ProviderScope.GLOBAL),\n} satisfies RawZodShape<ProviderMetadata>).passthrough();\n\n"]}
1
+ {"version":3,"file":"provider.metadata.js","sourceRoot":"","sources":["../../../../src/common/metadata/provider.metadata.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAaxB;;;;;;;GAOG;AACH,IAAY,aAaX;AAbD,WAAY,aAAa;IACvB,4CAA4C;IAC5C,kCAAiB,CAAA;IACjB,6DAA6D;IAC7D,oCAAmB,CAAA;IACnB;;OAEG;IACH,oCAAmB,CAAA;IACnB;;OAEG;IACH,oCAAmB,CAAA;AACrB,CAAC,EAbW,aAAa,6BAAb,aAAa,QAaxB;AAEY,QAAA,8BAA8B,GAAG,OAAC;KAC5C,MAAM,CAAC;IACN,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACzB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,KAAK,EAAE,OAAC,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC;CACpC,CAAC;KACzC,WAAW,EAAE,CAAC","sourcesContent":["import { z } from 'zod';\nimport { RawZodShape } from '../types';\n\n/**\n * Declarative metadata describing what a FrontMcpProvider contributes at app scope.\n */\nexport interface ProviderMetadata {\n id?: string;\n name: string;\n description?: string;\n scope?: ProviderScope;\n}\n\n/**\n * Provider lifetime scope semantics.\n *\n * - GLOBAL: Singleton, shared across all requests\n * - CONTEXT: Per-context instance (combines session + request data)\n * - SESSION: deprecated Use CONTEXT instead\n * - REQUEST: deprecated Use CONTEXT instead\n */\nexport enum ProviderScope {\n /** Singleton, shared across all requests */\n GLOBAL = 'global',\n /** Per-context instance (unified session + request scope) */\n CONTEXT = 'context',\n /**\n * @deprecated Use CONTEXT instead. Maps to CONTEXT internally.\n */\n SESSION = 'session',\n /**\n * @deprecated Use CONTEXT instead. Maps to CONTEXT internally.\n */\n REQUEST = 'request',\n}\n\nexport const frontMcpProviderMetadataSchema = z\n .object({\n id: z.string().optional(),\n name: z.string().min(1),\n description: z.string().optional(),\n scope: z.nativeEnum(ProviderScope).optional().default(ProviderScope.GLOBAL),\n } satisfies RawZodShape<ProviderMetadata>)\n .passthrough();\n"]}
@@ -56,6 +56,10 @@ export declare const frontMcpResourceMetadataSchema: z.ZodObject<{
56
56
  src: z.ZodString;
57
57
  mimeType: z.ZodOptional<z.ZodString>;
58
58
  sizes: z.ZodOptional<z.ZodArray<z.ZodString>>;
59
+ theme: z.ZodOptional<z.ZodEnum<{
60
+ light: "light";
61
+ dark: "dark";
62
+ }>>;
59
63
  }, z.core.$strip>>>;
60
64
  }, z.core.$loose>;
61
65
  /**
@@ -102,6 +106,10 @@ export declare const frontMcpResourceTemplateMetadataSchema: z.ZodObject<{
102
106
  src: z.ZodString;
103
107
  mimeType: z.ZodOptional<z.ZodString>;
104
108
  sizes: z.ZodOptional<z.ZodArray<z.ZodString>>;
109
+ theme: z.ZodOptional<z.ZodEnum<{
110
+ light: "light";
111
+ dark: "dark";
112
+ }>>;
105
113
  }, z.core.$strip>>>;
106
114
  }, z.core.$loose>;
107
115
  export { ResourceMetadata, ResourceMetadata as FrontMcpResourceMetadata, ResourceTemplateMetadata, ResourceTemplateMetadata as FrontMcpResourceTemplateMetadata, };
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * Tool UI Configuration Types
3
3
  *
4
- * Re-exports types from @frontmcp/ui/types for SDK consumers.
4
+ * Re-exports types from @frontmcp/uipack/types for SDK consumers.
5
5
  * This provides a single source of truth for UI configuration types
6
6
  * while maintaining backwards compatibility.
7
7
  *
8
8
  * @see {@link https://docs.agentfront.dev/docs/servers/tools#tool-ui | Tool UI Documentation}
9
9
  */
10
- export { type UIContentSecurityPolicy, type TemplateHelpers, type TemplateContext, type TemplateBuilderFn, type WidgetServingMode, type WidgetDisplayMode, type UITemplateConfig as ToolUIConfig, type UIType, type BundlingMode, type DisplayMode, type ResourceMode, type CSPDirectives, type RendererAssets, type WidgetManifest, type RuntimePayload, type WidgetConfig, type WidgetTemplate, type WidgetRuntimeOptions, type BuildManifestResult, type BuildManifestOptions, } from '@frontmcp/ui/types';
10
+ export { type UIContentSecurityPolicy, type TemplateHelpers, type TemplateContext, type TemplateBuilderFn, type WidgetServingMode, type WidgetDisplayMode, type UITemplateConfig as ToolUIConfig, type UIType, type BundlingMode, type DisplayMode, type ResourceMode, type CSPDirectives, type RendererAssets, type WidgetManifest, type RuntimePayload, type WidgetConfig, type WidgetTemplate, type WidgetRuntimeOptions, type BuildManifestResult, type BuildManifestOptions, } from '@frontmcp/uipack/types';
@@ -2,7 +2,7 @@
2
2
  /**
3
3
  * Tool UI Configuration Types
4
4
  *
5
- * Re-exports types from @frontmcp/ui/types for SDK consumers.
5
+ * Re-exports types from @frontmcp/uipack/types for SDK consumers.
6
6
  * This provides a single source of truth for UI configuration types
7
7
  * while maintaining backwards compatibility.
8
8
  *
@@ -1 +1 @@
1
- {"version":3,"file":"tool-ui.metadata.js","sourceRoot":"","sources":["../../../../src/common/metadata/tool-ui.metadata.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG","sourcesContent":["/**\n * Tool UI Configuration Types\n *\n * Re-exports types from @frontmcp/ui/types for SDK consumers.\n * This provides a single source of truth for UI configuration types\n * while maintaining backwards compatibility.\n *\n * @see {@link https://docs.agentfront.dev/docs/servers/tools#tool-ui | Tool UI Documentation}\n */\n\n// Re-export all UI configuration types from @frontmcp/ui\nexport {\n // Legacy UI Config Types\n type UIContentSecurityPolicy,\n type TemplateHelpers,\n type TemplateContext,\n type TemplateBuilderFn,\n type WidgetServingMode,\n type WidgetDisplayMode,\n // Re-export UITemplateConfig as ToolUIConfig for backwards compatibility\n type UITemplateConfig as ToolUIConfig,\n // New Widget Runtime Types\n type UIType,\n type BundlingMode,\n type DisplayMode,\n type ResourceMode,\n type CSPDirectives,\n type RendererAssets,\n type WidgetManifest,\n type RuntimePayload,\n type WidgetConfig,\n type WidgetTemplate,\n type WidgetRuntimeOptions,\n type BuildManifestResult,\n type BuildManifestOptions,\n} from '@frontmcp/ui/types';\n"]}
1
+ {"version":3,"file":"tool-ui.metadata.js","sourceRoot":"","sources":["../../../../src/common/metadata/tool-ui.metadata.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG","sourcesContent":["/**\n * Tool UI Configuration Types\n *\n * Re-exports types from @frontmcp/uipack/types for SDK consumers.\n * This provides a single source of truth for UI configuration types\n * while maintaining backwards compatibility.\n *\n * @see {@link https://docs.agentfront.dev/docs/servers/tools#tool-ui | Tool UI Documentation}\n */\n\n// Re-export all UI configuration types from @frontmcp/uipack\nexport {\n // Legacy UI Config Types\n type UIContentSecurityPolicy,\n type TemplateHelpers,\n type TemplateContext,\n type TemplateBuilderFn,\n type WidgetServingMode,\n type WidgetDisplayMode,\n // Re-export UITemplateConfig as ToolUIConfig for backwards compatibility\n type UITemplateConfig as ToolUIConfig,\n // New Widget Runtime Types\n type UIType,\n type BundlingMode,\n type DisplayMode,\n type ResourceMode,\n type CSPDirectives,\n type RendererAssets,\n type WidgetManifest,\n type RuntimePayload,\n type WidgetConfig,\n type WidgetTemplate,\n type WidgetRuntimeOptions,\n type BuildManifestResult,\n type BuildManifestOptions,\n} from '@frontmcp/uipack/types';\n"]}
@@ -159,6 +159,10 @@ export declare const ResourceLinkOutputSchema: z.ZodObject<{
159
159
  src: z.ZodString;
160
160
  mimeType: z.ZodOptional<z.ZodString>;
161
161
  sizes: z.ZodOptional<z.ZodArray<z.ZodString>>;
162
+ theme: z.ZodOptional<z.ZodEnum<{
163
+ light: "light";
164
+ dark: "dark";
165
+ }>>;
162
166
  }, z.core.$strip>>>;
163
167
  name: z.ZodString;
164
168
  title: z.ZodOptional<z.ZodString>;
@@ -174,7 +178,7 @@ export type ToolSingleOutputType = PrimitiveOutputType | ImageOutputType | Audio
174
178
  * Default default tool schema is {}
175
179
  */
176
180
  export type ToolOutputType = ToolSingleOutputType | ToolSingleOutputType[] | undefined;
177
- export type ToolInputType = z.ZodRawShape;
181
+ export type ToolInputType = z.ZodRawShape | z.ZodObject<any>;
178
182
  /**
179
183
  * Declarative metadata describing what an McpTool contributes.
180
184
  */
@@ -1 +1 @@
1
- {"version":3,"file":"tool.metadata.js","sourceRoot":"","sources":["../../../../src/common/metadata/tool.metadata.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAMxB,iEAK4C;AAyE5C,MAAM,wBAAwB,GAAG,OAAC;KAC/B,MAAM,CAAC;IACN,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,YAAY,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACpC,eAAe,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACvC,cAAc,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACtC,aAAa,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CACC,CAAC;KACxC,WAAW,EAAE,CAAC;AAmBJ,QAAA,iBAAiB,GAAG,6BAAkB,CAAC;AAOvC,QAAA,iBAAiB,GAAG,6BAAkB,CAAC;AAOvC,QAAA,oBAAoB,GAAG,iCAAsB,CAAC;AAO9C,QAAA,wBAAwB,GAAG,6BAAkB,CAAC;AAyF3D;;;;;GAKG;AAEH,MAAM,4BAA4B,GAAG,OAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;AACrF,MAAM,0BAA0B,GAAG,OAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC;AAE3F,MAAM,mB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IACzC,IAAI,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC3C,WAAW,EAAE,wBAAwB,CAAC,QAAQ,EAAE;IAChD,iBAAiB,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IACxD,QAAQ,EAAE,OAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,QAAQ,EAAE;IAC/C,EAAE,EAAE,OAAC,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE;CAC+B,CAAC;KACjE,WAAW,EAAE,CAAC","sourcesContent":["import { z } from 'zod';\nimport { RawZodShape } from '../types';\nimport type { JSONSchema } from 'zod/v4/core';\n\n/** JSON Schema type from Zod v4 */\ntype JsonSchema = JSONSchema.JSONSchema;\nimport {\n ImageContentSchema,\n AudioContentSchema,\n ResourceLinkSchema,\n EmbeddedResourceSchema,\n} from '@modelcontextprotocol/sdk/types.js';\nimport { ToolUIConfig } from './tool-ui.metadata';\nimport { ToolInputOf, ToolOutputOf } from '../decorators';\n\ndeclare global {\n /**\n * Declarative metadata extends to the an McpTool decorator.\n */\n interface ExtendFrontMcpToolMetadata {}\n}\n\n/**\n * Example input/output pair for a tool, used in documentation and describe output.\n */\nexport interface ToolExample {\n /**\n * Description of what this example demonstrates.\n */\n description: string;\n\n /**\n * Example input values for the tool.\n */\n input: Record<string, unknown>;\n\n /**\n * Optional expected output for the example.\n */\n output?: unknown;\n}\n\nexport interface ToolAnnotations {\n [x: string]: unknown;\n\n /**\n * A human-readable title for the tool.\n */\n title?: string;\n /**\n * If true, the tool does not modify its environment.\n *\n * Default: false\n */\n readOnlyHint?: boolean;\n /**\n * If true, the tool may perform destructive updates to its environment.\n * If false, the tool performs only additive updates.\n *\n * (This property is meaningful only when `readOnlyHint == false`)\n *\n * Default: true\n */\n destructiveHint?: boolean;\n /**\n * If true, calling the tool repeatedly with the same arguments\n * will have no additional effect on the its environment.\n *\n * (This property is meaningful only when `readOnlyHint == false`)\n *\n * Default: false\n */\n idempotentHint?: boolean;\n /**\n * If true, this tool may interact with an \"open world\" of external\n * entities. If false, the tool's domain of interaction is closed.\n * For example, the world of a web search tool is open, whereas that\n * of a memory tool is not.\n *\n * Default: true\n */\n openWorldHint?: boolean;\n}\n\nconst mcpToolAnnotationsSchema = z\n .object({\n title: z.string().optional(),\n readOnlyHint: z.boolean().optional(),\n destructiveHint: z.boolean().optional(),\n idempotentHint: z.boolean().optional(),\n openWorldHint: z.boolean().optional(),\n } satisfies RawZodShape<ToolAnnotations>)\n .passthrough();\n\n/**\n * Tool response type text: include if outputSchema is zod primitive types\n */\ntype PrimitiveOutputType =\n | 'string'\n | 'number'\n | 'date'\n | 'boolean'\n | z.ZodString\n | z.ZodNumber\n | z.ZodBoolean\n | z.ZodBigInt\n | z.ZodDate;\n/**\n * Tool response type image, will use the ImageContentSchema from MCP types\n */\ntype ImageOutputType = 'image';\nexport const ImageOutputSchema = ImageContentSchema;\nexport type ImageOutput = z.output<typeof ImageOutputSchema>;\n\n/**\n * Tool response type audio, will use the AudioContentSchema from MCP types\n */\ntype AudioOutputType = 'audio';\nexport const AudioOutputSchema = AudioContentSchema;\nexport type AudioOutput = z.output<typeof AudioOutputSchema>;\n\n/**\n * Tool response type resource, will use the EmbeddedResourceSchema from MCP types\n */\ntype ResourceOutputType = 'resource';\nexport const ResourceOutputSchema = EmbeddedResourceSchema;\nexport type ResourceOutput = z.output<typeof ResourceOutputSchema>;\n\n/**\n * Tool response type resource_link, will use the ResourceLinkSchema from MCP types\n */\ntype ResourceLinkOutputType = 'resource_link';\nexport const ResourceLinkOutputSchema = ResourceLinkSchema;\nexport type ResourceLinkOutput = z.output<typeof ResourceLinkOutputSchema>;\n\n/**\n * Tool response type json, ZodRawShape for fast usage\n */\ntype StructuredOutputType =\n | z.ZodRawShape\n | z.ZodObject<any>\n | z.ZodArray<z.ZodType>\n | z.ZodUnion<[z.ZodObject<any>, ...z.ZodObject<any>[]]>\n | z.ZodDiscriminatedUnion<z.ZodObject<any>[]>;\n\nexport type ToolSingleOutputType =\n | PrimitiveOutputType\n | ImageOutputType\n | AudioOutputType\n | ResourceOutputType\n | ResourceLinkOutputType\n | StructuredOutputType;\n\n/**\n * Default default tool schema is {}\n */\nexport type ToolOutputType = ToolSingleOutputType | ToolSingleOutputType[] | undefined;\nexport type ToolInputType = z.ZodRawShape;\n\n/**\n * Declarative metadata describing what an McpTool contributes.\n */\nexport interface ToolMetadata<InSchema = ToolInputType, OutSchema extends ToolOutputType = ToolOutputType>\n extends ExtendFrontMcpToolMetadata {\n /**\n * Optional unique identifier for the tool.\n * If omitted, a consumer may derive an ID from the class or file name.\n */\n id?: string;\n\n /**\n * Human‑readable name of the tool, used in UIs, logs, and discovery.\n */\n name: string;\n\n /**\n * Short summary describing what the tool does and when to use it.\n */\n description?: string;\n\n /**\n * Zod schema describing the expected input payload for the tool.\n * Used for validation and for generating automatic docs/UX.\n */\n inputSchema: InSchema;\n /**\n * Zod schema describing the expected input payload for the tool.\n * Used for validation and for generating automatic docs/UX.\n */\n rawInputSchema?: JsonSchema;\n\n /**\n * Zod schema describing the structure of the tool's successful output.\n */\n outputSchema?: OutSchema;\n\n /**\n * Optional list of tags/labels that categorize the tool for discovery and filtering.\n */\n tags?: string[];\n\n annotations?: ToolAnnotations;\n\n /**\n * If true, the tool will not be shown in the tool/list action results.\n * this method can still be called directly with tool/call even if hidden.\n * use case: tools that are intended to be private or internal. (usually for testing / private apis)\n * Default: false\n */\n hideFromDiscovery?: boolean;\n\n /**\n * Optional usage examples for the tool.\n * These are used by codecall:describe to provide accurate usage examples.\n * If provided, these take precedence over auto-generated examples.\n */\n examples?: ToolExample[];\n\n ui?: ToolUIConfig<ToolInputOf<InSchema>, ToolOutputOf<OutSchema>>;\n}\n\n/**\n * Runtime schema for ToolSingleOutputType:\n * - literals ('string', 'image', ...)\n * - any Zod schema (ZodObject, ZodArray, etc.)\n * - raw shapes (Record<string, ZodTypeAny>)\n */\n\nconst primitiveOutputLiteralSchema = z.enum(['string', 'number', 'date', 'boolean']);\nconst specialOutputLiteralSchema = z.enum(['image', 'audio', 'resource', 'resource_link']);\n\nconst outputLiteralSchema = z.union([primitiveOutputLiteralSchema, specialOutputLiteralSchema]);\n\n// Any Zod schema instance (object, array, union, etc.)\nconst zodSchemaInstanceSchema = z.instanceof(z.ZodType);\n\n// Raw shape: { field: z.string(), ... }\nconst zodRawShapeSchema = z.record(z.string(), zodSchemaInstanceSchema);\n\nconst toolSingleOutputSchema = z.union([outputLiteralSchema, zodSchemaInstanceSchema, zodRawShapeSchema]);\n\n// ToolOutputType = ToolSingleOutputType | ToolSingleOutputType[]\nconst toolOutputSchema = z.union([toolSingleOutputSchema, z.array(toolSingleOutputSchema)]);\nconst toolExampleSchema = z.object({\n description: z.string(),\n input: z.record(z.string(), z.unknown()),\n output: z.unknown().optional(),\n});\n\nexport const frontMcpToolMetadataSchema = z\n .object({\n id: z.string().optional(),\n name: z.string().min(1),\n description: z.string().optional(),\n inputSchema: z.instanceof(Object),\n rawInputSchema: z.any().optional(),\n outputSchema: toolOutputSchema.optional(),\n tags: z.array(z.string().min(1)).optional(),\n annotations: mcpToolAnnotationsSchema.optional(),\n hideFromDiscovery: z.boolean().optional().default(false),\n examples: z.array(toolExampleSchema).optional(),\n ui: z.looseObject({}).optional(),\n } satisfies RawZodShape<ToolMetadata, ExtendFrontMcpToolMetadata>)\n .passthrough();\n"]}
1
+ {"version":3,"file":"tool.metadata.js","sourceRoot":"","sources":["../../../../src/common/metadata/tool.metadata.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAMxB,iEAK4C;AAyE5C,MAAM,wBAAwB,GAAG,OAAC;KAC/B,MAAM,CAAC;IACN,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,YAAY,EAAE,OAAC,CAAC,OAAO,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\ntype JsonSchema = JSONSchema.JSONSchema;\nimport {\n ImageContentSchema,\n AudioContentSchema,\n ResourceLinkSchema,\n EmbeddedResourceSchema,\n} from '@modelcontextprotocol/sdk/types.js';\nimport { ToolUIConfig } from './tool-ui.metadata';\nimport { ToolInputOf, ToolOutputOf } from '../decorators';\n\ndeclare global {\n /**\n * Declarative metadata extends to the an McpTool decorator.\n */\n interface ExtendFrontMcpToolMetadata {}\n}\n\n/**\n * Example input/output pair for a tool, used in documentation and describe output.\n */\nexport interface ToolExample {\n /**\n * Description of what this example demonstrates.\n */\n description: string;\n\n /**\n * Example input values for the tool.\n */\n input: Record<string, unknown>;\n\n /**\n * Optional expected output for the example.\n */\n output?: unknown;\n}\n\nexport interface ToolAnnotations {\n [x: string]: unknown;\n\n /**\n * A human-readable title for the tool.\n */\n title?: string;\n /**\n * If true, the tool does not modify its environment.\n *\n * Default: false\n */\n readOnlyHint?: boolean;\n /**\n * If true, the tool may perform destructive updates to its environment.\n * If false, the tool performs only additive updates.\n *\n * (This property is meaningful only when `readOnlyHint == false`)\n *\n * Default: true\n */\n destructiveHint?: boolean;\n /**\n * If true, calling the tool repeatedly with the same arguments\n * will have no additional effect on the its environment.\n *\n * (This property is meaningful only when `readOnlyHint == false`)\n *\n * Default: false\n */\n idempotentHint?: boolean;\n /**\n * If true, this tool may interact with an \"open world\" of external\n * entities. If false, the tool's domain of interaction is closed.\n * For example, the world of a web search tool is open, whereas that\n * of a memory tool is not.\n *\n * Default: true\n */\n openWorldHint?: boolean;\n}\n\nconst mcpToolAnnotationsSchema = z\n .object({\n title: z.string().optional(),\n readOnlyHint: z.boolean().optional(),\n destructiveHint: z.boolean().optional(),\n idempotentHint: z.boolean().optional(),\n openWorldHint: z.boolean().optional(),\n } satisfies RawZodShape<ToolAnnotations>)\n .passthrough();\n\n/**\n * Tool response type text: include if outputSchema is zod primitive types\n */\ntype PrimitiveOutputType =\n | 'string'\n | 'number'\n | 'date'\n | 'boolean'\n | z.ZodString\n | z.ZodNumber\n | z.ZodBoolean\n | z.ZodBigInt\n | z.ZodDate;\n/**\n * Tool response type image, will use the ImageContentSchema from MCP types\n */\ntype ImageOutputType = 'image';\nexport const ImageOutputSchema = ImageContentSchema;\nexport type ImageOutput = z.output<typeof ImageOutputSchema>;\n\n/**\n * Tool response type audio, will use the AudioContentSchema from MCP types\n */\ntype AudioOutputType = 'audio';\nexport const AudioOutputSchema = AudioContentSchema;\nexport type AudioOutput = z.output<typeof AudioOutputSchema>;\n\n/**\n * Tool response type resource, will use the EmbeddedResourceSchema from MCP types\n */\ntype ResourceOutputType = 'resource';\nexport const ResourceOutputSchema = EmbeddedResourceSchema;\nexport type ResourceOutput = z.output<typeof ResourceOutputSchema>;\n\n/**\n * Tool response type resource_link, will use the ResourceLinkSchema from MCP types\n */\ntype ResourceLinkOutputType = 'resource_link';\nexport const ResourceLinkOutputSchema = ResourceLinkSchema;\nexport type ResourceLinkOutput = z.output<typeof ResourceLinkOutputSchema>;\n\n/**\n * Tool response type json, ZodRawShape for fast usage\n */\ntype StructuredOutputType =\n | z.ZodRawShape\n | z.ZodObject<any>\n | z.ZodArray<z.ZodType>\n | z.ZodUnion<[z.ZodObject<any>, ...z.ZodObject<any>[]]>\n | z.ZodDiscriminatedUnion<z.ZodObject<any>[]>;\n\nexport type ToolSingleOutputType =\n | PrimitiveOutputType\n | ImageOutputType\n | AudioOutputType\n | ResourceOutputType\n | ResourceLinkOutputType\n | StructuredOutputType;\n\n/**\n * Default default tool schema is {}\n */\nexport type ToolOutputType = ToolSingleOutputType | ToolSingleOutputType[] | undefined;\nexport type ToolInputType = z.ZodRawShape | z.ZodObject<any>;\n\n/**\n * Declarative metadata describing what an McpTool contributes.\n */\nexport interface ToolMetadata<InSchema = ToolInputType, OutSchema extends ToolOutputType = ToolOutputType>\n extends ExtendFrontMcpToolMetadata {\n /**\n * Optional unique identifier for the tool.\n * If omitted, a consumer may derive an ID from the class or file name.\n */\n id?: string;\n\n /**\n * Human‑readable name of the tool, used in UIs, logs, and discovery.\n */\n name: string;\n\n /**\n * Short summary describing what the tool does and when to use it.\n */\n description?: string;\n\n /**\n * Zod schema describing the expected input payload for the tool.\n * Used for validation and for generating automatic docs/UX.\n */\n inputSchema: InSchema;\n /**\n * Zod schema describing the expected input payload for the tool.\n * Used for validation and for generating automatic docs/UX.\n */\n rawInputSchema?: JsonSchema;\n\n /**\n * Zod schema describing the structure of the tool's successful output.\n */\n outputSchema?: OutSchema;\n\n /**\n * Optional list of tags/labels that categorize the tool for discovery and filtering.\n */\n tags?: string[];\n\n annotations?: ToolAnnotations;\n\n /**\n * If true, the tool will not be shown in the tool/list action results.\n * this method can still be called directly with tool/call even if hidden.\n * use case: tools that are intended to be private or internal. (usually for testing / private apis)\n * Default: false\n */\n hideFromDiscovery?: boolean;\n\n /**\n * Optional usage examples for the tool.\n * These are used by codecall:describe to provide accurate usage examples.\n * If provided, these take precedence over auto-generated examples.\n */\n examples?: ToolExample[];\n\n ui?: ToolUIConfig<ToolInputOf<InSchema>, ToolOutputOf<OutSchema>>;\n}\n\n/**\n * Runtime schema for ToolSingleOutputType:\n * - literals ('string', 'image', ...)\n * - any Zod schema (ZodObject, ZodArray, etc.)\n * - raw shapes (Record<string, ZodTypeAny>)\n */\n\nconst primitiveOutputLiteralSchema = z.enum(['string', 'number', 'date', 'boolean']);\nconst specialOutputLiteralSchema = z.enum(['image', 'audio', 'resource', 'resource_link']);\n\nconst outputLiteralSchema = z.union([primitiveOutputLiteralSchema, specialOutputLiteralSchema]);\n\n// Any Zod schema instance (object, array, union, etc.)\nconst zodSchemaInstanceSchema = z.instanceof(z.ZodType);\n\n// Raw shape: { field: z.string(), ... }\nconst zodRawShapeSchema = z.record(z.string(), zodSchemaInstanceSchema);\n\nconst toolSingleOutputSchema = z.union([outputLiteralSchema, zodSchemaInstanceSchema, zodRawShapeSchema]);\n\n// ToolOutputType = ToolSingleOutputType | ToolSingleOutputType[]\nconst toolOutputSchema = z.union([toolSingleOutputSchema, z.array(toolSingleOutputSchema)]);\nconst toolExampleSchema = z.object({\n description: z.string(),\n input: z.record(z.string(), z.unknown()),\n output: z.unknown().optional(),\n});\n\nexport const frontMcpToolMetadataSchema = z\n .object({\n id: z.string().optional(),\n name: z.string().min(1),\n description: z.string().optional(),\n inputSchema: z.instanceof(Object),\n rawInputSchema: z.any().optional(),\n outputSchema: toolOutputSchema.optional(),\n tags: z.array(z.string().min(1)).optional(),\n annotations: mcpToolAnnotationsSchema.optional(),\n hideFromDiscovery: z.boolean().optional().default(false),\n examples: z.array(toolExampleSchema).optional(),\n ui: z.looseObject({}).optional(),\n } satisfies RawZodShape<ToolMetadata, ExtendFrontMcpToolMetadata>)\n .passthrough();\n"]}
@@ -0,0 +1,62 @@
1
+ import type { TransportOptionsInput } from '../types/options/transport.options';
2
+ import type { RedisOptionsInput } from '../types/options/redis.options';
3
+ import type { SessionOptions } from '../types/options/session.options';
4
+ /**
5
+ * Old transport config structure (nested under auth)
6
+ */
7
+ interface OldTransportConfig {
8
+ enableLegacySSE?: boolean;
9
+ enableSseListener?: boolean;
10
+ enableStreamableHttp?: boolean;
11
+ enableStatelessHttp?: boolean;
12
+ enableStatefulHttp?: boolean;
13
+ requireSessionForStreamable?: boolean;
14
+ recreation?: {
15
+ enabled?: boolean;
16
+ redis?: RedisOptionsInput;
17
+ defaultTtlMs?: number;
18
+ };
19
+ }
20
+ /**
21
+ * Old auth config structure (with nested transport)
22
+ */
23
+ interface OldAuthConfig {
24
+ mode: string;
25
+ transport?: OldTransportConfig;
26
+ [key: string]: unknown;
27
+ }
28
+ /**
29
+ * Metadata structure for migration
30
+ */
31
+ interface MigratableMetadata {
32
+ auth?: OldAuthConfig;
33
+ session?: SessionOptions;
34
+ transport?: TransportOptionsInput;
35
+ redis?: RedisOptionsInput;
36
+ }
37
+ /**
38
+ * Reset deprecation warning flag (for testing)
39
+ */
40
+ export declare function resetDeprecationWarning(): void;
41
+ /**
42
+ * Check if config needs migration
43
+ */
44
+ export declare function needsMigration(metadata: MigratableMetadata): boolean;
45
+ /**
46
+ * Migrate old config structure to new structure
47
+ *
48
+ * Returns the migrated values that should be applied to the metadata
49
+ */
50
+ export declare function migrateAuthTransportConfig(metadata: MigratableMetadata): {
51
+ transport?: TransportOptionsInput;
52
+ redis?: RedisOptionsInput;
53
+ auth?: OldAuthConfig;
54
+ };
55
+ /**
56
+ * Apply migration to metadata (mutates in place for decorator use)
57
+ *
58
+ * This function takes a metadata object with the old config structure
59
+ * and transforms it to the new structure in place.
60
+ */
61
+ export declare function applyMigration<T extends MigratableMetadata>(metadata: T): T;
62
+ export {};
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+ // common/migrate/auth-transport.migrate.ts
3
+ //
4
+ // Migration helper for auth.transport -> transport config
5
+ //
6
+ // This file handles backward compatibility for the old config structure.
7
+ // DELETE THIS FILE when removing deprecated support (target: v1.0.0)
8
+ //
9
+ // Migration performed:
10
+ // 1. auth.transport -> transport (top-level)
11
+ // 2. session -> transport (merged)
12
+ // 3. auth.transport.recreation.redis -> redis (top-level, if not already set)
13
+ // 4. auth.tokenStorage.config -> references top-level redis
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.resetDeprecationWarning = resetDeprecationWarning;
16
+ exports.needsMigration = needsMigration;
17
+ exports.migrateAuthTransportConfig = migrateAuthTransportConfig;
18
+ exports.applyMigration = applyMigration;
19
+ let deprecationWarningShown = false;
20
+ /**
21
+ * Show deprecation warning once per process
22
+ */
23
+ function showDeprecationWarning(hasOldTransport, hasOldSession) {
24
+ if (deprecationWarningShown) {
25
+ return;
26
+ }
27
+ deprecationWarningShown = true;
28
+ const warnings = [];
29
+ if (hasOldTransport) {
30
+ warnings.push(' - auth.transport is deprecated, use top-level "transport" instead');
31
+ }
32
+ if (hasOldSession) {
33
+ warnings.push(' - session is deprecated, merge into top-level "transport" instead');
34
+ }
35
+ console.warn('\n[DEPRECATION WARNING] FrontMCP config structure has changed:\n' +
36
+ warnings.join('\n') +
37
+ '\n - For Redis config, use top-level "redis" instead\n' +
38
+ '\nSee documentation: https://docs.agentfront.dev/docs/servers/server\n');
39
+ }
40
+ /**
41
+ * Reset deprecation warning flag (for testing)
42
+ */
43
+ function resetDeprecationWarning() {
44
+ deprecationWarningShown = false;
45
+ }
46
+ /**
47
+ * Check if config needs migration
48
+ */
49
+ function needsMigration(metadata) {
50
+ const hasOldTransport = !!(metadata.auth && 'transport' in metadata.auth && metadata.auth.transport);
51
+ const hasOldSession = !!metadata.session;
52
+ return hasOldTransport || hasOldSession;
53
+ }
54
+ /**
55
+ * Migrate old config structure to new structure
56
+ *
57
+ * Returns the migrated values that should be applied to the metadata
58
+ */
59
+ function migrateAuthTransportConfig(metadata) {
60
+ const result = {};
61
+ const hasOldTransport = !!(metadata.auth && 'transport' in metadata.auth && metadata.auth.transport);
62
+ const hasOldSession = !!metadata.session;
63
+ if (!hasOldTransport && !hasOldSession) {
64
+ return result;
65
+ }
66
+ // Show deprecation warning
67
+ showDeprecationWarning(hasOldTransport, hasOldSession);
68
+ // Start with existing transport config if present
69
+ result.transport = { ...metadata.transport };
70
+ // Migrate session config
71
+ if (hasOldSession) {
72
+ const session = metadata.session;
73
+ result.transport = {
74
+ ...result.transport,
75
+ sessionMode: session.sessionMode,
76
+ transportIdMode: session.transportIdMode,
77
+ platformDetection: session.platformDetection,
78
+ };
79
+ }
80
+ // Migrate auth.transport config
81
+ if (hasOldTransport) {
82
+ const oldTransport = metadata.auth.transport;
83
+ // Merge transport protocol settings
84
+ result.transport = {
85
+ ...result.transport,
86
+ enableLegacySSE: oldTransport.enableLegacySSE ?? result.transport.enableLegacySSE,
87
+ enableSseListener: oldTransport.enableSseListener ?? result.transport.enableSseListener,
88
+ enableStreamableHttp: oldTransport.enableStreamableHttp ?? result.transport.enableStreamableHttp,
89
+ enableStatelessHttp: oldTransport.enableStatelessHttp ?? result.transport.enableStatelessHttp,
90
+ enableStatefulHttp: oldTransport.enableStatefulHttp ?? result.transport.enableStatefulHttp,
91
+ requireSessionForStreamable: oldTransport.requireSessionForStreamable ?? result.transport.requireSessionForStreamable,
92
+ };
93
+ // Migrate recreation -> persistence
94
+ if (oldTransport.recreation) {
95
+ result.transport.persistence = {
96
+ enabled: oldTransport.recreation.enabled ?? false,
97
+ redis: oldTransport.recreation.redis,
98
+ defaultTtlMs: oldTransport.recreation.defaultTtlMs,
99
+ };
100
+ // Extract Redis config to top-level if not already present
101
+ if (oldTransport.recreation.redis && !metadata.redis) {
102
+ result.redis = oldTransport.recreation.redis;
103
+ }
104
+ }
105
+ // Create clean auth without transport
106
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
107
+ const { transport: _, ...cleanAuth } = metadata.auth;
108
+ result.auth = cleanAuth;
109
+ }
110
+ return result;
111
+ }
112
+ /**
113
+ * Apply migration to metadata (mutates in place for decorator use)
114
+ *
115
+ * This function takes a metadata object with the old config structure
116
+ * and transforms it to the new structure in place.
117
+ */
118
+ function applyMigration(metadata) {
119
+ if (!needsMigration(metadata)) {
120
+ return metadata;
121
+ }
122
+ const migrated = migrateAuthTransportConfig(metadata);
123
+ // Apply migrated transport config
124
+ if (migrated.transport) {
125
+ metadata['transport'] = {
126
+ ...metadata.transport,
127
+ ...migrated.transport,
128
+ };
129
+ }
130
+ // Apply migrated redis config
131
+ if (migrated.redis) {
132
+ metadata['redis'] = migrated.redis;
133
+ }
134
+ // Apply cleaned auth config (without transport)
135
+ if (migrated.auth) {
136
+ metadata.auth = migrated.auth;
137
+ }
138
+ return metadata;
139
+ }
140
+ //# sourceMappingURL=auth-transport.migrate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-transport.migrate.js","sourceRoot":"","sources":["../../../../src/common/migrate/auth-transport.migrate.ts"],"names":[],"mappings":";AAAA,2CAA2C;AAC3C,EAAE;AACF,0DAA0D;AAC1D,EAAE;AACF,yEAAyE;AACzE,qEAAqE;AACrE,EAAE;AACF,uBAAuB;AACvB,6CAA6C;AAC7C,mCAAmC;AACnC,8EAA8E;AAC9E,4DAA4D;;AAwE5D,0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Q,CAAC,IAAI,EAAE,CAAC;QAClB,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;IAChC,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["// common/migrate/auth-transport.migrate.ts\n//\n// Migration helper for auth.transport -> transport config\n//\n// This file handles backward compatibility for the old config structure.\n// DELETE THIS FILE when removing deprecated support (target: v1.0.0)\n//\n// Migration performed:\n// 1. auth.transport -> transport (top-level)\n// 2. session -> transport (merged)\n// 3. auth.transport.recreation.redis -> redis (top-level, if not already set)\n// 4. auth.tokenStorage.config -> references top-level redis\n\nimport type { TransportOptionsInput } from '../types/options/transport.options';\nimport type { RedisOptionsInput } from '../types/options/redis.options';\nimport type { SessionOptions } from '../types/options/session.options';\n\n/**\n * Old transport config structure (nested under auth)\n */\ninterface OldTransportConfig {\n enableLegacySSE?: boolean;\n enableSseListener?: boolean;\n enableStreamableHttp?: boolean;\n enableStatelessHttp?: boolean;\n enableStatefulHttp?: boolean;\n requireSessionForStreamable?: boolean;\n recreation?: {\n enabled?: boolean;\n redis?: RedisOptionsInput;\n defaultTtlMs?: number;\n };\n}\n\n/**\n * Old auth config structure (with nested transport)\n */\ninterface OldAuthConfig {\n mode: string;\n transport?: OldTransportConfig;\n [key: string]: unknown;\n}\n\n/**\n * Metadata structure for migration\n */\ninterface MigratableMetadata {\n auth?: OldAuthConfig;\n session?: SessionOptions;\n transport?: TransportOptionsInput;\n redis?: RedisOptionsInput;\n}\n\nlet deprecationWarningShown = false;\n\n/**\n * Show deprecation warning once per process\n */\nfunction showDeprecationWarning(hasOldTransport: boolean, hasOldSession: boolean): void {\n if (deprecationWarningShown) {\n return;\n }\n deprecationWarningShown = true;\n\n const warnings: string[] = [];\n if (hasOldTransport) {\n warnings.push(' - auth.transport is deprecated, use top-level \"transport\" instead');\n }\n if (hasOldSession) {\n warnings.push(' - session is deprecated, merge into top-level \"transport\" instead');\n }\n\n console.warn(\n '\\n[DEPRECATION WARNING] FrontMCP config structure has changed:\\n' +\n warnings.join('\\n') +\n '\\n - For Redis config, use top-level \"redis\" instead\\n' +\n '\\nSee documentation: https://docs.agentfront.dev/docs/servers/server\\n',\n );\n}\n\n/**\n * Reset deprecation warning flag (for testing)\n */\nexport function resetDeprecationWarning(): void {\n deprecationWarningShown = false;\n}\n\n/**\n * Check if config needs migration\n */\nexport function needsMigration(metadata: MigratableMetadata): boolean {\n const hasOldTransport = !!(metadata.auth && 'transport' in metadata.auth && metadata.auth.transport);\n const hasOldSession = !!metadata.session;\n return hasOldTransport || hasOldSession;\n}\n\n/**\n * Migrate old config structure to new structure\n *\n * Returns the migrated values that should be applied to the metadata\n */\nexport function migrateAuthTransportConfig(metadata: MigratableMetadata): {\n transport?: TransportOptionsInput;\n redis?: RedisOptionsInput;\n auth?: OldAuthConfig;\n} {\n const result: {\n transport?: TransportOptionsInput;\n redis?: RedisOptionsInput;\n auth?: OldAuthConfig;\n } = {};\n\n const hasOldTransport = !!(metadata.auth && 'transport' in metadata.auth && metadata.auth.transport);\n const hasOldSession = !!metadata.session;\n\n if (!hasOldTransport && !hasOldSession) {\n return result;\n }\n\n // Show deprecation warning\n showDeprecationWarning(hasOldTransport, hasOldSession);\n\n // Start with existing transport config if present\n result.transport = { ...metadata.transport };\n\n // Migrate session config\n if (hasOldSession) {\n const session = metadata.session!;\n result.transport = {\n ...result.transport,\n sessionMode: session.sessionMode,\n transportIdMode: session.transportIdMode,\n platformDetection: session.platformDetection,\n };\n }\n\n // Migrate auth.transport config\n if (hasOldTransport) {\n const oldTransport = metadata.auth!.transport!;\n\n // Merge transport protocol settings\n result.transport = {\n ...result.transport,\n enableLegacySSE: oldTransport.enableLegacySSE ?? result.transport.enableLegacySSE,\n enableSseListener: oldTransport.enableSseListener ?? result.transport.enableSseListener,\n enableStreamableHttp: oldTransport.enableStreamableHttp ?? result.transport.enableStreamableHttp,\n enableStatelessHttp: oldTransport.enableStatelessHttp ?? result.transport.enableStatelessHttp,\n enableStatefulHttp: oldTransport.enableStatefulHttp ?? result.transport.enableStatefulHttp,\n requireSessionForStreamable:\n oldTransport.requireSessionForStreamable ?? result.transport.requireSessionForStreamable,\n };\n\n // Migrate recreation -> persistence\n if (oldTransport.recreation) {\n result.transport.persistence = {\n enabled: oldTransport.recreation.enabled ?? false,\n redis: oldTransport.recreation.redis,\n defaultTtlMs: oldTransport.recreation.defaultTtlMs,\n };\n\n // Extract Redis config to top-level if not already present\n if (oldTransport.recreation.redis && !metadata.redis) {\n result.redis = oldTransport.recreation.redis;\n }\n }\n\n // Create clean auth without transport\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { transport: _, ...cleanAuth } = metadata.auth!;\n result.auth = cleanAuth as OldAuthConfig;\n }\n\n return result;\n}\n\n/**\n * Apply migration to metadata (mutates in place for decorator use)\n *\n * This function takes a metadata object with the old config structure\n * and transforms it to the new structure in place.\n */\nexport function applyMigration<T extends MigratableMetadata>(metadata: T): T {\n if (!needsMigration(metadata)) {\n return metadata;\n }\n\n const migrated = migrateAuthTransportConfig(metadata);\n\n // Apply migrated transport config\n if (migrated.transport) {\n (metadata as Record<string, unknown>)['transport'] = {\n ...metadata.transport,\n ...migrated.transport,\n };\n }\n\n // Apply migrated redis config\n if (migrated.redis) {\n (metadata as Record<string, unknown>)['redis'] = migrated.redis;\n }\n\n // Apply cleaned auth config (without transport)\n if (migrated.auth) {\n metadata.auth = migrated.auth;\n }\n\n return metadata;\n}\n"]}
@@ -0,0 +1 @@
1
+ export * from './auth-transport.migrate';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ // common/migrate/index.ts
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const tslib_1 = require("tslib");
5
+ tslib_1.__exportStar(require("./auth-transport.migrate"), exports);
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/common/migrate/index.ts"],"names":[],"mappings":";AAAA,0BAA0B;;;AAE1B,mEAAyC","sourcesContent":["// common/migrate/index.ts\n\nexport * from './auth-transport.migrate';\n"]}
@@ -298,19 +298,28 @@ export declare const HttpJsonRpcSchema: z.ZodObject<{
298
298
  kind: z.ZodLiteral<"jsonrpc">;
299
299
  status: z.ZodNumber;
300
300
  contentType: z.ZodDefault<z.ZodString>;
301
- body: z.ZodUnion<readonly [z.ZodObject<{
301
+ body: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject<{
302
302
  jsonrpc: z.ZodLiteral<"2.0">;
303
303
  id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
304
304
  result: z.ZodObject<{
305
305
  _meta: z.ZodOptional<z.ZodObject<{
306
+ progressToken: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
306
307
  "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{
307
308
  taskId: z.ZodString;
308
- }, z.core.$loose>>;
309
+ }, z.core.$strip>>;
309
310
  }, z.core.$loose>>;
310
311
  }, z.core.$loose>;
311
312
  }, z.core.$strict>, z.ZodObject<{
312
313
  jsonrpc: z.ZodLiteral<"2.0">;
313
- id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
314
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
315
+ error: z.ZodObject<{
316
+ code: z.ZodNumber;
317
+ message: z.ZodString;
318
+ data: z.ZodOptional<z.ZodUnknown>;
319
+ }, z.core.$strip>;
320
+ }, z.core.$strict>]>, z.ZodObject<{
321
+ jsonrpc: z.ZodLiteral<"2.0">;
322
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
314
323
  error: z.ZodObject<{
315
324
  code: z.ZodNumber;
316
325
  message: z.ZodString;
@@ -596,19 +605,28 @@ export declare const httpOutputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
596
605
  kind: z.ZodLiteral<"jsonrpc">;
597
606
  status: z.ZodNumber;
598
607
  contentType: z.ZodDefault<z.ZodString>;
599
- body: z.ZodUnion<readonly [z.ZodObject<{
608
+ body: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject<{
600
609
  jsonrpc: z.ZodLiteral<"2.0">;
601
610
  id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
602
611
  result: z.ZodObject<{
603
612
  _meta: z.ZodOptional<z.ZodObject<{
613
+ progressToken: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
604
614
  "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{
605
615
  taskId: z.ZodString;
606
- }, z.core.$loose>>;
616
+ }, z.core.$strip>>;
607
617
  }, z.core.$loose>>;
608
618
  }, z.core.$loose>;
609
619
  }, z.core.$strict>, z.ZodObject<{
610
620
  jsonrpc: z.ZodLiteral<"2.0">;
611
- id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
621
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
622
+ error: z.ZodObject<{
623
+ code: z.ZodNumber;
624
+ message: z.ZodString;
625
+ data: z.ZodOptional<z.ZodUnknown>;
626
+ }, z.core.$strip>;
627
+ }, z.core.$strict>]>, z.ZodObject<{
628
+ jsonrpc: z.ZodLiteral<"2.0">;
629
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
612
630
  error: z.ZodObject<{
613
631
  code: z.ZodNumber;
614
632
  message: z.ZodString;
@@ -1,3 +1,4 @@
1
1
  export * from './annotated-class.schema';
2
2
  export * from './http-output.schema';
3
3
  export * from './http-input.schema';
4
+ export * from './session-header.schema';
@@ -4,4 +4,5 @@ const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./annotated-class.schema"), exports);
5
5
  tslib_1.__exportStar(require("./http-output.schema"), exports);
6
6
  tslib_1.__exportStar(require("./http-input.schema"), exports);
7
+ tslib_1.__exportStar(require("./session-header.schema"), exports);
7
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/common/schemas/index.ts"],"names":[],"mappings":";;;AAAA,mEAAyC;AACzC,+DAAqC;AACrC,8DAAoC","sourcesContent":["export * from './annotated-class.schema';\nexport * from './http-output.schema';\nexport * from './http-input.schema';"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/common/schemas/index.ts"],"names":[],"mappings":";;;AAAA,mEAAyC;AACzC,+DAAqC;AACrC,8DAAoC;AACpC,kEAAwC","sourcesContent":["export * from './annotated-class.schema';\nexport * from './http-output.schema';\nexport * from './http-input.schema';\nexport * from './session-header.schema';\n"]}
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Zod schema for validating mcp-session-id header format.
4
+ * Uses Zod's built-in validators to prevent ReDoS attacks and ensure safe validation.
5
+ *
6
+ * - Max length: 2048 characters (encrypted session IDs can be 460-700+ characters
7
+ * due to AES-256-GCM encryption producing base64url format: iv.tag.ciphertext)
8
+ * - Only allows printable ASCII characters (0x20-0x7E)
9
+ * - Rejects control characters and null bytes
10
+ */
11
+ export declare const mcpSessionHeaderSchema: z.ZodString;
12
+ /**
13
+ * Validate mcp-session-id header using Zod schema.
14
+ * Returns undefined for invalid or missing values.
15
+ */
16
+ export declare function validateMcpSessionHeader(value: string | undefined): string | undefined;