@cyanheads/mcp-ts-core 0.1.0-beta.12

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 (485) hide show
  1. package/CLAUDE.md +583 -0
  2. package/LICENSE +201 -0
  3. package/README.md +287 -0
  4. package/biome.json +103 -0
  5. package/dist/app.d.ts +82 -0
  6. package/dist/app.d.ts.map +1 -0
  7. package/dist/app.js +222 -0
  8. package/dist/app.js.map +1 -0
  9. package/dist/cli/init.d.ts +8 -0
  10. package/dist/cli/init.d.ts.map +1 -0
  11. package/dist/cli/init.js +161 -0
  12. package/dist/cli/init.js.map +1 -0
  13. package/dist/config/index.d.ts +349 -0
  14. package/dist/config/index.d.ts.map +1 -0
  15. package/dist/config/index.js +464 -0
  16. package/dist/config/index.js.map +1 -0
  17. package/dist/context.d.ts +119 -0
  18. package/dist/context.d.ts.map +1 -0
  19. package/dist/context.js +144 -0
  20. package/dist/context.js.map +1 -0
  21. package/dist/index.d.ts +8 -0
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +9 -0
  24. package/dist/index.js.map +1 -0
  25. package/dist/mcp-server/prompts/prompt-registration.d.ts +33 -0
  26. package/dist/mcp-server/prompts/prompt-registration.d.ts.map +1 -0
  27. package/dist/mcp-server/prompts/prompt-registration.js +91 -0
  28. package/dist/mcp-server/prompts/prompt-registration.js.map +1 -0
  29. package/dist/mcp-server/prompts/utils/newPromptDefinition.d.ts +49 -0
  30. package/dist/mcp-server/prompts/utils/newPromptDefinition.d.ts.map +1 -0
  31. package/dist/mcp-server/prompts/utils/newPromptDefinition.js +39 -0
  32. package/dist/mcp-server/prompts/utils/newPromptDefinition.js.map +1 -0
  33. package/dist/mcp-server/prompts/utils/promptDefinition.d.ts +37 -0
  34. package/dist/mcp-server/prompts/utils/promptDefinition.d.ts.map +1 -0
  35. package/dist/mcp-server/prompts/utils/promptDefinition.js +2 -0
  36. package/dist/mcp-server/prompts/utils/promptDefinition.js.map +1 -0
  37. package/dist/mcp-server/resources/resource-registration.d.ts +27 -0
  38. package/dist/mcp-server/resources/resource-registration.d.ts.map +1 -0
  39. package/dist/mcp-server/resources/resource-registration.js +85 -0
  40. package/dist/mcp-server/resources/resource-registration.js.map +1 -0
  41. package/dist/mcp-server/resources/utils/newResourceDefinition.d.ts +84 -0
  42. package/dist/mcp-server/resources/utils/newResourceDefinition.d.ts.map +1 -0
  43. package/dist/mcp-server/resources/utils/newResourceDefinition.js +40 -0
  44. package/dist/mcp-server/resources/utils/newResourceDefinition.js.map +1 -0
  45. package/dist/mcp-server/resources/utils/newResourceHandlerFactory.d.ts +32 -0
  46. package/dist/mcp-server/resources/utils/newResourceHandlerFactory.d.ts.map +1 -0
  47. package/dist/mcp-server/resources/utils/newResourceHandlerFactory.js +103 -0
  48. package/dist/mcp-server/resources/utils/newResourceHandlerFactory.js.map +1 -0
  49. package/dist/mcp-server/resources/utils/resourceDefinition.d.ts +94 -0
  50. package/dist/mcp-server/resources/utils/resourceDefinition.d.ts.map +1 -0
  51. package/dist/mcp-server/resources/utils/resourceDefinition.js +2 -0
  52. package/dist/mcp-server/resources/utils/resourceDefinition.js.map +1 -0
  53. package/dist/mcp-server/resources/utils/resourceHandlerFactory.d.ts +14 -0
  54. package/dist/mcp-server/resources/utils/resourceHandlerFactory.d.ts.map +1 -0
  55. package/dist/mcp-server/resources/utils/resourceHandlerFactory.js +111 -0
  56. package/dist/mcp-server/resources/utils/resourceHandlerFactory.js.map +1 -0
  57. package/dist/mcp-server/roots/roots-registration.d.ts +22 -0
  58. package/dist/mcp-server/roots/roots-registration.d.ts.map +1 -0
  59. package/dist/mcp-server/roots/roots-registration.js +25 -0
  60. package/dist/mcp-server/roots/roots-registration.js.map +1 -0
  61. package/dist/mcp-server/server.d.ts +34 -0
  62. package/dist/mcp-server/server.d.ts.map +1 -0
  63. package/dist/mcp-server/server.js +62 -0
  64. package/dist/mcp-server/server.js.map +1 -0
  65. package/dist/mcp-server/tasks/core/sessionAwareTaskStore.d.ts +42 -0
  66. package/dist/mcp-server/tasks/core/sessionAwareTaskStore.d.ts.map +1 -0
  67. package/dist/mcp-server/tasks/core/sessionAwareTaskStore.js +70 -0
  68. package/dist/mcp-server/tasks/core/sessionAwareTaskStore.js.map +1 -0
  69. package/dist/mcp-server/tasks/core/storageBackedTaskStore.d.ts +109 -0
  70. package/dist/mcp-server/tasks/core/storageBackedTaskStore.d.ts.map +1 -0
  71. package/dist/mcp-server/tasks/core/storageBackedTaskStore.js +209 -0
  72. package/dist/mcp-server/tasks/core/storageBackedTaskStore.js.map +1 -0
  73. package/dist/mcp-server/tasks/core/taskManager.d.ts +103 -0
  74. package/dist/mcp-server/tasks/core/taskManager.d.ts.map +1 -0
  75. package/dist/mcp-server/tasks/core/taskManager.js +144 -0
  76. package/dist/mcp-server/tasks/core/taskManager.js.map +1 -0
  77. package/dist/mcp-server/tasks/core/taskTypes.d.ts +11 -0
  78. package/dist/mcp-server/tasks/core/taskTypes.d.ts.map +1 -0
  79. package/dist/mcp-server/tasks/core/taskTypes.js +13 -0
  80. package/dist/mcp-server/tasks/core/taskTypes.js.map +1 -0
  81. package/dist/mcp-server/tasks/utils/taskToolDefinition.d.ts +108 -0
  82. package/dist/mcp-server/tasks/utils/taskToolDefinition.d.ts.map +1 -0
  83. package/dist/mcp-server/tasks/utils/taskToolDefinition.js +14 -0
  84. package/dist/mcp-server/tasks/utils/taskToolDefinition.js.map +1 -0
  85. package/dist/mcp-server/tools/tool-registration.d.ts +49 -0
  86. package/dist/mcp-server/tools/tool-registration.d.ts.map +1 -0
  87. package/dist/mcp-server/tools/tool-registration.js +269 -0
  88. package/dist/mcp-server/tools/tool-registration.js.map +1 -0
  89. package/dist/mcp-server/tools/utils/newToolDefinition.d.ts +73 -0
  90. package/dist/mcp-server/tools/utils/newToolDefinition.d.ts.map +1 -0
  91. package/dist/mcp-server/tools/utils/newToolDefinition.js +45 -0
  92. package/dist/mcp-server/tools/utils/newToolDefinition.js.map +1 -0
  93. package/dist/mcp-server/tools/utils/newToolHandlerFactory.d.ts +33 -0
  94. package/dist/mcp-server/tools/utils/newToolHandlerFactory.d.ts.map +1 -0
  95. package/dist/mcp-server/tools/utils/newToolHandlerFactory.js +107 -0
  96. package/dist/mcp-server/tools/utils/newToolHandlerFactory.js.map +1 -0
  97. package/dist/mcp-server/tools/utils/toolDefinition.d.ts +118 -0
  98. package/dist/mcp-server/tools/utils/toolDefinition.d.ts.map +1 -0
  99. package/dist/mcp-server/tools/utils/toolDefinition.js +2 -0
  100. package/dist/mcp-server/tools/utils/toolDefinition.js.map +1 -0
  101. package/dist/mcp-server/tools/utils/toolHandlerFactory.d.ts +34 -0
  102. package/dist/mcp-server/tools/utils/toolHandlerFactory.d.ts.map +1 -0
  103. package/dist/mcp-server/tools/utils/toolHandlerFactory.js +68 -0
  104. package/dist/mcp-server/tools/utils/toolHandlerFactory.js.map +1 -0
  105. package/dist/mcp-server/transports/ITransport.d.ts +15 -0
  106. package/dist/mcp-server/transports/ITransport.d.ts.map +1 -0
  107. package/dist/mcp-server/transports/ITransport.js +2 -0
  108. package/dist/mcp-server/transports/ITransport.js.map +1 -0
  109. package/dist/mcp-server/transports/auth/authFactory.d.ts +11 -0
  110. package/dist/mcp-server/transports/auth/authFactory.d.ts.map +1 -0
  111. package/dist/mcp-server/transports/auth/authFactory.js +43 -0
  112. package/dist/mcp-server/transports/auth/authFactory.js.map +1 -0
  113. package/dist/mcp-server/transports/auth/authMiddleware.d.ts +24 -0
  114. package/dist/mcp-server/transports/auth/authMiddleware.d.ts.map +1 -0
  115. package/dist/mcp-server/transports/auth/authMiddleware.js +69 -0
  116. package/dist/mcp-server/transports/auth/authMiddleware.js.map +1 -0
  117. package/dist/mcp-server/transports/auth/lib/authContext.d.ts +34 -0
  118. package/dist/mcp-server/transports/auth/lib/authContext.d.ts.map +1 -0
  119. package/dist/mcp-server/transports/auth/lib/authContext.js +25 -0
  120. package/dist/mcp-server/transports/auth/lib/authContext.js.map +1 -0
  121. package/dist/mcp-server/transports/auth/lib/authTypes.d.ts +19 -0
  122. package/dist/mcp-server/transports/auth/lib/authTypes.d.ts.map +1 -0
  123. package/dist/mcp-server/transports/auth/lib/authTypes.js +2 -0
  124. package/dist/mcp-server/transports/auth/lib/authTypes.js.map +1 -0
  125. package/dist/mcp-server/transports/auth/lib/authUtils.d.ts +18 -0
  126. package/dist/mcp-server/transports/auth/lib/authUtils.d.ts.map +1 -0
  127. package/dist/mcp-server/transports/auth/lib/authUtils.js +64 -0
  128. package/dist/mcp-server/transports/auth/lib/authUtils.js.map +1 -0
  129. package/dist/mcp-server/transports/auth/lib/checkScopes.d.ts +25 -0
  130. package/dist/mcp-server/transports/auth/lib/checkScopes.d.ts.map +1 -0
  131. package/dist/mcp-server/transports/auth/lib/checkScopes.js +34 -0
  132. package/dist/mcp-server/transports/auth/lib/checkScopes.js.map +1 -0
  133. package/dist/mcp-server/transports/auth/lib/claimParser.d.ts +34 -0
  134. package/dist/mcp-server/transports/auth/lib/claimParser.d.ts.map +1 -0
  135. package/dist/mcp-server/transports/auth/lib/claimParser.js +58 -0
  136. package/dist/mcp-server/transports/auth/lib/claimParser.js.map +1 -0
  137. package/dist/mcp-server/transports/auth/lib/withAuth.d.ts +25 -0
  138. package/dist/mcp-server/transports/auth/lib/withAuth.d.ts.map +1 -0
  139. package/dist/mcp-server/transports/auth/lib/withAuth.js +30 -0
  140. package/dist/mcp-server/transports/auth/lib/withAuth.js.map +1 -0
  141. package/dist/mcp-server/transports/auth/strategies/authStrategy.d.ts +18 -0
  142. package/dist/mcp-server/transports/auth/strategies/authStrategy.d.ts.map +1 -0
  143. package/dist/mcp-server/transports/auth/strategies/authStrategy.js +2 -0
  144. package/dist/mcp-server/transports/auth/strategies/authStrategy.js.map +1 -0
  145. package/dist/mcp-server/transports/auth/strategies/jwtStrategy.d.ts +14 -0
  146. package/dist/mcp-server/transports/auth/strategies/jwtStrategy.d.ts.map +1 -0
  147. package/dist/mcp-server/transports/auth/strategies/jwtStrategy.js +86 -0
  148. package/dist/mcp-server/transports/auth/strategies/jwtStrategy.js.map +1 -0
  149. package/dist/mcp-server/transports/auth/strategies/oauthStrategy.d.ts +14 -0
  150. package/dist/mcp-server/transports/auth/strategies/oauthStrategy.d.ts.map +1 -0
  151. package/dist/mcp-server/transports/auth/strategies/oauthStrategy.js +113 -0
  152. package/dist/mcp-server/transports/auth/strategies/oauthStrategy.js.map +1 -0
  153. package/dist/mcp-server/transports/http/httpErrorHandler.d.ts +25 -0
  154. package/dist/mcp-server/transports/http/httpErrorHandler.d.ts.map +1 -0
  155. package/dist/mcp-server/transports/http/httpErrorHandler.js +112 -0
  156. package/dist/mcp-server/transports/http/httpErrorHandler.js.map +1 -0
  157. package/dist/mcp-server/transports/http/httpTransport.d.ts +47 -0
  158. package/dist/mcp-server/transports/http/httpTransport.d.ts.map +1 -0
  159. package/dist/mcp-server/transports/http/httpTransport.js +396 -0
  160. package/dist/mcp-server/transports/http/httpTransport.js.map +1 -0
  161. package/dist/mcp-server/transports/http/httpTypes.d.ts +17 -0
  162. package/dist/mcp-server/transports/http/httpTypes.d.ts.map +1 -0
  163. package/dist/mcp-server/transports/http/httpTypes.js +2 -0
  164. package/dist/mcp-server/transports/http/httpTypes.js.map +1 -0
  165. package/dist/mcp-server/transports/http/protectedResourceMetadata.d.ts +21 -0
  166. package/dist/mcp-server/transports/http/protectedResourceMetadata.d.ts.map +1 -0
  167. package/dist/mcp-server/transports/http/protectedResourceMetadata.js +44 -0
  168. package/dist/mcp-server/transports/http/protectedResourceMetadata.js.map +1 -0
  169. package/dist/mcp-server/transports/http/sessionIdUtils.d.ts +33 -0
  170. package/dist/mcp-server/transports/http/sessionIdUtils.d.ts.map +1 -0
  171. package/dist/mcp-server/transports/http/sessionIdUtils.js +54 -0
  172. package/dist/mcp-server/transports/http/sessionIdUtils.js.map +1 -0
  173. package/dist/mcp-server/transports/http/sessionStore.d.ts +87 -0
  174. package/dist/mcp-server/transports/http/sessionStore.d.ts.map +1 -0
  175. package/dist/mcp-server/transports/http/sessionStore.js +209 -0
  176. package/dist/mcp-server/transports/http/sessionStore.js.map +1 -0
  177. package/dist/mcp-server/transports/manager.d.ts +22 -0
  178. package/dist/mcp-server/transports/manager.d.ts.map +1 -0
  179. package/dist/mcp-server/transports/manager.js +62 -0
  180. package/dist/mcp-server/transports/manager.js.map +1 -0
  181. package/dist/mcp-server/transports/stdio/stdioTransport.d.ts +44 -0
  182. package/dist/mcp-server/transports/stdio/stdioTransport.d.ts.map +1 -0
  183. package/dist/mcp-server/transports/stdio/stdioTransport.js +63 -0
  184. package/dist/mcp-server/transports/stdio/stdioTransport.js.map +1 -0
  185. package/dist/services/graph/core/GraphService.d.ts +205 -0
  186. package/dist/services/graph/core/GraphService.d.ts.map +1 -0
  187. package/dist/services/graph/core/GraphService.js +231 -0
  188. package/dist/services/graph/core/GraphService.js.map +1 -0
  189. package/dist/services/graph/core/IGraphProvider.d.ts +295 -0
  190. package/dist/services/graph/core/IGraphProvider.d.ts.map +1 -0
  191. package/dist/services/graph/core/IGraphProvider.js +8 -0
  192. package/dist/services/graph/core/IGraphProvider.js.map +1 -0
  193. package/dist/services/graph/types.d.ts +107 -0
  194. package/dist/services/graph/types.d.ts.map +1 -0
  195. package/dist/services/graph/types.js +8 -0
  196. package/dist/services/graph/types.js.map +1 -0
  197. package/dist/services/llm/core/ILlmProvider.d.ts +86 -0
  198. package/dist/services/llm/core/ILlmProvider.d.ts.map +1 -0
  199. package/dist/services/llm/core/ILlmProvider.js +2 -0
  200. package/dist/services/llm/core/ILlmProvider.js.map +1 -0
  201. package/dist/services/llm/providers/openrouter.provider.d.ts +187 -0
  202. package/dist/services/llm/providers/openrouter.provider.d.ts.map +1 -0
  203. package/dist/services/llm/providers/openrouter.provider.js +302 -0
  204. package/dist/services/llm/providers/openrouter.provider.js.map +1 -0
  205. package/dist/services/llm/types.d.ts +16 -0
  206. package/dist/services/llm/types.d.ts.map +1 -0
  207. package/dist/services/llm/types.js +9 -0
  208. package/dist/services/llm/types.js.map +1 -0
  209. package/dist/services/speech/core/ISpeechProvider.d.ts +92 -0
  210. package/dist/services/speech/core/ISpeechProvider.d.ts.map +1 -0
  211. package/dist/services/speech/core/ISpeechProvider.js +34 -0
  212. package/dist/services/speech/core/ISpeechProvider.js.map +1 -0
  213. package/dist/services/speech/core/SpeechService.d.ts +87 -0
  214. package/dist/services/speech/core/SpeechService.d.ts.map +1 -0
  215. package/dist/services/speech/core/SpeechService.js +135 -0
  216. package/dist/services/speech/core/SpeechService.js.map +1 -0
  217. package/dist/services/speech/providers/elevenlabs.provider.d.ts +77 -0
  218. package/dist/services/speech/providers/elevenlabs.provider.d.ts.map +1 -0
  219. package/dist/services/speech/providers/elevenlabs.provider.js +199 -0
  220. package/dist/services/speech/providers/elevenlabs.provider.js.map +1 -0
  221. package/dist/services/speech/providers/whisper.provider.d.ts +94 -0
  222. package/dist/services/speech/providers/whisper.provider.d.ts.map +1 -0
  223. package/dist/services/speech/providers/whisper.provider.js +240 -0
  224. package/dist/services/speech/providers/whisper.provider.js.map +1 -0
  225. package/dist/services/speech/types.d.ts +173 -0
  226. package/dist/services/speech/types.d.ts.map +1 -0
  227. package/dist/services/speech/types.js +8 -0
  228. package/dist/services/speech/types.js.map +1 -0
  229. package/dist/storage/core/IStorageProvider.d.ts +159 -0
  230. package/dist/storage/core/IStorageProvider.d.ts.map +1 -0
  231. package/dist/storage/core/IStorageProvider.js +2 -0
  232. package/dist/storage/core/IStorageProvider.js.map +1 -0
  233. package/dist/storage/core/StorageService.d.ts +22 -0
  234. package/dist/storage/core/StorageService.d.ts.map +1 -0
  235. package/dist/storage/core/StorageService.js +151 -0
  236. package/dist/storage/core/StorageService.js.map +1 -0
  237. package/dist/storage/core/storageFactory.d.ts +66 -0
  238. package/dist/storage/core/storageFactory.d.ts.map +1 -0
  239. package/dist/storage/core/storageFactory.js +122 -0
  240. package/dist/storage/core/storageFactory.js.map +1 -0
  241. package/dist/storage/core/storageValidation.d.ts +77 -0
  242. package/dist/storage/core/storageValidation.d.ts.map +1 -0
  243. package/dist/storage/core/storageValidation.js +303 -0
  244. package/dist/storage/core/storageValidation.js.map +1 -0
  245. package/dist/storage/providers/cloudflare/d1Provider.d.ts +94 -0
  246. package/dist/storage/providers/cloudflare/d1Provider.d.ts.map +1 -0
  247. package/dist/storage/providers/cloudflare/d1Provider.js +347 -0
  248. package/dist/storage/providers/cloudflare/d1Provider.js.map +1 -0
  249. package/dist/storage/providers/cloudflare/kvProvider.d.ts +21 -0
  250. package/dist/storage/providers/cloudflare/kvProvider.d.ts.map +1 -0
  251. package/dist/storage/providers/cloudflare/kvProvider.js +183 -0
  252. package/dist/storage/providers/cloudflare/kvProvider.js.map +1 -0
  253. package/dist/storage/providers/cloudflare/r2Provider.d.ts +28 -0
  254. package/dist/storage/providers/cloudflare/r2Provider.d.ts.map +1 -0
  255. package/dist/storage/providers/cloudflare/r2Provider.js +222 -0
  256. package/dist/storage/providers/cloudflare/r2Provider.js.map +1 -0
  257. package/dist/storage/providers/fileSystem/fileSystemProvider.d.ts +20 -0
  258. package/dist/storage/providers/fileSystem/fileSystemProvider.d.ts.map +1 -0
  259. package/dist/storage/providers/fileSystem/fileSystemProvider.js +282 -0
  260. package/dist/storage/providers/fileSystem/fileSystemProvider.js.map +1 -0
  261. package/dist/storage/providers/inMemory/inMemoryProvider.d.ts +21 -0
  262. package/dist/storage/providers/inMemory/inMemoryProvider.d.ts.map +1 -0
  263. package/dist/storage/providers/inMemory/inMemoryProvider.js +139 -0
  264. package/dist/storage/providers/inMemory/inMemoryProvider.js.map +1 -0
  265. package/dist/storage/providers/supabase/supabase.types.d.ts +49 -0
  266. package/dist/storage/providers/supabase/supabase.types.d.ts.map +1 -0
  267. package/dist/storage/providers/supabase/supabase.types.js +8 -0
  268. package/dist/storage/providers/supabase/supabase.types.js.map +1 -0
  269. package/dist/storage/providers/supabase/supabaseProvider.d.ts +24 -0
  270. package/dist/storage/providers/supabase/supabaseProvider.d.ts.map +1 -0
  271. package/dist/storage/providers/supabase/supabaseProvider.js +209 -0
  272. package/dist/storage/providers/supabase/supabaseProvider.js.map +1 -0
  273. package/dist/testing/index.d.ts +53 -0
  274. package/dist/testing/index.d.ts.map +1 -0
  275. package/dist/testing/index.js +132 -0
  276. package/dist/testing/index.js.map +1 -0
  277. package/dist/types-global/errors.d.ts +83 -0
  278. package/dist/types-global/errors.d.ts.map +1 -0
  279. package/dist/types-global/errors.js +113 -0
  280. package/dist/types-global/errors.js.map +1 -0
  281. package/dist/utils/formatting/diffFormatter.d.ts +227 -0
  282. package/dist/utils/formatting/diffFormatter.d.ts.map +1 -0
  283. package/dist/utils/formatting/diffFormatter.js +369 -0
  284. package/dist/utils/formatting/diffFormatter.js.map +1 -0
  285. package/dist/utils/formatting/index.d.ts +9 -0
  286. package/dist/utils/formatting/index.d.ts.map +1 -0
  287. package/dist/utils/formatting/index.js +9 -0
  288. package/dist/utils/formatting/index.js.map +1 -0
  289. package/dist/utils/formatting/markdownBuilder.d.ts +543 -0
  290. package/dist/utils/formatting/markdownBuilder.d.ts.map +1 -0
  291. package/dist/utils/formatting/markdownBuilder.js +674 -0
  292. package/dist/utils/formatting/markdownBuilder.js.map +1 -0
  293. package/dist/utils/formatting/tableFormatter.d.ts +261 -0
  294. package/dist/utils/formatting/tableFormatter.d.ts.map +1 -0
  295. package/dist/utils/formatting/tableFormatter.js +456 -0
  296. package/dist/utils/formatting/tableFormatter.js.map +1 -0
  297. package/dist/utils/formatting/treeFormatter.d.ts +344 -0
  298. package/dist/utils/formatting/treeFormatter.d.ts.map +1 -0
  299. package/dist/utils/formatting/treeFormatter.js +400 -0
  300. package/dist/utils/formatting/treeFormatter.js.map +1 -0
  301. package/dist/utils/internal/encoding.d.ts +42 -0
  302. package/dist/utils/internal/encoding.d.ts.map +1 -0
  303. package/dist/utils/internal/encoding.js +87 -0
  304. package/dist/utils/internal/encoding.js.map +1 -0
  305. package/dist/utils/internal/error-handler/errorHandler.d.ts +140 -0
  306. package/dist/utils/internal/error-handler/errorHandler.d.ts.map +1 -0
  307. package/dist/utils/internal/error-handler/errorHandler.js +318 -0
  308. package/dist/utils/internal/error-handler/errorHandler.js.map +1 -0
  309. package/dist/utils/internal/error-handler/helpers.d.ts +98 -0
  310. package/dist/utils/internal/error-handler/helpers.d.ts.map +1 -0
  311. package/dist/utils/internal/error-handler/helpers.js +214 -0
  312. package/dist/utils/internal/error-handler/helpers.js.map +1 -0
  313. package/dist/utils/internal/error-handler/mappings.d.ts +85 -0
  314. package/dist/utils/internal/error-handler/mappings.d.ts.map +1 -0
  315. package/dist/utils/internal/error-handler/mappings.js +234 -0
  316. package/dist/utils/internal/error-handler/mappings.js.map +1 -0
  317. package/dist/utils/internal/error-handler/types.d.ts +160 -0
  318. package/dist/utils/internal/error-handler/types.d.ts.map +1 -0
  319. package/dist/utils/internal/error-handler/types.js +6 -0
  320. package/dist/utils/internal/error-handler/types.js.map +1 -0
  321. package/dist/utils/internal/health.d.ts +60 -0
  322. package/dist/utils/internal/health.d.ts.map +1 -0
  323. package/dist/utils/internal/health.js +46 -0
  324. package/dist/utils/internal/health.js.map +1 -0
  325. package/dist/utils/internal/logger.d.ts +300 -0
  326. package/dist/utils/internal/logger.d.ts.map +1 -0
  327. package/dist/utils/internal/logger.js +573 -0
  328. package/dist/utils/internal/logger.js.map +1 -0
  329. package/dist/utils/internal/performance.d.ts +78 -0
  330. package/dist/utils/internal/performance.d.ts.map +1 -0
  331. package/dist/utils/internal/performance.js +227 -0
  332. package/dist/utils/internal/performance.js.map +1 -0
  333. package/dist/utils/internal/requestContext.d.ts +200 -0
  334. package/dist/utils/internal/requestContext.d.ts.map +1 -0
  335. package/dist/utils/internal/requestContext.js +163 -0
  336. package/dist/utils/internal/requestContext.js.map +1 -0
  337. package/dist/utils/internal/runtime.d.ts +49 -0
  338. package/dist/utils/internal/runtime.d.ts.map +1 -0
  339. package/dist/utils/internal/runtime.js +90 -0
  340. package/dist/utils/internal/runtime.js.map +1 -0
  341. package/dist/utils/internal/startupBanner.d.ts +23 -0
  342. package/dist/utils/internal/startupBanner.d.ts.map +1 -0
  343. package/dist/utils/internal/startupBanner.js +34 -0
  344. package/dist/utils/internal/startupBanner.js.map +1 -0
  345. package/dist/utils/metrics/tokenCounter.d.ts +97 -0
  346. package/dist/utils/metrics/tokenCounter.d.ts.map +1 -0
  347. package/dist/utils/metrics/tokenCounter.js +162 -0
  348. package/dist/utils/metrics/tokenCounter.js.map +1 -0
  349. package/dist/utils/network/fetchWithTimeout.d.ts +91 -0
  350. package/dist/utils/network/fetchWithTimeout.d.ts.map +1 -0
  351. package/dist/utils/network/fetchWithTimeout.js +305 -0
  352. package/dist/utils/network/fetchWithTimeout.js.map +1 -0
  353. package/dist/utils/pagination/pagination.d.ts +157 -0
  354. package/dist/utils/pagination/pagination.d.ts.map +1 -0
  355. package/dist/utils/pagination/pagination.js +191 -0
  356. package/dist/utils/pagination/pagination.js.map +1 -0
  357. package/dist/utils/parsing/csvParser.d.ts +84 -0
  358. package/dist/utils/parsing/csvParser.d.ts.map +1 -0
  359. package/dist/utils/parsing/csvParser.js +132 -0
  360. package/dist/utils/parsing/csvParser.js.map +1 -0
  361. package/dist/utils/parsing/dateParser.d.ts +103 -0
  362. package/dist/utils/parsing/dateParser.d.ts.map +1 -0
  363. package/dist/utils/parsing/dateParser.js +142 -0
  364. package/dist/utils/parsing/dateParser.js.map +1 -0
  365. package/dist/utils/parsing/frontmatterParser.d.ts +91 -0
  366. package/dist/utils/parsing/frontmatterParser.d.ts.map +1 -0
  367. package/dist/utils/parsing/frontmatterParser.js +163 -0
  368. package/dist/utils/parsing/frontmatterParser.js.map +1 -0
  369. package/dist/utils/parsing/index.d.ts +15 -0
  370. package/dist/utils/parsing/index.d.ts.map +1 -0
  371. package/dist/utils/parsing/index.js +15 -0
  372. package/dist/utils/parsing/index.js.map +1 -0
  373. package/dist/utils/parsing/jsonParser.d.ts +115 -0
  374. package/dist/utils/parsing/jsonParser.d.ts.map +1 -0
  375. package/dist/utils/parsing/jsonParser.js +177 -0
  376. package/dist/utils/parsing/jsonParser.js.map +1 -0
  377. package/dist/utils/parsing/pdfParser.d.ts +563 -0
  378. package/dist/utils/parsing/pdfParser.d.ts.map +1 -0
  379. package/dist/utils/parsing/pdfParser.js +775 -0
  380. package/dist/utils/parsing/pdfParser.js.map +1 -0
  381. package/dist/utils/parsing/thinkBlock.d.ts +31 -0
  382. package/dist/utils/parsing/thinkBlock.d.ts.map +1 -0
  383. package/dist/utils/parsing/thinkBlock.js +31 -0
  384. package/dist/utils/parsing/thinkBlock.js.map +1 -0
  385. package/dist/utils/parsing/xmlParser.d.ts +69 -0
  386. package/dist/utils/parsing/xmlParser.d.ts.map +1 -0
  387. package/dist/utils/parsing/xmlParser.js +140 -0
  388. package/dist/utils/parsing/xmlParser.js.map +1 -0
  389. package/dist/utils/parsing/yamlParser.d.ts +64 -0
  390. package/dist/utils/parsing/yamlParser.d.ts.map +1 -0
  391. package/dist/utils/parsing/yamlParser.js +129 -0
  392. package/dist/utils/parsing/yamlParser.js.map +1 -0
  393. package/dist/utils/scheduling/scheduler.d.ts +174 -0
  394. package/dist/utils/scheduling/scheduler.d.ts.map +1 -0
  395. package/dist/utils/scheduling/scheduler.js +248 -0
  396. package/dist/utils/scheduling/scheduler.js.map +1 -0
  397. package/dist/utils/security/idGenerator.d.ts +189 -0
  398. package/dist/utils/security/idGenerator.d.ts.map +1 -0
  399. package/dist/utils/security/idGenerator.js +301 -0
  400. package/dist/utils/security/idGenerator.js.map +1 -0
  401. package/dist/utils/security/index.d.ts +8 -0
  402. package/dist/utils/security/index.d.ts.map +1 -0
  403. package/dist/utils/security/index.js +8 -0
  404. package/dist/utils/security/index.js.map +1 -0
  405. package/dist/utils/security/rateLimiter.d.ts +171 -0
  406. package/dist/utils/security/rateLimiter.d.ts.map +1 -0
  407. package/dist/utils/security/rateLimiter.js +294 -0
  408. package/dist/utils/security/rateLimiter.js.map +1 -0
  409. package/dist/utils/security/sanitization.d.ts +430 -0
  410. package/dist/utils/security/sanitization.d.ts.map +1 -0
  411. package/dist/utils/security/sanitization.js +759 -0
  412. package/dist/utils/security/sanitization.js.map +1 -0
  413. package/dist/utils/telemetry/index.d.ts +12 -0
  414. package/dist/utils/telemetry/index.d.ts.map +1 -0
  415. package/dist/utils/telemetry/index.js +12 -0
  416. package/dist/utils/telemetry/index.js.map +1 -0
  417. package/dist/utils/telemetry/instrumentation.d.ts +62 -0
  418. package/dist/utils/telemetry/instrumentation.d.ts.map +1 -0
  419. package/dist/utils/telemetry/instrumentation.js +223 -0
  420. package/dist/utils/telemetry/instrumentation.js.map +1 -0
  421. package/dist/utils/telemetry/metrics.d.ts +170 -0
  422. package/dist/utils/telemetry/metrics.d.ts.map +1 -0
  423. package/dist/utils/telemetry/metrics.js +205 -0
  424. package/dist/utils/telemetry/metrics.js.map +1 -0
  425. package/dist/utils/telemetry/semconv.d.ts +147 -0
  426. package/dist/utils/telemetry/semconv.d.ts.map +1 -0
  427. package/dist/utils/telemetry/semconv.js +159 -0
  428. package/dist/utils/telemetry/semconv.js.map +1 -0
  429. package/dist/utils/telemetry/trace.d.ts +141 -0
  430. package/dist/utils/telemetry/trace.d.ts.map +1 -0
  431. package/dist/utils/telemetry/trace.js +193 -0
  432. package/dist/utils/telemetry/trace.js.map +1 -0
  433. package/dist/utils/types/guards.d.ts +209 -0
  434. package/dist/utils/types/guards.d.ts.map +1 -0
  435. package/dist/utils/types/guards.js +229 -0
  436. package/dist/utils/types/guards.js.map +1 -0
  437. package/dist/utils/types/index.d.ts +6 -0
  438. package/dist/utils/types/index.d.ts.map +1 -0
  439. package/dist/utils/types/index.js +6 -0
  440. package/dist/utils/types/index.js.map +1 -0
  441. package/dist/worker.d.ts +59 -0
  442. package/dist/worker.d.ts.map +1 -0
  443. package/dist/worker.js +216 -0
  444. package/dist/worker.js.map +1 -0
  445. package/package.json +377 -0
  446. package/skills/README.md +38 -0
  447. package/skills/add-export/SKILL.md +49 -0
  448. package/skills/add-prompt/SKILL.md +97 -0
  449. package/skills/add-provider/SKILL.md +53 -0
  450. package/skills/add-resource/SKILL.md +107 -0
  451. package/skills/add-service/SKILL.md +113 -0
  452. package/skills/add-tool/SKILL.md +110 -0
  453. package/skills/api-auth/SKILL.md +173 -0
  454. package/skills/api-config/SKILL.md +68 -0
  455. package/skills/api-context/SKILL.md +321 -0
  456. package/skills/api-errors/SKILL.md +146 -0
  457. package/skills/api-services/SKILL.md +24 -0
  458. package/skills/api-services/references/graph.md +124 -0
  459. package/skills/api-services/references/llm.md +46 -0
  460. package/skills/api-services/references/speech.md +72 -0
  461. package/skills/api-testing/SKILL.md +263 -0
  462. package/skills/api-utils/SKILL.md +106 -0
  463. package/skills/api-utils/references/formatting.md +237 -0
  464. package/skills/api-utils/references/parsing.md +263 -0
  465. package/skills/api-utils/references/security.md +226 -0
  466. package/skills/api-workers/SKILL.md +165 -0
  467. package/skills/devcheck/SKILL.md +31 -0
  468. package/skills/maintenance/SKILL.md +52 -0
  469. package/skills/migrate-mcp-ts-template/SKILL.md +131 -0
  470. package/skills/release/SKILL.md +67 -0
  471. package/skills/setup/SKILL.md +89 -0
  472. package/skills/walkthrough-init/SKILL.md +50 -0
  473. package/templates/.env.example +17 -0
  474. package/templates/AGENTS.md +113 -0
  475. package/templates/CLAUDE.md +113 -0
  476. package/templates/_tsconfig.json +33 -0
  477. package/templates/biome.template.json +43 -0
  478. package/templates/package.json +26 -0
  479. package/templates/src/index.ts +16 -0
  480. package/templates/src/mcp-server/prompts/definitions/echo.prompt.ts +19 -0
  481. package/templates/src/mcp-server/resources/definitions/echo.resource.ts +30 -0
  482. package/templates/src/mcp-server/tools/definitions/echo.tool.ts +24 -0
  483. package/templates/vitest.config.ts +12 -0
  484. package/tsconfig.base.json +44 -0
  485. package/vitest.config.base.ts +38 -0
