@cyanheads/mcp-ts-core 0.11.5 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (357) hide show
  1. package/AGENTS.md +27 -23
  2. package/CLAUDE.md +27 -23
  3. package/README.md +10 -10
  4. package/biome.json +1 -1
  5. package/changelog/0.12.x/0.12.0.md +96 -0
  6. package/dist/cli/init.js +1 -1
  7. package/dist/cli/init.js.map +1 -1
  8. package/dist/config/index.d.ts +0 -18
  9. package/dist/config/index.d.ts.map +1 -1
  10. package/dist/config/index.js +0 -25
  11. package/dist/config/index.js.map +1 -1
  12. package/dist/core/app.d.ts +5 -7
  13. package/dist/core/app.d.ts.map +1 -1
  14. package/dist/core/app.js +18 -27
  15. package/dist/core/app.js.map +1 -1
  16. package/dist/core/context.d.ts +90 -57
  17. package/dist/core/context.d.ts.map +1 -1
  18. package/dist/core/context.js +32 -33
  19. package/dist/core/context.js.map +1 -1
  20. package/dist/core/gcPressure.d.ts.map +1 -1
  21. package/dist/core/gcPressure.js +3 -4
  22. package/dist/core/gcPressure.js.map +1 -1
  23. package/dist/core/index.d.ts +6 -7
  24. package/dist/core/index.d.ts.map +1 -1
  25. package/dist/core/index.js +10 -2
  26. package/dist/core/index.js.map +1 -1
  27. package/dist/core/serverManifest.d.ts +1 -3
  28. package/dist/core/serverManifest.d.ts.map +1 -1
  29. package/dist/core/serverManifest.js +9 -4
  30. package/dist/core/serverManifest.js.map +1 -1
  31. package/dist/core/worker.d.ts.map +1 -1
  32. package/dist/core/worker.js +32 -35
  33. package/dist/core/worker.js.map +1 -1
  34. package/dist/logs/combined.log +10 -22
  35. package/dist/logs/error.log +6 -18
  36. package/dist/mcp-server/inputRequired.d.ts +52 -0
  37. package/dist/mcp-server/inputRequired.d.ts.map +1 -0
  38. package/dist/mcp-server/inputRequired.js +76 -0
  39. package/dist/mcp-server/inputRequired.js.map +1 -0
  40. package/dist/mcp-server/notifications.d.ts +33 -31
  41. package/dist/mcp-server/notifications.d.ts.map +1 -1
  42. package/dist/mcp-server/notifications.js +34 -26
  43. package/dist/mcp-server/notifications.js.map +1 -1
  44. package/dist/mcp-server/prompts/prompt-registration.d.ts +2 -2
  45. package/dist/mcp-server/prompts/prompt-registration.d.ts.map +1 -1
  46. package/dist/mcp-server/prompts/prompt-registration.js +15 -5
  47. package/dist/mcp-server/prompts/prompt-registration.js.map +1 -1
  48. package/dist/mcp-server/prompts/utils/promptDefinition.d.ts +1 -1
  49. package/dist/mcp-server/prompts/utils/promptDefinition.d.ts.map +1 -1
  50. package/dist/mcp-server/resources/resource-registration.d.ts +3 -3
  51. package/dist/mcp-server/resources/resource-registration.d.ts.map +1 -1
  52. package/dist/mcp-server/resources/resource-registration.js +8 -15
  53. package/dist/mcp-server/resources/resource-registration.js.map +1 -1
  54. package/dist/mcp-server/resources/resourceSubscriptions.d.ts +45 -0
  55. package/dist/mcp-server/resources/resourceSubscriptions.d.ts.map +1 -0
  56. package/dist/mcp-server/resources/resourceSubscriptions.js +51 -0
  57. package/dist/mcp-server/resources/resourceSubscriptions.js.map +1 -0
  58. package/dist/mcp-server/resources/utils/resourceDefinition.d.ts +3 -5
  59. package/dist/mcp-server/resources/utils/resourceDefinition.d.ts.map +1 -1
  60. package/dist/mcp-server/resources/utils/resourceDefinition.js +1 -1
  61. package/dist/mcp-server/resources/utils/resourceDefinition.js.map +1 -1
  62. package/dist/mcp-server/resources/utils/resourceHandlerFactory.d.ts +8 -15
  63. package/dist/mcp-server/resources/utils/resourceHandlerFactory.d.ts.map +1 -1
  64. package/dist/mcp-server/resources/utils/resourceHandlerFactory.js +21 -22
  65. package/dist/mcp-server/resources/utils/resourceHandlerFactory.js.map +1 -1
  66. package/dist/mcp-server/server.d.ts +12 -21
  67. package/dist/mcp-server/server.d.ts.map +1 -1
  68. package/dist/mcp-server/server.js +38 -28
  69. package/dist/mcp-server/server.js.map +1 -1
  70. package/dist/mcp-server/tools/tool-registration.d.ts +11 -33
  71. package/dist/mcp-server/tools/tool-registration.d.ts.map +1 -1
  72. package/dist/mcp-server/tools/tool-registration.js +17 -243
  73. package/dist/mcp-server/tools/tool-registration.js.map +1 -1
  74. package/dist/mcp-server/tools/utils/toolDefinition.d.ts +1 -3
  75. package/dist/mcp-server/tools/utils/toolDefinition.d.ts.map +1 -1
  76. package/dist/mcp-server/tools/utils/toolDefinition.js +48 -1
  77. package/dist/mcp-server/tools/utils/toolDefinition.js.map +1 -1
  78. package/dist/mcp-server/tools/utils/toolHandlerFactory.d.ts +46 -20
  79. package/dist/mcp-server/tools/utils/toolHandlerFactory.d.ts.map +1 -1
  80. package/dist/mcp-server/tools/utils/toolHandlerFactory.js +131 -25
  81. package/dist/mcp-server/tools/utils/toolHandlerFactory.js.map +1 -1
  82. package/dist/mcp-server/transports/ITransport.d.ts +2 -2
  83. package/dist/mcp-server/transports/ITransport.d.ts.map +1 -1
  84. package/dist/mcp-server/transports/auth/authFactory.js +1 -1
  85. package/dist/mcp-server/transports/auth/authFactory.js.map +1 -1
  86. package/dist/mcp-server/transports/auth/lib/authTypes.d.ts +1 -1
  87. package/dist/mcp-server/transports/auth/lib/authTypes.d.ts.map +1 -1
  88. package/dist/mcp-server/transports/auth/lib/authUtils.d.ts.map +1 -1
  89. package/dist/mcp-server/transports/auth/lib/authUtils.js +5 -13
  90. package/dist/mcp-server/transports/auth/lib/authUtils.js.map +1 -1
  91. package/dist/mcp-server/transports/auth/strategies/jwtStrategy.js +5 -11
  92. package/dist/mcp-server/transports/auth/strategies/jwtStrategy.js.map +1 -1
  93. package/dist/mcp-server/transports/auth/strategies/oauthStrategy.d.ts.map +1 -1
  94. package/dist/mcp-server/transports/auth/strategies/oauthStrategy.js +9 -22
  95. package/dist/mcp-server/transports/auth/strategies/oauthStrategy.js.map +1 -1
  96. package/dist/mcp-server/transports/heartbeat.d.ts.map +1 -1
  97. package/dist/mcp-server/transports/heartbeat.js +4 -8
  98. package/dist/mcp-server/transports/heartbeat.js.map +1 -1
  99. package/dist/mcp-server/transports/http/httpErrorHandler.d.ts.map +1 -1
  100. package/dist/mcp-server/transports/http/httpErrorHandler.js +6 -24
  101. package/dist/mcp-server/transports/http/httpErrorHandler.js.map +1 -1
  102. package/dist/mcp-server/transports/http/httpServer.d.ts +3 -3
  103. package/dist/mcp-server/transports/http/httpServer.d.ts.map +1 -1
  104. package/dist/mcp-server/transports/http/httpServer.js +15 -32
  105. package/dist/mcp-server/transports/http/httpServer.js.map +1 -1
  106. package/dist/mcp-server/transports/http/httpTransport.d.ts +25 -8
  107. package/dist/mcp-server/transports/http/httpTransport.d.ts.map +1 -1
  108. package/dist/mcp-server/transports/http/httpTransport.js +156 -373
  109. package/dist/mcp-server/transports/http/httpTransport.js.map +1 -1
  110. package/dist/mcp-server/transports/http/landing-page/assets/styles.d.ts.map +1 -1
  111. package/dist/mcp-server/transports/http/landing-page/assets/styles.js +0 -1
  112. package/dist/mcp-server/transports/http/landing-page/assets/styles.js.map +1 -1
  113. package/dist/mcp-server/transports/http/landing-page/handler.d.ts.map +1 -1
  114. package/dist/mcp-server/transports/http/landing-page/handler.js +4 -8
  115. package/dist/mcp-server/transports/http/landing-page/handler.js.map +1 -1
  116. package/dist/mcp-server/transports/http/landing-page/sections/tools.js +0 -2
  117. package/dist/mcp-server/transports/http/landing-page/sections/tools.js.map +1 -1
  118. package/dist/mcp-server/transports/http/protectedResourceMetadata.d.ts.map +1 -1
  119. package/dist/mcp-server/transports/http/protectedResourceMetadata.js +2 -6
  120. package/dist/mcp-server/transports/http/protectedResourceMetadata.js.map +1 -1
  121. package/dist/mcp-server/transports/http/robotsTxt.js +2 -2
  122. package/dist/mcp-server/transports/http/robotsTxt.js.map +1 -1
  123. package/dist/mcp-server/transports/http/serverCard.d.ts.map +1 -1
  124. package/dist/mcp-server/transports/http/serverCard.js +2 -6
  125. package/dist/mcp-server/transports/http/serverCard.js.map +1 -1
  126. package/dist/mcp-server/transports/http/sessionStore.d.ts +46 -66
  127. package/dist/mcp-server/transports/http/sessionStore.d.ts.map +1 -1
  128. package/dist/mcp-server/transports/http/sessionStore.js +140 -238
  129. package/dist/mcp-server/transports/http/sessionStore.js.map +1 -1
  130. package/dist/mcp-server/transports/manager.d.ts +12 -4
  131. package/dist/mcp-server/transports/manager.d.ts.map +1 -1
  132. package/dist/mcp-server/transports/manager.js +35 -33
  133. package/dist/mcp-server/transports/manager.js.map +1 -1
  134. package/dist/mcp-server/transports/stdio/stdioTransport.d.ts +24 -31
  135. package/dist/mcp-server/transports/stdio/stdioTransport.d.ts.map +1 -1
  136. package/dist/mcp-server/transports/stdio/stdioTransport.js +23 -38
  137. package/dist/mcp-server/transports/stdio/stdioTransport.js.map +1 -1
  138. package/dist/mcp-server/types.d.ts +25 -0
  139. package/dist/mcp-server/types.d.ts.map +1 -0
  140. package/dist/mcp-server/types.js +10 -0
  141. package/dist/mcp-server/types.js.map +1 -0
  142. package/dist/services/canvas/core/CanvasInstance.d.ts +2 -2
  143. package/dist/services/canvas/core/CanvasInstance.d.ts.map +1 -1
  144. package/dist/services/canvas/core/CanvasInstance.js.map +1 -1
  145. package/dist/services/canvas/core/CanvasRegistry.d.ts +4 -4
  146. package/dist/services/canvas/core/CanvasRegistry.d.ts.map +1 -1
  147. package/dist/services/canvas/core/CanvasRegistry.js +8 -18
  148. package/dist/services/canvas/core/CanvasRegistry.js.map +1 -1
  149. package/dist/services/canvas/core/DataCanvas.d.ts +5 -5
  150. package/dist/services/canvas/core/DataCanvas.d.ts.map +1 -1
  151. package/dist/services/canvas/core/DataCanvas.js +2 -3
  152. package/dist/services/canvas/core/DataCanvas.js.map +1 -1
  153. package/dist/services/canvas/core/IDataCanvasProvider.d.ts +11 -11
  154. package/dist/services/canvas/core/IDataCanvasProvider.d.ts.map +1 -1
  155. package/dist/services/canvas/providers/duckdb/DuckdbProvider.d.ts +11 -11
  156. package/dist/services/canvas/providers/duckdb/DuckdbProvider.d.ts.map +1 -1
  157. package/dist/services/canvas/providers/duckdb/DuckdbProvider.js +4 -10
  158. package/dist/services/canvas/providers/duckdb/DuckdbProvider.js.map +1 -1
  159. package/dist/services/llm/providers/openrouter.provider.d.ts.map +1 -1
  160. package/dist/services/llm/providers/openrouter.provider.js +2 -5
  161. package/dist/services/llm/providers/openrouter.provider.js.map +1 -1
  162. package/dist/services/mirror/core/defineMirror.js +1 -1
  163. package/dist/services/mirror/core/defineMirror.js.map +1 -1
  164. package/dist/services/mirror/types.d.ts +5 -5
  165. package/dist/services/mirror/types.d.ts.map +1 -1
  166. package/dist/services/speech/providers/elevenlabs.provider.js +1 -1
  167. package/dist/services/speech/providers/elevenlabs.provider.js.map +1 -1
  168. package/dist/services/speech/providers/whisper.provider.js +1 -1
  169. package/dist/services/speech/providers/whisper.provider.js.map +1 -1
  170. package/dist/storage/core/StorageService.d.ts +1 -1
  171. package/dist/storage/core/StorageService.d.ts.map +1 -1
  172. package/dist/storage/core/StorageService.js +12 -20
  173. package/dist/storage/core/StorageService.js.map +1 -1
  174. package/dist/storage/core/storageFactory.d.ts.map +1 -1
  175. package/dist/storage/core/storageFactory.js.map +1 -1
  176. package/dist/storage/core/storageValidation.d.ts +1 -1
  177. package/dist/storage/core/storageValidation.d.ts.map +1 -1
  178. package/dist/storage/core/storageValidation.js +2 -2
  179. package/dist/storage/core/storageValidation.js.map +1 -1
  180. package/dist/storage/providers/cloudflare/d1Provider.d.ts +1 -1
  181. package/dist/storage/providers/cloudflare/d1Provider.d.ts.map +1 -1
  182. package/dist/storage/providers/cloudflare/d1Provider.js +4 -12
  183. package/dist/storage/providers/cloudflare/d1Provider.js.map +1 -1
  184. package/dist/storage/providers/cloudflare/kvProvider.d.ts +1 -1
  185. package/dist/storage/providers/cloudflare/kvProvider.d.ts.map +1 -1
  186. package/dist/storage/providers/cloudflare/kvProvider.js +3 -8
  187. package/dist/storage/providers/cloudflare/kvProvider.js.map +1 -1
  188. package/dist/storage/providers/cloudflare/r2Provider.d.ts +1 -1
  189. package/dist/storage/providers/cloudflare/r2Provider.d.ts.map +1 -1
  190. package/dist/storage/providers/cloudflare/r2Provider.js +3 -8
  191. package/dist/storage/providers/cloudflare/r2Provider.js.map +1 -1
  192. package/dist/storage/providers/inMemory/inMemoryProvider.d.ts +1 -1
  193. package/dist/storage/providers/inMemory/inMemoryProvider.d.ts.map +1 -1
  194. package/dist/storage/providers/inMemory/inMemoryProvider.js +2 -4
  195. package/dist/storage/providers/inMemory/inMemoryProvider.js.map +1 -1
  196. package/dist/testing/index.d.ts +35 -12
  197. package/dist/testing/index.d.ts.map +1 -1
  198. package/dist/testing/index.js +53 -38
  199. package/dist/testing/index.js.map +1 -1
  200. package/dist/testing/vitest.d.ts +1 -1
  201. package/dist/testing/vitest.d.ts.map +1 -1
  202. package/dist/types-global/errors.d.ts +28 -15
  203. package/dist/types-global/errors.d.ts.map +1 -1
  204. package/dist/types-global/errors.js +8 -1
  205. package/dist/types-global/errors.js.map +1 -1
  206. package/dist/utils/formatting/diffFormatter.d.ts +5 -5
  207. package/dist/utils/formatting/diffFormatter.d.ts.map +1 -1
  208. package/dist/utils/formatting/diffFormatter.js +7 -20
  209. package/dist/utils/formatting/diffFormatter.js.map +1 -1
  210. package/dist/utils/formatting/tableFormatter.d.ts +3 -3
  211. package/dist/utils/formatting/tableFormatter.d.ts.map +1 -1
  212. package/dist/utils/formatting/tableFormatter.js +6 -17
  213. package/dist/utils/formatting/tableFormatter.js.map +1 -1
  214. package/dist/utils/formatting/treeFormatter.d.ts +3 -3
  215. package/dist/utils/formatting/treeFormatter.d.ts.map +1 -1
  216. package/dist/utils/formatting/treeFormatter.js +5 -18
  217. package/dist/utils/formatting/treeFormatter.js.map +1 -1
  218. package/dist/utils/index.d.ts +4 -2
  219. package/dist/utils/index.d.ts.map +1 -1
  220. package/dist/utils/index.js +2 -2
  221. package/dist/utils/index.js.map +1 -1
  222. package/dist/utils/internal/error-handler/errorHandler.d.ts +1 -1
  223. package/dist/utils/internal/error-handler/errorHandler.d.ts.map +1 -1
  224. package/dist/utils/internal/error-handler/errorHandler.js +23 -11
  225. package/dist/utils/internal/error-handler/errorHandler.js.map +1 -1
  226. package/dist/utils/internal/error-handler/types.d.ts +10 -13
  227. package/dist/utils/internal/error-handler/types.d.ts.map +1 -1
  228. package/dist/utils/internal/logger.d.ts +3 -3
  229. package/dist/utils/internal/logger.d.ts.map +1 -1
  230. package/dist/utils/internal/logger.js +11 -5
  231. package/dist/utils/internal/logger.js.map +1 -1
  232. package/dist/utils/internal/performance.d.ts +1 -1
  233. package/dist/utils/internal/performance.d.ts.map +1 -1
  234. package/dist/utils/internal/performance.js +57 -13
  235. package/dist/utils/internal/performance.js.map +1 -1
  236. package/dist/utils/internal/requestContext.d.ts +79 -55
  237. package/dist/utils/internal/requestContext.d.ts.map +1 -1
  238. package/dist/utils/internal/requestContext.js +77 -32
  239. package/dist/utils/internal/requestContext.js.map +1 -1
  240. package/dist/utils/metrics/tokenCounter.d.ts +3 -3
  241. package/dist/utils/metrics/tokenCounter.d.ts.map +1 -1
  242. package/dist/utils/metrics/tokenCounter.js.map +1 -1
  243. package/dist/utils/network/fetchWithTimeout.d.ts +2 -2
  244. package/dist/utils/network/fetchWithTimeout.d.ts.map +1 -1
  245. package/dist/utils/network/fetchWithTimeout.js +8 -24
  246. package/dist/utils/network/fetchWithTimeout.js.map +1 -1
  247. package/dist/utils/network/retry.d.ts +2 -2
  248. package/dist/utils/network/retry.d.ts.map +1 -1
  249. package/dist/utils/overflow/outlineOnOverflow.d.ts +1 -1
  250. package/dist/utils/overflow/outlineOnOverflow.d.ts.map +1 -1
  251. package/dist/utils/pagination/pagination.d.ts +3 -3
  252. package/dist/utils/pagination/pagination.d.ts.map +1 -1
  253. package/dist/utils/pagination/pagination.js +3 -3
  254. package/dist/utils/pagination/pagination.js.map +1 -1
  255. package/dist/utils/parsing/csvParser.d.ts +2 -2
  256. package/dist/utils/parsing/csvParser.d.ts.map +1 -1
  257. package/dist/utils/parsing/csvParser.js +4 -8
  258. package/dist/utils/parsing/csvParser.js.map +1 -1
  259. package/dist/utils/parsing/dateParser.d.ts +3 -3
  260. package/dist/utils/parsing/dateParser.d.ts.map +1 -1
  261. package/dist/utils/parsing/dateParser.js +3 -2
  262. package/dist/utils/parsing/dateParser.js.map +1 -1
  263. package/dist/utils/parsing/frontmatterParser.d.ts +2 -2
  264. package/dist/utils/parsing/frontmatterParser.d.ts.map +1 -1
  265. package/dist/utils/parsing/frontmatterParser.js +7 -10
  266. package/dist/utils/parsing/frontmatterParser.js.map +1 -1
  267. package/dist/utils/parsing/htmlExtractor.d.ts +2 -2
  268. package/dist/utils/parsing/htmlExtractor.d.ts.map +1 -1
  269. package/dist/utils/parsing/htmlExtractor.js +6 -11
  270. package/dist/utils/parsing/htmlExtractor.js.map +1 -1
  271. package/dist/utils/parsing/jsonParser.d.ts +2 -2
  272. package/dist/utils/parsing/jsonParser.d.ts.map +1 -1
  273. package/dist/utils/parsing/jsonParser.js +4 -8
  274. package/dist/utils/parsing/jsonParser.js.map +1 -1
  275. package/dist/utils/parsing/pdfParser.d.ts +10 -10
  276. package/dist/utils/parsing/pdfParser.d.ts.map +1 -1
  277. package/dist/utils/parsing/pdfParser.js +26 -89
  278. package/dist/utils/parsing/pdfParser.js.map +1 -1
  279. package/dist/utils/parsing/xmlParser.d.ts +2 -2
  280. package/dist/utils/parsing/xmlParser.d.ts.map +1 -1
  281. package/dist/utils/parsing/xmlParser.js +4 -8
  282. package/dist/utils/parsing/xmlParser.js.map +1 -1
  283. package/dist/utils/parsing/yamlParser.d.ts +2 -2
  284. package/dist/utils/parsing/yamlParser.d.ts.map +1 -1
  285. package/dist/utils/parsing/yamlParser.js +4 -8
  286. package/dist/utils/parsing/yamlParser.js.map +1 -1
  287. package/dist/utils/scheduling/scheduler.d.ts.map +1 -1
  288. package/dist/utils/scheduling/scheduler.js +5 -6
  289. package/dist/utils/scheduling/scheduler.js.map +1 -1
  290. package/dist/utils/security/rateLimiter.d.ts +2 -2
  291. package/dist/utils/security/rateLimiter.d.ts.map +1 -1
  292. package/dist/utils/security/rateLimiter.js +1 -1
  293. package/dist/utils/security/rateLimiter.js.map +1 -1
  294. package/dist/utils/telemetry/attributes.d.ts +23 -7
  295. package/dist/utils/telemetry/attributes.d.ts.map +1 -1
  296. package/dist/utils/telemetry/attributes.js +23 -10
  297. package/dist/utils/telemetry/attributes.js.map +1 -1
  298. package/dist/utils/telemetry/trace.d.ts +3 -3
  299. package/dist/utils/telemetry/trace.d.ts.map +1 -1
  300. package/dist/utils/telemetry/trace.js +4 -2
  301. package/dist/utils/telemetry/trace.js.map +1 -1
  302. package/package.json +22 -26
  303. package/scripts/lint-mcp.ts +1 -3
  304. package/scripts/lint-packaging.ts +1 -1
  305. package/skills/add-service/SKILL.md +2 -2
  306. package/skills/add-test/SKILL.md +42 -20
  307. package/skills/add-tool/SKILL.md +68 -19
  308. package/skills/api-config/SKILL.md +1 -11
  309. package/skills/api-context/SKILL.md +175 -111
  310. package/skills/api-linter/SKILL.md +2 -2
  311. package/skills/api-telemetry/SKILL.md +8 -12
  312. package/skills/api-testing/SKILL.md +53 -52
  313. package/skills/code-simplifier/SKILL.md +2 -2
  314. package/skills/design-mcp-server/SKILL.md +31 -17
  315. package/skills/field-test/SKILL.md +4 -2
  316. package/skills/polish-docs-meta/SKILL.md +1 -1
  317. package/skills/polish-docs-meta/references/agent-protocol.md +2 -2
  318. package/skills/polish-docs-meta/references/readme.md +1 -1
  319. package/skills/release-and-publish/SKILL.md +3 -1
  320. package/skills/report-issue-framework/SKILL.md +2 -2
  321. package/skills/report-issue-local/SKILL.md +2 -2
  322. package/skills/security-pass/SKILL.md +16 -14
  323. package/templates/AGENTS.md +6 -6
  324. package/templates/CLAUDE.md +6 -6
  325. package/templates/tests/resources/echo.resource.test.ts +16 -9
  326. package/dist/mcp-server/elicitation.d.ts +0 -64
  327. package/dist/mcp-server/elicitation.d.ts.map +0 -1
  328. package/dist/mcp-server/elicitation.js +0 -81
  329. package/dist/mcp-server/elicitation.js.map +0 -1
  330. package/dist/mcp-server/protocolSession.d.ts +0 -34
  331. package/dist/mcp-server/protocolSession.d.ts.map +0 -1
  332. package/dist/mcp-server/protocolSession.js +0 -13
  333. package/dist/mcp-server/protocolSession.js.map +0 -1
  334. package/dist/mcp-server/tasks/core/evictingTaskMessageQueue.d.ts +0 -53
  335. package/dist/mcp-server/tasks/core/evictingTaskMessageQueue.d.ts.map +0 -1
  336. package/dist/mcp-server/tasks/core/evictingTaskMessageQueue.js +0 -65
  337. package/dist/mcp-server/tasks/core/evictingTaskMessageQueue.js.map +0 -1
  338. package/dist/mcp-server/tasks/core/sessionAwareTaskStore.d.ts +0 -70
  339. package/dist/mcp-server/tasks/core/sessionAwareTaskStore.d.ts.map +0 -1
  340. package/dist/mcp-server/tasks/core/sessionAwareTaskStore.js +0 -130
  341. package/dist/mcp-server/tasks/core/sessionAwareTaskStore.js.map +0 -1
  342. package/dist/mcp-server/tasks/core/storageBackedTaskStore.d.ts +0 -109
  343. package/dist/mcp-server/tasks/core/storageBackedTaskStore.d.ts.map +0 -1
  344. package/dist/mcp-server/tasks/core/storageBackedTaskStore.js +0 -209
  345. package/dist/mcp-server/tasks/core/storageBackedTaskStore.js.map +0 -1
  346. package/dist/mcp-server/tasks/core/taskManager.d.ts +0 -91
  347. package/dist/mcp-server/tasks/core/taskManager.d.ts.map +0 -1
  348. package/dist/mcp-server/tasks/core/taskManager.js +0 -210
  349. package/dist/mcp-server/tasks/core/taskManager.js.map +0 -1
  350. package/dist/mcp-server/tasks/core/taskTypes.d.ts +0 -18
  351. package/dist/mcp-server/tasks/core/taskTypes.d.ts.map +0 -1
  352. package/dist/mcp-server/tasks/core/taskTypes.js +0 -20
  353. package/dist/mcp-server/tasks/core/taskTypes.js.map +0 -1
  354. package/dist/mcp-server/tasks/utils/taskToolDefinition.d.ts +0 -101
  355. package/dist/mcp-server/tasks/utils/taskToolDefinition.d.ts.map +0 -1
  356. package/dist/mcp-server/tasks/utils/taskToolDefinition.js +0 -14
  357. package/dist/mcp-server/tasks/utils/taskToolDefinition.js.map +0 -1
