@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
@@ -1 +1 @@
1
- {"version":3,"file":"prompt-registration.js","sourceRoot":"","sources":["../../../src/mcp-server/prompts/prompt-registration.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AAE9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAM3E,MAAM,OAAO,cAAc;IAKf,UAAU;IACV,MAAM;IALhB,sEAAsE;IACrD,eAAe,GAAG,IAAI,GAAG,EAAU,CAAC;IAErD,YACU,UAAiC,EACjC,MAA4B;0BAD5B,UAAU;sBACV,MAAM;IACb,CAAC;IAEJ;;OAEG;IACH,KAAK,CAAC,WAAW,CAAC,MAAiB;QACjC,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;QAE7B,MAAM,OAAO,GAAG,qBAAqB,CAAC,oBAAoB,CAAC;YACzD,SAAS,EAAE,4BAA4B;SACxC,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,IAAI,CAAC,UAAU,CAAC,MAAM,eAAe,EAAE,OAAO,CAAC,CAAC;QAEjF,sEAAsE;QACtE,wEAAwE;QACxE,6CAA6C;QAC5C,MAAoD,CAAC,wBAAwB,EAAE,CAAC;QAEjF,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACxC,MAAM,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QACxD,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,2BAA2B,IAAI,CAAC,UAAU,CAAC,MAAM,UAAU,EAAE,OAAO,CAAC,CAAC;IAC1F,CAAC;IAED,+EAA+E;IACvE,gBAAgB,CAAC,IAAY;QACnC,IAAI,IAAI,CAAC,e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;gBACtB,CAAC;gBAAC,OAAO,KAAc,EAAE,CAAC;oBACxB,MAAM,OAAO,GAAG,YAAY,CAAC,WAAW,CAAC,KAAK,EAAE;wBAC9C,SAAS,EAAE,UAAU,SAAS,CAAC,IAAI,EAAE;wBACrC,OAAO;qBACR,CAAC,CAAC;oBACH,MAAM,OAAO,YAAY,QAAQ;wBAC/B,CAAC,CAAC,OAAO;wBACT,CAAC,CAAC,IAAI,QAAQ,CAAC,gBAAgB,CAAC,aAAa,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;gBACpE,CAAC;YACH,CAAC,CACF,CAAC;YAEF,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,sBAAsB,SAAS,CAAC,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;QACrE,CAAC,EACD;YACE,SAAS,EAAE,qBAAqB,SAAS,CAAC,IAAI,EAAE;YAChD,OAAO;YACP,SAAS,EAAE,gBAAgB,CAAC,oBAAoB;YAChD,QAAQ,EAAE,IAAI;SACf,CACF,CAAC;IACJ,CAAC;CACF"}
1
+ {"version":3,"file":"prompt-registration.js","sourceRoot":"","sources":["../../../src/mcp-server/prompts/prompt-registration.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AAE9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAE3E,MAAM,OAAO,cAAc;IAKf,UAAU;IACV,MAAM;IALhB,sEAAsE;IACrD,eAAe,GAAG,IAAI,GAAG,EAAU,CAAC;IAErD,YACU,UAAiC,EACjC,MAA4B;0BAD5B,UAAU;sBACV,MAAM;IACb,CAAC;IAEJ;;OAEG;IACH,KAAK,CAAC,WAAW,CAA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CAAC,MAAM,CAAC,KAAK,CAAC,sBAAsB,SAAS,CAAC,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;QACrE,CAAC,EACD;YACE,SAAS,EAAE,qBAAqB,SAAS,CAAC,IAAI,EAAE;YAChD,OAAO;YACP,SAAS,EAAE,gBAAgB,CAAC,oBAAoB;YAChD,QAAQ,EAAE,IAAI;SACf,CACF,CAAC;IACJ,CAAC;CACF"}
@@ -6,7 +6,7 @@
6
6
  * @see {@link https://modelcontextprotocol.io/specification/2025-06-18/basic/prompts | MCP Prompts}
7
7
  * @module src/mcp-server/prompts/utils/promptDefinition
8
8
  */
9
- import type { PromptMessage } from '@modelcontextprotocol/sdk/types.js';
9
+ import type { PromptMessage } from '@modelcontextprotocol/server';
10
10
  import type { ZodObject, ZodRawShape, z } from 'zod';
11
11
  /**
12
12
  * Represents the complete, self-contained definition of an MCP prompt.
@@ -1 +1 @@
1
- {"version":3,"file":"promptDefinition.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/prompts/utils/promptDefinition.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAErD;;GAEG;AACH,MAAM,WAAW,gBAAgB,CAAC,KAAK,SAAS,SAAS,CAAC,WAAW,CAAC,GAAG,SAAS,GAAG,SAAS;IAC5F;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,8BAA8B;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,QAAQ,EAAE,CACR,IAAI,EAAE,KAAK,SAAS,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,KAChF,aAAa,EAAE,GAAG,OAAO,CAAC,aAAa,EAA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6C;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,kFAAkF;AAClF,MAAM,MAAM,mBAAmB,GAAG,gBAAgB,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,SAAS,CAAC,CAAC;AAMvF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,MAAM,CAAC,KAAK,SAAS,SAAS,CAAC,WAAW,CAAC,GAAG,SAAS,GAAG,SAAS,EACjF,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,GAC7C,gBAAgB,CAAC,KAAK,CAAC,CAEzB"}
@@ -2,8 +2,8 @@
2
2
  * @fileoverview Encapsulates the registration of all resource definitions with an McpServer.
3
3
  * @module src/mcp-server/resources/resource-registration
4
4
  */
5
- import { type McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
6
- import type { ProtocolSessionHooks } from '../../mcp-server/protocolSession.js';
5
+ import { type McpServer } from '@modelcontextprotocol/server';
6
+ import type { ResourceSubscriptions } from '../../mcp-server/notifications.js';
7
7
  import type { AnyResourceDefinition } from '../../mcp-server/resources/utils/resourceDefinition.js';
8
8
  import { type ResourceHandlerFactoryServices } from '../../mcp-server/resources/utils/resourceHandlerFactory.js';
9
9
  export declare class ResourceRegistry {
@@ -15,7 +15,7 @@ export declare class ResourceRegistry {
15
15
  /**
16
16
  * Registers all resolved resource definitions with the provided McpServer instance.
17
17
  */
18
- registerAll(server: McpServer, protocolSession?: ProtocolSessionHooks): Promise<void>;
18
+ registerAll(server: McpServer, subscriptions?: ResourceSubscriptions): Promise<void>;
19
19
  /** Throws at startup if a resource with the same name was already registered. */
20
20
  private assertUniqueName;
21
21
  private registerResource;
@@ -1 +1 @@
1
- {"version":3,"file":"resource-registration.d.ts","sourceRoot":"","sources":["../../../src/mcp-server/resources/resource-registration.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,KAAK,SAAS,EAAoB,MAAM,yCAAyC,CAAC;AAE3F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oDAAoD,CAAC;AAChG,OAAO,EAEL,KAAK,8BAA8B,EAEpC,MAAM,wDAAwD,CAAC;AAchE,qBAAa,gBAAgB;IAKzB,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,QAAQ;IALlB,wEAAwE;IACxE,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAqB;IAErD,YACU,YAAY,EAAE,qBAAqB,EAAE,EACrC,QAAQ,EAAE,8BAA8B,EAC9C;IAEJ;;OAEG;IACU,WAAW,CACtB,MAAM,EAAE,SAAS,EACjB,eAAe,CAAC,EAAE,oBAAoB,GACrC,OAAO,CAAC,IAAI,CAAC,CAoCf;IAED,iFAAiF;IACjF,OAAO,CAAC,gBAAgB;YAUV,gBAAgB;CAqD/B"}
1
+ {"version":3,"file":"resource-registration.d.ts","sourceRoot":"","sources":["../../../src/mcp-server/resources/resource-registration.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,KAAK,SAAS,EAAoB,MAAM,8BAA8B,CAAC;AAEhF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oDAAoD,CAAC;AAChG,OAAO,EAEL,KAAK,8BAA8B,EAEpC,MAAM,wDAAwD,CAAC;AAUhE,qBAAa,gBAAgB;IAKzB,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,QAAQ;IALlB,wEAAwE;IACxE,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAqB;IAErD,YACU,YAAY,EAAE,qBAAqB,EAAE,EACrC,QAAQ,EAAE,8BAA8B,EAC9C;IAEJ;;OAEG;IACU,WAAW,CACtB,MAAM,EAAE,SAAS,EACjB,aAAa,CAAC,EAAE,qBAAqB,GACpC,OAAO,CAAC,IAAI,CAAC,CA2Bf;IAED,iFAAiF;IACjF,OAAO,CAAC,gBAAgB;YAUV,gBAAgB;CAqD/B"}
@@ -2,7 +2,7 @@
2
2
  * @fileoverview Encapsulates the registration of all resource definitions with an McpServer.
3
3
  * @module src/mcp-server/resources/resource-registration
4
4
  */
5
- import { ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js';
5
+ import { ResourceTemplate } from '@modelcontextprotocol/server';
6
6
  import { createResourceHandler, } from '../../mcp-server/resources/utils/resourceHandlerFactory.js';
7
7
  import { JsonRpcErrorCode } from '../../types-global/errors.js';
8
8
  import { ErrorHandler } from '../../utils/internal/error-handler/errorHandler.js';
@@ -23,7 +23,7 @@ export class ResourceRegistry {
23
23
  /**
24
24
  * Registers all resolved resource definitions with the provided McpServer instance.
25
25
  */
26
- async registerAll(server, protocolSession) {
26
+ async registerAll(server, subscriptions) {
27
27
  this.registeredNames.clear();
28
28
  // Per-server notifier closures targeting `server.send*ListChanged()`. Bound
29
29
  // once per registerAll() call — never mutated on a shared services object
@@ -31,25 +31,18 @@ export class ResourceRegistry {
31
31
  // factory prefers request-scoped notifiers (#135) and falls back to these
32
32
  // only when a request has no notification sender.
33
33
  const notifiers = {
34
- elicitInput: (params) => server.server.elicitInput(params),
35
- getClientCapabilities: () => protocolSession?.clientCapabilities ?? server.server.getClientCapabilities(),
36
34
  notifyPromptListChanged: () => server.sendPromptListChanged(),
37
35
  notifyResourceListChanged: () => server.sendResourceListChanged(),
38
- notifyResourceUpdated: (uri) => server.server.sendResourceUpdated({ uri }),
39
36
  notifyToolListChanged: () => server.sendToolListChanged(),
40
- requestScopedElicitation: protocolSession !== undefined,
41
- ...(protocolSession?.registerRequest && {
42
- registerRequest: protocolSession.registerRequest,
43
- }),
37
+ ...(subscriptions && { subscriptions }),
44
38
  };
45
39
  const context = requestContextService.createRequestContext({
46
40
  operation: 'ResourceRegistry.registerAll',
47
41
  });
48
42
  logger.debug(`Registering ${this.resourceDefs.length} resource(s)...`, context);
49
- // The SDK only initializes resources/list + resources/read handlers when a
50
- // resource is first registered. Initialize them up front so empty servers
51
- // still expose truthful MCP resource behavior.
52
- server.setResourceRequestHandlers();
43
+ // `resources/list` and `resources/read` are installed by the SDK from the
44
+ // declared `resources` capability, so a server with no resources still
45
+ // answers `resources/list` with an empty array rather than `-32601`.
53
46
  for (const resourceDef of this.resourceDefs) {
54
47
  await this.registerResource(server, resourceDef, notifiers);
55
48
  }
@@ -88,10 +81,10 @@ export class ResourceRegistry {
88
81
  list: def.list,
89
82
  ...(def.complete && { complete: def.complete }),
90
83
  });
91
- server.resource(resourceName, template, metadata, handler);
84
+ server.registerResource(resourceName, template, metadata, handler);
92
85
  }
93
86
  else {
94
- server.resource(resourceName, def.uriTemplate, metadata, (uri, extra) => handler(uri, {}, extra));
87
+ server.registerResource(resourceName, def.uriTemplate, metadata, (uri, ctx) => handler(uri, {}, ctx));
95
88
  }
96
89
  logger.debug(`Resource '${resourceName}' registered successfully.`, registrationContext);
97
90
  }, {
@@ -1 +1 @@
1
- {"version":3,"file":"resource-registration.js","sourceRoot":"","sources":["../../../src/mcp-server/resources/resource-registration.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAkB,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAI3F,OAAO,EACL,qBAAqB,GAGtB,MAAM,wDAAwD,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAM3E,SAAS,uBAAuB,CAAC,WAAmB;IAClD,OAAO,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,C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AE,mBAAmB;YAC5B,SAAS,EAAE,gBAAgB,CAAC,oBAAoB;YAChD,QAAQ,EAAE,IAAI;SACf,CACF,CAAC;IACJ,CAAC;CACF"}
1
+ {"version":3,"file":"resource-registration.js","sourceRoot":"","sources":["../../../src/mcp-server/resources/resource-registration.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAkB,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAIhF,OAAO,EACL,qBAAqB,GAGtB,MAAM,wDAAwD,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAE3E,SAAS,uBAAuB,CAAC,WAAmB;IAClD,OAAO,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,OAAO,gBAAgB;IAKjB,YAAY;IACZ,QAAQ;IALlB,wEAAwE;IACvD,eAAe,GAAG,IAAI,GAAG,EAAU,CAAC;IAErD,YACU,YAAqC,EACrC,QAAwC;4BADxC,YAAY;wBACZ,QAAQ;IACf,CAAC;IAEJ;;OAEG;IACI,KAAK,CAAC,WAAW,CACtB,MAAiB,EACjB,aAAqC;QAErC,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;QAE7B,4EAA4E;QAC5E,0EAA0E;QAC1E,0EAA0E;QAC1E,0EAA0E;QAC1E,kDAAkD;QAClD,MAAM,SAAS,GAA6B;YAC1C,uBAAuB,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,qBAAqB,EAAE;YAC7D,yBAAyB,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,uBAAuB,EAAE;YACjE,qBAAqB,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,EAAE;YACzD,GAAG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GAAG,CAAC,CACtB,CAAC;YACJ,CAAC;YAED,MAAM,CAAC,KAAK,CAAC,aAAa,YAAY,4BAA4B,EAAE,mBAAmB,CAAC,CAAC;QAC3F,CAAC,EACD;YACE,SAAS,EAAE,uBAAuB,YAAY,EAAE;YAChD,OAAO,EAAE,mBAAmB;YAC5B,SAAS,EAAE,gBAAgB,CAAC,oBAAoB;YAChD,QAAQ,EAAE,IAAI;SACf,CACF,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * @fileoverview Per-connection `resources/subscribe` registry.
3
+ *
4
+ * The framework advertises `resources: { subscribe: true }`, and a declared
5
+ * capability is a promise: `resources/subscribe` and `resources/unsubscribe`
6
+ * must resolve, and `notifications/resources/updated` must only reach clients
7
+ * that actually subscribed to the URI (#354).
8
+ *
9
+ * This is the **2025-era** mechanism, and it is installed only on instances
10
+ * serving that era. The 2026-07-28 revision has no `resources/subscribe` RPC —
11
+ * a client opts in through `subscriptions/listen`'s `resourceSubscriptions`
12
+ * filter, and the SDK's listen router owns delivery. Handing a modern instance
13
+ * this registry would leave it permanently empty and silently drop every
14
+ * `ctx.notifyResourceUpdated(uri)`, so `createMcpServerInstance` passes none
15
+ * and the notifiers emit unconditionally there.
16
+ *
17
+ * Scope is the `McpServer` instance, which is also the connection: a persistent
18
+ * instance per session on the sessionful legacy arm, one per request under
19
+ * per-request serving. On the per-request arm a subscription cannot outlive the
20
+ * request that created it, so a handler-time `ctx.notifyResourceUpdated(uri)`
21
+ * only delivers when the same exchange subscribed first.
22
+ *
23
+ * @see {@link https://modelcontextprotocol.io/specification/2026-07-28/server/resources | MCP Resources}
24
+ * @module src/mcp-server/resources/resourceSubscriptions
25
+ */
26
+ import type { McpServer } from '@modelcontextprotocol/server';
27
+ import type { ResourceSubscriptions } from '../../mcp-server/notifications.js';
28
+ /**
29
+ * Read-only view of one connection's subscription set. The set is mutated only
30
+ * by the `resources/subscribe` / `resources/unsubscribe` handlers installed
31
+ * alongside it.
32
+ */
33
+ export interface ResourceSubscriptionRegistry extends ResourceSubscriptions {
34
+ readonly size: number;
35
+ }
36
+ /**
37
+ * Installs `resources/subscribe` / `resources/unsubscribe` on a server instance
38
+ * and returns the registry the notifiers read.
39
+ *
40
+ * Both handlers are idempotent and never fail: re-subscribing is a no-op, and
41
+ * unsubscribing from a URI that was never subscribed succeeds (the spec
42
+ * defines no error for it, and clients tear down optimistically).
43
+ */
44
+ export declare function installResourceSubscriptions(server: McpServer): ResourceSubscriptionRegistry;
45
+ //# sourceMappingURL=resourceSubscriptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resourceSubscriptions.d.ts","sourceRoot":"","sources":["../../../src/mcp-server/resources/resourceSubscriptions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAE3E;;;;GAIG;AACH,MAAM,WAAW,4BAA6B,SAAQ,qBAAqB;IACzE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,SAAS,GAAG,4BAA4B,CAmB5F"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * @fileoverview Per-connection `resources/subscribe` registry.
3
+ *
4
+ * The framework advertises `resources: { subscribe: true }`, and a declared
5
+ * capability is a promise: `resources/subscribe` and `resources/unsubscribe`
6
+ * must resolve, and `notifications/resources/updated` must only reach clients
7
+ * that actually subscribed to the URI (#354).
8
+ *
9
+ * This is the **2025-era** mechanism, and it is installed only on instances
10
+ * serving that era. The 2026-07-28 revision has no `resources/subscribe` RPC —
11
+ * a client opts in through `subscriptions/listen`'s `resourceSubscriptions`
12
+ * filter, and the SDK's listen router owns delivery. Handing a modern instance
13
+ * this registry would leave it permanently empty and silently drop every
14
+ * `ctx.notifyResourceUpdated(uri)`, so `createMcpServerInstance` passes none
15
+ * and the notifiers emit unconditionally there.
16
+ *
17
+ * Scope is the `McpServer` instance, which is also the connection: a persistent
18
+ * instance per session on the sessionful legacy arm, one per request under
19
+ * per-request serving. On the per-request arm a subscription cannot outlive the
20
+ * request that created it, so a handler-time `ctx.notifyResourceUpdated(uri)`
21
+ * only delivers when the same exchange subscribed first.
22
+ *
23
+ * @see {@link https://modelcontextprotocol.io/specification/2026-07-28/server/resources | MCP Resources}
24
+ * @module src/mcp-server/resources/resourceSubscriptions
25
+ */
26
+ /**
27
+ * Installs `resources/subscribe` / `resources/unsubscribe` on a server instance
28
+ * and returns the registry the notifiers read.
29
+ *
30
+ * Both handlers are idempotent and never fail: re-subscribing is a no-op, and
31
+ * unsubscribing from a URI that was never subscribed succeeds (the spec
32
+ * defines no error for it, and clients tear down optimistically).
33
+ */
34
+ export function installResourceSubscriptions(server) {
35
+ const subscribed = new Set();
36
+ server.server.setRequestHandler('resources/subscribe', (request) => {
37
+ subscribed.add(request.params.uri);
38
+ return {};
39
+ });
40
+ server.server.setRequestHandler('resources/unsubscribe', (request) => {
41
+ subscribed.delete(request.params.uri);
42
+ return {};
43
+ });
44
+ return {
45
+ has: (uri) => subscribed.has(uri),
46
+ get size() {
47
+ return subscribed.size;
48
+ },
49
+ };
50
+ }
51
+ //# sourceMappingURL=resourceSubscriptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resourceSubscriptions.js","sourceRoot":"","sources":["../../../src/mcp-server/resources/resourceSubscriptions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAeH;;;;;;;GAOG;AACH,MAAM,UAAU,4BAA4B,CAAC,MAAiB;IAC5D,MAAM,UAAU,GAAG,IAAI,GAAG,EAAU,CAAC;IAErC,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,qBAAqB,EAAE,CAAC,OAAO,EAAE,EAAE;QACjE,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACnC,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,uBAAuB,EAAE,CAAC,OAAO,EAAE,EAAE;QACnE,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACtC,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC;QACjC,IAAI,IAAI;YACN,OAAO,UAAU,CAAC,IAAI,CAAC;QACzB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -3,12 +3,10 @@
3
3
  * Handler receives `(params, ctx)` — URI is available on `ctx.uri`.
4
4
  *
5
5
  * MCP Resources Specification:
6
- * @see {@link https://modelcontextprotocol.io/specification/2025-06-18/basic/resources | MCP Resources}
6
+ * @see {@link https://modelcontextprotocol.io/specification/2026-07-28/server/resources | MCP Resources}
7
7
  * @module src/mcp-server/resources/utils/resourceDefinition
8
8
  */
9
- import type { CompleteResourceTemplateCallback } from '@modelcontextprotocol/sdk/server/mcp.js';
10
- import type { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol.js';
11
- import type { ListResourcesResult, ReadResourceResult, ServerNotification, ServerRequest } from '@modelcontextprotocol/sdk/types.js';
9
+ import type { CompleteResourceTemplateCallback, ListResourcesResult, ReadResourceResult, ServerContext } from '@modelcontextprotocol/server';
12
10
  import type { ZodObject, ZodRawShape, z } from 'zod';
13
11
  import type { HandlerContext, ReasonOf } from '../../../core/context.js';
14
12
  import type { ErrorContract } from '../../../types-global/errors.js';
@@ -25,7 +23,7 @@ export interface ResourceAnnotations {
25
23
  priority?: number;
26
24
  }
27
25
  /** Extra context provided to list() handlers. */
28
- export type ListExtra = RequestHandlerExtra<ServerRequest, ServerNotification>;
26
+ export type ListExtra = ServerContext;
29
27
  /**
30
28
  * Represents a complete, self-contained definition of an MCP resource.
31
29
  * Handler receives `(params, ctx)` — URI is available on `ctx.uri`.
@@ -1 +1 @@
1
- {"version":3,"file":"resourceDefinition.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/utils/resourceDefinition.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,yCAAyC,CAAC;AAChG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACd,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAErD,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,qEAAqE;IACrE,QAAQ,CAAC,EAAE,CAAC,MAAM,GAAG,WAAW,CAAC,EAAE,CAAC;IACpC,qEAAqE;IACrE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,iDAAiD;AACjD,MAAM,MAAM,SAAS,GAAG,mBAAmB,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC;AAE/E;;;GAGG;AACH,MAAM,WAAW,kBAAkB,CACjC,OAAO,SAAS,SAAS,CAAC,WAAW,CAAC,GAAG,SAAS,CAAC,WAAW,CAAC,EAC/D,OAAO,SAAS,SAAS,CAAC,WAAW,CAAC,GAAG,SAAS,GAAG,SAAS,EAC9D,OAAO,SAAS,SAAS,aAAa,EAAE,GAAG,SAAS,GAAG,SAAS;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AC,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,2EAA2E;IAC3E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,6EAA6E;IAC7E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iFAAiF;IACjF,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,0CAA0C;AAC1C,MAAM,MAAM,qBAAqB,GAAG,kBAAkB,CACpD,SAAS,CAAC,WAAW,CAAC,EACtB,SAAS,CAAC,WAAW,CAAC,GAAG,SAAS,EAClC,SAAS,aAAa,EAAE,GAAG,SAAS,CACrC,CAAC;AAMF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,QAAQ,CACtB,OAAO,SAAS,SAAS,CAAC,WAAW,CAAC,EACtC,OAAO,SAAS,SAAS,CAAC,WAAW,CAAC,GAAG,SAAS,GAAG,SAAS,EAC9D,KAAK,CAAC,OAAO,SAAS,SAAS,aAAa,EAAE,GAAG,SAAS,GAAG,SAAS,EAEtE,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,aAAa,CAAC,GAC1E,kBAAkB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAE/C"}
1
+ {"version":3,"file":"resourceDefinition.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/utils/resourceDefinition.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,gCAAgC,EAChC,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,EACd,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAErD,OAAO,KA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C,EACtC,OAAO,SAAS,SAAS,CAAC,WAAW,CAAC,GAAG,SAAS,GAAG,SAAS,EAC9D,KAAK,CAAC,OAAO,SAAS,SAAS,aAAa,EAAE,GAAG,SAAS,GAAG,SAAS,EAEtE,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,aAAa,CAAC,GAC1E,kBAAkB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAE/C"}
@@ -3,7 +3,7 @@
3
3
  * Handler receives `(params, ctx)` — URI is available on `ctx.uri`.
4
4
  *
5
5
  * MCP Resources Specification:
6
- * @see {@link https://modelcontextprotocol.io/specification/2025-06-18/basic/resources | MCP Resources}
6
+ * @see {@link https://modelcontextprotocol.io/specification/2026-07-28/server/resources | MCP Resources}
7
7
  * @module src/mcp-server/resources/utils/resourceDefinition
8
8
  */
9
9
  // ---------------------------------------------------------------------------
@@ -1 +1 @@
1
- {"version":3,"file":"resourceDefinition.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/utils/resourceDefinition.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAyIH,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,QAAQ,CAKtB,WAAmB,EACnB,OAA2E;IAE3E,OAAO,EAAE,WAAW,EAAE,GAAG,OAAO,EAAE,CAAC;AACrC,CAAC"}
1
+ {"version":3,"file":"resourceDefinition.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/utils/resourceDefinition.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAuIH,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,QAAQ,CAKtB,WAAmB,EACnB,OAA2E;IAE3E,OAAO,EAAE,WAAW,EAAE,GAAG,OAAO,EAAE,CAAC;AACrC,CAAC"}
@@ -3,15 +3,11 @@
3
3
  * Constructs Context (with `uri`), checks inline auth, validates params, formats response.
4
4
  * @module src/mcp-server/resources/utils/resourceHandlerFactory
5
5
  */
6
- import type { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol.js';
7
- import type { Variables } from '@modelcontextprotocol/sdk/shared/uriTemplate.js';
8
- import type { ReadResourceResult, ServerNotification, ServerRequest } from '@modelcontextprotocol/sdk/types.js';
9
- import { type ElicitationNotifiers } from '../../../mcp-server/elicitation.js';
10
- import type { ProtocolRequestRegistration } from '../../../mcp-server/protocolSession.js';
6
+ import type { InputRequiredResult, ReadResourceResult, ServerContext, Variables } from '@modelcontextprotocol/server';
7
+ import { type ResourceSubscriptions } from '../../../mcp-server/notifications.js';
11
8
  import type { AnyResourceDefinition } from '../../../mcp-server/resources/utils/resourceDefinition.js';
12
9
  import type { StorageService } from '../../../storage/core/StorageService.js';
13
10
  import type { Logger } from '../../../utils/internal/logger.js';
14
- type SdkExtra = RequestHandlerExtra<ServerRequest, ServerNotification>;
15
11
  /** Services required by the handler factory to construct Context. */
16
12
  export interface ResourceHandlerFactoryServices {
17
13
  /**
@@ -26,7 +22,7 @@ export interface ResourceHandlerFactoryServices {
26
22
  }
27
23
  /**
28
24
  * Per-server notifier closures bound at registration time, targeting
29
- * `server.send*ListChanged()` and `server.server.elicitInput(...)`.
25
+ * `server.send*ListChanged()`.
30
26
  *
31
27
  * Split from {@link ResourceHandlerFactoryServices} so each per-request
32
28
  * McpServer gets its own notifier closures — preventing a concurrent
@@ -34,17 +30,15 @@ export interface ResourceHandlerFactoryServices {
34
30
  *
35
31
  * The resource handler factory prefers request-scoped notifiers
36
32
  * ({@link buildRequestScopedNotifiers}, #135) and uses these only as a fallback
37
- * when the SDK extra exposes no sender (e.g. a non-request test scope).
38
- *
39
- * The elicitation fields come from {@link ElicitationNotifiers}.
33
+ * when the request scope exposes no sender (e.g. a non-request test scope).
40
34
  */
41
- export interface ResourceHandlerNotifiers extends ElicitationNotifiers {
35
+ export interface ResourceHandlerNotifiers {
42
36
  notifyPromptListChanged?: () => void;
43
37
  notifyResourceListChanged?: () => void;
44
38
  notifyResourceUpdated?: (uri: string) => void;
45
39
  notifyToolListChanged?: () => void;
46
- /** Registers this handler invocation for session-scoped HTTP cancellation. */
47
- registerRequest?: (requestId: SdkExtra['requestId']) => ProtocolRequestRegistration;
40
+ /** Per-connection `resources/subscribe` registry (#354). */
41
+ subscriptions?: ResourceSubscriptions;
48
42
  }
49
43
  /**
50
44
  * Creates an MCP resource read handler from a resource definition.
@@ -58,6 +52,5 @@ export interface ResourceHandlerNotifiers extends ElicitationNotifiers {
58
52
  * - Formats response via `format` or JSON default
59
53
  * - Catches errors and re-throws for the SDK
60
54
  */
61
- export declare function createResourceHandler(def: AnyResourceDefinition, services: ResourceHandlerFactoryServices, notifiers: ResourceHandlerNotifiers): (uri: URL, variables: Variables, extra: SdkExtra) => Promise<ReadResourceResult>;
62
- export {};
55
+ export declare function createResourceHandler(def: AnyResourceDefinition, services: ResourceHandlerFactoryServices, notifiers: ResourceHandlerNotifiers): (uri: URL, variables: Variables, ctx: ServerContext) => Promise<ReadResourceResult | InputRequiredResult>;
63
56
  //# sourceMappingURL=resourceHandlerFactory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resourceHandlerFactory.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/utils/resourceHandlerFactory.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iDAAiD,CAAC;AACjF,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACd,MAAM,oCAAoC,CAAC;AAI5C,OAAO,EAAE,KAAK,oBAAoB,EAAc,MAAM,6BAA6B,CAAC;AAEpF,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AACnF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oDAAoD,CAAC;AAEhG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAGvE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAQzD,KAAK,QAAQ,GAAG,mBAAmB,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC;AAEvE,qEAAqE;AACrE,MAAM,WAAW,8BAA8B;IAC7C;;;;;OAKG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,cAAc,CAAC;CACzB;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,wBAAyB,SAAQ,oBAAoB;IACpE,uBAAuB,CAAC,EAAE,MAAM,IAAI,CAAC;IACrC,yBAAyB,CAAC,EAAE,MAAM,IAAI,CAAC;IACvC,qBAAqB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;IACnC,8EAA8E;IAC9E,eAAe,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,WAAW,CAAC,KAAK,2BAA2B,CAAC;CACrF;AA+CD;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,qBAAqB,EAC1B,QAAQ,EAAE,8BAA8B,EACxC,SAAS,EAAE,wBAAwB,GAClC,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,KAAK,OAAO,CAAC,kBAAkB,CAAC,CA0GlF"}
1
+ {"version":3,"file":"resourceHandlerFactory.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/utils/resourceHandlerFactory.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,EACb,SAAS,EACV,MAAM,8BAA8B,CAAC;AAStC,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oDAAoD,CAAC;AAEhG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAGvE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAQzD,qEAAqE;AACrE,MAAM,WAAW,8BAA8B;IAC7C;;;;;OAKG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,cAAc,CAAC;CACzB;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,wBAAwB;IACvC,uBAAuB,CAAC,EAAE,MAAM,IAAI,CAAC;IACrC,yBAAyB,CAAC,EAAE,MAAM,IAAI,CAAC;IACvC,qBAAqB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;IACnC,4DAA4D;IAC5D,aAAa,CAAC,EAAE,qBAAqB,CAAC;CACvC;AA+CD;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,qBAAqB,EAC1B,QAAQ,EAAE,8BAA8B,EACxC,SAAS,EAAE,wBAAwB,GAClC,CACD,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,aAAa,KACf,OAAO,CAAC,kBAAkB,GAAG,mBAAmB,CAAC,CA+GrD"}
@@ -5,8 +5,8 @@
5
5
  */
6
6
  import { config } from '../../../config/index.js';
7
7
  import { attachTypedFail, createContext } from '../../../core/context.js';
8
- import { wrapElicit } from '../../../mcp-server/elicitation.js';
9
- import { buildRequestScopedNotifiers } from '../../../mcp-server/notifications.js';
8
+ import { createContextInputs, createRequestInput, isInputRequiredSignal, } from '../../../mcp-server/inputRequired.js';
9
+ import { buildRequestScopedNotifiers, } from '../../../mcp-server/notifications.js';
10
10
  import { withRequiredScopes } from '../../../mcp-server/transports/auth/lib/authUtils.js';
11
11
  import { McpError } from '../../../types-global/errors.js';
12
12
  import { ErrorHandler } from '../../../utils/internal/error-handler/errorHandler.js';
@@ -63,19 +63,16 @@ function observableResourceUri(uri) {
63
63
  export function createResourceHandler(def, services, notifiers) {
64
64
  const mimeType = def.mimeType ?? 'application/json';
65
65
  const formatter = def.format ?? defaultResponseFormatter;
66
- return async (uri, variables, callContext) => {
67
- const sdkContext = callContext;
68
- const protocolRequest = notifiers.registerRequest?.(sdkContext.requestId);
69
- const signal = protocolRequest
70
- ? AbortSignal.any([sdkContext.signal, protocolRequest.signal])
71
- : sdkContext.signal;
66
+ const resourceName = def.name ?? def.uriTemplate;
67
+ return async (uri, variables, serverContext) => {
68
+ const mcpReq = serverContext?.mcpReq;
69
+ const signal = mcpReq?.signal ?? new AbortController().signal;
72
70
  // Route handler-time list-changed / resource-updated notifications through
73
- // this request's `extra.sendNotification` so they carry `relatedRequestId`
74
- // and reach the client under the per-request HTTP/Worker McpServer model
75
- // (#135). Fall back to the server-level notifiers when the extra exposes no
76
- // sender (non-request scopes) — those deliver on stdio but drop under HTTP.
77
- const effectiveNotifiers = buildRequestScopedNotifiers(sdkContext) ?? notifiers;
78
- const sdkSessionId = typeof sdkContext?.sessionId === 'string' ? sdkContext.sessionId : undefined;
71
+ // this request's `ctx.mcpReq.notify` so they carry `relatedRequestId` and
72
+ // reach the client under per-request serving (#135). Fall back to the
73
+ // server-level notifiers when the scope exposes no sender.
74
+ const effectiveNotifiers = buildRequestScopedNotifiers(mcpReq ?? {}, notifiers.subscriptions) ?? notifiers;
75
+ const sdkSessionId = typeof serverContext?.sessionId === 'string' ? serverContext.sessionId : undefined;
79
76
  // Surface sessionId on `Context` only when it has request-spanning
80
77
  // lifetime — stateful HTTP (or `auto`, which resolves to stateful for
81
78
  // HTTP). In stateless mode the SDK still hands us a per-request token;
@@ -93,17 +90,17 @@ export function createResourceHandler(def, services, notifiers) {
93
90
  // query-string / caller-supplied and belongs in metrics, not logs.
94
91
  // Log correlation always uses the raw SDK sessionId — useful even in
95
92
  // stateless mode for tracing the SDK's per-request token through events.
93
+ const requestId = mcpReq?.id;
96
94
  const appContext = requestContextService.createRequestContext({
97
95
  parentContext: {
98
- ...(typeof sdkContext?.requestId === 'string' ? { requestId: sdkContext.requestId } : {}),
96
+ ...(typeof requestId === 'string' ? { requestId } : {}),
99
97
  ...(sdkSessionId ? { sessionId: sdkSessionId } : {}),
100
98
  },
101
99
  operation: 'HandleResourceRead',
102
100
  additionalContext: {
103
- resourceName: def.name ?? def.uriTemplate,
101
+ resourceName,
104
102
  resourceUri,
105
103
  resourceHasQuery: uri.search.length > 0,
106
- sessionId: sdkSessionId,
107
104
  },
108
105
  });
109
106
  try {
@@ -121,7 +118,9 @@ export function createResourceHandler(def, services, notifiers) {
121
118
  storage: services.storage,
122
119
  signal,
123
120
  sessionId: handlerSessionId,
124
- elicit: wrapElicit(notifiers, sdkContext),
121
+ inputs: createContextInputs(mcpReq),
122
+ requestInput: createRequestInput(),
123
+ ...(mcpReq?.log && { wireLog: mcpReq.log }),
125
124
  notifyPromptListChanged: effectiveNotifiers.notifyPromptListChanged,
126
125
  notifyResourceListChanged: effectiveNotifiers.notifyResourceListChanged,
127
126
  notifyResourceUpdated: effectiveNotifiers.notifyResourceUpdated,
@@ -129,7 +128,6 @@ export function createResourceHandler(def, services, notifiers) {
129
128
  uri,
130
129
  }), def.errors);
131
130
  // Execute handler with performance measurement
132
- const resourceName = def.name ?? def.uriTemplate;
133
131
  const handlerResult = await measureResourceExecution(() => Promise.resolve(def.handler(validatedParams, ctx)), { ...appContext, resourceName }, { uri: resourceUri, mimeType });
134
132
  // Validate output against schema when defined
135
133
  const validatedResult = def.output ? def.output.parse(handlerResult) : handlerResult;
@@ -137,6 +135,10 @@ export function createResourceHandler(def, services, notifiers) {
137
135
  return { contents };
138
136
  }
139
137
  catch (error) {
138
+ // `ctx.requestInput(...)` is protocol control flow, not a failure —
139
+ // `resources/read` honors `input_required` on the 2026-07-28 revision.
140
+ if (isInputRequiredSignal(error))
141
+ return error.result;
140
142
  // Classify without logging — the SDK logs when it catches the thrown error.
141
143
  if (error instanceof McpError) {
142
144
  throw error;
@@ -144,9 +146,6 @@ export function createResourceHandler(def, services, notifiers) {
144
146
  const { code, message, data } = ErrorHandler.classifyOnly(error);
145
147
  throw new McpError(code, message, data, { cause: error });
146
148
  }
147
- finally {
148
- protocolRequest?.unregister();
149
- }
150
149
  };
151
150
  }
152
151
  //# sourceMappingURL=resourceHandlerFactory.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resourceHandlerFactory.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/utils/resourceHandlerFactory.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAA6B,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACpF,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAG5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AAEnF,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AAE9E,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AA4C3E,8EAA8E;AAC9E,oBAAoB;AACpB,8EAA8E;AAE9E,SAAS,cAAc,CAAC,QAAgB;IACtC,MAAM,kBAAkB,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC;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,CAAC,eAAe,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;YAC/D,OAAO,EAAE,QAAQ,EAAE,CAAC;QACtB,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,oEAAoE;YACpE,uEAAuE;YACvE,IAAI,qBAAqB,CAAC,KAAK,CAAC;gBAAE,OAAO,KAAK,CAAC,MAAM,CAAC;YAEtD,4EAA4E;YAC5E,IAAI,KAAK,YAAY,QAAQ,EAAE,CAAC;gBAC9B,MAAM,KAAK,CAAC;YACd,CAAC;YACD,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,YAAY,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;YACjE,MAAM,IAAI,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QAC5D,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
@@ -1,37 +1,34 @@
1
1
  /**
2
2
  * @fileoverview Factory for creating configured MCP server instances.
3
3
  * Creates an McpServer with identity, capabilities, and registered
4
- * tools/resources/prompts/roots from the provided registries.
4
+ * tools/resources/prompts from the provided registries.
5
5
  *
6
6
  * MCP Specification References:
7
- * - Lifecycle: https://modelcontextprotocol.io/specification/2025-06-18/basic/lifecycle
8
- * - Overview (Capabilities): https://modelcontextprotocol.io/specification/2025-06-18/basic/index
9
- * - Transports: https://modelcontextprotocol.io/specification/2025-06-18/basic/transports
7
+ * - Lifecycle: https://modelcontextprotocol.io/specification/2026-07-28/basic/lifecycle
8
+ * - Overview (Capabilities): https://modelcontextprotocol.io/specification/2026-07-28/basic/index
9
+ * - Transports: https://modelcontextprotocol.io/specification/2026-07-28/basic/transports
10
10
  * @module src/mcp-server/server
11
11
  */
12
- import type { TaskMessageQueue, TaskStore } from '@modelcontextprotocol/sdk/experimental/tasks';
13
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
14
- import type { Implementation } from '@modelcontextprotocol/sdk/types.js';
12
+ import { type Implementation, McpServer } from '@modelcontextprotocol/server';
15
13
  import type { AppConfig } from '../config/index.js';
16
14
  import type { PromptRegistry } from '../mcp-server/prompts/prompt-registration.js';
17
- import type { ProtocolSessionHooks } from '../mcp-server/protocolSession.js';
18
15
  import type { ResourceRegistry } from '../mcp-server/resources/resource-registration.js';
19
16
  import type { ToolRegistry } from '../mcp-server/tools/tool-registration.js';
20
17
  /** Dependencies required to create an MCP server instance. */
21
18
  export interface McpServerDeps {
22
- /**
23
- * When true, advertise the experimental `tasks` capability (SEP-1686).
24
- * The capability is gated on actual usage — at least one registered tool
25
- * must be a task tool — because the capability ships in spec revision
26
- * 2025-11-25 (GA) and clients pinned to 2025-06-18 fail on the unknown key.
27
- */
28
- advertiseTasks?: boolean;
29
19
  config: AppConfig;
30
20
  /**
31
21
  * One-line description forwarded to `new McpServer({ serverInfo })`.
32
22
  * Explicit option wins over `MCP_SERVER_DESCRIPTION` / `package.json`.
33
23
  */
34
24
  description?: string;
25
+ /**
26
+ * The protocol era this instance will serve, from the factory's
27
+ * {@link McpRequestContext}. Selects the resource-subscription mechanism —
28
+ * see {@link installResourceSubscriptions}. Defaults to `legacy` for direct
29
+ * callers that construct an instance outside the serving factories.
30
+ */
31
+ era?: 'legacy' | 'modern';
35
32
  /** SEP-2133 extensions to advertise in server capabilities. */
36
33
  extensions?: Record<string, object>;
37
34
  /** Server icon(s) forwarded to `new McpServer({ serverInfo })`. */
@@ -45,13 +42,7 @@ export interface McpServerDeps {
45
42
  */
46
43
  instructions?: string;
47
44
  promptRegistry: PromptRegistry;
48
- /** Request-spanning state restored for a per-request HTTP server instance. */
49
- protocolSession?: ProtocolSessionHooks;
50
45
  resourceRegistry: ResourceRegistry;
51
- /** Task message queue for side-channel delivery via tasks/result. */
52
- taskMessageQueue?: TaskMessageQueue;
53
- /** Task store for managing task lifecycle (create, status, result). */
54
- taskStore?: TaskStore;
55
46
  /**
56
47
  * Human-readable display name forwarded to `new McpServer({ serverInfo })`.
57
48
  * Supplements the machine-identifier `name`.
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp-server/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,8CAA8C,CAAC;AAChG,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,KAAK,EAAsB,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAE7F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAC;AAClF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iDAAiD,CAAC;AACxF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAI5E,8DAA8D;AAC9D,MAAM,WAAW,aAAa;IAC5B;;;;;OAKG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,MAAM,EAAE,SAAS,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,mEAAmE;IACnE,KAAK,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;IAChC;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,cAAc,CAAC;IAC/B,8EAA8E;IAC9E,eAAe,CAAC,EAAE,oBAAoB,CAAC;IACvC,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,qEAAqE;IACrE,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,uEAAuE;IACvE,SAAS,CAAC,EAAE,SAAS,CAAC;IAC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