@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
@@ -0,0 +1,148 @@
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.ZodUnion<readonly [z.ZodObject<{
11
+ provider: z.ZodLiteral<"redis">;
12
+ host: z.ZodString;
13
+ port: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
14
+ password: z.ZodOptional<z.ZodString>;
15
+ db: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
16
+ tls: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
17
+ keyPrefix: z.ZodDefault<z.ZodOptional<z.ZodString>>;
18
+ defaultTtlMs: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
19
+ }, z.core.$strip>, z.ZodObject<{
20
+ provider: z.ZodLiteral<"vercel-kv">;
21
+ url: z.ZodOptional<z.ZodString>;
22
+ token: z.ZodOptional<z.ZodString>;
23
+ keyPrefix: z.ZodDefault<z.ZodOptional<z.ZodString>>;
24
+ defaultTtlMs: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
25
+ }, z.core.$strip>, z.ZodPipe<z.ZodObject<{
26
+ host: z.ZodString;
27
+ port: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
28
+ password: z.ZodOptional<z.ZodString>;
29
+ db: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
30
+ tls: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
31
+ keyPrefix: z.ZodDefault<z.ZodOptional<z.ZodString>>;
32
+ defaultTtlMs: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
33
+ }, z.core.$strip>, z.ZodTransform<{
34
+ provider: "redis";
35
+ host: string;
36
+ port: number;
37
+ db: number;
38
+ tls: boolean;
39
+ keyPrefix: string;
40
+ defaultTtlMs: number;
41
+ password?: string | undefined;
42
+ }, {
43
+ host: string;
44
+ port: number;
45
+ db: number;
46
+ tls: boolean;
47
+ keyPrefix: string;
48
+ defaultTtlMs: number;
49
+ password?: string | undefined;
50
+ }>>]>>;
51
+ defaultTtlMs: z.ZodDefault<z.ZodNumber>;
52
+ }, z.core.$strip>;
53
+ /**
54
+ * Transport options schema
55
+ * Consolidates transport protocol config + session lifecycle config
56
+ */
57
+ export declare const transportOptionsSchema: z.ZodObject<{
58
+ sessionMode: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"stateful">, z.ZodLiteral<"stateless">, z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>]>>>;
59
+ transportIdMode: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"uuid">, z.ZodLiteral<"jwt">, z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>]>>>;
60
+ platformDetection: z.ZodOptional<z.ZodObject<{
61
+ mappings: z.ZodOptional<z.ZodArray<z.ZodObject<{
62
+ pattern: z.ZodUnion<readonly [z.ZodString, z.ZodCustom<RegExp, RegExp>]>;
63
+ platform: z.ZodEnum<{
64
+ unknown: "unknown";
65
+ continue: "continue";
66
+ openai: "openai";
67
+ claude: "claude";
68
+ gemini: "gemini";
69
+ cursor: "cursor";
70
+ cody: "cody";
71
+ "generic-mcp": "generic-mcp";
72
+ "ext-apps": "ext-apps";
73
+ }>;
74
+ }, z.core.$strip>>>;
75
+ customOnly: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
76
+ }, z.core.$strip>>;
77
+ enableLegacySSE: z.ZodDefault<z.ZodBoolean>;
78
+ enableSseListener: z.ZodDefault<z.ZodBoolean>;
79
+ enableStreamableHttp: z.ZodDefault<z.ZodBoolean>;
80
+ enableStatelessHttp: z.ZodDefault<z.ZodBoolean>;
81
+ enableStatefulHttp: z.ZodDefault<z.ZodBoolean>;
82
+ requireSessionForStreamable: z.ZodDefault<z.ZodBoolean>;
83
+ persistence: z.ZodOptional<z.ZodObject<{
84
+ enabled: z.ZodDefault<z.ZodBoolean>;
85
+ redis: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
86
+ provider: z.ZodLiteral<"redis">;
87
+ host: z.ZodString;
88
+ port: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
89
+ password: z.ZodOptional<z.ZodString>;
90
+ db: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
91
+ tls: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
92
+ keyPrefix: z.ZodDefault<z.ZodOptional<z.ZodString>>;
93
+ defaultTtlMs: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
94
+ }, z.core.$strip>, z.ZodObject<{
95
+ provider: z.ZodLiteral<"vercel-kv">;
96
+ url: z.ZodOptional<z.ZodString>;
97
+ token: z.ZodOptional<z.ZodString>;
98
+ keyPrefix: z.ZodDefault<z.ZodOptional<z.ZodString>>;
99
+ defaultTtlMs: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
100
+ }, z.core.$strip>, z.ZodPipe<z.ZodObject<{
101
+ host: z.ZodString;
102
+ port: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
103
+ password: z.ZodOptional<z.ZodString>;
104
+ db: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
105
+ tls: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
106
+ keyPrefix: z.ZodDefault<z.ZodOptional<z.ZodString>>;
107
+ defaultTtlMs: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
108
+ }, z.core.$strip>, z.ZodTransform<{
109
+ provider: "redis";
110
+ host: string;
111
+ port: number;
112
+ db: number;
113
+ tls: boolean;
114
+ keyPrefix: string;
115
+ defaultTtlMs: number;
116
+ password?: string | undefined;
117
+ }, {
118
+ host: string;
119
+ port: number;
120
+ db: number;
121
+ tls: boolean;
122
+ keyPrefix: string;
123
+ defaultTtlMs: number;
124
+ password?: string | undefined;
125
+ }>>]>>;
126
+ defaultTtlMs: z.ZodDefault<z.ZodNumber>;
127
+ }, z.core.$strip>>;
128
+ }, z.core.$strip>;
129
+ /**
130
+ * Transport options type (with defaults applied)
131
+ */
132
+ export type TransportOptions = z.infer<typeof transportOptionsSchema>;
133
+ /**
134
+ * Transport options input type (for user configuration)
135
+ */
136
+ export type TransportOptionsInput = z.input<typeof transportOptionsSchema>;
137
+ /**
138
+ * Transport persistence configuration type
139
+ */
140
+ export type TransportPersistenceConfig = z.infer<typeof transportPersistenceConfigSchema>;
141
+ /**
142
+ * Transport persistence configuration input type
143
+ */
144
+ export type TransportPersistenceConfigInput = z.input<typeof transportPersistenceConfigSchema>;
145
+ /**
146
+ * Platform detection configuration type
147
+ */
148
+ 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,GAAG,OAAC,CAAC,MAAM,CAAC;IACvD;;;;OAIG;IACH,OAAO,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IAEnC;;;;OAIG;IACH,KAAK,EAAE,kCAAkB,CAAC,QAAQ,EAAE;IAEpC;;;OAGG;IACH,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;CAC3D,CAAC,CAAC;AAEH,+CAA+C;AAC/C,qCAAqC;AACrC,+CAA+C;AAE/C;;;GAGG;AACU,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,+CAA+C;IAC/C,8CAA8C;IAC9C,+CAA+C;IAE/C;;;;;;;;OAQG;IACH,WAAW,EAAE,OAAC;SACX,KAAK,CAAC,CAAC,OAAC,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,OAAC,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,OAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;SACpE,QAAQ,EAAE;SACV,OAAO,CAAC,UAAU,CAAC;IAEtB;;;;;;;;OAQG;IACH,eAAe,EAAE,OAAC;SACf,KAAK,CAAC,CAAC,OAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,OAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,OAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;SAC1D,QAAQ,EAAE;SACV,OAAO,CAAC,MAAM,CAAC;IAElB;;;OAGG;IACH,iBAAiB,EAAE,+CAA6B,CAAC,QAAQ,EAAE;IAE3D,+CAA+C;IAC/C,4CAA4C;IAC5C,+CAA+C;IAE/C;;;OAGG;IACH,eAAe,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IAE3C;;;OAGG;IACH,iBAAiB,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;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"]}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Global Configuration Utilities
3
+ *
4
+ * Helper functions for plugins to access global configuration from @FrontMcp decorator.
5
+ */
6
+ import type { FrontMcpConfigType } from '../metadata';
7
+ import type { RedisOptions } from '../types';
8
+ /**
9
+ * Extract store configuration from global FrontMcp configuration.
10
+ *
11
+ * This helper is used by plugins that want to use the global redis/store
12
+ * configuration instead of requiring explicit configuration.
13
+ *
14
+ * @param pluginName - Name of the plugin requesting the config (for error messages)
15
+ * @param config - The FrontMcp configuration object
16
+ * @returns The redis/store configuration
17
+ * @throws GlobalConfigNotFoundError if redis is not configured
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * // In plugin dynamicProviders:
22
+ * static dynamicProviders = (options: MyPluginOptions) => {
23
+ * if (options.type === 'global-store') {
24
+ * return [{
25
+ * provide: MyStoreToken,
26
+ * inject: () => [FrontMcpConfig],
27
+ * useFactory: (config: FrontMcpConfigType) => {
28
+ * const storeConfig = getGlobalStoreConfig('MyPlugin', config);
29
+ * return new MyStoreProvider(storeConfig);
30
+ * },
31
+ * }];
32
+ * }
33
+ * };
34
+ * ```
35
+ */
36
+ export declare function getGlobalStoreConfig(pluginName: string, config: FrontMcpConfigType): RedisOptions;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ /**
3
+ * Global Configuration Utilities
4
+ *
5
+ * Helper functions for plugins to access global configuration from @FrontMcp decorator.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.getGlobalStoreConfig = getGlobalStoreConfig;
9
+ const errors_1 = require("../../errors");
10
+ /**
11
+ * Extract store configuration from global FrontMcp configuration.
12
+ *
13
+ * This helper is used by plugins that want to use the global redis/store
14
+ * configuration instead of requiring explicit configuration.
15
+ *
16
+ * @param pluginName - Name of the plugin requesting the config (for error messages)
17
+ * @param config - The FrontMcp configuration object
18
+ * @returns The redis/store configuration
19
+ * @throws GlobalConfigNotFoundError if redis is not configured
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * // In plugin dynamicProviders:
24
+ * static dynamicProviders = (options: MyPluginOptions) => {
25
+ * if (options.type === 'global-store') {
26
+ * return [{
27
+ * provide: MyStoreToken,
28
+ * inject: () => [FrontMcpConfig],
29
+ * useFactory: (config: FrontMcpConfigType) => {
30
+ * const storeConfig = getGlobalStoreConfig('MyPlugin', config);
31
+ * return new MyStoreProvider(storeConfig);
32
+ * },
33
+ * }];
34
+ * }
35
+ * };
36
+ * ```
37
+ */
38
+ function getGlobalStoreConfig(pluginName, config) {
39
+ if (!config.redis) {
40
+ throw new errors_1.GlobalConfigNotFoundError(pluginName, 'redis');
41
+ }
42
+ return config.redis;
43
+ }
44
+ //# sourceMappingURL=global-config.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"global-config.utils.js","sourceRoot":"","sources":["../../../../src/common/utils/global-config.utils.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAkCH,oDAKC;AAnCD,yCAAyD;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,SAAgB,oBAAoB,CAAC,UAAkB,EAAE,MAA0B;IACjF,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,IAAI,kCAAyB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC;AACtB,CAAC","sourcesContent":["/**\n * Global Configuration Utilities\n *\n * Helper functions for plugins to access global configuration from @FrontMcp decorator.\n */\n\nimport type { FrontMcpConfigType } from '../metadata';\nimport type { RedisOptions } from '../types';\nimport { GlobalConfigNotFoundError } from '../../errors';\n\n/**\n * Extract store configuration from global FrontMcp configuration.\n *\n * This helper is used by plugins that want to use the global redis/store\n * configuration instead of requiring explicit configuration.\n *\n * @param pluginName - Name of the plugin requesting the config (for error messages)\n * @param config - The FrontMcp configuration object\n * @returns The redis/store configuration\n * @throws GlobalConfigNotFoundError if redis is not configured\n *\n * @example\n * ```typescript\n * // In plugin dynamicProviders:\n * static dynamicProviders = (options: MyPluginOptions) => {\n * if (options.type === 'global-store') {\n * return [{\n * provide: MyStoreToken,\n * inject: () => [FrontMcpConfig],\n * useFactory: (config: FrontMcpConfigType) => {\n * const storeConfig = getGlobalStoreConfig('MyPlugin', config);\n * return new MyStoreProvider(storeConfig);\n * },\n * }];\n * }\n * };\n * ```\n */\nexport function getGlobalStoreConfig(pluginName: string, config: FrontMcpConfigType): RedisOptions {\n if (!config.redis) {\n throw new GlobalConfigNotFoundError(pluginName, 'redis');\n }\n return config.redis;\n}\n"]}
@@ -1,2 +1,3 @@
1
1
  export * from './decide-request-intent.utils';