@@ -4,7 +4,7 @@ description: >
4
4
  Scaffold a test file for an existing tool, resource, or service. Use when the user asks to add tests, improve coverage, or when a definition exists without a matching test file.
5
5
  metadata:
6
6
  author: cyanheads
7
- version: "1.5"
7
+ version: "1.6"
8
8
  audience: external
9
9
  type: reference
10
10
  ---
@@ -36,8 +36,8 @@ Read the handler and identify:
36
36
  | **Input variations** | Optional fields omitted, defaults applied, boundary values |
37
37
  | **Error paths** | Invalid state, missing resources, service failures → correct error thrown |
38
38
  | **`ctx.state` usage** | Available on any mock context (tenant `'default'` unless `{ tenantId }` says otherwise). It runs the production storage path, so use storage-legal keys (`cache/v1/abc`, never `cache:v1:abc`) and assert TTL expiry with fake timers. |
39
- | **`ctx.elicit`** | Mock with `vi.fn()`, also test the absent case (undefined) |
40
- | **`ctx.progress`** | Use `createMockContext({ progress: true })` for task tools |
39
+ | **`ctx.requestInput` / `ctx.inputs`** | Two rounds. First round: assert the handler throws the input-required signal (`.rejects.toSatisfy(isInputRequiredSignal)`), or catch it and assert on `error.result.inputRequests`. Second round: seed `createMockContext({ inputResponses })` and assert the handler completes. Cover the decline/cancel branch too. |
40
+ | **`ctx.signal`** | Pass `createMockContext({ signal: controller.signal })` and assert a long loop stops early rather than running to completion. |
41
41
  | **`ctx.fail` (typed contract)** | Definitions with `errors[]` need `fail` attached to the mock ctx — `createMockContext({ errors: myTool.errors })` does it for you. Assert on `data.reason` (stable per-contract entry), not just `code`. |
