@eclipse-glsp/server-mcp 2.7.0-next.9

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 (303) hide show
  1. package/LICENSE +642 -0
  2. package/README.md +57 -0
  3. package/lib/index.d.ts +23 -0
  4. package/lib/index.d.ts.map +1 -0
  5. package/lib/index.js +41 -0
  6. package/lib/index.js.map +1 -0
  7. package/lib/prompts/handlers/describe-diagram-mcp-prompt-handler.d.ts +43 -0
  8. package/lib/prompts/handlers/describe-diagram-mcp-prompt-handler.d.ts.map +1 -0
  9. package/lib/prompts/handlers/describe-diagram-mcp-prompt-handler.js +96 -0
  10. package/lib/prompts/handlers/describe-diagram-mcp-prompt-handler.js.map +1 -0
  11. package/lib/prompts/handlers/suggest-improvements-mcp-prompt-handler.d.ts +43 -0
  12. package/lib/prompts/handlers/suggest-improvements-mcp-prompt-handler.d.ts.map +1 -0
  13. package/lib/prompts/handlers/suggest-improvements-mcp-prompt-handler.js +95 -0
  14. package/lib/prompts/handlers/suggest-improvements-mcp-prompt-handler.js.map +1 -0
  15. package/lib/prompts/index.d.ts +18 -0
  16. package/lib/prompts/index.d.ts.map +1 -0
  17. package/lib/prompts/index.js +34 -0
  18. package/lib/prompts/index.js.map +1 -0
  19. package/lib/resources/handlers/diagram-png-mcp-resource-handler.d.ts +81 -0
  20. package/lib/resources/handlers/diagram-png-mcp-resource-handler.d.ts.map +1 -0
  21. package/lib/resources/handlers/diagram-png-mcp-resource-handler.js +174 -0
  22. package/lib/resources/handlers/diagram-png-mcp-resource-handler.js.map +1 -0
  23. package/lib/resources/handlers/diagram-svg-mcp-resource-handler.d.ts +52 -0
  24. package/lib/resources/handlers/diagram-svg-mcp-resource-handler.d.ts.map +1 -0
  25. package/lib/resources/handlers/diagram-svg-mcp-resource-handler.js +96 -0
  26. package/lib/resources/handlers/diagram-svg-mcp-resource-handler.js.map +1 -0
  27. package/lib/resources/index.d.ts +20 -0
  28. package/lib/resources/index.d.ts.map +1 -0
  29. package/lib/resources/index.js +36 -0
  30. package/lib/resources/index.js.map +1 -0
  31. package/lib/resources/services/element-types-provider.d.ts +65 -0
  32. package/lib/resources/services/element-types-provider.d.ts.map +1 -0
  33. package/lib/resources/services/element-types-provider.js +81 -0
  34. package/lib/resources/services/element-types-provider.js.map +1 -0
  35. package/lib/resources/services/mcp-model-serializer.d.ts +78 -0
  36. package/lib/resources/services/mcp-model-serializer.d.ts.map +1 -0
  37. package/lib/resources/services/mcp-model-serializer.js +188 -0
  38. package/lib/resources/services/mcp-model-serializer.js.map +1 -0
  39. package/lib/server/glsp-mcp-server.d.ts +82 -0
  40. package/lib/server/glsp-mcp-server.d.ts.map +1 -0
  41. package/lib/server/glsp-mcp-server.js +140 -0
  42. package/lib/server/glsp-mcp-server.js.map +1 -0
  43. package/lib/server/index.d.ts +37 -0
  44. package/lib/server/index.d.ts.map +1 -0
  45. package/lib/server/index.js +57 -0
  46. package/lib/server/index.js.map +1 -0
  47. package/lib/server/lru-event-store.d.ts +53 -0
  48. package/lib/server/lru-event-store.d.ts.map +1 -0
  49. package/lib/server/lru-event-store.js +100 -0
  50. package/lib/server/lru-event-store.js.map +1 -0
  51. package/lib/server/mcp-diagram-handler-dispatcher.d.ts +144 -0
  52. package/lib/server/mcp-diagram-handler-dispatcher.d.ts.map +1 -0
  53. package/lib/server/mcp-diagram-handler-dispatcher.js +382 -0
  54. package/lib/server/mcp-diagram-handler-dispatcher.js.map +1 -0
  55. package/lib/server/mcp-diagram-module.d.ts +123 -0
  56. package/lib/server/mcp-diagram-module.d.ts.map +1 -0
  57. package/lib/server/mcp-diagram-module.js +186 -0
  58. package/lib/server/mcp-diagram-module.js.map +1 -0
  59. package/lib/server/mcp-diagram-prompt-handler-registry.d.ts +33 -0
  60. package/lib/server/mcp-diagram-prompt-handler-registry.d.ts.map +1 -0
  61. package/lib/server/mcp-diagram-prompt-handler-registry.js +76 -0
  62. package/lib/server/mcp-diagram-prompt-handler-registry.js.map +1 -0
  63. package/lib/server/mcp-diagram-resource-handler-registry.d.ts +35 -0
  64. package/lib/server/mcp-diagram-resource-handler-registry.d.ts.map +1 -0
  65. package/lib/server/mcp-diagram-resource-handler-registry.js +94 -0
  66. package/lib/server/mcp-diagram-resource-handler-registry.js.map +1 -0
  67. package/lib/server/mcp-diagram-tool-handler-registry.d.ts +57 -0
  68. package/lib/server/mcp-diagram-tool-handler-registry.d.ts.map +1 -0
  69. package/lib/server/mcp-diagram-tool-handler-registry.js +111 -0
  70. package/lib/server/mcp-diagram-tool-handler-registry.js.map +1 -0
  71. package/lib/server/mcp-handler-shared.d.ts +142 -0
  72. package/lib/server/mcp-handler-shared.d.ts.map +1 -0
  73. package/lib/server/mcp-handler-shared.js +199 -0
  74. package/lib/server/mcp-handler-shared.js.map +1 -0
  75. package/lib/server/mcp-http-transport.d.ts +93 -0
  76. package/lib/server/mcp-http-transport.d.ts.map +1 -0
  77. package/lib/server/mcp-http-transport.js +350 -0
  78. package/lib/server/mcp-http-transport.js.map +1 -0
  79. package/lib/server/mcp-id-alias-service.d.ts +70 -0
  80. package/lib/server/mcp-id-alias-service.d.ts.map +1 -0
  81. package/lib/server/mcp-id-alias-service.js +85 -0
  82. package/lib/server/mcp-id-alias-service.js.map +1 -0
  83. package/lib/server/mcp-input-schemas.d.ts +73 -0
  84. package/lib/server/mcp-input-schemas.d.ts.map +1 -0
  85. package/lib/server/mcp-input-schemas.js +67 -0
  86. package/lib/server/mcp-input-schemas.js.map +1 -0
  87. package/lib/server/mcp-label-provider.d.ts +45 -0
  88. package/lib/server/mcp-label-provider.d.ts.map +1 -0
  89. package/lib/server/mcp-label-provider.js +42 -0
  90. package/lib/server/mcp-label-provider.js.map +1 -0
  91. package/lib/server/mcp-log-level-registry.d.ts +54 -0
  92. package/lib/server/mcp-log-level-registry.d.ts.map +1 -0
  93. package/lib/server/mcp-log-level-registry.js +80 -0
  94. package/lib/server/mcp-log-level-registry.js.map +1 -0
  95. package/lib/server/mcp-logger.d.ts +59 -0
  96. package/lib/server/mcp-logger.d.ts.map +1 -0
  97. package/lib/server/mcp-logger.js +104 -0
  98. package/lib/server/mcp-logger.js.map +1 -0
  99. package/lib/server/mcp-mime-types.d.ts +28 -0
  100. package/lib/server/mcp-mime-types.d.ts.map +1 -0
  101. package/lib/server/mcp-mime-types.js +18 -0
  102. package/lib/server/mcp-mime-types.js.map +1 -0
  103. package/lib/server/mcp-options.d.ts +39 -0
  104. package/lib/server/mcp-options.d.ts.map +1 -0
  105. package/lib/server/mcp-options.js +53 -0
  106. package/lib/server/mcp-options.js.map +1 -0
  107. package/lib/server/mcp-progress-reporter.d.ts +48 -0
  108. package/lib/server/mcp-progress-reporter.d.ts.map +1 -0
  109. package/lib/server/mcp-progress-reporter.js +66 -0
  110. package/lib/server/mcp-progress-reporter.js.map +1 -0
  111. package/lib/server/mcp-prompt-handler.d.ts +120 -0
  112. package/lib/server/mcp-prompt-handler.d.ts.map +1 -0
  113. package/lib/server/mcp-prompt-handler.js +131 -0
  114. package/lib/server/mcp-prompt-handler.js.map +1 -0
  115. package/lib/server/mcp-request-context.d.ts +37 -0
  116. package/lib/server/mcp-request-context.d.ts.map +1 -0
  117. package/lib/server/mcp-request-context.js +37 -0
  118. package/lib/server/mcp-request-context.js.map +1 -0
  119. package/lib/server/mcp-resource-handler.d.ts +212 -0
  120. package/lib/server/mcp-resource-handler.d.ts.map +1 -0
  121. package/lib/server/mcp-resource-handler.js +298 -0
  122. package/lib/server/mcp-resource-handler.js.map +1 -0
  123. package/lib/server/mcp-server-launcher.d.ts +143 -0
  124. package/lib/server/mcp-server-launcher.d.ts.map +1 -0
  125. package/lib/server/mcp-server-launcher.js +355 -0
  126. package/lib/server/mcp-server-launcher.js.map +1 -0
  127. package/lib/server/mcp-server-module.d.ts +143 -0
  128. package/lib/server/mcp-server-module.d.ts.map +1 -0
  129. package/lib/server/mcp-server-module.js +249 -0
  130. package/lib/server/mcp-server-module.js.map +1 -0
  131. package/lib/server/mcp-session.d.ts +44 -0
  132. package/lib/server/mcp-session.d.ts.map +1 -0
  133. package/lib/server/mcp-session.js +18 -0
  134. package/lib/server/mcp-session.js.map +1 -0
  135. package/lib/server/mcp-tool-handler.d.ts +259 -0
  136. package/lib/server/mcp-tool-handler.d.ts.map +1 -0
  137. package/lib/server/mcp-tool-handler.js +355 -0
  138. package/lib/server/mcp-tool-handler.js.map +1 -0
  139. package/lib/tools/handlers/count-elements-mcp-tool-handler.d.ts +46 -0
  140. package/lib/tools/handlers/count-elements-mcp-tool-handler.d.ts.map +1 -0
  141. package/lib/tools/handlers/count-elements-mcp-tool-handler.js +76 -0
  142. package/lib/tools/handlers/count-elements-mcp-tool-handler.js.map +1 -0
  143. package/lib/tools/handlers/create-edges-mcp-tool-handler.d.ts +112 -0
  144. package/lib/tools/handlers/create-edges-mcp-tool-handler.d.ts.map +1 -0
  145. package/lib/tools/handlers/create-edges-mcp-tool-handler.js +190 -0
  146. package/lib/tools/handlers/create-edges-mcp-tool-handler.js.map +1 -0
  147. package/lib/tools/handlers/create-nodes-mcp-tool-handler.d.ts +81 -0
  148. package/lib/tools/handlers/create-nodes-mcp-tool-handler.d.ts.map +1 -0
  149. package/lib/tools/handlers/create-nodes-mcp-tool-handler.js +123 -0
  150. package/lib/tools/handlers/create-nodes-mcp-tool-handler.js.map +1 -0
  151. package/lib/tools/handlers/delete-elements-mcp-tool-handler.d.ts +52 -0
  152. package/lib/tools/handlers/delete-elements-mcp-tool-handler.d.ts.map +1 -0
  153. package/lib/tools/handlers/delete-elements-mcp-tool-handler.js +73 -0
  154. package/lib/tools/handlers/delete-elements-mcp-tool-handler.js.map +1 -0
  155. package/lib/tools/handlers/diagram-model-mcp-tool-handler.d.ts +59 -0
  156. package/lib/tools/handlers/diagram-model-mcp-tool-handler.d.ts.map +1 -0
  157. package/lib/tools/handlers/diagram-model-mcp-tool-handler.js +78 -0
  158. package/lib/tools/handlers/diagram-model-mcp-tool-handler.js.map +1 -0
  159. package/lib/tools/handlers/element-types-mcp-tool-handler.d.ts +97 -0
  160. package/lib/tools/handlers/element-types-mcp-tool-handler.d.ts.map +1 -0
  161. package/lib/tools/handlers/element-types-mcp-tool-handler.js +155 -0
  162. package/lib/tools/handlers/element-types-mcp-tool-handler.js.map +1 -0
  163. package/lib/tools/handlers/get-selection-mcp-tool-handler.d.ts +43 -0
  164. package/lib/tools/handlers/get-selection-mcp-tool-handler.d.ts.map +1 -0
  165. package/lib/tools/handlers/get-selection-mcp-tool-handler.js +68 -0
  166. package/lib/tools/handlers/get-selection-mcp-tool-handler.js.map +1 -0
  167. package/lib/tools/handlers/layout-mcp-tool-handler.d.ts +43 -0
  168. package/lib/tools/handlers/layout-mcp-tool-handler.d.ts.map +1 -0
  169. package/lib/tools/handlers/layout-mcp-tool-handler.js +71 -0
  170. package/lib/tools/handlers/layout-mcp-tool-handler.js.map +1 -0
  171. package/lib/tools/handlers/modify-edges-mcp-tool-handler.d.ts +78 -0
  172. package/lib/tools/handlers/modify-edges-mcp-tool-handler.d.ts.map +1 -0
  173. package/lib/tools/handlers/modify-edges-mcp-tool-handler.js +136 -0
  174. package/lib/tools/handlers/modify-edges-mcp-tool-handler.js.map +1 -0
  175. package/lib/tools/handlers/modify-nodes-mcp-tool-handler.d.ts +92 -0
  176. package/lib/tools/handlers/modify-nodes-mcp-tool-handler.d.ts.map +1 -0
  177. package/lib/tools/handlers/modify-nodes-mcp-tool-handler.js +125 -0
  178. package/lib/tools/handlers/modify-nodes-mcp-tool-handler.js.map +1 -0
  179. package/lib/tools/handlers/query-elements-mcp-tool-handler.d.ts +102 -0
  180. package/lib/tools/handlers/query-elements-mcp-tool-handler.d.ts.map +1 -0
  181. package/lib/tools/handlers/query-elements-mcp-tool-handler.js +158 -0
  182. package/lib/tools/handlers/query-elements-mcp-tool-handler.js.map +1 -0
  183. package/lib/tools/handlers/redo-mcp-tool-handler.d.ts +45 -0
  184. package/lib/tools/handlers/redo-mcp-tool-handler.d.ts.map +1 -0
  185. package/lib/tools/handlers/redo-mcp-tool-handler.js +73 -0
  186. package/lib/tools/handlers/redo-mcp-tool-handler.js.map +1 -0
  187. package/lib/tools/handlers/save-model-mcp-tool-handler.d.ts +55 -0
  188. package/lib/tools/handlers/save-model-mcp-tool-handler.d.ts.map +1 -0
  189. package/lib/tools/handlers/save-model-mcp-tool-handler.js +91 -0
  190. package/lib/tools/handlers/save-model-mcp-tool-handler.js.map +1 -0
  191. package/lib/tools/handlers/session-info-mcp-tool-handler.d.ts +65 -0
  192. package/lib/tools/handlers/session-info-mcp-tool-handler.d.ts.map +1 -0
  193. package/lib/tools/handlers/session-info-mcp-tool-handler.js +108 -0
  194. package/lib/tools/handlers/session-info-mcp-tool-handler.js.map +1 -0
  195. package/lib/tools/handlers/set-selection-mcp-tool-handler.d.ts +60 -0
  196. package/lib/tools/handlers/set-selection-mcp-tool-handler.d.ts.map +1 -0
  197. package/lib/tools/handlers/set-selection-mcp-tool-handler.js +103 -0
  198. package/lib/tools/handlers/set-selection-mcp-tool-handler.js.map +1 -0
  199. package/lib/tools/handlers/set-view-mcp-tool-handler.d.ts +110 -0
  200. package/lib/tools/handlers/set-view-mcp-tool-handler.d.ts.map +1 -0
  201. package/lib/tools/handlers/set-view-mcp-tool-handler.js +142 -0
  202. package/lib/tools/handlers/set-view-mcp-tool-handler.js.map +1 -0
  203. package/lib/tools/handlers/undo-mcp-tool-handler.d.ts +45 -0
  204. package/lib/tools/handlers/undo-mcp-tool-handler.d.ts.map +1 -0
  205. package/lib/tools/handlers/undo-mcp-tool-handler.js +74 -0
  206. package/lib/tools/handlers/undo-mcp-tool-handler.js.map +1 -0
  207. package/lib/tools/handlers/validate-diagram-mcp-tool-handler.d.ts +66 -0
  208. package/lib/tools/handlers/validate-diagram-mcp-tool-handler.d.ts.map +1 -0
  209. package/lib/tools/handlers/validate-diagram-mcp-tool-handler.js +0 -0
  210. package/lib/tools/handlers/validate-diagram-mcp-tool-handler.js.map +1 -0
  211. package/lib/tools/index.d.ts +34 -0
  212. package/lib/tools/index.d.ts.map +1 -0
  213. package/lib/tools/index.js +50 -0
  214. package/lib/tools/index.js.map +1 -0
  215. package/lib/util/index.d.ts +18 -0
  216. package/lib/util/index.d.ts.map +1 -0
  217. package/lib/util/index.js +34 -0
  218. package/lib/util/index.js.map +1 -0
  219. package/lib/util/markdown-util.d.ts +20 -0
  220. package/lib/util/markdown-util.d.ts.map +1 -0
  221. package/lib/util/markdown-util.js +45 -0
  222. package/lib/util/markdown-util.js.map +1 -0
  223. package/lib/util/mcp-util.d.ts +22 -0
  224. package/lib/util/mcp-util.d.ts.map +1 -0
  225. package/lib/util/mcp-util.js +29 -0
  226. package/lib/util/mcp-util.js.map +1 -0
  227. package/package.json +63 -0
  228. package/src/index.ts +24 -0
  229. package/src/prompts/handlers/describe-diagram-mcp-prompt-handler.ts +89 -0
  230. package/src/prompts/handlers/suggest-improvements-mcp-prompt-handler.ts +86 -0
  231. package/src/prompts/index.ts +18 -0
  232. package/src/resources/handlers/diagram-png-mcp-resource-handler.ts +181 -0
  233. package/src/resources/handlers/diagram-svg-mcp-resource-handler.ts +89 -0
  234. package/src/resources/index.ts +20 -0
  235. package/src/resources/services/element-types-provider.ts +105 -0
  236. package/src/resources/services/mcp-model-serializer.ts +211 -0
  237. package/src/server/glsp-mcp-server.spec.ts +73 -0
  238. package/src/server/glsp-mcp-server.ts +196 -0
  239. package/src/server/index.ts +42 -0
  240. package/src/server/lru-event-store.spec.ts +121 -0
  241. package/src/server/lru-event-store.ts +112 -0
  242. package/src/server/mcp-diagram-handler-dispatcher.spec.ts +231 -0
  243. package/src/server/mcp-diagram-handler-dispatcher.ts +459 -0
  244. package/src/server/mcp-diagram-module.ts +248 -0
  245. package/src/server/mcp-diagram-prompt-handler-registry.ts +59 -0
  246. package/src/server/mcp-diagram-resource-handler-registry.ts +73 -0
  247. package/src/server/mcp-diagram-tool-handler-registry.ts +97 -0
  248. package/src/server/mcp-handler-shared.spec.ts +53 -0
  249. package/src/server/mcp-handler-shared.ts +247 -0
  250. package/src/server/mcp-http-transport-e2e.spec.ts +151 -0
  251. package/src/server/mcp-http-transport.spec.ts +385 -0
  252. package/src/server/mcp-http-transport.ts +368 -0
  253. package/src/server/mcp-id-alias-service.spec.ts +106 -0
  254. package/src/server/mcp-id-alias-service.ts +104 -0
  255. package/src/server/mcp-input-schemas.ts +82 -0
  256. package/src/server/mcp-label-provider.ts +52 -0
  257. package/src/server/mcp-log-level-registry.spec.ts +75 -0
  258. package/src/server/mcp-log-level-registry.ts +90 -0
  259. package/src/server/mcp-logger.spec.ts +227 -0
  260. package/src/server/mcp-logger.ts +91 -0
  261. package/src/server/mcp-mime-types.ts +31 -0
  262. package/src/server/mcp-options.ts +43 -0
  263. package/src/server/mcp-progress-reporter.spec.ts +93 -0
  264. package/src/server/mcp-progress-reporter.ts +67 -0
  265. package/src/server/mcp-prompt-handler.ts +157 -0
  266. package/src/server/mcp-request-context.ts +39 -0
  267. package/src/server/mcp-resource-handler.ts +389 -0
  268. package/src/server/mcp-server-launcher.spec.ts +173 -0
  269. package/src/server/mcp-server-launcher.ts +369 -0
  270. package/src/server/mcp-server-module.ts +287 -0
  271. package/src/server/mcp-session.ts +45 -0
  272. package/src/server/mcp-tool-handler.spec.ts +182 -0
  273. package/src/server/mcp-tool-handler.ts +431 -0
  274. package/src/server/raw-http.spec.ts +59 -0
  275. package/src/tools/handlers/count-elements-mcp-tool-handler.spec.ts +99 -0
  276. package/src/tools/handlers/count-elements-mcp-tool-handler.ts +66 -0
  277. package/src/tools/handlers/create-edges-mcp-tool-handler.spec.ts +196 -0
  278. package/src/tools/handlers/create-edges-mcp-tool-handler.ts +205 -0
  279. package/src/tools/handlers/create-nodes-mcp-tool-handler.spec.ts +197 -0
  280. package/src/tools/handlers/create-nodes-mcp-tool-handler.ts +131 -0
  281. package/src/tools/handlers/delete-elements-mcp-tool-handler.ts +73 -0
  282. package/src/tools/handlers/diagram-model-mcp-tool-handler.ts +66 -0
  283. package/src/tools/handlers/element-types-mcp-tool-handler.ts +151 -0
  284. package/src/tools/handlers/get-selection-mcp-tool-handler.ts +54 -0
  285. package/src/tools/handlers/layout-mcp-tool-handler.ts +56 -0
  286. package/src/tools/handlers/modify-edges-mcp-tool-handler.ts +148 -0
  287. package/src/tools/handlers/modify-nodes-mcp-tool-handler.ts +140 -0
  288. package/src/tools/handlers/query-elements-mcp-tool-handler.spec.ts +210 -0
  289. package/src/tools/handlers/query-elements-mcp-tool-handler.ts +161 -0
  290. package/src/tools/handlers/redo-mcp-tool-handler.ts +62 -0
  291. package/src/tools/handlers/save-model-mcp-tool-handler.ts +71 -0
  292. package/src/tools/handlers/session-info-mcp-tool-handler.spec.ts +152 -0
  293. package/src/tools/handlers/session-info-mcp-tool-handler.ts +97 -0
  294. package/src/tools/handlers/set-selection-mcp-tool-handler.spec.ts +118 -0
  295. package/src/tools/handlers/set-selection-mcp-tool-handler.ts +90 -0
  296. package/src/tools/handlers/set-view-mcp-tool-handler.ts +162 -0
  297. package/src/tools/handlers/undo-mcp-tool-handler.ts +61 -0
  298. package/src/tools/handlers/validate-diagram-mcp-tool-handler.ts +0 -0
  299. package/src/tools/index.ts +34 -0
  300. package/src/tools/tool-annotations.spec.ts +141 -0
  301. package/src/util/index.ts +18 -0
  302. package/src/util/markdown-util.ts +44 -0
  303. package/src/util/mcp-util.ts +25 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-options.js","sourceRoot":"","sources":["../../src/server/mcp-options.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;AAGlF,yCAAuC;AAEvC;;;;;;;;;;;GAWG;AAEI,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAAtB;QACH,WAAM,GAAyB,EAAE,CAAC;IACtC,CAAC;CAAA,CAAA;AAFY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,sBAAU,GAAE;GACA,gBAAgB,CAE5B;AAED;;;;GAIG;AACU,QAAA,iBAAiB,GAAG,MAAM,CAAC,mBAAmB,CAAC,CAAC"}