@@ -0,0 +1,303 @@
1
+ /**
2
+ * @fileoverview Input validation utilities for storage operations.
3
+ *
4
+ * This module provides centralized validation for all storage inputs to prevent:
5
+ * - Path traversal attacks (via tenant ID, key, and prefix validation)
6
+ * - Resource exhaustion (via length limits and pagination controls)
7
+ * - Injection attacks (via character allowlists)
8
+ * - Cross-tenant data access (via cursor validation with tenant binding)
9
+ *
10
+ * Security Model:
11
+ * - Defense in depth: validation at service layer AND provider layer
12
+ * - Fail closed: invalid input throws McpError, never coerced
13
+ * - Audit trail: all validation failures logged with context
14
+ * - Immutable: validation functions are pure (no side effects)
15
+ *
16
+ * All validation functions are synchronous and throw McpError on failure.
17
+ * Callers should NOT catch validation errors - let them bubble to handlers.
18
+ *
19
+ * @module src/storage/core/storageValidation
20
+ */
21
+ import { JsonRpcErrorCode, McpError } from '../../types-global/errors.js';
22
+ import { base64ToString, stringToBase64 } from '../../utils/internal/encoding.js';
23
+ /**
24
+ * Maximum length for tenant IDs and keys to prevent abuse.
25
+ * These constants are security-critical and must not be modified at runtime.
26
+ *
27
+ * Rationale:
28
+ * - MAX_TENANT_ID_LENGTH (128): Accommodates UUIDs, org slugs, and email-based IDs
29
+ * - MAX_KEY_LENGTH (1024): Balances between deep hierarchies and URL limits
30
+ * - MAX_PREFIX_LENGTH (512): Half of key length, enough for namespace prefixes
31
+ * - MAX_LIST_LIMIT (10000): Prevents memory exhaustion while allowing bulk operations
32
+ */
33
+ const MAX_TENANT_ID_LENGTH = 128;
34
+ const MAX_KEY_LENGTH = 1024;
35
+ const MAX_PREFIX_LENGTH = 512;
36
+ /**
37
+ * Maximum page size to prevent memory exhaustion attacks.
38
+ */
39
+ const MAX_LIST_LIMIT = 10000;
40
+ /**
41
+ * Pattern for valid tenant IDs (alphanumeric, hyphens, underscores, dots).
42
+ * More restrictive than key pattern - no slashes allowed to prevent path traversal.
43
+ * Single character: must be alphanumeric.
44
+ * Multiple characters: must start and end with alphanumeric, middle can include ._-
45
+ * @readonly
46
+ */
47
+ const VALID_TENANT_ID_PATTERN = /^[a-zA-Z0-9]$|^[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9]$/;
48
+ /**
49
+ * Pattern for valid keys and prefixes (alphanumeric, hyphens, underscores, dots, slashes).
50
+ * @readonly
51
+ */
52
+ const VALID_KEY_PATTERN = /^[a-zA-Z0-9_.\-/]+$/;
53
+ /**
54
+ * Validates a tenant ID for storage operations.
55
+ *
56
+ * Security constraints:
57
+ * - Must be non-empty string
58
+ * - Maximum length: 128 characters
59
+ * - Allowed characters: alphanumeric, hyphens, underscores, dots
60
+ * - Cannot contain slashes or path traversal sequences
61
+ * - Cannot start or end with special characters
62
+ *
63
+ * @param tenantId The tenant ID to validate.
64
+ * @param context The request context for error reporting.
65
+ * @throws {McpError} JsonRpcErrorCode.InvalidParams - If tenant ID is not a string, empty, too long, contains invalid characters, or has path traversal sequences.
66
+ */
67
+ export function validateTenantId(tenantId, context) {
68
+ if (typeof tenantId !== 'string') {
69
+ throw new McpError(JsonRpcErrorCode.InvalidParams, 'Tenant ID must be a string.', {
70
+ ...context,
71
+ tenantId,
72
+ });
73
+ }
74
+ const trimmedTenantId = tenantId.trim();
75
+ if (trimmedTenantId.length === 0) {
76
+ throw new McpError(JsonRpcErrorCode.InvalidParams, 'Tenant ID cannot be an empty string.', {
77
+ ...context,
78
+ tenantId,
79
+ });
80
+ }
81
+ if (trimmedTenantId.length > MAX_TENANT_ID_LENGTH) {
82
+ throw new McpError(JsonRpcErrorCode.InvalidParams, `Tenant ID exceeds maximum length of ${MAX_TENANT_ID_LENGTH} characters.`, { ...context, tenantIdLength: trimmedTenantId.length });
83
+ }
84
+ if (!VALID_TENANT_ID_PATTERN.test(trimmedTenantId)) {
85
+ throw new McpError(JsonRpcErrorCode.InvalidParams, 'Tenant ID contains invalid characters. Only alphanumeric characters, hyphens, underscores, and dots are allowed. Must start and end with alphanumeric characters.', { ...context, tenantId: trimmedTenantId });
86
+ }
87
+ if (trimmedTenantId.includes('..')) {
88
+ throw new McpError(JsonRpcErrorCode.InvalidParams, 'Tenant ID contains consecutive dots, which are not allowed.', { ...context, tenantId: trimmedTenantId });
89
+ }
90
+ if (trimmedTenantId.includes('../') || trimmedTenantId.includes('..\\')) {
91
+ throw new McpError(JsonRpcErrorCode.InvalidParams, 'Tenant ID contains path traversal sequences, which are not allowed.', { ...context, tenantId: trimmedTenantId });
92
+ }
93
+ }
94
+ /**
95
+ * Validates a storage key.
96
+ * @param key The key to validate.
97
+ * @param context The request context for error reporting.
98
+ * @throws {McpError} JsonRpcErrorCode.ValidationError - If key is not a non-empty string, too long, contains invalid characters, or has path traversal sequences.
99
+ */
100
+ export function validateKey(key, context) {
101
+ if (!key || typeof key !== 'string') {
102
+ throw new McpError(JsonRpcErrorCode.ValidationError, 'Key must be a non-empty string.', {
103
+ ...context,
104
+ key,
105
+ });
106
+ }
107
+ if (key.length > MAX_KEY_LENGTH) {
108
+ throw new McpError(JsonRpcErrorCode.ValidationError, `Key exceeds maximum length of ${MAX_KEY_LENGTH} characters.`, { ...context, key: `${key.substring(0, 50)}...` });
109
+ }
110
+ if (!VALID_KEY_PATTERN.test(key)) {
111
+ throw new McpError(JsonRpcErrorCode.ValidationError, 'Key contains invalid characters. Only alphanumeric, hyphens, underscores, dots, and slashes are allowed.', { ...context, key });
112
+ }
113
+ if (key.includes('..')) {
114
+ throw new McpError(JsonRpcErrorCode.ValidationError, 'Key must not contain ".." (path traversal attempt).', { ...context, key });
115
+ }
116
+ }
117
+ /**
118
+ * Validates a prefix for list operations.
119
+ *
120
+ * Security constraints:
121
+ * - Can be empty string (matches all keys within tenant)
122
+ * - Maximum length: 512 characters
123
+ * - No path traversal sequences allowed
124
+ * - Only valid path characters allowed
125
+ *
126
+ * @param prefix The prefix to validate (empty string is valid).
127
+ * @param context The request context for error reporting.
128
+ * @throws {McpError} JsonRpcErrorCode.ValidationError - If prefix is not a string, too long, contains invalid characters, or has path traversal sequences.
129
+ */
130
+ export function validatePrefix(prefix, context) {
131
+ if (typeof prefix !== 'string') {
132
+ throw new McpError(JsonRpcErrorCode.ValidationError, 'Prefix must be a string.', {
133
+ ...context,
134
+ operation: 'validatePrefix',
135
+ prefix,
136
+ });
137
+ }
138
+ // Empty prefix is valid (matches all keys)
139
+ if (prefix === '') {
140
+ return;
141
+ }
142
+ if (prefix.length > MAX_PREFIX_LENGTH) {
143
+ throw new McpError(JsonRpcErrorCode.ValidationError, `Prefix exceeds maximum length of ${MAX_PREFIX_LENGTH} characters.`, {
144
+ ...context,
145
+ operation: 'validatePrefix',
146
+ prefix: `${prefix.substring(0, 50)}...`,
147
+ });
148
+ }
149
+ // Only validate pattern if non-empty
150
+ if (!VALID_KEY_PATTERN.test(prefix)) {
151
+ throw new McpError(JsonRpcErrorCode.ValidationError, 'Prefix contains invalid characters. Only alphanumeric, hyphens, underscores, dots, and slashes are allowed.', {
152
+ ...context,
153
+ operation: 'validatePrefix',
154
+ prefix: prefix.length > 50 ? `${prefix.substring(0, 50)}...` : prefix,
155
+ });
156
+ }
157
+ if (prefix.includes('..')) {
158
+ throw new McpError(JsonRpcErrorCode.ValidationError, 'Prefix must not contain ".." (path traversal attempt).', { ...context, operation: 'validatePrefix', prefix });
159
+ }
160
+ }
161
+ /**
162
+ * Validates storage options.
163
+ * @param options The storage options to validate.
164
+ * @param context The request context for error reporting.
165
+ * @throws {McpError} JsonRpcErrorCode.ValidationError - If TTL is not a number, negative, or not finite.
166
+ */
167
+ export function validateStorageOptions(options, context) {
168
+ if (!options) {
169
+ return;
170
+ }
171
+ if (options.ttl !== undefined) {
172
+ if (typeof options.ttl !== 'number') {
173
+ throw new McpError(JsonRpcErrorCode.ValidationError, 'TTL must be a number (seconds).', {
174
+ ...context,
175
+ ttl: options.ttl,
176
+ });
177
+ }
178
+ if (options.ttl < 0) {
179
+ throw new McpError(JsonRpcErrorCode.ValidationError, 'TTL must be a non-negative number. Use 0 for immediate expiration.', { ...context, ttl: options.ttl });
180
+ }
181
+ if (!Number.isFinite(options.ttl)) {
182
+ throw new McpError(JsonRpcErrorCode.ValidationError, 'TTL must be a finite number.', {
183
+ ...context,
184
+ ttl: options.ttl,
185
+ });
186
+ }
187
+ }
188
+ }
189
+ /**
190
+ * Validates list operation options.
191
+ *
192
+ * Security constraints:
193
+ * - Limit must be positive integer between 1 and 10000
194
+ * - Cursor must be valid base64 string if provided
195
+ * - Prevents memory exhaustion via oversized page requests
196
+ *
197
+ * @param options The list options to validate.
198
+ * @param context The request context for error reporting.
199
+ * @throws {McpError} If the options are invalid.
200
+ */
201
+ export function validateListOptions(options, context) {
202
+ if (!options) {
203
+ return;
204
+ }
205
+ if (options.limit !== undefined) {
206
+ if (typeof options.limit !== 'number') {
207
+ throw new McpError(JsonRpcErrorCode.ValidationError, 'List limit must be a number.', {
208
+ ...context,
209
+ operation: 'validateListOptions',
210
+ limit: options.limit,
211
+ });
212
+ }
213
+ if (!Number.isInteger(options.limit)) {
214
+ throw new McpError(JsonRpcErrorCode.ValidationError, 'List limit must be an integer.', {
215
+ ...context,
216
+ operation: 'validateListOptions',
217
+ limit: options.limit,
218
+ });
219
+ }
220
+ if (options.limit < 1) {
221
+ throw new McpError(JsonRpcErrorCode.ValidationError, 'List limit must be at least 1.', {
222
+ ...context,
223
+ operation: 'validateListOptions',
224
+ limit: options.limit,
225
+ });
226
+ }
227
+ if (options.limit > MAX_LIST_LIMIT) {
228
+ throw new McpError(JsonRpcErrorCode.ValidationError, `List limit exceeds maximum of ${MAX_LIST_LIMIT}.`, { ...context, operation: 'validateListOptions', limit: options.limit });
229
+ }
230
+ if (!Number.isFinite(options.limit)) {
231
+ throw new McpError(JsonRpcErrorCode.ValidationError, 'List limit must be a finite number.', {
232
+ ...context,
233
+ operation: 'validateListOptions',
234
+ limit: options.limit,
235
+ });
236
+ }
237
+ }
238
+ if (options.cursor !== undefined) {
239
+ if (typeof options.cursor !== 'string') {
240
+ throw new McpError(JsonRpcErrorCode.ValidationError, 'Cursor must be a string.', {
241
+ ...context,
242
+ operation: 'validateListOptions',
243
+ });
244
+ }
245
+ if (options.cursor.trim() === '') {
246
+ throw new McpError(JsonRpcErrorCode.ValidationError, 'Cursor must not be an empty string.', {
247
+ ...context,
248
+ operation: 'validateListOptions',
249
+ });
250
+ }
251
+ // Basic base64 validation (more thorough check happens in decodeCursor)
252
+ if (!/^[A-Za-z0-9+/=]+$/.test(options.cursor)) {
253
+ throw new McpError(JsonRpcErrorCode.ValidationError, 'Cursor contains invalid characters for base64.', { ...context, operation: 'validateListOptions' });
254
+ }
255
+ }
256
+ }
257
+ /**
258
+ * Encodes pagination cursor data into an opaque string.
259
+ * Uses runtime-agnostic base64 encoding for Worker compatibility.
260
+ * @param lastKey The last key from the current page.
261
+ * @param tenantId The tenant ID for validation.
262
+ * @returns An opaque cursor string.
263
+ */
264
+ export function encodeCursor(lastKey, tenantId) {
265
+ const data = { k: lastKey, t: tenantId };
266
+ return stringToBase64(JSON.stringify(data));
267
+ }
268
+ /**
269
+ * Decodes and validates an opaque cursor string.
270
+ * Uses runtime-agnostic base64 decoding for Worker compatibility.
271
+ * @param cursor The cursor string to decode.
272
+ * @param tenantId The expected tenant ID for validation.
273
+ * @param context The request context for error reporting.
274
+ * @returns The last key from the cursor.
275
+ * @throws {McpError} If the cursor is invalid or tampered with.
276
+ */
277
+ export function decodeCursor(cursor, tenantId, context) {
278
+ try {
279
+ const decoded = base64ToString(cursor);
280
+ const data = JSON.parse(decoded);
281
+ if (!data || typeof data !== 'object' || !('k' in data) || !('t' in data)) {
282
+ throw new McpError(JsonRpcErrorCode.InvalidParams, 'Invalid cursor format.', {
283
+ ...context,
284
+ operation: 'decodeCursor',
285
+ });
286
+ }
287
+ if (data.t !== tenantId) {
288
+ throw new McpError(JsonRpcErrorCode.InvalidParams, 'Cursor tenant ID mismatch. Cursor may have been tampered with.', { ...context, operation: 'decodeCursor' });
289
+ }
290
+ return data.k;
291
+ }
292
+ catch (error) {
293
+ if (error instanceof McpError) {
294
+ throw error;
295
+ }
296
+ throw new McpError(JsonRpcErrorCode.InvalidParams, 'Failed to decode cursor. Cursor may be corrupted or invalid.', {
297
+ ...context,
298
+ operation: 'decodeCursor',
299
+ rawError: error instanceof Error ? error.stack : String(error),
300
+ });
301
+ }
302
+ }
303
+ //# sourceMappingURL=storageValidation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storageValidation.js","sourceRoot":"","sources":["../../../src/storage/core/storageValidation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAI9E;;;;;;;;;GASG;AACH,MAAM,oBAAoB,GAAG,GAAY,CAAC;AAC1C,MAAM,cAAc,GAAG,IAAa,CAAC;AACrC,MAAM,iBAAiB,GAAG,GAAY,CAAC;AAEvC;;GAEG;AACH,MAAM,cAAc,GAAG,KAAc,CAAC;AAEtC;;;;;;GAMG;AACH,MAAM,uBAAuB,GAAG,uDAAuD,CAAC;AAExF;;;GAGG;AACH,MAAM,iBAAiB,GAAG,qBAAqB,CAAC;AAEhD;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAgB,EAAE,OAAuB;IACxE,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACjC,MAAM,IAAI,QAAQ,CAAC,gBAAgB,CAAC,aAAa,EAAE,6BAA6B,EAAE;YAChF,GAAG,OAAO;YACV,QAAQ;SACT,CAAC,CAAC;IACL,CAAC;IAED,MAAM,eAAe,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;IAExC,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACjC,MAAM,IAAI,QAAQ,CAAC,gBAAgB,CAAC,aAAa,EAAE,sCAAsC,EAAE;YACzF,GAAG,OAAO;YACV,QAAQ;SACT,CAAC,CAAC;IACL,CAAC;IAED,IAAI,eAAe,CAAC,MAAM,GAAG,oBAAoB,EAAE,CAAC;QAClD,MAAM,IAAI,QAAQ,CAChB,gBAAgB,CAAC,aAAa,EAC9B,uCAAuC,oBAAoB,cAAc,EACzE,EAAE,GA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,CAAC"}
@@ -0,0 +1,94 @@
1
+ /**
2
+ * @fileoverview Implements the IStorageProvider interface for Cloudflare D1.
3
+ * Provides SQL-based key-value storage with multi-tenancy, TTL support, and batch operations.
4
+ * @module src/storage/providers/cloudflare/d1Provider
5
+ */
6
+ import type { D1Database } from '@cloudflare/workers-types';
7
+ import type { IStorageProvider, ListOptions, ListResult, StorageOptions } from '../../../storage/core/IStorageProvider.js';
8
+ import type { RequestContext } from '../../../utils/internal/requestContext.js';
9
+ /**
10
+ * Cloudflare D1 storage provider implementation.
11
+ *
12
+ * Features:
13
+ * - SQL-based key-value storage with multi-tenancy
14
+ * - TTL support via expires_at column (Unix timestamp in milliseconds)
15
+ * - Batch operations using D1's batch() API for transactional writes
16
+ * - Cursor-based pagination with tenant-bound security
17
+ * - Strong consistency (vs KV's eventual consistency)
18
+ *
19
+ * Schema Requirements:
20
+ * - Table: kv_store (tenant_id, key, value, expires_at)
21
+ * - See docs/cloudflare-d1-schema.sql for setup
22
+ *
23
+ * Performance Characteristics:
24
+ * - Reads: ~50-100ms (depends on query complexity)
25
+ * - Writes: ~50-200ms (single), ~100-500ms (batch)
26
+ * - List operations: Efficient with proper indexes
27
+ * - Batch operations: 20-100x faster than individual calls
28
+ */
29
+ export declare class D1Provider implements IStorageProvider {
30
+ private readonly db;
31
+ private readonly tableName;
32
+ /**
33
+ * Creates a new D1Provider instance.
34
+ *
35
+ * @param db - The D1Database binding from Cloudflare Workers
36
+ * @param tableName - The name of the kv_store table (default: 'kv_store')
37
+ * @throws {McpError} If db is not provided or invalid
38
+ */
39
+ private static readonly SAFE_TABLE_NAME;
40
+ constructor(db: D1Database, tableName?: string);
41
+ /**
42
+ * Helper to get current timestamp in milliseconds.
43
+ */
44
+ private getNow;
45
+ /**
46
+ * Helper to check if a value has expired based on expires_at timestamp.
47
+ */
48
+ private isExpired;
49
+ /**
50
+ * Retrieves a value from the D1 database.
51
+ * Returns null if the key doesn't exist or has expired.
52
+ */
53
+ get<T>(tenantId: string, key: string, context: RequestContext): Promise<T | null>;
54
+ /**
55
+ * Stores a value in the D1 database.
56
+ * Uses UPSERT (INSERT OR REPLACE) to handle both new and existing keys.
57
+ */
58
+ set(tenantId: string, key: string, value: unknown, context: RequestContext, options?: StorageOptions): Promise<void>;
59
+ /**
60
+ * Deletes a key from the D1 database.
61
+ * Returns true if the key existed, false otherwise.
62
+ */
63
+ delete(tenantId: string, key: string, context: RequestContext): Promise<boolean>;
64
+ /**
65
+ * Lists keys matching a prefix with pagination support.
66
+ * Filters out expired keys based on TTL.
67
+ */
68
+ list(tenantId: string, prefix: string, context: RequestContext, options?: ListOptions): Promise<ListResult>;
69
+ /**
70
+ * Retrieves multiple values in a single operation.
71
+ * More efficient than multiple individual get() calls.
72
+ * Uses SQL IN clause for batch fetching.
73
+ */
74
+ getMany<T>(tenantId: string, keys: string[], context: RequestContext): Promise<Map<string, T>>;
75
+ /**
76
+ * Stores multiple key-value pairs in a single transaction.
77
+ * Uses D1's batch() API for atomic, transactional writes.
78
+ * Significantly faster than individual set() calls (20-100x).
79
+ */
80
+ setMany(tenantId: string, entries: Map<string, unknown>, context: RequestContext, options?: StorageOptions): Promise<void>;
81
+ /**
82
+ * Deletes multiple keys in a single transaction.
83
+ * Uses D1's batch() API for atomic deletion.
84
+ * Returns the count of successfully deleted keys.
85
+ */
86
+ deleteMany(tenantId: string, keys: string[], context: RequestContext): Promise<number>;
87
+ /**
88
+ * Clears all keys for a given tenant.
89
+ * WARNING: This is a destructive operation that cannot be undone.
90
+ * Useful for testing or tenant cleanup operations.
91
+ */
92
+ clear(tenantId: string, context: RequestContext): Promise<number>;
93
+ }
94
+ //# sourceMappingURL=d1Provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"d1Provider.d.ts","sourceRoot":"","sources":["../../../../src/storage/providers/cloudflare/d1Provider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D,O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