@cyanheads/mcp-ts-core 0.11.4 → 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 (366) hide show
  1. package/AGENTS.md +28 -24
  2. package/CLAUDE.md +28 -24
  3. package/README.md +10 -10
  4. package/biome.json +1 -1
  5. package/changelog/0.11.x/0.11.5.md +28 -0
  6. package/changelog/0.12.x/0.12.0.md +96 -0
  7. package/changelog/template.md +55 -16
  8. package/dist/cli/init.js +1 -1
  9. package/dist/cli/init.js.map +1 -1
  10. package/dist/config/index.d.ts +0 -18
  11. package/dist/config/index.d.ts.map +1 -1
  12. package/dist/config/index.js +0 -25
  13. package/dist/config/index.js.map +1 -1
  14. package/dist/core/app.d.ts +5 -7
  15. package/dist/core/app.d.ts.map +1 -1
  16. package/dist/core/app.js +18 -27
  17. package/dist/core/app.js.map +1 -1
  18. package/dist/core/context.d.ts +90 -57
  19. package/dist/core/context.d.ts.map +1 -1
  20. package/dist/core/context.js +32 -33
  21. package/dist/core/context.js.map +1 -1
  22. package/dist/core/gcPressure.d.ts.map +1 -1
  23. package/dist/core/gcPressure.js +3 -4
  24. package/dist/core/gcPressure.js.map +1 -1
  25. package/dist/core/index.d.ts +6 -7
  26. package/dist/core/index.d.ts.map +1 -1
  27. package/dist/core/index.js +10 -2
  28. package/dist/core/index.js.map +1 -1
  29. package/dist/core/serverManifest.d.ts +1 -3
  30. package/dist/core/serverManifest.d.ts.map +1 -1
  31. package/dist/core/serverManifest.js +9 -4
  32. package/dist/core/serverManifest.js.map +1 -1
  33. package/dist/core/worker.d.ts.map +1 -1
  34. package/dist/core/worker.js +32 -35
  35. package/dist/core/worker.js.map +1 -1
  36. package/dist/logs/combined.log +10 -0
  37. package/dist/logs/error.log +6 -0
  38. package/dist/logs/interactions.log +0 -0
  39. package/dist/mcp-server/inputRequired.d.ts +52 -0
  40. package/dist/mcp-server/inputRequired.d.ts.map +1 -0
  41. package/dist/mcp-server/inputRequired.js +76 -0
  42. package/dist/mcp-server/inputRequired.js.map +1 -0
  43. package/dist/mcp-server/notifications.d.ts +33 -31
  44. package/dist/mcp-server/notifications.d.ts.map +1 -1
  45. package/dist/mcp-server/notifications.js +34 -26
  46. package/dist/mcp-server/notifications.js.map +1 -1
  47. package/dist/mcp-server/prompts/prompt-registration.d.ts +2 -2
  48. package/dist/mcp-server/prompts/prompt-registration.d.ts.map +1 -1
  49. package/dist/mcp-server/prompts/prompt-registration.js +15 -5
  50. package/dist/mcp-server/prompts/prompt-registration.js.map +1 -1
  51. package/dist/mcp-server/prompts/utils/promptDefinition.d.ts +1 -1
  52. package/dist/mcp-server/prompts/utils/promptDefinition.d.ts.map +1 -1
  53. package/dist/mcp-server/resources/resource-registration.d.ts +3 -3
  54. package/dist/mcp-server/resources/resource-registration.d.ts.map +1 -1
  55. package/dist/mcp-server/resources/resource-registration.js +8 -15
  56. package/dist/mcp-server/resources/resource-registration.js.map +1 -1
  57. package/dist/mcp-server/resources/resourceSubscriptions.d.ts +45 -0
  58. package/dist/mcp-server/resources/resourceSubscriptions.d.ts.map +1 -0
  59. package/dist/mcp-server/resources/resourceSubscriptions.js +51 -0
  60. package/dist/mcp-server/resources/resourceSubscriptions.js.map +1 -0
  61. package/dist/mcp-server/resources/utils/resourceDefinition.d.ts +3 -5
  62. package/dist/mcp-server/resources/utils/resourceDefinition.d.ts.map +1 -1
  63. package/dist/mcp-server/resources/utils/resourceDefinition.js +1 -1
  64. package/dist/mcp-server/resources/utils/resourceDefinition.js.map +1 -1
  65. package/dist/mcp-server/resources/utils/resourceHandlerFactory.d.ts +8 -15
  66. package/dist/mcp-server/resources/utils/resourceHandlerFactory.d.ts.map +1 -1
  67. package/dist/mcp-server/resources/utils/resourceHandlerFactory.js +21 -22
  68. package/dist/mcp-server/resources/utils/resourceHandlerFactory.js.map +1 -1
  69. package/dist/mcp-server/server.d.ts +12 -21
  70. package/dist/mcp-server/server.d.ts.map +1 -1
  71. package/dist/mcp-server/server.js +38 -28
  72. package/dist/mcp-server/server.js.map +1 -1
  73. package/dist/mcp-server/tools/tool-registration.d.ts +11 -33
  74. package/dist/mcp-server/tools/tool-registration.d.ts.map +1 -1
  75. package/dist/mcp-server/tools/tool-registration.js +17 -243
  76. package/dist/mcp-server/tools/tool-registration.js.map +1 -1
  77. package/dist/mcp-server/tools/utils/toolDefinition.d.ts +1 -3
  78. package/dist/mcp-server/tools/utils/toolDefinition.d.ts.map +1 -1
  79. package/dist/mcp-server/tools/utils/toolDefinition.js +48 -1
  80. package/dist/mcp-server/tools/utils/toolDefinition.js.map +1 -1
  81. package/dist/mcp-server/tools/utils/toolHandlerFactory.d.ts +46 -20
  82. package/dist/mcp-server/tools/utils/toolHandlerFactory.d.ts.map +1 -1
  83. package/dist/mcp-server/tools/utils/toolHandlerFactory.js +131 -25
  84. package/dist/mcp-server/tools/utils/toolHandlerFactory.js.map +1 -1
  85. package/dist/mcp-server/transports/ITransport.d.ts +2 -2
  86. package/dist/mcp-server/transports/ITransport.d.ts.map +1 -1
  87. package/dist/mcp-server/transports/auth/authFactory.js +1 -1
  88. package/dist/mcp-server/transports/auth/authFactory.js.map +1 -1
  89. package/dist/mcp-server/transports/auth/lib/authTypes.d.ts +1 -1
  90. package/dist/mcp-server/transports/auth/lib/authTypes.d.ts.map +1 -1
  91. package/dist/mcp-server/transports/auth/lib/authUtils.d.ts.map +1 -1
  92. package/dist/mcp-server/transports/auth/lib/authUtils.js +5 -13
  93. package/dist/mcp-server/transports/auth/lib/authUtils.js.map +1 -1
  94. package/dist/mcp-server/transports/auth/strategies/jwtStrategy.js +5 -11
  95. package/dist/mcp-server/transports/auth/strategies/jwtStrategy.js.map +1 -1
  96. package/dist/mcp-server/transports/auth/strategies/oauthStrategy.d.ts.map +1 -1
  97. package/dist/mcp-server/transports/auth/strategies/oauthStrategy.js +9 -22
  98. package/dist/mcp-server/transports/auth/strategies/oauthStrategy.js.map +1 -1
  99. package/dist/mcp-server/transports/heartbeat.d.ts.map +1 -1
  100. package/dist/mcp-server/transports/heartbeat.js +4 -8
  101. package/dist/mcp-server/transports/heartbeat.js.map +1 -1
  102. package/dist/mcp-server/transports/http/httpErrorHandler.d.ts.map +1 -1
  103. package/dist/mcp-server/transports/http/httpErrorHandler.js +6 -24
  104. package/dist/mcp-server/transports/http/httpErrorHandler.js.map +1 -1
  105. package/dist/mcp-server/transports/http/httpServer.d.ts +3 -3
  106. package/dist/mcp-server/transports/http/httpServer.d.ts.map +1 -1
  107. package/dist/mcp-server/transports/http/httpServer.js +15 -32
  108. package/dist/mcp-server/transports/http/httpServer.js.map +1 -1
  109. package/dist/mcp-server/transports/http/httpTransport.d.ts +25 -8
  110. package/dist/mcp-server/transports/http/httpTransport.d.ts.map +1 -1
  111. package/dist/mcp-server/transports/http/httpTransport.js +156 -310
  112. package/dist/mcp-server/transports/http/httpTransport.js.map +1 -1
  113. package/dist/mcp-server/transports/http/landing-page/assets/styles.d.ts.map +1 -1
  114. package/dist/mcp-server/transports/http/landing-page/assets/styles.js +0 -1
  115. package/dist/mcp-server/transports/http/landing-page/assets/styles.js.map +1 -1
  116. package/dist/mcp-server/transports/http/landing-page/handler.d.ts.map +1 -1
  117. package/dist/mcp-server/transports/http/landing-page/handler.js +4 -8
  118. package/dist/mcp-server/transports/http/landing-page/handler.js.map +1 -1
  119. package/dist/mcp-server/transports/http/landing-page/sections/tools.js +0 -2
  120. package/dist/mcp-server/transports/http/landing-page/sections/tools.js.map +1 -1
  121. package/dist/mcp-server/transports/http/protectedResourceMetadata.d.ts.map +1 -1
  122. package/dist/mcp-server/transports/http/protectedResourceMetadata.js +2 -6
  123. package/dist/mcp-server/transports/http/protectedResourceMetadata.js.map +1 -1
  124. package/dist/mcp-server/transports/http/robotsTxt.js +2 -2
  125. package/dist/mcp-server/transports/http/robotsTxt.js.map +1 -1
  126. package/dist/mcp-server/transports/http/serverCard.d.ts.map +1 -1
  127. package/dist/mcp-server/transports/http/serverCard.js +2 -6
  128. package/dist/mcp-server/transports/http/serverCard.js.map +1 -1
  129. package/dist/mcp-server/transports/http/sessionStore.d.ts +48 -45
  130. package/dist/mcp-server/transports/http/sessionStore.d.ts.map +1 -1
  131. package/dist/mcp-server/transports/http/sessionStore.js +141 -185
  132. package/dist/mcp-server/transports/http/sessionStore.js.map +1 -1
  133. package/dist/mcp-server/transports/manager.d.ts +12 -4
  134. package/dist/mcp-server/transports/manager.d.ts.map +1 -1
  135. package/dist/mcp-server/transports/manager.js +35 -33
  136. package/dist/mcp-server/transports/manager.js.map +1 -1
  137. package/dist/mcp-server/transports/stdio/stdioTransport.d.ts +24 -31
  138. package/dist/mcp-server/transports/stdio/stdioTransport.d.ts.map +1 -1
  139. package/dist/mcp-server/transports/stdio/stdioTransport.js +23 -38
  140. package/dist/mcp-server/transports/stdio/stdioTransport.js.map +1 -1
  141. package/dist/mcp-server/types.d.ts +25 -0
  142. package/dist/mcp-server/types.d.ts.map +1 -0
  143. package/dist/mcp-server/types.js +10 -0
  144. package/dist/mcp-server/types.js.map +1 -0
  145. package/dist/services/canvas/core/CanvasInstance.d.ts +2 -2
  146. package/dist/services/canvas/core/CanvasInstance.d.ts.map +1 -1
  147. package/dist/services/canvas/core/CanvasInstance.js.map +1 -1
  148. package/dist/services/canvas/core/CanvasRegistry.d.ts +4 -4
  149. package/dist/services/canvas/core/CanvasRegistry.d.ts.map +1 -1
  150. package/dist/services/canvas/core/CanvasRegistry.js +8 -18
  151. package/dist/services/canvas/core/CanvasRegistry.js.map +1 -1
  152. package/dist/services/canvas/core/DataCanvas.d.ts +5 -5
  153. package/dist/services/canvas/core/DataCanvas.d.ts.map +1 -1
  154. package/dist/services/canvas/core/DataCanvas.js +2 -3
  155. package/dist/services/canvas/core/DataCanvas.js.map +1 -1
  156. package/dist/services/canvas/core/IDataCanvasProvider.d.ts +11 -11
  157. package/dist/services/canvas/core/IDataCanvasProvider.d.ts.map +1 -1
  158. package/dist/services/canvas/providers/duckdb/DuckdbProvider.d.ts +11 -11
  159. package/dist/services/canvas/providers/duckdb/DuckdbProvider.d.ts.map +1 -1
  160. package/dist/services/canvas/providers/duckdb/DuckdbProvider.js +4 -10
  161. package/dist/services/canvas/providers/duckdb/DuckdbProvider.js.map +1 -1
  162. package/dist/services/llm/providers/openrouter.provider.d.ts.map +1 -1
  163. package/dist/services/llm/providers/openrouter.provider.js +2 -5
  164. package/dist/services/llm/providers/openrouter.provider.js.map +1 -1
  165. package/dist/services/mirror/core/defineMirror.js +1 -1
  166. package/dist/services/mirror/core/defineMirror.js.map +1 -1
  167. package/dist/services/mirror/types.d.ts +5 -5
  168. package/dist/services/mirror/types.d.ts.map +1 -1
  169. package/dist/services/speech/providers/elevenlabs.provider.js +1 -1
  170. package/dist/services/speech/providers/elevenlabs.provider.js.map +1 -1
  171. package/dist/services/speech/providers/whisper.provider.js +1 -1
  172. package/dist/services/speech/providers/whisper.provider.js.map +1 -1
  173. package/dist/storage/core/StorageService.d.ts +1 -1
  174. package/dist/storage/core/StorageService.d.ts.map +1 -1
  175. package/dist/storage/core/StorageService.js +12 -20
  176. package/dist/storage/core/StorageService.js.map +1 -1
  177. package/dist/storage/core/storageFactory.d.ts.map +1 -1
  178. package/dist/storage/core/storageFactory.js.map +1 -1
  179. package/dist/storage/core/storageValidation.d.ts +1 -1
  180. package/dist/storage/core/storageValidation.d.ts.map +1 -1
  181. package/dist/storage/core/storageValidation.js +2 -2
  182. package/dist/storage/core/storageValidation.js.map +1 -1
  183. package/dist/storage/providers/cloudflare/d1Provider.d.ts +1 -1
  184. package/dist/storage/providers/cloudflare/d1Provider.d.ts.map +1 -1
  185. package/dist/storage/providers/cloudflare/d1Provider.js +4 -12
  186. package/dist/storage/providers/cloudflare/d1Provider.js.map +1 -1
  187. package/dist/storage/providers/cloudflare/kvProvider.d.ts +1 -1
  188. package/dist/storage/providers/cloudflare/kvProvider.d.ts.map +1 -1
  189. package/dist/storage/providers/cloudflare/kvProvider.js +3 -8
  190. package/dist/storage/providers/cloudflare/kvProvider.js.map +1 -1
  191. package/dist/storage/providers/cloudflare/r2Provider.d.ts +1 -1
  192. package/dist/storage/providers/cloudflare/r2Provider.d.ts.map +1 -1
  193. package/dist/storage/providers/cloudflare/r2Provider.js +3 -8
  194. package/dist/storage/providers/cloudflare/r2Provider.js.map +1 -1
  195. package/dist/storage/providers/inMemory/inMemoryProvider.d.ts +1 -1
  196. package/dist/storage/providers/inMemory/inMemoryProvider.d.ts.map +1 -1
  197. package/dist/storage/providers/inMemory/inMemoryProvider.js +2 -4
  198. package/dist/storage/providers/inMemory/inMemoryProvider.js.map +1 -1
  199. package/dist/testing/index.d.ts +35 -12
  200. package/dist/testing/index.d.ts.map +1 -1
  201. package/dist/testing/index.js +53 -38
  202. package/dist/testing/index.js.map +1 -1
  203. package/dist/testing/vitest.d.ts +1 -1
  204. package/dist/testing/vitest.d.ts.map +1 -1
  205. package/dist/types-global/errors.d.ts +28 -15
  206. package/dist/types-global/errors.d.ts.map +1 -1
  207. package/dist/types-global/errors.js +8 -1
  208. package/dist/types-global/errors.js.map +1 -1
  209. package/dist/utils/formatting/diffFormatter.d.ts +5 -5
  210. package/dist/utils/formatting/diffFormatter.d.ts.map +1 -1
  211. package/dist/utils/formatting/diffFormatter.js +7 -20
  212. package/dist/utils/formatting/diffFormatter.js.map +1 -1
  213. package/dist/utils/formatting/tableFormatter.d.ts +3 -3
  214. package/dist/utils/formatting/tableFormatter.d.ts.map +1 -1
  215. package/dist/utils/formatting/tableFormatter.js +6 -17
  216. package/dist/utils/formatting/tableFormatter.js.map +1 -1
  217. package/dist/utils/formatting/treeFormatter.d.ts +3 -3
  218. package/dist/utils/formatting/treeFormatter.d.ts.map +1 -1
  219. package/dist/utils/formatting/treeFormatter.js +5 -18
  220. package/dist/utils/formatting/treeFormatter.js.map +1 -1
  221. package/dist/utils/index.d.ts +4 -2
  222. package/dist/utils/index.d.ts.map +1 -1
  223. package/dist/utils/index.js +2 -2
  224. package/dist/utils/index.js.map +1 -1
  225. package/dist/utils/internal/error-handler/errorHandler.d.ts +1 -1
  226. package/dist/utils/internal/error-handler/errorHandler.d.ts.map +1 -1
  227. package/dist/utils/internal/error-handler/errorHandler.js +23 -11
  228. package/dist/utils/internal/error-handler/errorHandler.js.map +1 -1
  229. package/dist/utils/internal/error-handler/types.d.ts +10 -13
  230. package/dist/utils/internal/error-handler/types.d.ts.map +1 -1
  231. package/dist/utils/internal/logger.d.ts +3 -3
  232. package/dist/utils/internal/logger.d.ts.map +1 -1
  233. package/dist/utils/internal/logger.js +11 -5
  234. package/dist/utils/internal/logger.js.map +1 -1
  235. package/dist/utils/internal/performance.d.ts +1 -1
  236. package/dist/utils/internal/performance.d.ts.map +1 -1
  237. package/dist/utils/internal/performance.js +57 -13
  238. package/dist/utils/internal/performance.js.map +1 -1
  239. package/dist/utils/internal/requestContext.d.ts +79 -55
  240. package/dist/utils/internal/requestContext.d.ts.map +1 -1
  241. package/dist/utils/internal/requestContext.js +77 -32
  242. package/dist/utils/internal/requestContext.js.map +1 -1
  243. package/dist/utils/metrics/tokenCounter.d.ts +3 -3
  244. package/dist/utils/metrics/tokenCounter.d.ts.map +1 -1
  245. package/dist/utils/metrics/tokenCounter.js.map +1 -1
  246. package/dist/utils/network/fetchWithTimeout.d.ts +2 -2
  247. package/dist/utils/network/fetchWithTimeout.d.ts.map +1 -1
  248. package/dist/utils/network/fetchWithTimeout.js +8 -24
  249. package/dist/utils/network/fetchWithTimeout.js.map +1 -1
  250. package/dist/utils/network/retry.d.ts +2 -2
  251. package/dist/utils/network/retry.d.ts.map +1 -1
  252. package/dist/utils/overflow/outlineOnOverflow.d.ts +1 -1
  253. package/dist/utils/overflow/outlineOnOverflow.d.ts.map +1 -1
  254. package/dist/utils/pagination/pagination.d.ts +3 -3
  255. package/dist/utils/pagination/pagination.d.ts.map +1 -1
  256. package/dist/utils/pagination/pagination.js +3 -3
  257. package/dist/utils/pagination/pagination.js.map +1 -1
  258. package/dist/utils/parsing/csvParser.d.ts +2 -2
  259. package/dist/utils/parsing/csvParser.d.ts.map +1 -1
  260. package/dist/utils/parsing/csvParser.js +4 -8
  261. package/dist/utils/parsing/csvParser.js.map +1 -1
  262. package/dist/utils/parsing/dateParser.d.ts +3 -3
  263. package/dist/utils/parsing/dateParser.d.ts.map +1 -1
  264. package/dist/utils/parsing/dateParser.js +3 -2
  265. package/dist/utils/parsing/dateParser.js.map +1 -1
  266. package/dist/utils/parsing/frontmatterParser.d.ts +2 -2
  267. package/dist/utils/parsing/frontmatterParser.d.ts.map +1 -1
  268. package/dist/utils/parsing/frontmatterParser.js +7 -10
  269. package/dist/utils/parsing/frontmatterParser.js.map +1 -1
  270. package/dist/utils/parsing/htmlExtractor.d.ts +2 -2
  271. package/dist/utils/parsing/htmlExtractor.d.ts.map +1 -1
  272. package/dist/utils/parsing/htmlExtractor.js +6 -11
  273. package/dist/utils/parsing/htmlExtractor.js.map +1 -1
  274. package/dist/utils/parsing/jsonParser.d.ts +2 -2
  275. package/dist/utils/parsing/jsonParser.d.ts.map +1 -1
  276. package/dist/utils/parsing/jsonParser.js +4 -8
  277. package/dist/utils/parsing/jsonParser.js.map +1 -1
  278. package/dist/utils/parsing/pdfParser.d.ts +10 -10
  279. package/dist/utils/parsing/pdfParser.d.ts.map +1 -1
  280. package/dist/utils/parsing/pdfParser.js +26 -89
  281. package/dist/utils/parsing/pdfParser.js.map +1 -1
  282. package/dist/utils/parsing/xmlParser.d.ts +2 -2
  283. package/dist/utils/parsing/xmlParser.d.ts.map +1 -1
  284. package/dist/utils/parsing/xmlParser.js +4 -8
  285. package/dist/utils/parsing/xmlParser.js.map +1 -1
  286. package/dist/utils/parsing/yamlParser.d.ts +2 -2
  287. package/dist/utils/parsing/yamlParser.d.ts.map +1 -1
  288. package/dist/utils/parsing/yamlParser.js +4 -8
  289. package/dist/utils/parsing/yamlParser.js.map +1 -1
  290. package/dist/utils/scheduling/scheduler.d.ts.map +1 -1
  291. package/dist/utils/scheduling/scheduler.js +5 -6
  292. package/dist/utils/scheduling/scheduler.js.map +1 -1
  293. package/dist/utils/security/rateLimiter.d.ts +2 -2
  294. package/dist/utils/security/rateLimiter.d.ts.map +1 -1
  295. package/dist/utils/security/rateLimiter.js +1 -1
  296. package/dist/utils/security/rateLimiter.js.map +1 -1
  297. package/dist/utils/telemetry/attributes.d.ts +23 -7
  298. package/dist/utils/telemetry/attributes.d.ts.map +1 -1
  299. package/dist/utils/telemetry/attributes.js +23 -10
  300. package/dist/utils/telemetry/attributes.js.map +1 -1
  301. package/dist/utils/telemetry/trace.d.ts +3 -3
  302. package/dist/utils/telemetry/trace.d.ts.map +1 -1
  303. package/dist/utils/telemetry/trace.js +4 -2
  304. package/dist/utils/telemetry/trace.js.map +1 -1
  305. package/package.json +22 -26
  306. package/scripts/lint-mcp.ts +1 -3
  307. package/scripts/lint-packaging.ts +1 -1
  308. package/skills/add-service/SKILL.md +2 -2
  309. package/skills/add-test/SKILL.md +42 -20
  310. package/skills/add-tool/SKILL.md +68 -19
  311. package/skills/api-canvas/SKILL.md +2 -2
  312. package/skills/api-config/SKILL.md +1 -11
  313. package/skills/api-context/SKILL.md +175 -111
  314. package/skills/api-linter/SKILL.md +2 -2
  315. package/skills/api-telemetry/SKILL.md +8 -12
  316. package/skills/api-testing/SKILL.md +53 -52
  317. package/skills/code-simplifier/SKILL.md +2 -2
  318. package/skills/design-mcp-server/SKILL.md +34 -18
  319. package/skills/field-test/SKILL.md +4 -2
  320. package/skills/git-wrapup/SKILL.md +3 -3
  321. package/skills/polish-docs-meta/SKILL.md +1 -1
  322. package/skills/polish-docs-meta/references/agent-protocol.md +2 -2
  323. package/skills/polish-docs-meta/references/readme.md +1 -1
  324. package/skills/release-and-publish/SKILL.md +3 -1
  325. package/skills/report-issue-framework/SKILL.md +2 -2
  326. package/skills/report-issue-local/SKILL.md +2 -2
  327. package/skills/security-pass/SKILL.md +16 -14
  328. package/templates/.github/CODE_OF_CONDUCT.md +28 -0
  329. package/templates/.github/CONTRIBUTING.md +50 -0
  330. package/templates/.github/SECURITY.md +24 -0
  331. package/templates/AGENTS.md +6 -6
  332. package/templates/CLAUDE.md +6 -6
  333. package/templates/changelog/template.md +55 -16
  334. package/templates/tests/resources/echo.resource.test.ts +16 -9
  335. package/dist/mcp-server/elicitation.d.ts +0 -64
  336. package/dist/mcp-server/elicitation.d.ts.map +0 -1
  337. package/dist/mcp-server/elicitation.js +0 -81
  338. package/dist/mcp-server/elicitation.js.map +0 -1
  339. package/dist/mcp-server/protocolSession.d.ts +0 -34
  340. package/dist/mcp-server/protocolSession.d.ts.map +0 -1
  341. package/dist/mcp-server/protocolSession.js +0 -13
  342. package/dist/mcp-server/protocolSession.js.map +0 -1
  343. package/dist/mcp-server/tasks/core/evictingTaskMessageQueue.d.ts +0 -53
  344. package/dist/mcp-server/tasks/core/evictingTaskMessageQueue.d.ts.map +0 -1
  345. package/dist/mcp-server/tasks/core/evictingTaskMessageQueue.js +0 -65
  346. package/dist/mcp-server/tasks/core/evictingTaskMessageQueue.js.map +0 -1
  347. package/dist/mcp-server/tasks/core/sessionAwareTaskStore.d.ts +0 -70
  348. package/dist/mcp-server/tasks/core/sessionAwareTaskStore.d.ts.map +0 -1
  349. package/dist/mcp-server/tasks/core/sessionAwareTaskStore.js +0 -130
  350. package/dist/mcp-server/tasks/core/sessionAwareTaskStore.js.map +0 -1
  351. package/dist/mcp-server/tasks/core/storageBackedTaskStore.d.ts +0 -109
  352. package/dist/mcp-server/tasks/core/storageBackedTaskStore.d.ts.map +0 -1
  353. package/dist/mcp-server/tasks/core/storageBackedTaskStore.js +0 -209
  354. package/dist/mcp-server/tasks/core/storageBackedTaskStore.js.map +0 -1
  355. package/dist/mcp-server/tasks/core/taskManager.d.ts +0 -91
  356. package/dist/mcp-server/tasks/core/taskManager.d.ts.map +0 -1
  357. package/dist/mcp-server/tasks/core/taskManager.js +0 -210
  358. package/dist/mcp-server/tasks/core/taskManager.js.map +0 -1
  359. package/dist/mcp-server/tasks/core/taskTypes.d.ts +0 -18
  360. package/dist/mcp-server/tasks/core/taskTypes.d.ts.map +0 -1
  361. package/dist/mcp-server/tasks/core/taskTypes.js +0 -20
  362. package/dist/mcp-server/tasks/core/taskTypes.js.map +0 -1
  363. package/dist/mcp-server/tasks/utils/taskToolDefinition.d.ts +0 -101
  364. package/dist/mcp-server/tasks/utils/taskToolDefinition.d.ts.map +0 -1
  365. package/dist/mcp-server/tasks/utils/taskToolDefinition.js +0 -14
  366. package/dist/mcp-server/tasks/utils/taskToolDefinition.js.map +0 -1