@@ -0,0 +1,48 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+ /**
17
+ * Per-call shape of a `notifications/progress` emission. Mirrors the SDK's
18
+ * `ProgressNotificationParams` minus the `progressToken` field (the reporter pulls that from
19
+ * the active request context — the caller's job is just to describe the progress beat).
20
+ */
21
+ export interface McpProgressBeat {
22
+ /** Monotonic progress count. Spec is loose; convention: increment from 0 toward `total` if known, or use seconds-elapsed otherwise. */
23
+ progress: number;
24
+ /** Total when known (e.g. number of nodes to process). Omit when bounded only by a timeout. */
25
+ total?: number;
26
+ /** Short user-facing description; surfaces in compatible clients' UI. */
27
+ message?: string;
28
+ }
29
+ /**
30
+ * Emits `notifications/progress` to the connected MCP client when the active request carries a
31
+ * `progressToken` in its `_meta`. Built on the same {@link mcpRequestContext} as
32
+ * {@link McpLogger}; handlers don't need to thread `extra` through their own signatures.
33
+ *
34
+ * Behaviour:
35
+ * - Outside a request context (init, background): no-op.
36
+ * - Inside a request context with no `progressToken` (client didn't opt in): no-op.
37
+ * Universally supported per spec — clients that don't render progress simply omit the token.
38
+ * - Failures to deliver are swallowed: a broken transport must not break the producing tool.
39
+ *
40
+ * Shared across MCP clients on the same GLSP session; per-client routing is handled by the
41
+ * active `mcpRequestContext` frame.
42
+ *
43
+ * @experimental
44
+ */
45
+ export declare class McpProgressReporter {
46
+ emit(beat: McpProgressBeat): Promise<void>;
47
+ }
48
+ //# sourceMappingURL=mcp-progress-reporter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-progress-reporter.d.ts","sourceRoot":"","sources":["../../src/server/mcp-progress-reporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAKlF;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC5B,uIAAuI;IACvI,QAAQ,EAAE,MAAM,CAAC;IACjB,+FAA+F;IAC/F,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBACa,mBAAmB;IACtB,IAAI,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;CAenD"}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (c) 2026 EclipseSource and others.
4
+ *
5
+ * This program and the accompanying materials are made available under the
6
+ * terms of the Eclipse Public License v. 2.0 which is available at
7
+ * http://www.eclipse.org/legal/epl-2.0.
8
+ *
9
+ * This Source Code may also be made available under the following Secondary
10
+ * Licenses when the conditions for such availability set forth in the Eclipse
11
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ * with the GNU Classpath Exception which is available at
13
+ * https://www.gnu.org/software/classpath/license.html.
14
+ *
15
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
+ ********************************************************************************/
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.McpProgressReporter = void 0;
25
+ const inversify_1 = require("inversify");
26
+ const mcp_request_context_1 = require("./mcp-request-context");
27
+ /**
28
+ * Emits `notifications/progress` to the connected MCP client when the active request carries a
29
+ * `progressToken` in its `_meta`. Built on the same {@link mcpRequestContext} as
30
+ * {@link McpLogger}; handlers don't need to thread `extra` through their own signatures.
31
+ *
32
+ * Behaviour:
33
+ * - Outside a request context (init, background): no-op.
34
+ * - Inside a request context with no `progressToken` (client didn't opt in): no-op.
35
+ * Universally supported per spec — clients that don't render progress simply omit the token.
36
+ * - Failures to deliver are swallowed: a broken transport must not break the producing tool.
37
+ *
38
+ * Shared across MCP clients on the same GLSP session; per-client routing is handled by the
39
+ * active `mcpRequestContext` frame.
40
+ *
41
+ * @experimental
42
+ */
43
+ let McpProgressReporter = class McpProgressReporter {
44
+ async emit(beat) {
45
+ var _a;
46
+ const extra = mcp_request_context_1.mcpRequestContext.getStore();
47
+ const progressToken = (_a = extra === null || extra === void 0 ? void 0 : extra._meta) === null || _a === void 0 ? void 0 : _a.progressToken;
48
+ if (extra === undefined || progressToken === undefined) {
49
+ return;
50
+ }
51
+ try {
52
+ await extra.sendNotification({
53
+ method: 'notifications/progress',
54
+ params: { progressToken, ...beat }
55
+ });
56
+ }
57
+ catch {
58
+ // Fire-and-forget — never propagate transport errors into tool execution.
59
+ }
60
+ }
61
+ };
62
+ exports.McpProgressReporter = McpProgressReporter;
63
+ exports.McpProgressReporter = McpProgressReporter = __decorate([
64
+ (0, inversify_1.injectable)()
65
+ ], McpProgressReporter);
66
+ //# sourceMappingURL=mcp-progress-reporter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-progress-reporter.js","sourceRoot":"","sources":["../../src/server/mcp-progress-reporter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;AAElF,yCAAuC;AACvC,+DAA0D;AAgB1D;;;;;;;;;;;;;;;GAeG;AAEI,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAC5B,KAAK,CAAC,IAAI,CAAC,IAAqB;;QAC5B,MAAM,KAAK,GAAG,uCAAiB,CAAC,QAAQ,EAAE,CAAC;QAC3C,MAAM,aAAa,GAAG,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,0CAAE,aAAa,CAAC;QAClD,IAAI,KAAK,KAAK,SAAS,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;YACrD,OAAO;QACX,CAAC;QACD,IAAI,CAAC;YACD,MAAM,KAAK,CAAC,gBAAgB,CAAC;gBACzB,MAAM,EAAE,wBAAwB;gBAChC,MAAM,EAAE,EAAE,aAAa,EAAE,GAAG,IAAI,EAAE;aACrC,CAAC,CAAC;QACP,CAAC;QAAC,MAAM,CAAC;YACL,0EAA0E;QAC9E,CAAC;IACL,CAAC;CACJ,CAAA;AAhBY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,sBAAU,GAAE;GACA,mBAAmB,CAgB/B"}
@@ -0,0 +1,120 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2025-2026 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+ import { Logger, MaybePromise, ModelState } from '@eclipse-glsp/server';
17
+ import { interfaces } from 'inversify';
18
+ import { ZodObject, ZodRawShape } from 'zod/v4';
19
+ import { GLSPMcpServer } from './glsp-mcp-server';
20
+ import { McpPromptResult } from './mcp-handler-shared';
21
+ import { McpIdAliasService } from './mcp-id-alias-service';
22
+ import { McpDiagramScopedInput } from './mcp-input-schemas';
23
+ /**
24
+ * Multi-binding key for **server-scope** prompt handlers — singletons that don't target a
25
+ * specific GLSP client session. Diagram-scope prompts (one instance per open diagram) use the
26
+ * separate {@link McpDiagramPromptHandlerConstructor} multi-binding instead.
27
+ *
28
+ * Prompts are LLM-facing message templates the AI client may invoke. No prompts ship by default;
29
+ * the surface exists for adopters.
30
+ *
31
+ * @experimental
32
+ */
33
+ export interface McpPromptHandler {
34
+ /** Prompt identifier exposed to the MCP client; matches the abstract base's field. */
35
+ readonly name: string;
36
+ registerPrompt(server: GLSPMcpServer): void;
37
+ /** Tool names this prompt's text references via `${OtherHandler.NAME}`; default: empty. */
38
+ referencedToolNames(): string[];
39
+ }
40
+ export declare const McpPromptHandler: unique symbol;
41
+ /** Shared infrastructure for both server- and diagram-scope prompt handlers. */
42
+ declare abstract class BaseMcpPromptHandler {
43
+ protected logger: Logger;
44
+ /**
45
+ * Prompt identifier exposed to the MCP client. Also used to reference this prompt from
46
+ * other handlers' prompt or description text — wire via `static readonly NAME = '…'` and
47
+ * `readonly name = ClassName.NAME` so those cross-references survive renames.
48
+ */
49
+ abstract readonly name: string;
50
+ /** LLM-facing explanation surfaced in the prompt catalog. Keep concise — clients pass this verbatim to the model. */
51
+ abstract readonly description: string;
52
+ /** Adopter writes `z.object({ ... })`; the base passes `.shape` to the SDK. */
53
+ abstract readonly argsSchema: ZodObject<ZodRawShape>;
54
+ /** Optional human-friendly display name for UIs that render a friendlier label than `name`. */
55
+ readonly title?: string;
56
+ /** SDK-facing registration config; consumed by both registration paths. */
57
+ toRegistrationConfig(): {
58
+ title?: string;
59
+ description: string;
60
+ argsSchema: ZodRawShape;
61
+ };
62
+ /**
63
+ * Optional list of tool names this prompt's text refers to via `${OtherHandler.NAME}`
64
+ * substitutions. Default: empty. Override in concrete subclasses to declare references so
65
+ * the launcher can warn at registration time when an adopter unbinds a referenced tool —
66
+ * the prompt would otherwise still register and silently produce text pointing at a tool
67
+ * that no longer exists. Pure declarative metadata; never invoked at request time.
68
+ */
69
+ referencedToolNames(): string[];
70
+ /**
71
+ * Catches `McpToolError` (→ surfaced as a `user`-role assistant message) and unexpected
72
+ * errors (→ logged + extracted message). Errors map to a single text-content message so
73
+ * the LLM sees the failure in the prompt response.
74
+ */
75
+ protected execute(producer: () => MaybePromise<McpPromptResult>): Promise<McpPromptResult>;
76
+ protected errorResult(message: string): McpPromptResult;
77
+ }
78
+ /**
79
+ * Server-scope prompt base — for prompts that don't target a specific GLSP client session
80
+ * (e.g., a prompt that summarizes the system's state). Bound under {@link McpPromptHandler};
81
+ * the launcher invokes `registerPrompt(server)` once per MCP session.
82
+ *
83
+ * @experimental
84
+ */
85
+ export declare abstract class AbstractMcpPromptHandler<T = Record<string, unknown>> extends BaseMcpPromptHandler implements McpPromptHandler {
86
+ /** Throw {@link McpToolError} for expected errors; the base wraps. */
87
+ protected abstract createResult(args: T): MaybePromise<McpPromptResult>;
88
+ registerPrompt(server: GLSPMcpServer): void;
89
+ }
90
+ /**
91
+ * Diagram-scope prompt base — for prompts whose argument schema carries a `sessionId`
92
+ * (e.g., a `describe-diagram` prompt for one open diagram).
93
+ *
94
+ * The launcher's dispatcher resolves `args.sessionId` to the right GLSP session and invokes
95
+ * {@link handle} on this session's per-instance handler. From the handler's perspective the
96
+ * session is implicit — `this.clientId`, `this.modelState`, `this.aliasService` (and any
97
+ * adopter `@inject(...)` fields) all resolve to that GLSP session's container.
98
+ *
99
+ * @experimental
100
+ */
101
+ export declare abstract class AbstractMcpDiagramPromptHandler<T extends McpDiagramScopedInput = McpDiagramScopedInput> extends BaseMcpPromptHandler {
102
+ protected clientId: string;
103
+ protected modelState: ModelState;
104
+ protected aliasService: McpIdAliasService;
105
+ /** Throw {@link McpToolError} for expected errors; the base wraps. */
106
+ protected abstract createResult(args: T): MaybePromise<McpPromptResult>;
107
+ /**
108
+ * Public dispatch entry point invoked by {@link McpServerLauncher}'s SDK callback.
109
+ */
110
+ handle(args: T): Promise<McpPromptResult>;
111
+ }
112
+ /**
113
+ * Multi-binding identifier for diagram-scope prompt handler constructors. See
114
+ * {@link McpDiagramToolHandlerConstructor} for the lifecycle pattern — same shape, applied to
115
+ * prompt handlers.
116
+ */
117
+ export type McpDiagramPromptHandlerConstructor = interfaces.Newable<AbstractMcpDiagramPromptHandler<any>>;
118
+ export declare const McpDiagramPromptHandlerConstructor: unique symbol;
119
+ export {};
120
+ //# sourceMappingURL=mcp-prompt-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-prompt-handler.d.ts","sourceRoot":"","sources":["../../src/server/mcp-prompt-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAY,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,EAAsB,UAAU,EAAE,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAqC,MAAM,sBAAsB,CAAC;AAC1F,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAG5D;;;;;;;;;GASG;AACH,MAAM,WAAW,gBAAgB;IAC7B,sFAAsF;IACtF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAAC;IAC5C,2FAA2F;IAC3F,mBAAmB,IAAI,MAAM,EAAE,CAAC;CACnC;AACD,eAAO,MAAM,gBAAgB,eAA6B,CAAC;AAE3D,gFAAgF;AAChF,uBACe,oBAAoB;IACf,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;IAEzC;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAC/B,qHAAqH;IACrH,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IACtC,+EAA+E;IAC/E,QAAQ,CAAC,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IACrD,+FAA+F;IAC/F,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAExB,2EAA2E;IAC3E,oBAAoB,IAAI;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,WAAW,CAAA;KAAE;IAIxF;;;;;;OAMG;IACH,mBAAmB,IAAI,MAAM,EAAE;IAI/B;;;;OAIG;cACa,OAAO,CAAC,QAAQ,EAAE,MAAM,YAAY,CAAC,eAAe,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC;IAahG,SAAS,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe;CAG1D;AAED;;;;;;GAMG;AACH,8BACsB,wBAAwB,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAE,SAAQ,oBAAqB,YAAW,gBAAgB;IAChI,sEAAsE;IACtE,SAAS,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,GAAG,YAAY,CAAC,eAAe,CAAC;IAEvE,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI;CAK9C;AAED;;;;;;;;;;GAUG;AACH,8BACsB,+BAA+B,CACjD,CAAC,SAAS,qBAAqB,GAAG,qBAAqB,CACzD,SAAQ,oBAAoB;IACR,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,UAAU,EAAE,UAAU,CAAC;IAC1B,SAAS,CAAC,YAAY,EAAE,iBAAiB,CAAC;IAErE,sEAAsE;IACtE,SAAS,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,GAAG,YAAY,CAAC,eAAe,CAAC;IAEvE;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC;CAG5C;AAED;;;;GAIG;AACH,MAAM,MAAM,kCAAkC,GAAG,UAAU,CAAC,OAAO,CAAC,+BAA+B,CAAC,GAAG,CAAC,CAAC,CAAC;AAC1G,eAAO,MAAM,kCAAkC,eAA+C,CAAC"}
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (c) 2025-2026 EclipseSource and others.
4
+ *
5
+ * This program and the accompanying materials are made available under the
6
+ * terms of the Eclipse Public License v. 2.0 which is available at
7
+ * http://www.eclipse.org/legal/epl-2.0.
8
+ *
9
+ * This Source Code may also be made available under the following Secondary
10
+ * Licenses when the conditions for such availability set forth in the Eclipse
11
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ * with the GNU Classpath Exception which is available at
13
+ * https://www.gnu.org/software/classpath/license.html.
14
+ *
15
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
+ ********************************************************************************/
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ var __metadata = (this && this.__metadata) || function (k, v) {
24
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.McpDiagramPromptHandlerConstructor = exports.AbstractMcpDiagramPromptHandler = exports.AbstractMcpPromptHandler = exports.McpPromptHandler = void 0;
28
+ const server_1 = require("@eclipse-glsp/server");
29
+ const inversify_1 = require("inversify");
30
+ const mcp_handler_shared_1 = require("./mcp-handler-shared");
31
+ const mcp_id_alias_service_1 = require("./mcp-id-alias-service");
32
+ const mcp_request_context_1 = require("./mcp-request-context");
33
+ exports.McpPromptHandler = Symbol('McpPromptHandler');
34
+ /** Shared infrastructure for both server- and diagram-scope prompt handlers. */
35
+ let BaseMcpPromptHandler = class BaseMcpPromptHandler {
36
+ /** SDK-facing registration config; consumed by both registration paths. */
37
+ toRegistrationConfig() {
38
+ return { title: this.title, description: this.description, argsSchema: this.argsSchema.shape };
39
+ }
40
+ /**
41
+ * Optional list of tool names this prompt's text refers to via `${OtherHandler.NAME}`
42
+ * substitutions. Default: empty. Override in concrete subclasses to declare references so
43
+ * the launcher can warn at registration time when an adopter unbinds a referenced tool —
44
+ * the prompt would otherwise still register and silently produce text pointing at a tool
45
+ * that no longer exists. Pure declarative metadata; never invoked at request time.
46
+ */
47
+ referencedToolNames() {
48
+ return [];
49
+ }
50
+ /**
51
+ * Catches `McpToolError` (→ surfaced as a `user`-role assistant message) and unexpected
52
+ * errors (→ logged + extracted message). Errors map to a single text-content message so
53
+ * the LLM sees the failure in the prompt response.
54
+ */
55
+ async execute(producer) {
56
+ try {
57
+ return await producer();
58
+ }
59
+ catch (err) {
60
+ if (err instanceof mcp_handler_shared_1.McpToolError) {
61
+ return this.errorResult(err.message);
62
+ }
63
+ const message = (0, mcp_handler_shared_1.extractErrorMessage)(err);
64
+ this.logger.error(`Unexpected error in prompt '${this.name}': ${message}`, err);
65
+ return this.errorResult(message);
66
+ }
67
+ }
68
+ errorResult(message) {
69
+ return { messages: [{ role: 'user', content: { type: 'text', text: message } }] };
70
+ }
71
+ };
72
+ __decorate([
73
+ (0, inversify_1.inject)(server_1.Logger),
74
+ __metadata("design:type", server_1.Logger)
75
+ ], BaseMcpPromptHandler.prototype, "logger", void 0);
76
+ BaseMcpPromptHandler = __decorate([
77
+ (0, inversify_1.injectable)()
78
+ ], BaseMcpPromptHandler);
79
+ /**
80
+ * Server-scope prompt base — for prompts that don't target a specific GLSP client session
81
+ * (e.g., a prompt that summarizes the system's state). Bound under {@link McpPromptHandler};
82
+ * the launcher invokes `registerPrompt(server)` once per MCP session.
83
+ *
84
+ * @experimental
85
+ */
86
+ let AbstractMcpPromptHandler = class AbstractMcpPromptHandler extends BaseMcpPromptHandler {
87
+ registerPrompt(server) {
88
+ server.registerPrompt(this.name, this.toRegistrationConfig(), async (args, extra) => mcp_request_context_1.mcpRequestContext.run(extra, () => this.execute(() => this.createResult(args))));
89
+ }
90
+ };
91
+ exports.AbstractMcpPromptHandler = AbstractMcpPromptHandler;
92
+ exports.AbstractMcpPromptHandler = AbstractMcpPromptHandler = __decorate([
93
+ (0, inversify_1.injectable)()
94
+ ], AbstractMcpPromptHandler);
95
+ /**
96
+ * Diagram-scope prompt base — for prompts whose argument schema carries a `sessionId`
97
+ * (e.g., a `describe-diagram` prompt for one open diagram).
98
+ *
99
+ * The launcher's dispatcher resolves `args.sessionId` to the right GLSP session and invokes
100
+ * {@link handle} on this session's per-instance handler. From the handler's perspective the
101
+ * session is implicit — `this.clientId`, `this.modelState`, `this.aliasService` (and any
102
+ * adopter `@inject(...)` fields) all resolve to that GLSP session's container.
103
+ *
104
+ * @experimental
105
+ */
106
+ let AbstractMcpDiagramPromptHandler = class AbstractMcpDiagramPromptHandler extends BaseMcpPromptHandler {
107
+ /**
108
+ * Public dispatch entry point invoked by {@link McpServerLauncher}'s SDK callback.
109
+ */
110
+ handle(args) {
111
+ return this.execute(() => this.createResult(args));
112
+ }
113
+ };
114
+ exports.AbstractMcpDiagramPromptHandler = AbstractMcpDiagramPromptHandler;
115
+ __decorate([
116
+ (0, inversify_1.inject)(server_1.ClientId),
117
+ __metadata("design:type", String)
118
+ ], AbstractMcpDiagramPromptHandler.prototype, "clientId", void 0);
119
+ __decorate([
120
+ (0, inversify_1.inject)(server_1.ModelState),
121
+ __metadata("design:type", Object)
122
+ ], AbstractMcpDiagramPromptHandler.prototype, "modelState", void 0);
123
+ __decorate([
124
+ (0, inversify_1.inject)(mcp_id_alias_service_1.McpIdAliasService),
125
+ __metadata("design:type", Object)
126
+ ], AbstractMcpDiagramPromptHandler.prototype, "aliasService", void 0);
127
+ exports.AbstractMcpDiagramPromptHandler = AbstractMcpDiagramPromptHandler = __decorate([
128
+ (0, inversify_1.injectable)()
129
+ ], AbstractMcpDiagramPromptHandler);
130
+ exports.McpDiagramPromptHandlerConstructor = Symbol('McpDiagramPromptHandlerConstructor');
131
+ //# sourceMappingURL=mcp-prompt-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-prompt-handler.js","sourceRoot":"","sources":["../../src/server/mcp-prompt-handler.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;AAElF,iDAAkF;AAClF,yCAA2D;AAG3D,6DAA0F;AAC1F,iEAA2D;AAE3D,+DAA0D;AAmB7C,QAAA,gBAAgB,GAAG,MAAM,CAAC,kBAAkB,CAAC,CAAC;AAE3D,gFAAgF;AAEhF,IAAe,oBAAoB,GAAnC,MAAe,oBAAoB;IAgB/B,2EAA2E;IAC3E,oBAAoB;QAChB,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;IACnG,CAAC;IAED;;;;;;OAMG;IACH,mBAAmB;QACf,OAAO,EAAE,CAAC;IACd,CAAC;IAED;;;;OAIG;IACO,KAAK,CAAC,OAAO,CAAC,QAA6C;QACjE,IAAI,CAAC;YACD,OAAO,MAAM,QAAQ,EAAE,CAAC;QAC5B,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACpB,IAAI,GAAG,YAAY,iCAAY,EAAE,CAAC;gBAC9B,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACzC,CAAC;YACD,MAAM,OAAO,GAAG,IAAA,wCAAmB,EAAC,GAAG,CAAC,CAAC;YACzC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,+BAA+B,IAAI,CAAC,IAAI,MAAM,OAAO,EAAE,EAAE,GAAG,CAAC,CAAC;YAChF,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QACrC,CAAC;IACL,CAAC;IAES,WAAW,CAAC,OAAe;QACjC,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,CAAC;IACtF,CAAC;CACJ,CAAA;AApD6B;IAAzB,IAAA,kBAAM,EAAC,eAAM,CAAC;8BAAmB,eAAM;oDAAC;AAD9B,oBAAoB;IADlC,IAAA,sBAAU,GAAE;GACE,oBAAoB,CAqDlC;AAED;;;;;;GAMG;AAEI,IAAe,wBAAwB,GAAvC,MAAe,wBAAsD,SAAQ,oBAAoB;IAIpG,cAAc,CAAC,MAAqB;QAChC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,oBAAoB,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,CAChF,uCAAiB,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,IAAS,CAAC,CAAC,CAAC,CACvF,CAAC;IACN,CAAC;CACJ,CAAA;AATqB,4DAAwB;mCAAxB,wBAAwB;IAD7C,IAAA,sBAAU,GAAE;GACS,wBAAwB,CAS7C;AAED;;;;;;;;;;GAUG;AAEI,IAAe,+BAA+B,GAA9C,MAAe,+BAEpB,SAAQ,oBAAoB;IAQ1B;;OAEG;IACH,MAAM,CAAC,IAAO;QACV,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;IACvD,CAAC;CACJ,CAAA;AAhBqB,0EAA+B;AAGrB;IAA3B,IAAA,kBAAM,EAAC,iBAAQ,CAAC;;iEAA4B;AACf;IAA7B,IAAA,kBAAM,EAAC,mBAAU,CAAC;;mEAAkC;AAChB;IAApC,IAAA,kBAAM,EAAC,wCAAiB,CAAC;;qEAA2C;0CALnD,+BAA+B;IADpD,IAAA,sBAAU,GAAE;GACS,+BAA+B,CAgBpD;AAQY,QAAA,kCAAkC,GAAG,MAAM,CAAC,oCAAoC,CAAC,CAAC"}
@@ -0,0 +1,37 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+ import { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol.js';
17
+ import { ServerNotification, ServerRequest } from '@modelcontextprotocol/sdk/types.js';
18
+ import { AsyncLocalStorage } from 'node:async_hooks';
19
+ export type McpRequestExtra = RequestHandlerExtra<ServerRequest, ServerNotification>;
20
+ /**
21
+ * Module-level `AsyncLocalStorage` carrying the SDK's per-request `extra` (notification sender,
22
+ * progress token, request id, session id) for the duration of a tool/resource/prompt callback.
23
+ *
24
+ * The handler bases (tool / resource / prompt) wrap each registered SDK callback in
25
+ * `mcpRequestContext.run(extra, () => …)`. Anything inside the handler — and any await chain
26
+ * branching off it — can read the active context via {@link mcpRequestContext.getStore}.
27
+ *
28
+ * This lets {@link McpLogger} forward logs to the MCP client without every handler having to
29
+ * thread `extra` through its own signature, and lets future progress-emission code (P1f / PNG
30
+ * export) reach the same channel from inside `requestUntil` chains.
31
+ *
32
+ * Concurrent requests on the same MCP session each get their own AsyncLocalStorage frame —
33
+ * no cross-talk. Code that runs OUTSIDE a request (init contributions, background timers)
34
+ * sees `undefined` from `getStore()`.
35
+ */
36
+ export declare const mcpRequestContext: AsyncLocalStorage<McpRequestExtra>;
37
+ //# sourceMappingURL=mcp-request-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-request-context.d.ts","sourceRoot":"","sources":["../../src/server/mcp-request-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,MAAM,MAAM,eAAe,GAAG,mBAAmB,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC;AAErF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,iBAAiB,oCAA2C,CAAC"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (c) 2026 EclipseSource and others.
4
+ *
5
+ * This program and the accompanying materials are made available under the
6
+ * terms of the Eclipse Public License v. 2.0 which is available at
7
+ * http://www.eclipse.org/legal/epl-2.0.
8
+ *
9
+ * This Source Code may also be made available under the following Secondary
10
+ * Licenses when the conditions for such availability set forth in the Eclipse
11
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ * with the GNU Classpath Exception which is available at
13
+ * https://www.gnu.org/software/classpath/license.html.
14
+ *
15
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
+ ********************************************************************************/
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.mcpRequestContext = void 0;
19
+ const node_async_hooks_1 = require("node:async_hooks");
20
+ /**
21
+ * Module-level `AsyncLocalStorage` carrying the SDK's per-request `extra` (notification sender,
22
+ * progress token, request id, session id) for the duration of a tool/resource/prompt callback.
23
+ *
24
+ * The handler bases (tool / resource / prompt) wrap each registered SDK callback in
25
+ * `mcpRequestContext.run(extra, () => …)`. Anything inside the handler — and any await chain
26
+ * branching off it — can read the active context via {@link mcpRequestContext.getStore}.
27
+ *
28
+ * This lets {@link McpLogger} forward logs to the MCP client without every handler having to
29
+ * thread `extra` through its own signature, and lets future progress-emission code (P1f / PNG
30
+ * export) reach the same channel from inside `requestUntil` chains.
31
+ *
32
+ * Concurrent requests on the same MCP session each get their own AsyncLocalStorage frame —
33
+ * no cross-talk. Code that runs OUTSIDE a request (init contributions, background timers)
34
+ * sees `undefined` from `getStore()`.
35
+ */
36
+ exports.mcpRequestContext = new node_async_hooks_1.AsyncLocalStorage();
37
+ //# sourceMappingURL=mcp-request-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-request-context.js","sourceRoot":"","sources":["../../src/server/mcp-request-context.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAIlF,uDAAqD;AAIrD;;;;;;;;;;;;;;;GAeG;AACU,QAAA,iBAAiB,GAAG,IAAI,oCAAiB,EAAmB,CAAC"}