2
2
  export * from './path.utils';
3
+ export * from './global-config.utils';
@@ -3,4 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./decide-request-intent.utils"), exports);
5
5
  tslib_1.__exportStar(require("./path.utils"), exports);
6
+ tslib_1.__exportStar(require("./global-config.utils"), exports);
6
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/common/utils/index.ts"],"names":[],"mappings":";;;AAAA,wEAA6C;AAC7C,uDAA4B","sourcesContent":["export * from './decide-request-intent.utils'\nexport * from './path.utils'"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/common/utils/index.ts"],"names":[],"mappings":";;;AAAA,wEAA8C;AAC9C,uDAA6B;AAC7B,gEAAsC","sourcesContent":["export * from './decide-request-intent.utils';\nexport * from './path.utils';\nexport * from './global-config.utils';\n"]}
@@ -4,15 +4,11 @@ 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>>;
11
7
  _meta: z.ZodOptional<z.ZodObject<{
12
8
  progressToken: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
13
9
  "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{
14
10
  taskId: z.ZodString;
15
- }, z.core.$loose>>;
11
+ }, z.core.$strip>>;
16
12
  }, z.core.$loose>>;
17
13
  ref: z.ZodUnion<readonly [z.ZodObject<{
18
14
  type: z.ZodLiteral<"ref/prompt">;
@@ -28,15 +24,16 @@ declare const inputSchema: z.ZodObject<{
28
24
  context: z.ZodOptional<z.ZodObject<{
29
25
  arguments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
30
26
  }, z.core.$strip>>;
31
- }, z.core.$loose>;
27
+ }, z.core.$strip>;
32
28
  }, z.core.$strip>;
33
29
  ctx: z.ZodUnknown;
34
30
  }, z.core.$strip>;
35
31
  declare const outputSchema: z.ZodObject<{
36
32
  _meta: z.ZodOptional<z.ZodObject<{
33
+ progressToken: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
37
34
  "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{
38
35
  taskId: z.ZodString;
39
- }, z.core.$loose>>;
36
+ }, z.core.$strip>>;
40
37
  }, z.core.$loose>>;
41
38
  completion: z.ZodObject<{
42
39
  values: z.ZodArray<z.ZodString>;
@@ -58,9 +55,10 @@ declare const stateSchema: z.ZodObject<{
58
55
  }, z.core.$strip>;
59
56
  output: z.ZodObject<{
60
57
  _meta: z.ZodOptional<z.ZodObject<{
58
+ progressToken: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
61
59
  "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{
62
60
  taskId: z.ZodString;
63
- }, z.core.$loose>>;
61
+ }, z.core.$strip>>;
64
62
  }, z.core.$loose>>;
65
63
  completion: z.ZodObject<{
66
64
  values: z.ZodArray<z.ZodString>;
@@ -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 };