@@ -0,0 +1,28 @@
1
+ # Code of Conduct
2
+
3
+ This project is a place to build software together. Be decent to the people you're building it with.
4
+
5
+ ## Expected
6
+
7
+ - Assume good faith. Most disagreements are missing context, not bad intent.
8
+ - Keep it technical. Criticize the code, the design, or the idea — not the person.
9
+ - Accept that "no" is a valid answer, and that a maintainer's time is finite.
10
+
11
+ ## Not acceptable
12
+
13
+ - Harassment, personal attacks, or demeaning comments — including about someone's identity, background, or experience level.
14
+ - Hate speech or sexualized language and imagery.
15
+ - Publishing anyone's private information without their permission.
16
+ - Sustained disruption: derailing threads, repeatedly reopening settled decisions, or filing in bad faith.
17
+
18
+ ## Scope
19
+
20
+ This applies in every project space — issues, discussions, pull requests, commit messages, and code review — and when representing the project elsewhere.
21
+
22
+ If you're running an agent that files issues here, you're accountable for what it posts. Read the [contributing guide](./CONTRIBUTING.md) before pointing one at this repo.
23
+
24
+ ## Reporting
25
+
26
+ Email **[your-contact-email]**. Reports are handled privately, and your identity won't be shared with the person you're reporting.
27
+
28
+ Maintainers may edit, remove, or lock any contribution that doesn't fit these guidelines, and block accounts that repeatedly ignore them. For anything egregious, that happens immediately and without warning.
@@ -0,0 +1,50 @@
1
+ # Contributing
2
+
3
+ Thanks for using `{{PACKAGE_NAME}}`. Bugs, feature requests, and documentation gaps all belong in an issue — that's where they get read and picked up.
4
+
5
+ Open one from the **Issues** tab and pick the **Bug Report** or **Feature Request** form. Both are structured, and filling in the fields is what makes an issue actionable.
6
+
7
+ <!-- Optional: swap the line above for direct links once you know your repo URL —
8
+ https://github.com/OWNER/REPO/issues/new?template=bug_report.yml -->
9
+
10
+ <!-- If you accept pull requests, say so here — e.g. "PRs welcome; open an issue
11
+ first for anything larger than a typo." Silence reads as "issues only". -->
12
+
13
+ ## Server bug or framework bug?
14
+
15
+ `{{PACKAGE_NAME}}` is built on [@cyanheads/mcp-ts-core](https://github.com/cyanheads/mcp-ts-core), which handles transports, auth, config, logging, and telemetry. Sorting out which layer broke saves everyone a round-trip:
16
+
17
+ - **This repo** — a tool returns wrong data, an upstream API call fails, a schema doesn't match reality, a description misleads the model.
18
+ - **[mcp-ts-core](https://github.com/cyanheads/mcp-ts-core/issues)** — a builder rejects valid input, `createApp()` fails on a valid config, a `Context` method behaves contrary to its docs, transport or auth misbehaves regardless of which tool you call.
19
+
20
+ If you're not sure, file here and it'll get routed.
21
+
22
+ ## Before filing
23
+
24
+ A few things that save a round-trip:
25
+
26
+ 1. **Check you're on the latest release.** Fixes land on the current version.
27
+ 2. **Search existing issues** before opening a new one. Add to the matching thread instead of filing a duplicate.
28
+ 3. **Redact anything sensitive.** Issues are public and permanent — no API keys, tokens, auth headers, internal URLs, or PII in code, logs, or stack traces.
29
+
30
+ ## What makes an issue actionable
31
+
32
+ - Server version, `mcp-ts-core` version, runtime (Bun / Node / Workers), and transport (stdio / HTTP).
33
+ - The tool, resource, or prompt involved, and the arguments you called it with.
34
+ - Actual vs expected behavior, verbatim: error messages and stack traces as they appeared.
35
+ - For features: the use case first, then the API as you'd want to call it.
36
+
37
+ ## For agents
38
+
39
+ Do the triage first — an unverified report costs more to read than it saves to file.
40
+
41
+ Two workflows ship with this project:
42
+
43
+ - [`skills/report-issue-local/SKILL.md`](../skills/report-issue-local/SKILL.md) — filing against this repo.
44
+ - [`skills/report-issue-framework/SKILL.md`](../skills/report-issue-framework/SKILL.md) — filing against `mcp-ts-core` when you've isolated the bug to the framework.
45
+
46
+ Read the relevant one before filing on a user's behalf.
47
+
48
+ ## Security
49
+
50
+ Don't open a public issue for a vulnerability. Report it privately — GitHub's **Security** tab → **Report a vulnerability**, or email the maintainer.
@@ -0,0 +1,24 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ Security fixes land on the latest release of `{{PACKAGE_NAME}}`. Older
6
+ versions are not patched — upgrade to the current release.
7
+
8
+ ## Reporting a Vulnerability
9
+
10
+ Please do not open a public issue for security reports. Instead:
11
+
12
+ <!-- GitHub's private reporting is off by default. Turn it on under
13
+ Settings → Code security → Private vulnerability reporting. -->
14
+
15
+ - Report privately via GitHub: **Security** tab → **Report a vulnerability**, or
16
+ - Email **[your-contact-email]**
17
+
18
+ Include a minimal reproduction where possible, with any API keys, tokens, or
19
+ credentials redacted — a placeholder is enough to show the shape. You'll
20
+ receive an acknowledgment, and credit in the release notes if the report leads
21
+ to a fix (unless you prefer otherwise).
22
+
23
+ <!-- If you want to commit to a response window, say so above — e.g.
24
+ "You'll receive an acknowledgment within a few days." -->
@@ -4,7 +4,7 @@
4
4
  **Version:** 0.1.0
5
5
  **Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^{{FRAMEWORK_VERSION}}`
6
6
  **Engines:** Bun ≥1.3.0, Node ≥24.0.0
7
- **MCP SDK:** `@modelcontextprotocol/sdk` {{MCP_SDK_VERSION}}
7
+ **MCP SDK:** `@modelcontextprotocol/server` {{MCP_SDK_VERSION}}
8
8
  **Zod:** {{ZOD_VERSION}}
9
9
 
10
10
  > **Read the framework docs first:** `node_modules/@cyanheads/mcp-ts-core/CLAUDE.md` contains the full API reference — builders, Context, error codes, exports, patterns. This file covers server-specific conventions only.
@@ -48,7 +48,7 @@ Tailor suggestions to what's actually missing or stale — don't recite the full
48
48
  - **Logic throws, framework catches.** Tool/resource handlers are pure — throw on failure, no `try/catch`. Plain `Error` is fine; the framework catches, classifies, and formats. Use error factories (`notFound()`, `validationError()`, etc.) when the error code matters.
49
49
  - **Use `ctx.log`** for request-scoped logging. No `console` calls.
50
50
  - **Use `ctx.state`** for tenant-scoped storage. Never access persistence directly.
51
- - **Check `ctx.elicit`** for presence before calling.
51
+ - **Need input the caller didn't supply?** `return ctx.requestInput(...)` and read `ctx.inputs` when the handler is re-entered. Never `await` for user input mid-handler.
52
52
  - **Secrets in env vars only** — never hardcoded.
53
53
  - **Close the loop on issues.** When implementing work tracked by a GitHub issue, comment on the issue with what landed and close it. Do both — a comment without a close leaves stale issues open; a close without a comment leaves no record of what shipped. The comment is for future readers — state the concrete changes, not the conversation that produced them.
54
54
 
@@ -181,13 +181,13 @@ Handlers receive a unified `ctx` object. Key properties:
181
181
 
182
182
  | Property | Description |
183
183
  |:---------|:------------|
184
- | `ctx.log` | Request-scoped logger — `.debug()`, `.info()`, `.notice()`, `.warning()`, `.error()`. Auto-correlates requestId, traceId, tenantId. |
184
+ | `ctx.log` | Request-scoped logger — `.debug()`, `.info()`, `.notice()`, `.warning()`, `.error()`. Auto-correlates requestId, traceId, tenantId. Dual-sink: Pino **and** `notifications/message` to the client, so treat it as client-visible. |
185
185
  | `ctx.state` | Tenant-scoped KV — `.get(key)`, `.set(key, value, { ttl? })`, `.delete(key)`, `.getMany(keys)`, `.list(prefix, { cursor, limit })`. Accepts any serializable value. |
186
- | `ctx.elicit` | Ask user for structured input — form call `(message, schema)` or `.url(message, url)` for an external link. **Check for presence first:** `if (ctx.elicit) { ... }` |
186
+ | `ctx.requestInput` | Suspend and ask the caller for more input — `return ctx.requestInput({ inputRequests: { key: inputRequired.elicit({ message, requestedSchema }) } })`. Never returns; the handler is re-entered with the answers. Always present. |
187
+ | `ctx.inputs` | Reader over a retried request's responses — `.accepted(key, schema)`, `.view(key)`, `.state()`, `.dropped`. Empty on the first round. |
187
188
  | `ctx.enrich` | Success-path agent context (empty-result notices, query echo, pagination totals) — `ctx.enrich(...)` or `.notice()` / `.total()` / `.echo()` / `.truncated()`. Reaches `structuredContent` and `content[]`; lands only when the definition declares an `enrichment` block (no-op otherwise). |
188
189
  | `ctx.content` | Non-text content blocks — `.image(data, mimeType)`, `.audio(data, mimeType)`, or `ctx.content(block)` for a raw block. Prepended to `content[]` after `format()`; never enters `structuredContent`. |
189
190
  | `ctx.signal` | `AbortSignal` for cancellation. |
190
- | `ctx.progress` | Task progress (present when `task: true`) — `.setTotal(n)`, `.increment()`, `.update(message)`. |
191
191
  | `ctx.requestId` | Unique request ID. |
192
192
  | `ctx.tenantId` | Tenant ID from JWT; `'default'` for stdio or HTTP with auth off. |
193
193
 
@@ -303,7 +303,7 @@ Available skills:
303
303
  | `api-auth` | Auth modes, scopes, JWT/OAuth |
304
304
  | `api-canvas` | DataCanvas: register tabular data, run SQL, export, plus the `spillover()` helper for big result sets — Tier 3 opt-in |
305
305
  | `api-config` | AppConfig, parseConfig, env vars |
306
- | `api-context` | Context interface, logger, state, progress |
306
+ | `api-context` | Context interface, RequestContext, logger, state, multi-round-trip input |
307
307
  | `api-errors` | McpError, JsonRpcErrorCode, error patterns |
308
308
  | `api-linter` | Definition linter rule catalog — invoked by `bun run lint:mcp` and `devcheck` |
309
309
  | `api-mirror` | MirrorService: persistent self-refreshing local mirror (embedded SQLite + FTS5) of a bulk upstream dataset — Tier 3 opt-in |
@@ -4,7 +4,7 @@
4
4
  **Version:** 0.1.0
5
5
  **Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^{{FRAMEWORK_VERSION}}`
6
6
  **Engines:** Bun ≥1.3.0, Node ≥24.0.0
7
- **MCP SDK:** `@modelcontextprotocol/sdk` {{MCP_SDK_VERSION}}
7
+ **MCP SDK:** `@modelcontextprotocol/server` {{MCP_SDK_VERSION}}
8
8
  **Zod:** {{ZOD_VERSION}}
9
9
 
10
10
  > **Read the framework docs first:** `node_modules/@cyanheads/mcp-ts-core/CLAUDE.md` contains the full API reference — builders, Context, error codes, exports, patterns. This file covers server-specific conventions only.
@@ -48,7 +48,7 @@ Tailor suggestions to what's actually missing or stale — don't recite the full
48
48
  - **Logic throws, framework catches.** Tool/resource handlers are pure — throw on failure, no `try/catch`. Plain `Error` is fine; the framework catches, classifies, and formats. Use error factories (`notFound()`, `validationError()`, etc.) when the error code matters.
49
49
  - **Use `ctx.log`** for request-scoped logging. No `console` calls.
50
50
  - **Use `ctx.state`** for tenant-scoped storage. Never access persistence directly.
51
- - **Check `ctx.elicit`** for presence before calling.
51
+ - **Need input the caller didn't supply?** `return ctx.requestInput(...)` and read `ctx.inputs` when the handler is re-entered. Never `await` for user input mid-handler.
52
52
  - **Secrets in env vars only** — never hardcoded.
53
53
  - **Close the loop on issues.** When implementing work tracked by a GitHub issue, comment on the issue with what landed and close it. Do both — a comment without a close leaves stale issues open; a close without a comment leaves no record of what shipped. The comment is for future readers — state the concrete changes, not the conversation that produced them.
54
54
 
@@ -181,13 +181,13 @@ Handlers receive a unified `ctx` object. Key properties:
181
181
 
182
182
  | Property | Description |
183
183
  |:---------|:------------|
184
- | `ctx.log` | Request-scoped logger — `.debug()`, `.info()`, `.notice()`, `.warning()`, `.error()`. Auto-correlates requestId, traceId, tenantId. |
184
+ | `ctx.log` | Request-scoped logger — `.debug()`, `.info()`, `.notice()`, `.warning()`, `.error()`. Auto-correlates requestId, traceId, tenantId. Dual-sink: Pino **and** `notifications/message` to the client, so treat it as client-visible. |
185
185
  | `ctx.state` | Tenant-scoped KV — `.get(key)`, `.set(key, value, { ttl? })`, `.delete(key)`, `.getMany(keys)`, `.list(prefix, { cursor, limit })`. Accepts any serializable value. |
186
- | `ctx.elicit` | Ask user for structured input — form call `(message, schema)` or `.url(message, url)` for an external link. **Check for presence first:** `if (ctx.elicit) { ... }` |
186
+ | `ctx.requestInput` | Suspend and ask the caller for more input — `return ctx.requestInput({ inputRequests: { key: inputRequired.elicit({ message, requestedSchema }) } })`. Never returns; the handler is re-entered with the answers. Always present. |
187
+ | `ctx.inputs` | Reader over a retried request's responses — `.accepted(key, schema)`, `.view(key)`, `.state()`, `.dropped`. Empty on the first round. |
187
188
  | `ctx.enrich` | Success-path agent context (empty-result notices, query echo, pagination totals) — `ctx.enrich(...)` or `.notice()` / `.total()` / `.echo()` / `.truncated()`. Reaches `structuredContent` and `content[]`; lands only when the definition declares an `enrichment` block (no-op otherwise). |
188
189
  | `ctx.content` | Non-text content blocks — `.image(data, mimeType)`, `.audio(data, mimeType)`, or `ctx.content(block)` for a raw block. Prepended to `content[]` after `format()`; never enters `structuredContent`. |
189
190
  | `ctx.signal` | `AbortSignal` for cancellation. |
190
- | `ctx.progress` | Task progress (present when `task: true`) — `.setTotal(n)`, `.increment()`, `.update(message)`. |
191
191
  | `ctx.requestId` | Unique request ID. |
192
192
  | `ctx.tenantId` | Tenant ID from JWT; `'default'` for stdio or HTTP with auth off. |
193
193
 
@@ -303,7 +303,7 @@ Available skills:
303
303
  | `api-auth` | Auth modes, scopes, JWT/OAuth |
304
304
  | `api-canvas` | DataCanvas: register tabular data, run SQL, export, plus the `spillover()` helper for big result sets — Tier 3 opt-in |
305
305
  | `api-config` | AppConfig, parseConfig, env vars |
306
- | `api-context` | Context interface, logger, state, progress |
306
+ | `api-context` | Context interface, RequestContext, logger, state, multi-round-trip input |
307
307
  | `api-errors` | McpError, JsonRpcErrorCode, error patterns |
308
308
  | `api-linter` | Definition linter rule catalog — invoked by `bun run lint:mcp` and `devcheck` |
309
309
  | `api-mirror` | MirrorService: persistent self-refreshing local mirror (embedded SQLite + FTS5) of a bulk upstream dataset — Tier 3 opt-in |
@@ -4,10 +4,11 @@
4
4
  # to author a new release. Set that file's H1 to `# <version> — YYYY-MM-DD`
5
5
  # with a concrete date.
6
6
 
7
- # Required. One-line GitHub Release-style headline. 350 character cap.
8
- # Default short and scannable. Don't pad, don't stitch unrelated changes with
9
- # semicolons — pick the headline. Quotes required: unquoted YAML treats `: `
10
- # inside the value as a key separator and fails GitHub's strict parser.
7
+ # Required. One-line GitHub Release-style headline. 350 character cap — a
8
+ # ceiling, not a target. Default short and scannable. Don't pad, don't stitch
9
+ # unrelated changes with commas/semicolons into an inventory — pick the
10
+ # headline, like a tag's theme line. Quotes required: unquoted YAML treats
11
+ # `: ` inside the value as a key separator and fails GitHub's strict parser.
11
12
  summary: ""
12
13
 
13
14
  # Set `true` when consumers must change code to upgrade: API removals,
@@ -24,9 +25,10 @@ security: false
24
25
 
25
26
  # Optional free-form notes for maintenance agents processing this release.
26
27
  # Not rendered in CHANGELOG — consumed by agents running `maintenance` on
27
- # downstream servers. Use for adoption instructions that don't fit the
28
- # human-facing sections: new files to create, fields to populate, one-time
29
- # migration steps. Omit the field entirely when there's nothing to say.
28
+ # downstream servers. ADOPTION STEPS ONLY — new files to create, fields to
29
+ # populate, one-time migration steps. Never a second rendering of the body:
30
+ # if a body bullet already says it, name the bullet's symbol instead of
31
+ # re-explaining. Omit the field entirely when there's nothing to say.
30
32
  # agent-notes: |
31
33
  # <instructions for downstream maintenance agents>
32
34
  ---
@@ -41,17 +43,54 @@ security: false
41
43
  each bullet with the symbol or concept name in **bold** so they can skip
42
44
  what's irrelevant and zoom in on what's not.
43
45
 
44
- Tone: terse, fact-dense, not verbose. Default to one sentence per bullet —
45
- name the symbol, state what changed, stop. Use a second sentence only when
46
- it carries weight. If a bullet feels long, it is.
47
-
48
- Cut: mechanism walkthroughs (those belong in JSDoc, CLAUDE.md/AGENTS.md, or the
49
- relevant skill), ceremonial framings ("This release introduces…",
50
- backwards-compat paragraphs), file-by-file test enumerations, internal
51
- implementation notes. Prefer code/symbol names over English re-explanations.
46
+ Tone: terse, fact-dense, not verbose. Bullet shape: **symbol** + what
47
+ changed + at most one consumer-facing caveat. One sentence by default, two
48
+ when the second carries weight — a bullet past ~40 words or three sentences
49
+ is wrong. The depth lives one hop away: the linked issue carries the why,
50
+ the commit diff carries the how. The changelog names what changed and what
51
+ a consumer does about it; a reader who wants mechanism opens the link.
52
+
53
+ Model length on THIS guide, never on the previous entry — entries modeled
54
+ on entries compound.
55
+
56
+ Cut (each has shipped as a wall of text; these are the cruft):
57
+ - History/justification narration — how the bug worked, why the old
58
+ behavior was wrong. One short clause at most; the issue carries the story.
59
+ - Design-rationale defense — "chosen over Y because…", "guarding the
60
+ getter is not enough…". That is the author arguing with a reviewer;
61
+ reviewers read the PR, not the changelog.
62
+ - Defensive unchanged-clauses — "X is unchanged", "byte-identical to
63
+ <prev>". Keep one only where its absence would cause a real misread,
64
+ as a short parenthetical.
65
+ - Edge-case inventories — marker lists, not-flagged lists, escape tables.
66
+ Tests and the issue carry those.
67
+ - Mechanism walkthroughs (JSDoc, CLAUDE.md/AGENTS.md, or the relevant
68
+ skill own those), ceremonial framings ("This release introduces…"),
69
+ backwards-compat paragraphs, file-by-file test enumerations. Prefer
70
+ code/symbol names over English re-explanations.
71
+
72
+ Verified ≠ included: the every-claim-verified-from-the-diff rule bounds
73
+ the TRUTH of what you write, never the AMOUNT.
74
+
75
+ Example — same fact, right size:
76
+
77
+ TOO LONG: **`fetchWithTimeout`'s `timeoutMs` bounds the whole exchange**
78
+ (#341). `fetch` resolves once headers arrive and the deadline was
79
+ cleared as the helper returned, so a peer that answered promptly and
80
+ then stalled the stream held the request open indefinitely. A 2xx
81
+ carrying a body now comes back as a passthrough wrapper that disarms
82
+ the deadline when the body closes, errors, or is cancelled; …
83
+ [+90 more words of mechanism and edge cases]
84
+
85
+ RIGHT: **`fetchWithTimeout`'s `timeoutMs` now bounds the whole
86
+ exchange, not just the headers** (#341). A stalled body aborts with
87
+ the same `Timeout` error; the returned `Response` is a wrapper, so
88
+ identity assertions (`toBe(response)`) no longer hold.
52
89
 
53
90
  Narrative intro: skip by default. Add one short sentence only when the
54
- release theme genuinely needs framing the bullets can't carry.
91
+ release theme genuinely needs framing the bullets can't carry. When many
92
+ bullets share one upgrade consequence, state it ONCE — intro line or
93
+ agent-notes — never per bullet.
55
94
 
56
95
  Sections: Keep a Changelog order — Added, Changed, Deprecated, Removed,
57
96
  Fixed, Security. Include only sections with entries; delete the rest
@@ -16,15 +16,22 @@ describe('echoResource', () => {
16
16
  });
17
17
 
18
18
  it('lists available resources', async () => {
19
- // `list` receives the SDK's request-handler extra, not a Context, and may be
20
- // async — a minimal literal is enough for a listing that ignores it.
21
- const extra = {
22
- signal: new AbortController().signal,
23
- requestId: 'test',
24
- sendNotification: () => Promise.resolve(),
25
- sendRequest: () => Promise.resolve({} as never),
26
- };
27
- const listing = await echoResource.list!(extra);
19
+ // `list` receives the SDK's `ServerContext`, not a handler `Context`, and
20
+ // may be async — a minimal literal is enough for a listing that ignores it.
21
+ const serverContext = {
22
+ mcpReq: {
23
+ id: 'test',
24
+ method: 'resources/list',
25
+ signal: new AbortController().signal,
26
+ requestState: () => undefined,
27
+ send: () => Promise.resolve({} as never),
28
+ notify: () => Promise.resolve(),
29
+ log: () => Promise.resolve(),
30
+ elicitInput: () => Promise.resolve({ action: 'cancel' as const }),
31
+ requestSampling: () => Promise.reject(new Error('not supported')),
32
+ },
33
+ } as unknown as Parameters<NonNullable<typeof echoResource.list>>[0];
34
+ const listing = await echoResource.list!(serverContext);
28
35
  expect(listing.resources).toHaveLength(1);
29
36
  expect(listing.resources[0]).toMatchObject({
30
37
  uri: 'echo://hello',
@@ -1,64 +0,0 @@
1
- /**
2
- * @fileoverview Shared elicitation plumbing for the tool and resource handler
3
- * factories.
4
- * @module src/mcp-server/elicitation
5
- */
6
- import type { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol.js';
7
- import { type ElicitRequestFormParams, type ElicitRequestURLParams, type ElicitResult, type ServerNotification, type ServerRequest } from '@modelcontextprotocol/sdk/types.js';
8
- import { type ZodObject, type ZodRawShape } from 'zod';
9
- import type { ElicitFn } from '../core/context.js';
10
- type SdkExtra = RequestHandlerExtra<ServerRequest, ServerNotification>;
11
- /**
12
- * The elicitation slice of the tool and resource notifier bundles.
13
- *
14
- * `elicitInput` and `getClientCapabilities` are bound at registration time to
15
- * the per-server `Server` instance so `wrapElicit` can gate `ctx.elicit` on the
16
- * client's advertised capability and forward elicitation requests on the wire.
17
- * Both are undefined where no connected client is available (the auto-task
18
- * background path).
19
- */
20
- export interface ElicitationNotifiers {
21
- /** Bound to `server.server.elicitInput.bind(server.server)`. */
22
- elicitInput?: (params: ElicitRequestFormParams | ElicitRequestURLParams) => Promise<ElicitResult>;
23
- /** Bound to `server.server.getClientCapabilities.bind(server.server)`. */
24
- getClientCapabilities?: () => {
25
- elicitation?: unknown;
26
- } | undefined;
27
- /** Route elicitation through RequestHandlerExtra.sendRequest on per-request servers. */
28
- requestScopedElicitation?: boolean;
29
- }
30
- /**
31
- * Validate an accepted elicitation payload against the schema its request
32
- * advertised.
33
- *
34
- * `Server.elicitInput` runs this check itself, but a per-request HTTP server
35
- * reaches the client through `RequestHandlerExtra.sendRequest` instead and so
36
- * bypasses it. Raising the SDK's own `InvalidParams` shape here keeps
37
- * `ctx.elicit`'s failure contract identical on both transports.
38
- *
39
- * @param schema - The Zod object the elicitation request was built from.
40
- * @param content - The `content` of an `accept` response.
41
- * @throws {McpError} `InvalidParams` when the payload does not satisfy `schema`.
42
- */
43
- export declare function assertElicitedContent(schema: ZodObject<ZodRawShape>, content: unknown): void;
44
- /**
45
- * Builds `ctx.elicit` from the notifiers bound at registration time.
46
- *
47
- * Returns `undefined` when:
48
- * - `elicitInput` was not bound (auto-task background path, or no server),
49
- * - the client did not advertise the elicitation capability (checked at
50
- * request time, after the initialize handshake populates capabilities).
51
- *
52
- * When defined, the returned function is an `ElicitFn`: directly callable for
53
- * form-mode elicitation (schema converted from ZodObject to the restricted
54
- * flat JSON Schema the MCP spec requires), plus a `.url(message, url)` helper
55
- * for URL-mode elicitation (elicitationId generated internally).
56
- *
57
- * CRITICAL: `requestedSchema` must be a plain JSON Schema object in the spec's
58
- * restricted flat form — passing a raw ZodObject causes AJV validation to
59
- * reject the request on the SDK side. `z.toJSONSchema(schema)` produces the
60
- * correct shape.
61
- */
62
- export declare function wrapElicit(notifiers: ElicitationNotifiers, sdkContext: SdkExtra): ElicitFn | undefined;
63
- export {};
64
- //# sourceMappingURL=elicitation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"elicitation.d.ts","sourceRoot":"","sources":["../../src/mcp-server/elicitation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,YAAY,EAEjB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EACnB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAgB,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,KAAK,CAAC;AAErE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGlD,KAAK,QAAQ,GAAG,mBAAmB,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC;AAEvE;;;;;;;;GAQG;AACH,MAAM,WAAW,oBAAoB;IACnC,gEAAgE;IAChE,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,uBAAuB,GAAG,sBAAsB,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;IAClG,0EAA0E;IAC1E,qBAAqB,CAAC,EAAE,MAAM;QAAE,WAAW,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,SAAS,CAAC;IACpE,wFAAwF;IACxF,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAU5F;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,UAAU,CACxB,SAAS,EAAE,oBAAoB,EAC/B,UAAU,EAAE,QAAQ,GACnB,QAAQ,GAAG,SAAS,CAgCtB"}
@@ -1,81 +0,0 @@
1
- /**
2
- * @fileoverview Shared elicitation plumbing for the tool and resource handler
3
- * factories.
4
- * @module src/mcp-server/elicitation
5
- */
6
- import { ElicitResultSchema, } from '@modelcontextprotocol/sdk/types.js';
7
- import { toJSONSchema } from 'zod';
8
- import { invalidParams } from '../types-global/errors.js';
9
- /**
10
- * Validate an accepted elicitation payload against the schema its request
11
- * advertised.
12
- *
13
- * `Server.elicitInput` runs this check itself, but a per-request HTTP server
14
- * reaches the client through `RequestHandlerExtra.sendRequest` instead and so
15
- * bypasses it. Raising the SDK's own `InvalidParams` shape here keeps
16
- * `ctx.elicit`'s failure contract identical on both transports.
17
- *
18
- * @param schema - The Zod object the elicitation request was built from.
19
- * @param content - The `content` of an `accept` response.
20
- * @throws {McpError} `InvalidParams` when the payload does not satisfy `schema`.
21
- */
22
- export function assertElicitedContent(schema, content) {
23
- const parsed = schema.safeParse(content);
24
- if (parsed.success)
25
- return;
26
- throw invalidParams('Elicitation response content does not match the requested schema.', {
27
- reason: 'elicitation_response_invalid',
28
- issues: parsed.error.issues.map((issue) => ({
29
- path: issue.path.join('.'),
30
- code: issue.code,
31
- })),
32
- });
33
- }
34
- /**
35
- * Builds `ctx.elicit` from the notifiers bound at registration time.
36
- *
37
- * Returns `undefined` when:
38
- * - `elicitInput` was not bound (auto-task background path, or no server),
39
- * - the client did not advertise the elicitation capability (checked at
40
- * request time, after the initialize handshake populates capabilities).
41
- *
42
- * When defined, the returned function is an `ElicitFn`: directly callable for
43
- * form-mode elicitation (schema converted from ZodObject to the restricted
44
- * flat JSON Schema the MCP spec requires), plus a `.url(message, url)` helper
45
- * for URL-mode elicitation (elicitationId generated internally).
46
- *
47
- * CRITICAL: `requestedSchema` must be a plain JSON Schema object in the spec's
48
- * restricted flat form — passing a raw ZodObject causes AJV validation to
49
- * reject the request on the SDK side. `z.toJSONSchema(schema)` produces the
50
- * correct shape.
51
- */
52
- export function wrapElicit(notifiers, sdkContext) {
53
- const { elicitInput, getClientCapabilities } = notifiers;
54
- if (typeof elicitInput !== 'function')
55
- return;
56
- // Capability check runs at request time (not registration time) so that
57
- // capabilities populated during the initialize handshake are visible.
58
- if (!getClientCapabilities?.()?.elicitation)
59
- return;
60
- const send = (params) => {
61
- if (!notifiers.requestScopedElicitation)
62
- return elicitInput(params);
63
- return sdkContext.sendRequest({ method: 'elicitation/create', params }, ElicitResultSchema);
64
- };
65
- const formFn = async (msg, schema) => {
66
- const requestedSchema = toJSONSchema(schema);
67
- const result = await send({ mode: 'form', message: msg, requestedSchema });
68
- if (notifiers.requestScopedElicitation && result.action === 'accept' && result.content) {
69
- assertElicitedContent(schema, result.content);
70
- }
71
- return result;
72
- };
73
- const urlFn = (msg, url) => {
74
- const elicitationId = crypto.randomUUID();
75
- return send({ mode: 'url', message: msg, elicitationId, url });
76
- };
77
- const elicitFn = formFn;
78
- elicitFn.url = urlFn;
79
- return elicitFn;
80
- }
81
- //# sourceMappingURL=elicitation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"elicitation.js","sourceRoot":"","sources":["../../src/mcp-server/elicitation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAIL,kBAAkB,GAGnB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAoC,MAAM,KAAK,CAAC;AAGrE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAsBzD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAA8B,EAAE,OAAgB;IACpF,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACzC,IAAI,MAAM,CAAC,OAAO;QAAE,OAAO;IAC3B,MAAM,aAAa,CAAC,mEAAmE,EAAE;QACvF,MAAM,EAAE,8BAA8B;QACtC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAC1C,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;YAC1B,IAAI,EAAE,KAAK,CAAC,IAAI;SACjB,CAAC,CAAC;KACJ,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,UAAU,CACxB,SAA+B,EAC/B,UAAoB;IAEpB,MAAM,EAAE,WAAW,EAAE,qBAAqB,EAAE,GAAG,SAAS,CAAC;IACzD,IAAI,OAAO,WAAW,KAAK,UAAU;QAAE,OAAO;IAE9C,wEAAwE;IACxE,sEAAsE;IACtE,IAAI,CAAC,qBAAqB,EAAE,EAAE,EAAE,WAAW;QAAE,OAAO;IAEpD,MAAM,IAAI,GAAG,CACX,MAAwD,EACjC,EAAE;QACzB,IAAI,CAAC,SAAS,CAAC,wBAAwB;YAAE,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC;QACpE,OAAO,UAAU,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,EAAE,EAAE,kBAAkB,CAAC,CAAC;IAC9F,CAAC,CAAC;IAEF,MAAM,MAAM,GAAG,KAAK,EAAE,GAAW,EAAE,MAA8B,EAAyB,EAAE;QAC1F,MAAM,eAAe,GAAG,YAAY,CAAC,MAAM,CAA+C,CAAC;QAC3F,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,CAAC,CAAC;QAC3E,IAAI,SAAS,CAAC,wBAAwB,IAAI,MAAM,CAAC,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACvF,qBAAqB,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QAChD,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;IAEF,MAAM,KAAK,GAAG,CAAC,GAAW,EAAE,GAAW,EAAyB,EAAE;QAChE,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QAC1C,OAAO,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,CAAC,CAAC;IACjE,CAAC,CAAC;IAEF,MAAM,QAAQ,GAAG,MAAkB,CAAC;IACpC,QAAQ,CAAC,GAAG,GAAG,KAAK,CAAC;IACrB,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -1,34 +0,0 @@
1
- /**
2
- * @fileoverview Request-spanning protocol state hooks for transports that
3
- * create a fresh MCP SDK server for every request.
4
- *
5
- * The SDK stores negotiated capabilities and cancellation controllers on a
6
- * `Server` instance. Streamable HTTP deliberately cannot reuse that instance
7
- * across requests (GHSA-345p-7cg4-v4c7), so the framework carries only the
8
- * minimal session state needed by handler contexts through these hooks.
9
- *
10
- * @module src/mcp-server/protocolSession
11
- */
12
- import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
13
- import type { ClientCapabilities, RequestId } from '@modelcontextprotocol/sdk/types.js';
14
- /** A cancellation signal registered for one in-flight JSON-RPC request. */
15
- export interface ProtocolRequestRegistration {
16
- /** Aborted when a matching `notifications/cancelled` reaches the session. */
17
- signal: AbortSignal;
18
- /** Removes only this registration; safe to call more than once. */
19
- unregister: () => void;
20
- }
21
- /**
22
- * State restored onto a per-request server from its durable HTTP session.
23
- * Undefined for stdio and stateless HTTP, where no cross-request restoration
24
- * is necessary or possible.
25
- */
26
- export interface ProtocolSessionHooks {
27
- /** Capabilities captured from the successful initialize request. */
28
- clientCapabilities?: ClientCapabilities;
29
- /** Registers a tool/resource request for cross-request cancellation. */
30
- registerRequest?: (requestId: RequestId) => ProtocolRequestRegistration;
31
- }
32
- /** Factory shared by stdio (no hooks) and per-request HTTP servers. */
33
- export type McpServerFactory = (session?: ProtocolSessionHooks) => Promise<McpServer>;
34
- //# sourceMappingURL=protocolSession.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"protocolSession.d.ts","sourceRoot":"","sources":["../../src/mcp-server/protocolSession.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAExF,2EAA2E;AAC3E,MAAM,WAAW,2BAA2B;IAC1C,6EAA6E;IAC7E,MAAM,EAAE,WAAW,CAAC;IACpB,mEAAmE;IACnE,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,oEAAoE;IACpE,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,wEAAwE;IACxE,eAAe,CAAC,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,2BAA2B,CAAC;CACzE;AAED,uEAAuE;AACvE,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,CAAC,EAAE,oBAAoB,KAAK,OAAO,CAAC,SAAS,CAAC,CAAC"}
@@ -1,13 +0,0 @@
1
- /**
2
- * @fileoverview Request-spanning protocol state hooks for transports that
3
- * create a fresh MCP SDK server for every request.
4
- *
5
- * The SDK stores negotiated capabilities and cancellation controllers on a
6
- * `Server` instance. Streamable HTTP deliberately cannot reuse that instance
7
- * across requests (GHSA-345p-7cg4-v4c7), so the framework carries only the
8
- * minimal session state needed by handler contexts through these hooks.
9
- *
10
- * @module src/mcp-server/protocolSession
11
- */
12
- export {};
13
- //# sourceMappingURL=protocolSession.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"protocolSession.js","sourceRoot":"","sources":["../../src/mcp-server/protocolSession.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
@@ -1,53 +0,0 @@
1
- /**
2
- * @fileoverview A TaskMessageQueue wrapper that expires a task's queue on the
3
- * same schedule as the task itself.
4
- *
5
- * The SDK's `InMemoryTaskMessageQueue` deletes a queue only in `dequeueAll`,
6
- * which the SDK calls on `tasks/result` retrieval and `tasks/cancel`. Both
7
- * `enqueue` and `dequeue` allocate-and-keep a queue for any taskId they touch,
8
- * so a client that abandons a task — never fetching its result, never
9
- * cancelling — strands that queue and any messages in it for the life of the
10
- * process. Nothing in the SDK parallels the task store's TTL.
11
- *
12
- * @experimental These APIs are experimental and may change without notice.
13
- * @module src/mcp-server/tasks/core/evictingTaskMessageQueue
14
- */
15
- import type { QueuedMessage, TaskMessageQueue } from './taskTypes.js';
16
- /**
17
- * Wraps a {@link TaskMessageQueue} so each task's queue is reclaimed once its
18
- * TTL elapses.
19
- *
20
- * Eviction is lazy and traffic-driven rather than timer-based: a deadline is
21
- * refreshed whenever a task's queue is touched, expired queues are dropped on
22
- * the next operation, and `dequeueAll` releases the deadline outright. That
23
- * keeps the wrapper free of per-task timers and correct on runtimes where a
24
- * timer would never fire.
25
- *
26
- * @experimental
27
- */
28
- export declare class EvictingTaskMessageQueue implements TaskMessageQueue {
29
- private readonly inner;
30
- private readonly ttlMs;
31
- private readonly deadlines;
32
- /**
33
- * @param inner - Queue to delegate to.
34
- * @param ttlMs - Lifetime of an untouched queue. A non-positive value
35
- * disables eviction, matching a task store configured without a TTL.
36
- */
37
- constructor(inner: TaskMessageQueue, ttlMs: number);
38
- private get evicts();
39
- /**
40
- * Drain queues whose deadline has passed, then extend `taskId`'s.
41
- *
42
- * `dequeueAll` is the inner queue's only delete path, so it doubles as the
43
- * eviction primitive here — dropping the messages and the map entry in one
44
- * call.
45
- */
46
- private expireAndTouch;
47
- enqueue(taskId: string, message: QueuedMessage, sessionId?: string, maxSize?: number): Promise<void>;
48
- dequeue(taskId: string, sessionId?: string): Promise<QueuedMessage | undefined>;
49
- dequeueAll(taskId: string, sessionId?: string): Promise<QueuedMessage[]>;
50
- /** Number of queues currently tracked for eviction. Exposed for tests. */
51
- get trackedCount(): number;
52
- }
53
- //# sourceMappingURL=evictingTaskMessageQueue.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"evictingTaskMessageQueue.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tasks/core/evictingTaskMessageQueue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEtE;;;;;;;;;;;GAWG;AACH,qBAAa,wBAAyB,YAAW,gBAAgB;IAS7D,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,KAAK;IATxB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA6B;IAEvD;;;;OAIG;IACH,YACmB,KAAK,EAAE,gBAAgB,EACvB,KAAK,EAAE,MAAM,EAC5B;IAEJ,OAAO,KAAK,MAAM,GAEjB;IAED;;;;;;OAMG;YACW,cAAc;IAatB,OAAO,CACX,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,aAAa,EACtB,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CAGf;IAEK,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAGpF;IAEK,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAG7E;IAED,0EAA0E;IAC1E,IAAI,YAAY,IAAI,MAAM,CAEzB;CACF"}