42
42
  | **`format` function** | Test separately if defined — it's pure, no ctx needed. Verify it renders the IDs and fields the model needs, not just a count or title. For projection-style tools, test non-default field selections. |
43
43
  | **Sparse upstream payloads** | For third-party API integrations, build a fixture with omitted fields. Assert normalized output still validates and `format()` preserves unknown values instead of inventing facts. |
@@ -183,31 +183,53 @@ describe('{{ServiceClass}}', () => {
183
183
 
184
184
  If you need to test the accessor's "not initialized" guard, do it in a separate isolated-module test (`vi.resetModules()` before importing the service module). Don't mix that assertion into a suite that already calls `init{{ServiceClass}}()` in `beforeEach()`.
185
185
 
186
- ### Task tool test
186
+ ### Multi-round-trip tool test
187
187
 
188
- For tools with `task: true`, use `createMockContext({ progress: true })`:
188
+ A handler that calls `ctx.requestInput(...)` throws an `InputRequiredSignal` — in production the handler factory converts it to an `input_required` result; in a unit test it surfaces as a thrown value. Test both rounds.
189
189
 
190
190
  ```typescript
191
- it('reports progress during execution', async () => {
192
- const ctx = createMockContext({ progress: true });
193
- const input = {{TOOL_EXPORT}}.input.parse({ count: 3, delayMs: 10 });
194
- await {{TOOL_EXPORT}}.handler(input, ctx);
195
-
196
- const progress = ctx.progress as ContextProgress & {
197
- _total: number;
198
- _completed: number;
199
- _messages: string[];
200
- };
201
- expect(progress._total).toBe(3);
202
- expect(progress._completed).toBe(3);
191
+ import { isInputRequiredSignal } from '@cyanheads/mcp-ts-core';
192
+ import { createMockContext } from '@cyanheads/mcp-ts-core/testing';
193
+
194
+ it('requests the missing input on the first round', async () => {
195
+ const ctx = createMockContext();
196
+ const input = {{TOOL_EXPORT}}.input.parse({ path: '/tmp/x' });
197
+
198
+ try {
199
+ await {{TOOL_EXPORT}}.handler(input, ctx);
200
+ throw new Error('Expected the handler to request input.');
201
+ } catch (error) {
202
+ if (!isInputRequiredSignal(error)) throw error;
203
+ expect(Object.keys(error.result.inputRequests ?? {})).toEqual(['confirm']);
204
+ }
205
+ });
206
+
207
+ it('completes once the response is supplied', async () => {
208
+ const ctx = createMockContext({
209
+ inputResponses: { confirm: { action: 'accept', content: { confirm: true } } },
210
+ });
211
+ const input = {{TOOL_EXPORT}}.input.parse({ path: '/tmp/x' });
212
+
213
+ await expect({{TOOL_EXPORT}}.handler(input, ctx)).resolves.toMatchObject({ deleted: '/tmp/x' });
203
214
  });
204
215
 
216
+ it('does not re-ask after a decline', async () => {
217
+ const ctx = createMockContext({ inputResponses: { confirm: { action: 'decline' } } });
218
+ const input = {{TOOL_EXPORT}}.input.parse({ path: '/tmp/x' });
219
+
220
+ // Terminal, not another round — re-asking would burn the round budget.
221
+ await expect({{TOOL_EXPORT}}.handler(input, ctx)).rejects.toThrow(McpError);
222
+ });
223
+ ```
224
+
225
+ ### Cancellation test
226
+
227
+ ```typescript
205
228
  it('respects cancellation', async () => {
206
229
  const controller = new AbortController();
207
- const ctx = createMockContext({ progress: true, signal: controller.signal });
230
+ const ctx = createMockContext({ signal: controller.signal });
208
231
  const input = {{TOOL_EXPORT}}.input.parse({ count: 100, delayMs: 10 });
209
232
 
210
- // Abort after a short delay
211
233
  setTimeout(() => controller.abort(), 50);
212
234
  const result = await {{TOOL_EXPORT}}.handler(input, ctx);
213
235
 
@@ -286,7 +308,7 @@ When scaffolding tests for an existing handler, use the Zod schemas to generate
286
308
  - [ ] Happy path tested with valid input → expected output
287
309
  - [ ] Error paths tested (at least one `.rejects.toThrow()`)
288
310
  - [ ] `format` function tested if defined
289
- - [ ] `createMockContext` options match handler's ctx usage (`tenantId`, `progress`, `elicit`)
311
+ - [ ] `createMockContext` options match handler's ctx usage (`tenantId`, `inputResponses`, `requestState`, `errors`, `signal`)
290
312
  - [ ] Service re-initialized in `beforeEach` if handler depends on a service singleton
291
313
  - [ ] If handler has optional fields: tested with empty-string inner values (form-client simulation)
292
314
  - [ ] If wrapping external API: sparse-payload case tested — fixture omits at least one optional upstream field; output still validates and `format()` renders uncertainty honestly instead of inventing values
@@ -4,7 +4,7 @@ description: >
4
4
  Scaffold a new MCP tool definition. Use when the user asks to add a tool, create a new tool, or implement a new capability for the server.
5
5
  metadata:
6
6
  author: cyanheads
7
- version: "2.16"
7
+ version: "2.18"
8
8
  audience: external
9
9
  type: reference
10
10
  ---
@@ -16,8 +16,7 @@ Tools use the `tool()` builder from `@cyanheads/mcp-ts-core`. Each tool lives in
16
16
  ## Steps
17
17
 
18
18
  1. **Gather** the tool's name, purpose, and input/output shape from the user's request — ask only if genuinely absent
19
- 2. **Determine if long-running** — if the tool involves streaming, polling, or
20
- multi-step async work, it should use `task: true`
19
+ 2. **Determine if it needs input the caller may not supply** — a confirmation, a choice, the client's roots — which makes it a multi-round-trip handler (`ctx.requestInput` / `ctx.inputs`, see `api-context`)
21
20
  3. **Create the file** at `src/mcp-server/tools/definitions/{{tool-name}}.tool.ts`
22
21
  4. **Register** the tool in the project's existing `createApp()` tool list (directly in `src/index.ts` for fresh scaffolds, or via a barrel if the repo already has one)
23
22
  5. **Run `bun run devcheck`** to verify — if Biome reports formatting issues, run `bun run format` to auto-fix, then re-run devcheck
@@ -130,31 +129,48 @@ export const {{TOOL_EXPORT}} = tool('{{tool_name}}', {
130
129
  });
131
130
  ```
132
131
 
133
- ### Task tool variant
132
+ ### Multi-round-trip variant
134
133
 
135
- Add `task: true` and use `ctx.progress` for long-running operations:
134
+ A handler that needs something the caller didn't supply returns `ctx.requestInput(...)` and is re-entered with the answers on `ctx.inputs`. There is no mid-handler `await` for user input, and no capability check — the surface is always present, on every transport and both protocol eras.
136
135
 
137
136
  ```typescript
137
+ import { inputRequired, tool, z } from '@cyanheads/mcp-ts-core';
138
+ import { validationError } from '@cyanheads/mcp-ts-core/errors';
139
+
140
+ const Confirm = z.object({ confirm: z.boolean().describe('Whether to proceed.') });
141
+
138
142
  export const {{TOOL_EXPORT}} = tool('{{tool_name}}', {
139
143
  description: '{{TOOL_DESCRIPTION}}',
140
- task: true,
141
144
  input: z.object({ /* ... */ }),
142
145
  output: z.object({ /* ... */ }),
143
-
144
- async handler(input, ctx) {
145
- // ctx.progress is guaranteed non-null when task: true — the ! assertion is safe here.
146
- await ctx.progress!.setTotal(totalSteps);
147
- for (const step of steps) {
148
- if (ctx.signal.aborted) break;
149
- await ctx.progress!.update(`Processing: ${step}`);
150
- // ... do work ...
151
- await ctx.progress!.increment();
146
+ annotations: { destructiveHint: true },
147
+
148
+ handler(input, ctx) {
149
+ // Read what a prior round collected before asking for anything.
150
+ const answer = ctx.inputs.accepted('confirm', Confirm);
151
+ if (!answer) {
152
+ // A declined or cancelled prompt is a dead end — don't re-ask it.
153
+ const view = ctx.inputs.view('confirm');
154
+ if (view.kind === 'elicit' && view.action !== 'accept') {
155
+ throw validationError(`User ${view.action} the confirmation.`);
156
+ }
157
+ return ctx.requestInput({
158
+ inputRequests: {
159
+ confirm: inputRequired.elicit({
160
+ message: `Proceed with ${input.target}?`,
161
+ requestedSchema: Confirm,
162
+ }),
163
+ },
164
+ });
152
165
  }
166
+ // `answer` is narrowed here.
153
167
  return { /* output */ };
154
168
  },
155
169
  });
156
170
  ```
157
171
 
172
+ Write it as `return ctx.requestInput(...)` — the `never` return type makes it valid in return position for any output, and it is what lets TypeScript narrow the line below. Full reference (`inputRequired.elicitUrl` / `.createMessage` / `.listRoots`, `requestState`, decline handling): `skills/api-context`.
173
+
158
174
  ### Registration
159
175
 
160
176
  ```typescript
@@ -208,7 +224,40 @@ export const submitObservations = getServerConfig().enableWrites
208
224
  | `/.well-known/mcp.json` `definitions.tools` (Server Card) | **Yes**, with `disabled` field — discovery agents see them as present-but-uncallable |
209
225
  | `/` (HTML landing page) | **Yes**, in a 4th muted bucket after `read \| write \| destructive` |
210
226
 
211
- The wrapper composes with both standard and task tools, and preserves all original definition fields (handler, schemas, auth scopes, error contracts) — when re-enabled, the tool already conforms to every lint rule.
227
+ The wrapper preserves all original definition fields (handler, schemas, auth scopes, error contracts) — when re-enabled, the tool already conforms to every lint rule.
228
+
229
+ ## Schemas: what the framework stores vs. what clients see
230
+
231
+ `tool()` and the handler factory do not hand your Zod schemas to the SDK verbatim. Two deliberate transforms sit in between.
232
+
233
+ ### Input is strict
234
+
235
+ `tool()` stores `input` with `.strict()` applied, and the advertised `inputSchema` carries `additionalProperties: false` to match. An unrecognized argument key is **rejected by name** before the handler runs:
236
+
237
+ ```text
238
+ Input validation error: Invalid arguments for tool <name>: Unrecognized key: "querry"
239
+ ```
240
+
241
+ That arrives as an `isError: true` result, not a JSON-RPC error, and produces no framework span or log. The alternative — silently stripping the key — turns a caller's typo into a wrong answer they cannot detect: the value vanishes before the handler runs and the call fails downstream pointing at the wrong problem.
242
+
243
+ Two limits worth knowing when you write a schema:
244
+
245
+ - **Root level only**, matching `.strict()` itself. A nested `z.object()` inside the input still strips unknown keys unless it is strict in its own right — mark the nested option objects you want guarded.
246
+ - **An explicit opening wins.** A definition that declared `.passthrough()` or `.catchall(...)` asked for an open object, and `tool()` leaves it alone. Use that (deliberately) for tools that proxy arbitrary upstream query parameters.
247
+
248
+ ### The advertised `outputSchema` is widened
249
+
250
+ The framework parses a successful result against the strict effective schema — `output`, extended with the `enrichment` block when one is declared — so a required field the handler never populated still fails loudly. What it *advertises* in `tools/list` is a widened projection of that schema: every success field optional, plus a declared `error` property describing the failure envelope.
251
+
252
+ The reason is client-side validation. A failing tool returns `structuredContent: { error: … }`, which can never satisfy a success-only schema; clients whose SDK validates `structuredContent` without first checking `isError` reject that envelope with `-32602` before the error ever reaches the agent. Widening the advertised schema is the only fix a server can ship, because the validator runs in the caller.
253
+
254
+ The root stays `type: 'object'` (a discriminated union would emit `anyOf` with no `type`, which the 2025-era legacy projection rewrites — breaking the success path to fix the error path). The `required` list that the object form drops is recovered by an `anyOf` refinement in schema metadata: a result must satisfy either the success branch (success fields present, no `error`) or the failure branch (`error` present).
255
+
256
+ Practical consequence: **do not read the advertised schema as the contract your handler must satisfy.** `output` is still the contract. The widened form is emission only.
257
+
258
+ `data.reason` inside that envelope stays an unconstrained string. An `errors[]` contract covers what the *handler* throws, but a service it calls can raise its own reason (the SQL gate's `denied_function`, a parser's `yaml_parse_failed`), and that reaches the wire verbatim — an enum of the declared reasons would reject precisely those envelopes, recreating the `-32602` the widening exists to prevent. The declared reasons are emitted as `examples` and spelled out in the description instead.
259
+
260
+ **`error` is a reserved output field name.** `tool()` throws if `output` or `enrichment` declares one: on the wire a failure *is* `structuredContent.error`, so a success payload using the same key cannot be told apart from a failure. Rename it (`errorText`, `failureDetail`).
212
261
 
213
262
  ## Tool Response Design
214
263
 
@@ -218,7 +267,7 @@ Tool responses are the LLM's only window into what happened. Every response shou
218
267
 
219
268
  Empty-result notices, the query/filter as the server parsed it, pagination totals — the context an agent *reasons with*, as opposed to the domain payload itself — must reach **both** client surfaces: `structuredContent` (from `output`) and `content[]` (from `format()`). Hand-authored into `format()` text alone, this context reaches `content[]` but is invisible to `structuredContent`-only clients (Claude Code, MCP-SDK API callers).
220
269
 
221
- Declare it as an `enrichment` block — the success-path counterpart to `errors[]` — and populate it via `ctx.enrich(...)` (or the kind-tagged helpers `ctx.enrich.notice()` / `.total()` / `.echo()`). The framework merges enrichment into `structuredContent`, advertises `output.extend(enrichment)` as the tool's `outputSchema`, and mirrors it into a `content[]` trailer — both surfaces, no `format()` entry, never touched by `format-parity`. `ctx.enrich` lives on the base `Context` (like `ctx.log`), so the service layer can populate it too.
270
+ Declare it as an `enrichment` block — the success-path counterpart to `errors[]` — and populate it via `ctx.enrich(...)` (or the kind-tagged helpers `ctx.enrich.notice()` / `.total()` / `.echo()`). The framework merges enrichment into `structuredContent`, folds the block into the tool's advertised `outputSchema` (see [Schemas](#schemas-what-the-framework-stores-vs-what-clients-see)), and mirrors it into a `content[]` trailer — both surfaces, no `format()` entry, never touched by `format-parity`. `ctx.enrich` lives on the base `Context` (like `ctx.log`), so the service layer can populate it too.
222
271
 
223
272
  ```typescript
224
273
  enrichment: {
@@ -673,8 +722,8 @@ return { items: hits };
673
722
  - [ ] `auth` scopes declared if the tool needs authorization
674
723
  - [ ] `errors: [...]` contract declared for the tool's domain-specific failure modes — or block deleted if no domain failures apply (baseline codes bubble freely)
675
724
  - [ ] Error contract declared inline on this tool — not imported from a shared module, even when other tools have near-identical entries
676
- - [ ] `task: true` added if the tool is long-running
677
- - [ ] If `task: true`: handler checks `ctx.signal.aborted` in its loop for cancellation support
725
+ - [ ] Long loops check `ctx.signal.aborted` so a cancelled request (or a closed transport) stops the work
726
+ - [ ] If the tool needs caller input it may not have been given: reads `ctx.inputs` first, requests only what is missing via `return ctx.requestInput(...)`, and treats a declined/cancelled response as terminal rather than re-asking
678
727
  - [ ] If tool returns unbounded arrays: pagination with total count, or `spillover()` / DataCanvas for *analytical* working sets (an agent would SQL them — not a discovery/search surface). If any tool emits a `canvas_id`, a `dataframe_query` tool is registered in the same server — a token with no query tool is dead output
679
728
  - [ ] If tool returns one large *document* (not a row set) that can overflow context: `outlineOnOverflow()` returns a `full | outline` union so the agent re-calls with `sections: [...]` — not one-sided truncation
680
729
  - [ ] If tool is feature-gated: evaluated whether `disabledTool()` wrapper is appropriate (present in manifest but uncallable)
@@ -4,7 +4,7 @@ description: >
4
4
  Reference for core and server configuration in `@cyanheads/mcp-ts-core`. Covers env var tables with defaults, priority order, server-specific Zod schema pattern, and Workers lazy-parsing requirement.
5
5
  metadata:
6
6
  author: cyanheads
7
- version: "1.9"
7
+ version: "1.10"
8
8
  audience: external
9
9
  type: reference
10
10
  ---
@@ -177,16 +177,6 @@ Activated when both `SUPABASE_URL` and `SUPABASE_ANON_KEY` are set.
177
177
 
178
178
  ---
179
179
 
180
- ### Tasks
181
-
182
- | Env Var | `AppConfig` field | Default | Notes |
183
- |:--------|:-----------------|:--------|:------|
184
- | `TASK_STORE_TYPE` | `tasks.storeType` | `in-memory` | `in-memory` \| `storage`; aliases: `mem`/`memory`→`in-memory`, `persistent`→`storage` |
185
- | `TASK_STORE_TENANT_ID` | `tasks.tenantId` | `system-tasks` | Tenant ID for task state storage |
186
- | `TASK_STORE_DEFAULT_TTL_MS` | `tasks.defaultTtlMs` | — | TTL for completed tasks (ms); null = no expiry |
187
-
188
- ---
189
-
190
180
  ### Speech (optional sub-object)
191
181
 
192
182
  Activated when `SPEECH_TTS_ENABLED` or `SPEECH_STT_ENABLED` is set.