@eclipse-glsp/server-mcp 2.7.0-next.10 → 2.7.0-next.14

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 (443) hide show
  1. package/README.md +17 -3
  2. package/browser.d.ts +16 -0
  3. package/browser.js +18 -0
  4. package/common.d.ts +16 -0
  5. package/common.js +18 -0
  6. package/lib/browser/index.d.ts +21 -0
  7. package/lib/browser/index.d.ts.map +1 -0
  8. package/lib/browser/index.js +37 -0
  9. package/lib/browser/index.js.map +1 -0
  10. package/lib/browser/modules/browser-mcp-server-module.d.ts +42 -0
  11. package/lib/browser/modules/browser-mcp-server-module.d.ts.map +1 -0
  12. package/lib/browser/modules/browser-mcp-server-module.js +50 -0
  13. package/lib/browser/modules/browser-mcp-server-module.js.map +1 -0
  14. package/lib/browser/reexport.d.ts +17 -0
  15. package/lib/browser/reexport.d.ts.map +1 -0
  16. package/lib/browser/reexport.js +33 -0
  17. package/lib/browser/reexport.js.map +1 -0
  18. package/lib/browser/server/browser-mcp-request-context.d.ts +27 -0
  19. package/lib/browser/server/browser-mcp-request-context.d.ts.map +1 -0
  20. package/lib/browser/server/browser-mcp-request-context.js +67 -0
  21. package/lib/browser/server/browser-mcp-request-context.js.map +1 -0
  22. package/lib/browser/server/mcp-worker-bridge.d.ts +81 -0
  23. package/lib/browser/server/mcp-worker-bridge.d.ts.map +1 -0
  24. package/lib/browser/server/mcp-worker-bridge.js +159 -0
  25. package/lib/browser/server/mcp-worker-bridge.js.map +1 -0
  26. package/lib/browser/server/web-mcp-server-launcher.d.ts +34 -0
  27. package/lib/browser/server/web-mcp-server-launcher.d.ts.map +1 -0
  28. package/lib/browser/server/web-mcp-server-launcher.js +50 -0
  29. package/lib/browser/server/web-mcp-server-launcher.js.map +1 -0
  30. package/lib/{index.d.ts → common/index.d.ts} +3 -4
  31. package/lib/common/index.d.ts.map +1 -0
  32. package/lib/{index.js → common/index.js} +17 -18
  33. package/lib/common/index.js.map +1 -0
  34. package/lib/{modules/mcp-server-module.d.ts → common/modules/abstract-mcp-server-module.d.ts} +46 -37
  35. package/lib/common/modules/abstract-mcp-server-module.d.ts.map +1 -0
  36. package/lib/{modules/mcp-server-module.js → common/modules/abstract-mcp-server-module.js} +43 -66
  37. package/lib/common/modules/abstract-mcp-server-module.js.map +1 -0
  38. package/lib/common/modules/mcp-diagram-module.d.ts.map +1 -0
  39. package/lib/common/modules/mcp-diagram-module.js.map +1 -0
  40. package/lib/common/prompts/handlers/describe-diagram-mcp-prompt-handler.d.ts.map +1 -0
  41. package/lib/common/prompts/handlers/describe-diagram-mcp-prompt-handler.js.map +1 -0
  42. package/lib/common/prompts/handlers/suggest-improvements-mcp-prompt-handler.d.ts.map +1 -0
  43. package/lib/common/prompts/handlers/suggest-improvements-mcp-prompt-handler.js.map +1 -0
  44. package/lib/common/resources/handlers/diagram-png-mcp-resource-handler.d.ts.map +1 -0
  45. package/lib/common/resources/handlers/diagram-png-mcp-resource-handler.js.map +1 -0
  46. package/lib/common/resources/handlers/diagram-svg-mcp-resource-handler.d.ts.map +1 -0
  47. package/lib/common/resources/handlers/diagram-svg-mcp-resource-handler.js.map +1 -0
  48. package/lib/common/resources/services/element-types-provider.d.ts.map +1 -0
  49. package/lib/common/resources/services/element-types-provider.js.map +1 -0
  50. package/lib/common/resources/services/mcp-model-serializer.d.ts.map +1 -0
  51. package/lib/common/resources/services/mcp-model-serializer.js.map +1 -0
  52. package/lib/common/server/abstract-mcp-server-launcher.d.ts +168 -0
  53. package/lib/common/server/abstract-mcp-server-launcher.d.ts.map +1 -0
  54. package/lib/{server/mcp-server-launcher.js → common/server/abstract-mcp-server-launcher.js} +235 -121
  55. package/lib/common/server/abstract-mcp-server-launcher.js.map +1 -0
  56. package/lib/{server → common/server}/glsp-mcp-server.d.ts +1 -1
  57. package/lib/common/server/glsp-mcp-server.d.ts.map +1 -0
  58. package/lib/{server → common/server}/glsp-mcp-server.js +6 -1
  59. package/lib/common/server/glsp-mcp-server.js.map +1 -0
  60. package/lib/{server → common/server}/lru-event-store.d.ts +1 -1
  61. package/lib/common/server/lru-event-store.d.ts.map +1 -0
  62. package/lib/common/server/lru-event-store.js.map +1 -0
  63. package/lib/{server → common/server}/mcp-diagram-handler-dispatcher.d.ts +3 -1
  64. package/lib/common/server/mcp-diagram-handler-dispatcher.d.ts.map +1 -0
  65. package/lib/{server → common/server}/mcp-diagram-handler-dispatcher.js +12 -6
  66. package/lib/common/server/mcp-diagram-handler-dispatcher.js.map +1 -0
  67. package/lib/common/server/mcp-diagram-prompt-handler-registry.d.ts.map +1 -0
  68. package/lib/common/server/mcp-diagram-prompt-handler-registry.js.map +1 -0
  69. package/lib/common/server/mcp-diagram-resource-handler-registry.d.ts.map +1 -0
  70. package/lib/{server → common/server}/mcp-diagram-resource-handler-registry.js +4 -1
  71. package/lib/common/server/mcp-diagram-resource-handler-registry.js.map +1 -0
  72. package/lib/common/server/mcp-diagram-tool-handler-registry.d.ts.map +1 -0
  73. package/lib/{server → common/server}/mcp-diagram-tool-handler-registry.js +3 -1
  74. package/lib/common/server/mcp-diagram-tool-handler-registry.js.map +1 -0
  75. package/lib/common/server/mcp-handler-shared.d.ts.map +1 -0
  76. package/lib/common/server/mcp-handler-shared.js.map +1 -0
  77. package/lib/common/server/mcp-id-alias-service.d.ts.map +1 -0
  78. package/lib/common/server/mcp-id-alias-service.js.map +1 -0
  79. package/lib/{server → common/server}/mcp-input-schemas.d.ts +8 -0
  80. package/lib/common/server/mcp-input-schemas.d.ts.map +1 -0
  81. package/lib/{server → common/server}/mcp-input-schemas.js +13 -1
  82. package/lib/common/server/mcp-input-schemas.js.map +1 -0
  83. package/lib/common/server/mcp-label-provider.d.ts.map +1 -0
  84. package/lib/common/server/mcp-label-provider.js.map +1 -0
  85. package/lib/{server → common/server}/mcp-log-level-registry.d.ts +1 -1
  86. package/lib/common/server/mcp-log-level-registry.d.ts.map +1 -0
  87. package/lib/common/server/mcp-log-level-registry.js.map +1 -0
  88. package/lib/{server → common/server}/mcp-logger.d.ts +4 -2
  89. package/lib/common/server/mcp-logger.d.ts.map +1 -0
  90. package/lib/{server → common/server}/mcp-logger.js +11 -3
  91. package/lib/common/server/mcp-logger.js.map +1 -0
  92. package/lib/common/server/mcp-mime-types.d.ts.map +1 -0
  93. package/lib/common/server/mcp-mime-types.js.map +1 -0
  94. package/lib/{server → common/server}/mcp-options.d.ts +1 -1
  95. package/lib/common/server/mcp-options.d.ts.map +1 -0
  96. package/lib/{server → common/server}/mcp-options.js +1 -1
  97. package/lib/common/server/mcp-options.js.map +1 -0
  98. package/lib/{server → common/server}/mcp-progress-reporter.d.ts +4 -2
  99. package/lib/common/server/mcp-progress-reporter.d.ts.map +1 -0
  100. package/lib/{server → common/server}/mcp-progress-reporter.js +14 -3
  101. package/lib/common/server/mcp-progress-reporter.js.map +1 -0
  102. package/lib/{server → common/server}/mcp-prompt-handler.d.ts +3 -1
  103. package/lib/common/server/mcp-prompt-handler.d.ts.map +1 -0
  104. package/lib/{server → common/server}/mcp-prompt-handler.js +10 -2
  105. package/lib/common/server/mcp-prompt-handler.js.map +1 -0
  106. package/lib/common/server/mcp-request-context.d.ts +35 -0
  107. package/lib/common/server/mcp-request-context.d.ts.map +1 -0
  108. package/lib/common/server/mcp-request-context.js +30 -0
  109. package/lib/common/server/mcp-request-context.js.map +1 -0
  110. package/lib/{server → common/server}/mcp-resource-handler.d.ts +3 -1
  111. package/lib/common/server/mcp-resource-handler.d.ts.map +1 -0
  112. package/lib/{server → common/server}/mcp-resource-handler.js +13 -5
  113. package/lib/common/server/mcp-resource-handler.js.map +1 -0
  114. package/lib/common/server/mcp-session.d.ts.map +1 -0
  115. package/lib/common/server/mcp-session.js.map +1 -0
  116. package/lib/{server → common/server}/mcp-tool-handler.d.ts +3 -1
  117. package/lib/common/server/mcp-tool-handler.d.ts.map +1 -0
  118. package/lib/{server → common/server}/mcp-tool-handler.js +7 -1
  119. package/lib/{server → common/server}/mcp-tool-handler.js.map +1 -1
  120. package/lib/common/tools/handlers/count-elements-mcp-tool-handler.d.ts.map +1 -0
  121. package/lib/common/tools/handlers/count-elements-mcp-tool-handler.js.map +1 -0
  122. package/lib/{tools → common/tools}/handlers/create-edges-mcp-tool-handler.d.ts +2 -0
  123. package/lib/common/tools/handlers/create-edges-mcp-tool-handler.d.ts.map +1 -0
  124. package/lib/{tools → common/tools}/handlers/create-edges-mcp-tool-handler.js +2 -1
  125. package/lib/common/tools/handlers/create-edges-mcp-tool-handler.js.map +1 -0
  126. package/lib/{tools → common/tools}/handlers/create-nodes-mcp-tool-handler.d.ts +2 -0
  127. package/lib/common/tools/handlers/create-nodes-mcp-tool-handler.d.ts.map +1 -0
  128. package/lib/{tools → common/tools}/handlers/create-nodes-mcp-tool-handler.js +2 -1
  129. package/lib/common/tools/handlers/create-nodes-mcp-tool-handler.js.map +1 -0
  130. package/lib/{tools → common/tools}/handlers/delete-elements-mcp-tool-handler.d.ts +2 -0
  131. package/lib/common/tools/handlers/delete-elements-mcp-tool-handler.d.ts.map +1 -0
  132. package/lib/{tools → common/tools}/handlers/delete-elements-mcp-tool-handler.js +4 -2
  133. package/lib/common/tools/handlers/delete-elements-mcp-tool-handler.js.map +1 -0
  134. package/lib/common/tools/handlers/diagram-model-mcp-tool-handler.d.ts.map +1 -0
  135. package/lib/common/tools/handlers/diagram-model-mcp-tool-handler.js.map +1 -0
  136. package/lib/common/tools/handlers/element-types-mcp-tool-handler.d.ts.map +1 -0
  137. package/lib/common/tools/handlers/element-types-mcp-tool-handler.js.map +1 -0
  138. package/lib/common/tools/handlers/get-selection-mcp-tool-handler.d.ts.map +1 -0
  139. package/lib/common/tools/handlers/get-selection-mcp-tool-handler.js.map +1 -0
  140. package/lib/{tools → common/tools}/handlers/layout-mcp-tool-handler.d.ts +2 -0
  141. package/lib/common/tools/handlers/layout-mcp-tool-handler.d.ts.map +1 -0
  142. package/lib/{tools → common/tools}/handlers/layout-mcp-tool-handler.js +3 -2
  143. package/lib/common/tools/handlers/layout-mcp-tool-handler.js.map +1 -0
  144. package/lib/common/tools/handlers/modify-edges-mcp-tool-handler.d.ts.map +1 -0
  145. package/lib/{tools → common/tools}/handlers/modify-edges-mcp-tool-handler.js +1 -1
  146. package/lib/common/tools/handlers/modify-edges-mcp-tool-handler.js.map +1 -0
  147. package/lib/common/tools/handlers/modify-nodes-mcp-tool-handler.d.ts.map +1 -0
  148. package/lib/{tools → common/tools}/handlers/modify-nodes-mcp-tool-handler.js +1 -1
  149. package/lib/common/tools/handlers/modify-nodes-mcp-tool-handler.js.map +1 -0
  150. package/lib/common/tools/handlers/query-elements-mcp-tool-handler.d.ts.map +1 -0
  151. package/lib/common/tools/handlers/query-elements-mcp-tool-handler.js.map +1 -0
  152. package/lib/common/tools/handlers/redo-mcp-tool-handler.d.ts.map +1 -0
  153. package/lib/common/tools/handlers/redo-mcp-tool-handler.js.map +1 -0
  154. package/lib/common/tools/handlers/save-model-mcp-tool-handler.d.ts.map +1 -0
  155. package/lib/common/tools/handlers/save-model-mcp-tool-handler.js.map +1 -0
  156. package/lib/common/tools/handlers/session-info-mcp-tool-handler.d.ts.map +1 -0
  157. package/lib/common/tools/handlers/session-info-mcp-tool-handler.js.map +1 -0
  158. package/lib/common/tools/handlers/set-selection-mcp-tool-handler.d.ts.map +1 -0
  159. package/lib/common/tools/handlers/set-selection-mcp-tool-handler.js.map +1 -0
  160. package/lib/common/tools/handlers/set-view-mcp-tool-handler.d.ts.map +1 -0
  161. package/lib/common/tools/handlers/set-view-mcp-tool-handler.js.map +1 -0
  162. package/lib/common/tools/handlers/undo-mcp-tool-handler.d.ts.map +1 -0
  163. package/lib/common/tools/handlers/undo-mcp-tool-handler.js.map +1 -0
  164. package/lib/common/tools/handlers/validate-diagram-mcp-tool-handler.d.ts.map +1 -0
  165. package/lib/common/tools/handlers/validate-diagram-mcp-tool-handler.js.map +1 -0
  166. package/lib/common/util/markdown-util.d.ts.map +1 -0
  167. package/lib/common/util/markdown-util.js.map +1 -0
  168. package/lib/common/util/mcp-util.d.ts.map +1 -0
  169. package/lib/common/util/mcp-util.js.map +1 -0
  170. package/lib/node/index.d.ts +20 -0
  171. package/lib/node/index.d.ts.map +1 -0
  172. package/lib/node/index.js +36 -0
  173. package/lib/node/index.js.map +1 -0
  174. package/lib/node/modules/node-mcp-server-module.d.ts +37 -0
  175. package/lib/node/modules/node-mcp-server-module.d.ts.map +1 -0
  176. package/lib/node/modules/node-mcp-server-module.js +52 -0
  177. package/lib/node/modules/node-mcp-server-module.js.map +1 -0
  178. package/lib/node/reexport.d.ts +17 -0
  179. package/lib/node/reexport.d.ts.map +1 -0
  180. package/lib/node/reexport.js +33 -0
  181. package/lib/node/reexport.js.map +1 -0
  182. package/lib/node/server/node-mcp-request-context.d.ts +24 -0
  183. package/lib/node/server/node-mcp-request-context.d.ts.map +1 -0
  184. package/lib/node/server/node-mcp-request-context.js +43 -0
  185. package/lib/node/server/node-mcp-request-context.js.map +1 -0
  186. package/lib/node/server/node-mcp-server-launcher.d.ts +55 -0
  187. package/lib/node/server/node-mcp-server-launcher.d.ts.map +1 -0
  188. package/lib/node/server/node-mcp-server-launcher.js +123 -0
  189. package/lib/node/server/node-mcp-server-launcher.js.map +1 -0
  190. package/node.d.ts +16 -0
  191. package/node.js +18 -0
  192. package/package.json +19 -13
  193. package/src/browser/index.ts +21 -0
  194. package/src/browser/modules/browser-mcp-server-module.ts +54 -0
  195. package/src/browser/reexport.ts +16 -0
  196. package/src/browser/server/browser-mcp-request-context.ts +59 -0
  197. package/src/browser/server/mcp-worker-bridge.ts +200 -0
  198. package/src/browser/server/web-mcp-server-launcher.ts +39 -0
  199. package/src/{index.ts → common/index.ts} +4 -4
  200. package/src/{modules/mcp-server-module.ts → common/modules/abstract-mcp-server-module.ts} +54 -68
  201. package/src/common/server/abstract-mcp-server-launcher.spec.ts +458 -0
  202. package/src/common/server/abstract-mcp-server-launcher.ts +524 -0
  203. package/src/{server → common/server}/glsp-mcp-server.ts +7 -2
  204. package/src/{server → common/server}/lru-event-store.ts +1 -1
  205. package/src/{server → common/server}/mcp-diagram-handler-dispatcher.ts +13 -9
  206. package/src/{server → common/server}/mcp-diagram-resource-handler-registry.ts +4 -1
  207. package/src/{server → common/server}/mcp-diagram-tool-handler-registry.ts +3 -1
  208. package/src/{server → common/server}/mcp-input-schemas.ts +13 -0
  209. package/src/{server → common/server}/mcp-log-level-registry.ts +1 -1
  210. package/src/{server → common/server}/mcp-logger.spec.ts +26 -18
  211. package/src/{server → common/server}/mcp-logger.ts +9 -5
  212. package/src/{server → common/server}/mcp-options.ts +1 -1
  213. package/src/{server → common/server}/mcp-progress-reporter.spec.ts +19 -9
  214. package/src/{server → common/server}/mcp-progress-reporter.ts +9 -5
  215. package/src/{server → common/server}/mcp-prompt-handler.ts +8 -4
  216. package/src/{server → common/server}/mcp-request-context.ts +20 -16
  217. package/src/{server → common/server}/mcp-resource-handler.ts +11 -7
  218. package/src/{server → common/server}/mcp-tool-handler.spec.ts +4 -4
  219. package/src/{server → common/server}/mcp-tool-handler.ts +8 -4
  220. package/src/{tools → common/tools}/handlers/create-edges-mcp-tool-handler.ts +9 -2
  221. package/src/{tools → common/tools}/handlers/create-nodes-mcp-tool-handler.ts +9 -2
  222. package/src/{tools → common/tools}/handlers/delete-elements-mcp-tool-handler.ts +5 -3
  223. package/src/{tools → common/tools}/handlers/layout-mcp-tool-handler.ts +4 -3
  224. package/src/{tools → common/tools}/handlers/modify-edges-mcp-tool-handler.ts +8 -2
  225. package/src/{tools → common/tools}/handlers/modify-nodes-mcp-tool-handler.ts +8 -2
  226. package/src/node/index.ts +20 -0
  227. package/src/node/modules/node-mcp-server-module.ts +56 -0
  228. package/src/node/reexport.ts +16 -0
  229. package/src/node/server/mcp-http-transport-e2e.spec.ts +297 -0
  230. package/src/node/server/node-mcp-request-context.ts +33 -0
  231. package/src/{server/mcp-server-launcher.spec.ts → node/server/node-mcp-server-launcher.spec.ts} +19 -8
  232. package/src/node/server/node-mcp-server-launcher.ts +130 -0
  233. package/lib/index.d.ts.map +0 -1
  234. package/lib/index.js.map +0 -1
  235. package/lib/modules/mcp-diagram-module.d.ts.map +0 -1
  236. package/lib/modules/mcp-diagram-module.js.map +0 -1
  237. package/lib/modules/mcp-server-module.d.ts.map +0 -1
  238. package/lib/modules/mcp-server-module.js.map +0 -1
  239. package/lib/prompts/handlers/describe-diagram-mcp-prompt-handler.d.ts.map +0 -1
  240. package/lib/prompts/handlers/describe-diagram-mcp-prompt-handler.js.map +0 -1
  241. package/lib/prompts/handlers/suggest-improvements-mcp-prompt-handler.d.ts.map +0 -1
  242. package/lib/prompts/handlers/suggest-improvements-mcp-prompt-handler.js.map +0 -1
  243. package/lib/resources/handlers/diagram-png-mcp-resource-handler.d.ts.map +0 -1
  244. package/lib/resources/handlers/diagram-png-mcp-resource-handler.js.map +0 -1
  245. package/lib/resources/handlers/diagram-svg-mcp-resource-handler.d.ts.map +0 -1
  246. package/lib/resources/handlers/diagram-svg-mcp-resource-handler.js.map +0 -1
  247. package/lib/resources/services/element-types-provider.d.ts.map +0 -1
  248. package/lib/resources/services/element-types-provider.js.map +0 -1
  249. package/lib/resources/services/mcp-model-serializer.d.ts.map +0 -1
  250. package/lib/resources/services/mcp-model-serializer.js.map +0 -1
  251. package/lib/server/glsp-mcp-server.d.ts.map +0 -1
  252. package/lib/server/glsp-mcp-server.js.map +0 -1
  253. package/lib/server/lru-event-store.d.ts.map +0 -1
  254. package/lib/server/lru-event-store.js.map +0 -1
  255. package/lib/server/mcp-diagram-handler-dispatcher.d.ts.map +0 -1
  256. package/lib/server/mcp-diagram-handler-dispatcher.js.map +0 -1
  257. package/lib/server/mcp-diagram-prompt-handler-registry.d.ts.map +0 -1
  258. package/lib/server/mcp-diagram-prompt-handler-registry.js.map +0 -1
  259. package/lib/server/mcp-diagram-resource-handler-registry.d.ts.map +0 -1
  260. package/lib/server/mcp-diagram-resource-handler-registry.js.map +0 -1
  261. package/lib/server/mcp-diagram-tool-handler-registry.d.ts.map +0 -1
  262. package/lib/server/mcp-diagram-tool-handler-registry.js.map +0 -1
  263. package/lib/server/mcp-handler-shared.d.ts.map +0 -1
  264. package/lib/server/mcp-handler-shared.js.map +0 -1
  265. package/lib/server/mcp-http-transport.d.ts +0 -93
  266. package/lib/server/mcp-http-transport.d.ts.map +0 -1
  267. package/lib/server/mcp-http-transport.js +0 -350
  268. package/lib/server/mcp-http-transport.js.map +0 -1
  269. package/lib/server/mcp-id-alias-service.d.ts.map +0 -1
  270. package/lib/server/mcp-id-alias-service.js.map +0 -1
  271. package/lib/server/mcp-input-schemas.d.ts.map +0 -1
  272. package/lib/server/mcp-input-schemas.js.map +0 -1
  273. package/lib/server/mcp-label-provider.d.ts.map +0 -1
  274. package/lib/server/mcp-label-provider.js.map +0 -1
  275. package/lib/server/mcp-log-level-registry.d.ts.map +0 -1
  276. package/lib/server/mcp-log-level-registry.js.map +0 -1
  277. package/lib/server/mcp-logger.d.ts.map +0 -1
  278. package/lib/server/mcp-logger.js.map +0 -1
  279. package/lib/server/mcp-mime-types.d.ts.map +0 -1
  280. package/lib/server/mcp-mime-types.js.map +0 -1
  281. package/lib/server/mcp-options.d.ts.map +0 -1
  282. package/lib/server/mcp-options.js.map +0 -1
  283. package/lib/server/mcp-progress-reporter.d.ts.map +0 -1
  284. package/lib/server/mcp-progress-reporter.js.map +0 -1
  285. package/lib/server/mcp-prompt-handler.d.ts.map +0 -1
  286. package/lib/server/mcp-prompt-handler.js.map +0 -1
  287. package/lib/server/mcp-request-context.d.ts +0 -37
  288. package/lib/server/mcp-request-context.d.ts.map +0 -1
  289. package/lib/server/mcp-request-context.js +0 -37
  290. package/lib/server/mcp-request-context.js.map +0 -1
  291. package/lib/server/mcp-resource-handler.d.ts.map +0 -1
  292. package/lib/server/mcp-resource-handler.js.map +0 -1
  293. package/lib/server/mcp-server-launcher.d.ts +0 -143
  294. package/lib/server/mcp-server-launcher.d.ts.map +0 -1
  295. package/lib/server/mcp-server-launcher.js.map +0 -1
  296. package/lib/server/mcp-session.d.ts.map +0 -1
  297. package/lib/server/mcp-session.js.map +0 -1
  298. package/lib/server/mcp-tool-handler.d.ts.map +0 -1
  299. package/lib/tools/handlers/count-elements-mcp-tool-handler.d.ts.map +0 -1
  300. package/lib/tools/handlers/count-elements-mcp-tool-handler.js.map +0 -1
  301. package/lib/tools/handlers/create-edges-mcp-tool-handler.d.ts.map +0 -1
  302. package/lib/tools/handlers/create-edges-mcp-tool-handler.js.map +0 -1
  303. package/lib/tools/handlers/create-nodes-mcp-tool-handler.d.ts.map +0 -1
  304. package/lib/tools/handlers/create-nodes-mcp-tool-handler.js.map +0 -1
  305. package/lib/tools/handlers/delete-elements-mcp-tool-handler.d.ts.map +0 -1
  306. package/lib/tools/handlers/delete-elements-mcp-tool-handler.js.map +0 -1
  307. package/lib/tools/handlers/diagram-model-mcp-tool-handler.d.ts.map +0 -1
  308. package/lib/tools/handlers/diagram-model-mcp-tool-handler.js.map +0 -1
  309. package/lib/tools/handlers/element-types-mcp-tool-handler.d.ts.map +0 -1
  310. package/lib/tools/handlers/element-types-mcp-tool-handler.js.map +0 -1
  311. package/lib/tools/handlers/get-selection-mcp-tool-handler.d.ts.map +0 -1
  312. package/lib/tools/handlers/get-selection-mcp-tool-handler.js.map +0 -1
  313. package/lib/tools/handlers/layout-mcp-tool-handler.d.ts.map +0 -1
  314. package/lib/tools/handlers/layout-mcp-tool-handler.js.map +0 -1
  315. package/lib/tools/handlers/modify-edges-mcp-tool-handler.d.ts.map +0 -1
  316. package/lib/tools/handlers/modify-edges-mcp-tool-handler.js.map +0 -1
  317. package/lib/tools/handlers/modify-nodes-mcp-tool-handler.d.ts.map +0 -1
  318. package/lib/tools/handlers/modify-nodes-mcp-tool-handler.js.map +0 -1
  319. package/lib/tools/handlers/query-elements-mcp-tool-handler.d.ts.map +0 -1
  320. package/lib/tools/handlers/query-elements-mcp-tool-handler.js.map +0 -1
  321. package/lib/tools/handlers/redo-mcp-tool-handler.d.ts.map +0 -1
  322. package/lib/tools/handlers/redo-mcp-tool-handler.js.map +0 -1
  323. package/lib/tools/handlers/save-model-mcp-tool-handler.d.ts.map +0 -1
  324. package/lib/tools/handlers/save-model-mcp-tool-handler.js.map +0 -1
  325. package/lib/tools/handlers/session-info-mcp-tool-handler.d.ts.map +0 -1
  326. package/lib/tools/handlers/session-info-mcp-tool-handler.js.map +0 -1
  327. package/lib/tools/handlers/set-selection-mcp-tool-handler.d.ts.map +0 -1
  328. package/lib/tools/handlers/set-selection-mcp-tool-handler.js.map +0 -1
  329. package/lib/tools/handlers/set-view-mcp-tool-handler.d.ts.map +0 -1
  330. package/lib/tools/handlers/set-view-mcp-tool-handler.js.map +0 -1
  331. package/lib/tools/handlers/undo-mcp-tool-handler.d.ts.map +0 -1
  332. package/lib/tools/handlers/undo-mcp-tool-handler.js.map +0 -1
  333. package/lib/tools/handlers/validate-diagram-mcp-tool-handler.d.ts.map +0 -1
  334. package/lib/tools/handlers/validate-diagram-mcp-tool-handler.js.map +0 -1
  335. package/lib/util/markdown-util.d.ts.map +0 -1
  336. package/lib/util/markdown-util.js.map +0 -1
  337. package/lib/util/mcp-util.d.ts.map +0 -1
  338. package/lib/util/mcp-util.js.map +0 -1
  339. package/src/server/mcp-http-transport-e2e.spec.ts +0 -151
  340. package/src/server/mcp-http-transport.spec.ts +0 -385
  341. package/src/server/mcp-http-transport.ts +0 -368
  342. package/src/server/mcp-server-launcher.ts +0 -369
  343. /package/lib/{modules → common/modules}/mcp-diagram-module.d.ts +0 -0
  344. /package/lib/{modules → common/modules}/mcp-diagram-module.js +0 -0
  345. /package/lib/{prompts → common/prompts}/handlers/describe-diagram-mcp-prompt-handler.d.ts +0 -0
  346. /package/lib/{prompts → common/prompts}/handlers/describe-diagram-mcp-prompt-handler.js +0 -0
  347. /package/lib/{prompts → common/prompts}/handlers/suggest-improvements-mcp-prompt-handler.d.ts +0 -0
  348. /package/lib/{prompts → common/prompts}/handlers/suggest-improvements-mcp-prompt-handler.js +0 -0
  349. /package/lib/{resources → common/resources}/handlers/diagram-png-mcp-resource-handler.d.ts +0 -0
  350. /package/lib/{resources → common/resources}/handlers/diagram-png-mcp-resource-handler.js +0 -0
  351. /package/lib/{resources → common/resources}/handlers/diagram-svg-mcp-resource-handler.d.ts +0 -0
  352. /package/lib/{resources → common/resources}/handlers/diagram-svg-mcp-resource-handler.js +0 -0
  353. /package/lib/{resources → common/resources}/services/element-types-provider.d.ts +0 -0
  354. /package/lib/{resources → common/resources}/services/element-types-provider.js +0 -0
  355. /package/lib/{resources → common/resources}/services/mcp-model-serializer.d.ts +0 -0
  356. /package/lib/{resources → common/resources}/services/mcp-model-serializer.js +0 -0
  357. /package/lib/{server → common/server}/lru-event-store.js +0 -0
  358. /package/lib/{server → common/server}/mcp-diagram-prompt-handler-registry.d.ts +0 -0
  359. /package/lib/{server → common/server}/mcp-diagram-prompt-handler-registry.js +0 -0
  360. /package/lib/{server → common/server}/mcp-diagram-resource-handler-registry.d.ts +0 -0
  361. /package/lib/{server → common/server}/mcp-diagram-tool-handler-registry.d.ts +0 -0
  362. /package/lib/{server → common/server}/mcp-handler-shared.d.ts +0 -0
  363. /package/lib/{server → common/server}/mcp-handler-shared.js +0 -0
  364. /package/lib/{server → common/server}/mcp-id-alias-service.d.ts +0 -0
  365. /package/lib/{server → common/server}/mcp-id-alias-service.js +0 -0
  366. /package/lib/{server → common/server}/mcp-label-provider.d.ts +0 -0
  367. /package/lib/{server → common/server}/mcp-label-provider.js +0 -0
  368. /package/lib/{server → common/server}/mcp-log-level-registry.js +0 -0
  369. /package/lib/{server → common/server}/mcp-mime-types.d.ts +0 -0
  370. /package/lib/{server → common/server}/mcp-mime-types.js +0 -0
  371. /package/lib/{server → common/server}/mcp-session.d.ts +0 -0
  372. /package/lib/{server → common/server}/mcp-session.js +0 -0
  373. /package/lib/{tools → common/tools}/handlers/count-elements-mcp-tool-handler.d.ts +0 -0
  374. /package/lib/{tools → common/tools}/handlers/count-elements-mcp-tool-handler.js +0 -0
  375. /package/lib/{tools → common/tools}/handlers/diagram-model-mcp-tool-handler.d.ts +0 -0
  376. /package/lib/{tools → common/tools}/handlers/diagram-model-mcp-tool-handler.js +0 -0
  377. /package/lib/{tools → common/tools}/handlers/element-types-mcp-tool-handler.d.ts +0 -0
  378. /package/lib/{tools → common/tools}/handlers/element-types-mcp-tool-handler.js +0 -0
  379. /package/lib/{tools → common/tools}/handlers/get-selection-mcp-tool-handler.d.ts +0 -0
  380. /package/lib/{tools → common/tools}/handlers/get-selection-mcp-tool-handler.js +0 -0
  381. /package/lib/{tools → common/tools}/handlers/modify-edges-mcp-tool-handler.d.ts +0 -0
  382. /package/lib/{tools → common/tools}/handlers/modify-nodes-mcp-tool-handler.d.ts +0 -0
  383. /package/lib/{tools → common/tools}/handlers/query-elements-mcp-tool-handler.d.ts +0 -0
  384. /package/lib/{tools → common/tools}/handlers/query-elements-mcp-tool-handler.js +0 -0
  385. /package/lib/{tools → common/tools}/handlers/redo-mcp-tool-handler.d.ts +0 -0
  386. /package/lib/{tools → common/tools}/handlers/redo-mcp-tool-handler.js +0 -0
  387. /package/lib/{tools → common/tools}/handlers/save-model-mcp-tool-handler.d.ts +0 -0
  388. /package/lib/{tools → common/tools}/handlers/save-model-mcp-tool-handler.js +0 -0
  389. /package/lib/{tools → common/tools}/handlers/session-info-mcp-tool-handler.d.ts +0 -0
  390. /package/lib/{tools → common/tools}/handlers/session-info-mcp-tool-handler.js +0 -0
  391. /package/lib/{tools → common/tools}/handlers/set-selection-mcp-tool-handler.d.ts +0 -0
  392. /package/lib/{tools → common/tools}/handlers/set-selection-mcp-tool-handler.js +0 -0
  393. /package/lib/{tools → common/tools}/handlers/set-view-mcp-tool-handler.d.ts +0 -0
  394. /package/lib/{tools → common/tools}/handlers/set-view-mcp-tool-handler.js +0 -0
  395. /package/lib/{tools → common/tools}/handlers/undo-mcp-tool-handler.d.ts +0 -0
  396. /package/lib/{tools → common/tools}/handlers/undo-mcp-tool-handler.js +0 -0
  397. /package/lib/{tools → common/tools}/handlers/validate-diagram-mcp-tool-handler.d.ts +0 -0
  398. /package/lib/{tools → common/tools}/handlers/validate-diagram-mcp-tool-handler.js +0 -0
  399. /package/lib/{util → common/util}/markdown-util.d.ts +0 -0
  400. /package/lib/{util → common/util}/markdown-util.js +0 -0
  401. /package/lib/{util → common/util}/mcp-util.d.ts +0 -0
  402. /package/lib/{util → common/util}/mcp-util.js +0 -0
  403. /package/src/{modules → common/modules}/mcp-diagram-module.ts +0 -0
  404. /package/src/{prompts → common/prompts}/handlers/describe-diagram-mcp-prompt-handler.ts +0 -0
  405. /package/src/{prompts → common/prompts}/handlers/suggest-improvements-mcp-prompt-handler.ts +0 -0
  406. /package/src/{resources → common/resources}/handlers/diagram-png-mcp-resource-handler.ts +0 -0
  407. /package/src/{resources → common/resources}/handlers/diagram-svg-mcp-resource-handler.ts +0 -0
  408. /package/src/{resources → common/resources}/services/element-types-provider.ts +0 -0
  409. /package/src/{resources → common/resources}/services/mcp-model-serializer.ts +0 -0
  410. /package/src/{server → common/server}/glsp-mcp-server.spec.ts +0 -0
  411. /package/src/{server → common/server}/lru-event-store.spec.ts +0 -0
  412. /package/src/{server → common/server}/mcp-diagram-handler-dispatcher.spec.ts +0 -0
  413. /package/src/{server → common/server}/mcp-diagram-prompt-handler-registry.ts +0 -0
  414. /package/src/{server → common/server}/mcp-handler-shared.spec.ts +0 -0
  415. /package/src/{server → common/server}/mcp-handler-shared.ts +0 -0
  416. /package/src/{server → common/server}/mcp-id-alias-service.spec.ts +0 -0
  417. /package/src/{server → common/server}/mcp-id-alias-service.ts +0 -0
  418. /package/src/{server → common/server}/mcp-label-provider.ts +0 -0
  419. /package/src/{server → common/server}/mcp-log-level-registry.spec.ts +0 -0
  420. /package/src/{server → common/server}/mcp-mime-types.ts +0 -0
  421. /package/src/{server → common/server}/mcp-session.ts +0 -0
  422. /package/src/{tools → common/tools}/handlers/count-elements-mcp-tool-handler.spec.ts +0 -0
  423. /package/src/{tools → common/tools}/handlers/count-elements-mcp-tool-handler.ts +0 -0
  424. /package/src/{tools → common/tools}/handlers/create-edges-mcp-tool-handler.spec.ts +0 -0
  425. /package/src/{tools → common/tools}/handlers/create-nodes-mcp-tool-handler.spec.ts +0 -0
  426. /package/src/{tools → common/tools}/handlers/diagram-model-mcp-tool-handler.ts +0 -0
  427. /package/src/{tools → common/tools}/handlers/element-types-mcp-tool-handler.ts +0 -0
  428. /package/src/{tools → common/tools}/handlers/get-selection-mcp-tool-handler.ts +0 -0
  429. /package/src/{tools → common/tools}/handlers/query-elements-mcp-tool-handler.spec.ts +0 -0
  430. /package/src/{tools → common/tools}/handlers/query-elements-mcp-tool-handler.ts +0 -0
  431. /package/src/{tools → common/tools}/handlers/redo-mcp-tool-handler.ts +0 -0
  432. /package/src/{tools → common/tools}/handlers/save-model-mcp-tool-handler.ts +0 -0
  433. /package/src/{tools → common/tools}/handlers/session-info-mcp-tool-handler.spec.ts +0 -0
  434. /package/src/{tools → common/tools}/handlers/session-info-mcp-tool-handler.ts +0 -0
  435. /package/src/{tools → common/tools}/handlers/set-selection-mcp-tool-handler.spec.ts +0 -0
  436. /package/src/{tools → common/tools}/handlers/set-selection-mcp-tool-handler.ts +0 -0
  437. /package/src/{tools → common/tools}/handlers/set-view-mcp-tool-handler.ts +0 -0
  438. /package/src/{tools → common/tools}/handlers/undo-mcp-tool-handler.ts +0 -0
  439. /package/src/{tools → common/tools}/handlers/validate-diagram-mcp-tool-handler.ts +0 -0
  440. /package/src/{tools → common/tools}/tool-annotations.spec.ts +0 -0
  441. /package/src/{util → common/util}/markdown-util.ts +0 -0
  442. /package/src/{util → common/util}/mcp-util.ts +0 -0
  443. /package/src/{server → node/server}/raw-http.spec.ts +0 -0
@@ -0,0 +1,524 @@
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
+ import { McpServerOptions as McpServerOptionsType } from '@eclipse-glsp/protocol';
18
+ import {
19
+ ClientSessionListener,
20
+ ClientSessionManager,
21
+ Disposable,
22
+ DisposableCollection,
23
+ Emitter,
24
+ GLSPServer,
25
+ GLSPServerInitializer,
26
+ GLSPServerListener,
27
+ InitializeParameters,
28
+ InitializeResult,
29
+ Logger,
30
+ McpInitializeParameters,
31
+ McpInitializeResult,
32
+ McpServerConfiguration,
33
+ McpServerInitOptions
34
+ } from '@eclipse-glsp/server';
35
+ import { AuthInfo } from '@modelcontextprotocol/sdk/server/auth/types.js';
36
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
37
+ import { WebStandardStreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js';
38
+ import {
39
+ ServerCapabilities,
40
+ SUPPORTED_PROTOCOL_VERSIONS,
41
+ SetLevelRequestSchema,
42
+ isInitializeRequest
43
+ } from '@modelcontextprotocol/sdk/types.js';
44
+ import { inject, injectable, multiInject, optional } from 'inversify';
45
+ import { version as packageVersion } from '../../../package.json';
46
+ import { GLSPMcpServer, GLSPMcpServerFactory } from './glsp-mcp-server';
47
+ import { LruEventStore } from './lru-event-store';
48
+ import { McpDiagramHandlerDispatcher } from './mcp-diagram-handler-dispatcher';
49
+ import { McpLogLevelRegistry } from './mcp-log-level-registry';
50
+ import { McpServerDefaults, McpServerOptions } from './mcp-options';
51
+ import { McpPromptHandler } from './mcp-prompt-handler';
52
+ import { McpResourceHandler } from './mcp-resource-handler';
53
+ import { McpSession, McpSessionId, WithSessionId } from './mcp-session';
54
+ import { McpToolHandler } from './mcp-tool-handler';
55
+
56
+ /**
57
+ * Server version reported in MCP `initialize` handshake responses (the SDK's `serverInfo.version`
58
+ * field). Sourced from the package's own `package.json` so adopters and clients can tell builds
59
+ * apart without the server author having to remember to bump a literal.
60
+ */
61
+ export const SERVER_VERSION: string = packageVersion;
62
+
63
+ /**
64
+ * Launcher's internal handoff shape: everything from the public {@link McpServerConfiguration}
65
+ * with all fields resolved, plus `host`. `host` is deliberately *not* in the public protocol's
66
+ * init schema — it lives on `McpServerDeployOptions` (deploy-only) rather than
67
+ * `McpServerInitOptions` (init-controllable). The launcher reads it from the adopter-supplied
68
+ * defaults via `McpServerOptions.values.host`.
69
+ */
70
+ export type FullMcpServerConfiguration = Omit<Required<McpServerConfiguration>, 'options'> & {
71
+ host: string;
72
+ options: McpServerOptionsType;
73
+ };
74
+
75
+ /**
76
+ * Where this launcher's transport can be reached. Node binders populate `url` (loopback HTTP
77
+ * announcement). The web binder returns `{}` because the adopter wires the handler into its
78
+ * own listener and may not have a routable URL.
79
+ */
80
+ export interface TransportEndpoint {
81
+ url?: string;
82
+ headers?: Record<string, string>;
83
+ }
84
+
85
+ /**
86
+ * Per-call options accepted by {@link AbstractMcpServerLauncher.handleRequest}. Adopters wrap
87
+ * their own auth middleware around the handler and forward parsed bearer/JWT/etc. info here.
88
+ */
89
+ export interface McpRequestHandlerOptions {
90
+ /** Authenticated principal info — passed through to the SDK so tool handlers can read it via `extra.authInfo`. */
91
+ authInfo?: AuthInfo;
92
+ }
93
+
94
+ /**
95
+ * Defense-in-depth filter for the init-side options payload. The static type already rules out
96
+ * deploy-only fields (`host`, `allowedHosts`, `allowedOrigins`, `acknowledgedNoAuth`) on
97
+ * `McpServerConfiguration.options`, but the wire payload is JSON, so a malformed or malicious
98
+ * client could smuggle extra keys. Destructure-based pick drops anything outside the allowed set
99
+ * so deploy-only fields are sourced *only* from adopter defaults.
100
+ *
101
+ * **Update this allowlist when adding a field to `McpServerInitOptions`** — the destructure
102
+ * below is the single source of truth for which init-side fields cross the wire.
103
+ *
104
+ * Exported for regression-test access only; not part of the public package surface.
105
+ */
106
+ export function pickInitOptions(options: McpServerInitOptions): McpServerInitOptions {
107
+ const { dataMode, agentPersona, eventStoreLimit } = options;
108
+ const picked: McpServerInitOptions = {};
109
+ if (dataMode !== undefined) picked.dataMode = dataMode;
110
+ if (agentPersona !== undefined) picked.agentPersona = agentPersona;
111
+ if (eventStoreLimit !== undefined) picked.eventStoreLimit = eventStoreLimit;
112
+ return picked;
113
+ }
114
+
115
+ /**
116
+ * JSON-RPC 2.0 § 5 mandates `null` for error responses where the request id cannot be determined
117
+ * (e.g., parse errors, batch-level rejection, missing session id). Centralized so the unavoidable
118
+ * `null` literal lives behind one eslint exception instead of many.
119
+ */
120
+ // eslint-disable-next-line no-null/no-null
121
+ const JSON_RPC_NULL_ID = null;
122
+
123
+ /**
124
+ * Portable, target-neutral MCP server launcher. Owns the per-MCP-session
125
+ * {@link WebStandardStreamableHTTPServerTransport} map, the per-session {@link GLSPMcpServer}
126
+ * registry, handler registration, and the Fetch-shaped `(Request) => Promise<Response>` entry
127
+ * point. Concrete subclasses bind a listener (or no listener) in {@link bindTransport}.
128
+ *
129
+ * **Session state is single-process and in-memory.** Multi-isolate/Durable-Objects adopters
130
+ * need to override the session storage hook in a follow-up.
131
+ *
132
+ * **Authentication** is the adopter's responsibility on non-Node targets — wrap the handler
133
+ * with whatever middleware the deployment requires (bearer, mTLS at proxy, Cloudflare Access,
134
+ * etc.). Node binders run the {@link assertLoopbackOrAcknowledged} guard since they bind the
135
+ * socket themselves.
136
+ */
137
+ @injectable()
138
+ export abstract class AbstractMcpServerLauncher implements GLSPServerInitializer, GLSPServerListener, Disposable {
139
+ @inject(Logger) protected logger: Logger;
140
+
141
+ @inject(McpServerOptions) protected mcpOptions: McpServerOptions;
142
+
143
+ @inject(McpServerDefaults) protected mcpDefaults: McpServerDefaults;
144
+
145
+ @inject(GLSPMcpServerFactory) protected glspMcpServerFactory: GLSPMcpServerFactory;
146
+
147
+ @inject(McpDiagramHandlerDispatcher) protected dispatcher: McpDiagramHandlerDispatcher;
148
+
149
+ @inject(McpLogLevelRegistry) protected logLevelRegistry: McpLogLevelRegistry;
150
+
151
+ @inject(ClientSessionManager) protected clientSessionManager: ClientSessionManager;
152
+
153
+ @multiInject(McpToolHandler) @optional() protected toolHandlers: McpToolHandler[] = [];
154
+
155
+ @multiInject(McpResourceHandler) @optional() protected resourceHandlers: McpResourceHandler[] = [];
156
+
157
+ @multiInject(McpPromptHandler) @optional() protected promptHandlers: McpPromptHandler[] = [];
158
+
159
+ protected toDispose = new DisposableCollection();
160
+ protected serverUrl: string | undefined;
161
+ protected serverConfig: FullMcpServerConfiguration | undefined;
162
+
163
+ /** Per-MCP-session transport — populated on session-init, cleared on session-close. */
164
+ protected readonly sessions = new Map<string, WebStandardStreamableHTTPServerTransport>();
165
+
166
+ /** Per-MCP-session GLSPMcpServer registry — populated on session-init, cleared on session-close. */
167
+ protected readonly sessionServers = new Map<string, GLSPMcpServer>();
168
+
169
+ protected onSessionInitializedEmitter = new Emitter<McpSession>();
170
+ readonly onSessionInitialized = this.onSessionInitializedEmitter.event;
171
+ protected onSessionClosedEmitter = new Emitter<McpSessionId>();
172
+ readonly onSessionClosed = this.onSessionClosedEmitter.event;
173
+
174
+ async initializeServer(server: GLSPServer, params: InitializeParameters, result: InitializeResult): Promise<InitializeResult> {
175
+ const mcpServerParam = McpInitializeParameters.getServerConfig(params);
176
+ if (!mcpServerParam) {
177
+ return result;
178
+ }
179
+
180
+ // Idempotent: subsequent client sessions of the same GLSP server reuse the existing
181
+ // MCP server. Only the first call binds the listener.
182
+ if (this.serverConfig) {
183
+ if (this.serverUrl) {
184
+ return McpInitializeResult.attachServer(result, { name: this.serverConfig.name, url: this.serverUrl });
185
+ }
186
+ return result;
187
+ }
188
+
189
+ const { port = 0, route = '/mcp', name = 'glsp', options = {} } = mcpServerParam;
190
+ const mergedOptions = { ...this.mcpDefaults, ...pickInitOptions(options) };
191
+ this.mcpOptions.values = mergedOptions;
192
+ const host = mergedOptions.host ?? '127.0.0.1';
193
+ const mcpServerConfig: FullMcpServerConfiguration = { port, host, route, name, options: mergedOptions };
194
+
195
+ this.dispatcher.harvest();
196
+ this.installResourceListChangedNotifier();
197
+
198
+ const endpoint = await this.bindTransport(mcpServerConfig);
199
+ this.serverConfig = mcpServerConfig;
200
+ this.serverUrl = endpoint.url;
201
+ this.logger.info(
202
+ `MCP server '${mcpServerConfig.name}' is ready to accept new client requests on: ${this.serverUrl ?? '(no network endpoint)'}`
203
+ );
204
+
205
+ if (endpoint.url) {
206
+ return McpInitializeResult.attachServer(result, {
207
+ name: mcpServerConfig.name,
208
+ url: endpoint.url,
209
+ headers: endpoint.headers
210
+ });
211
+ }
212
+ return result;
213
+ }
214
+
215
+ serverShutDown(_server: GLSPServer): void {
216
+ this.dispose();
217
+ }
218
+
219
+ dispose(): void {
220
+ // Close transports first so in-flight SSE responses are signalled cleanly. The HTTP
221
+ // listener (registered on `toDispose`) is torn down only after the transport closes
222
+ // settle — closing it earlier would cut the SSE socket mid-flush.
223
+ const closing = Array.from(this.sessions.values()).map(transport =>
224
+ transport.close().catch(err => this.logger.warn(`Error closing MCP session ${transport.sessionId}: ${err}`))
225
+ );
226
+ this.sessions.clear();
227
+ this.sessionServers.forEach(glspMcpServer => glspMcpServer.dispose());
228
+ this.sessionServers.clear();
229
+ Promise.allSettled(closing).then(() => {
230
+ this.toDispose.dispose();
231
+ this.toDispose.clear();
232
+ });
233
+ this.serverUrl = undefined;
234
+ this.serverConfig = undefined;
235
+ this.dispatcher.reset();
236
+ }
237
+
238
+ /**
239
+ * Fetch-shaped request entry point. Dispatches POST/GET/DELETE against `config.route`,
240
+ * routing to the right per-session SDK transport. Validates the `MCP-Protocol-Version`
241
+ * header and the spec-mandated session-id rules before handing off to the SDK.
242
+ */
243
+ async handleRequest(req: Request, options?: McpRequestHandlerOptions): Promise<Response> {
244
+ const url = new URL(req.url);
245
+ const route = this.serverConfig?.route ?? '/mcp';
246
+ if (url.pathname !== route) {
247
+ return new Response('Not Found', { status: 404 });
248
+ }
249
+ if (req.method !== 'POST' && req.method !== 'GET' && req.method !== 'DELETE') {
250
+ return new Response('Method Not Allowed', { status: 405, headers: { Allow: 'POST, GET, DELETE' } });
251
+ }
252
+ const hostError = this.validateHostHeader(req);
253
+ if (hostError) {
254
+ return hostError;
255
+ }
256
+
257
+ let parsedBody: unknown | undefined;
258
+ if (req.method === 'POST') {
259
+ // `req.clone()` is mandatory: the body stream can only be read once; the SDK reads the original.
260
+ parsedBody = await req
261
+ .clone()
262
+ .json()
263
+ .catch(() => undefined);
264
+ }
265
+
266
+ const isInit = req.method === 'POST' && isInitializeRequest(parsedBody);
267
+ const versionError = this.validateProtocolVersionHeader(req, isInit);
268
+ if (versionError) {
269
+ return versionError;
270
+ }
271
+
272
+ const transport = this.resolveTransport(req, isInit);
273
+ if (transport instanceof Response) {
274
+ return transport;
275
+ }
276
+ try {
277
+ return await transport.handleRequest(req, { parsedBody, authInfo: options?.authInfo });
278
+ } catch (err: unknown) {
279
+ const message = err instanceof Error ? err.message : String(err);
280
+ this.logger.error('Error handling MCP request:', err);
281
+ return this.jsonRpcErrorResponse(500, -32603, `Internal server error: ${message}`);
282
+ }
283
+ }
284
+
285
+ /** Bound `(req) => Promise<Response>` for adopters plugging the handler into any Fetch-shaped listener. */
286
+ getRequestHandler(): (req: Request, options?: McpRequestHandlerOptions) => Promise<Response> {
287
+ return (req, options) => this.handleRequest(req, options);
288
+ }
289
+
290
+ /** Concrete subclasses bind their transport (or no-op for runtimes where the adopter owns the listener). */
291
+ protected abstract bindTransport(config: FullMcpServerConfiguration): Promise<TransportEndpoint>;
292
+
293
+ /**
294
+ * Resolve the right transport for an incoming request. Returns a {@link Response} for the
295
+ * spec-mandated 400/404 rejections so the caller can early-return.
296
+ */
297
+ protected resolveTransport(req: Request, isInit: boolean): WebStandardStreamableHTTPServerTransport | Response {
298
+ const sessionId = req.headers.get('mcp-session-id') ?? undefined;
299
+ if (isInit && !sessionId) {
300
+ return this.createTransport();
301
+ }
302
+ if (!sessionId) {
303
+ // MCP Streamable HTTP § Session Management #2: non-initialize request without session id → 400.
304
+ return this.jsonRpcErrorResponse(400, -32000, 'Bad Request: No valid session ID provided');
305
+ }
306
+ const existing = this.sessions.get(sessionId);
307
+ if (!existing) {
308
+ // § Session Management #3: unknown or terminated session id → 404.
309
+ return this.jsonRpcErrorResponse(404, -32001, 'Session not found');
310
+ }
311
+ return existing;
312
+ }
313
+
314
+ /**
315
+ * Validate the `MCP-Protocol-Version` header per the Streamable HTTP transport spec.
316
+ * Initialize POSTs negotiate the version in the body — the header isn't expected there.
317
+ * For every other request: absent → pass through (server defaults to `2025-03-26`);
318
+ * present-but-unsupported → respond `400` with a JSON-RPC error envelope.
319
+ */
320
+ protected validateProtocolVersionHeader(req: Request, isInit: boolean): Response | undefined {
321
+ if (isInit) {
322
+ return undefined;
323
+ }
324
+ const version = req.headers.get('mcp-protocol-version') ?? undefined;
325
+ if (version === undefined) {
326
+ return undefined;
327
+ }
328
+ if (!SUPPORTED_PROTOCOL_VERSIONS.includes(version)) {
329
+ return this.jsonRpcErrorResponse(
330
+ 400,
331
+ -32000,
332
+ `Unsupported MCP-Protocol-Version: '${version}'. Supported versions: ${SUPPORTED_PROTOCOL_VERSIONS.join(', ')}.`
333
+ );
334
+ }
335
+ return undefined;
336
+ }
337
+
338
+ /** Port-agnostic Host validation — `WebStandardStreamableHTTPServerTransport` does exact-string match incl. port. */
339
+ protected validateHostHeader(req: Request): Response | undefined {
340
+ const allowedHosts = this.mcpOptions.values.allowedHosts;
341
+ if (!allowedHosts || allowedHosts.length === 0) {
342
+ return undefined;
343
+ }
344
+ const hostHeader = req.headers.get('host');
345
+ if (!hostHeader) {
346
+ return this.jsonRpcErrorResponse(403, -32000, 'Missing Host header');
347
+ }
348
+ let hostname: string;
349
+ try {
350
+ hostname = new URL(`http://${hostHeader}`).hostname;
351
+ } catch {
352
+ return this.jsonRpcErrorResponse(403, -32000, `Invalid Host header: ${hostHeader}`);
353
+ }
354
+ if (!allowedHosts.includes(hostname)) {
355
+ return this.jsonRpcErrorResponse(403, -32000, `Invalid Host: ${hostname}`);
356
+ }
357
+ return undefined;
358
+ }
359
+
360
+ protected createTransport(): WebStandardStreamableHTTPServerTransport {
361
+ const allowedOrigins = this.mcpOptions.values.allowedOrigins;
362
+ const transport = new WebStandardStreamableHTTPServerTransport({
363
+ // `globalThis.crypto` is available on Node 18+, Bun, Deno, Cloudflare Workers, browsers.
364
+ // Avoid `node:crypto` so this file compiles cleanly into a browser bundle.
365
+ sessionIdGenerator: () => globalThis.crypto.randomUUID(),
366
+ eventStore: new LruEventStore(this.mcpOptions.values.eventStoreLimit, this.logger),
367
+ // Host validation lives on `validateHostHeader`.
368
+ allowedOrigins,
369
+ enableDnsRebindingProtection: (allowedOrigins?.length ?? 0) > 0,
370
+ onsessioninitialized: sessionId => {
371
+ this.logger.info(`MCP session initialized with ID: ${sessionId}`);
372
+ this.sessions.set(sessionId, transport);
373
+ if (this.serverConfig) {
374
+ this.attachServerToSession(transport, this.serverConfig);
375
+ }
376
+ this.onSessionInitializedEmitter.fire(transport as WithSessionId<WebStandardStreamableHTTPServerTransport>);
377
+ },
378
+ onsessionclosed: sessionId => this.closeSession(sessionId)
379
+ });
380
+ transport.onclose = () => this.closeSession(transport.sessionId);
381
+ transport.onerror = err => this.logger.error(`MCP transport error (session ${transport.sessionId ?? '<pre-init>'}):`, err);
382
+ return transport;
383
+ }
384
+
385
+ protected attachServerToSession(transport: WebStandardStreamableHTTPServerTransport, config: FullMcpServerConfiguration): void {
386
+ const sessionId = transport.sessionId;
387
+ if (!sessionId) {
388
+ return;
389
+ }
390
+ const glspMcpServer = this.createGlspMcpServer(config);
391
+ this.sessionServers.set(sessionId, glspMcpServer);
392
+ this.registerLogLevelHandler(glspMcpServer, sessionId);
393
+ glspMcpServer.connect(transport as McpSession);
394
+ }
395
+
396
+ protected closeSession(sessionId: string | undefined): void {
397
+ if (!sessionId) {
398
+ return;
399
+ }
400
+ const existed = this.sessions.delete(sessionId);
401
+ const glspMcpServer = this.sessionServers.get(sessionId);
402
+ if (glspMcpServer) {
403
+ this.sessionServers.delete(sessionId);
404
+ this.logLevelRegistry.clear(sessionId);
405
+ glspMcpServer.dispose();
406
+ }
407
+ if (existed) {
408
+ this.logger.info(`MCP session closed: ${sessionId}`);
409
+ this.onSessionClosedEmitter.fire(sessionId);
410
+ }
411
+ }
412
+
413
+ /**
414
+ * Fire `notifications/resources/list_changed` to every connected MCP client when a GLSP
415
+ * session opens or closes — diagram-scope resources aggregate across GLSP sessions, so the
416
+ * visible list mutates with that lifecycle. No-op when no diagram-scope resources are bound.
417
+ */
418
+ protected installResourceListChangedNotifier(): void {
419
+ if (!this.dispatcher.hasDiagramResources()) {
420
+ return;
421
+ }
422
+ const listener: ClientSessionListener = {
423
+ sessionCreated: () => this.broadcastResourceListChanged(),
424
+ sessionDisposed: () => this.broadcastResourceListChanged()
425
+ };
426
+ this.clientSessionManager.addListener(listener);
427
+ this.toDispose.push(Disposable.create(() => this.clientSessionManager.removeListener(listener)));
428
+ }
429
+
430
+ /** Best-effort fan-out — failures on individual MCP sessions (e.g. transport mid-close) are swallowed. */
431
+ protected broadcastResourceListChanged(): void {
432
+ for (const glspMcpServer of this.sessionServers.values()) {
433
+ glspMcpServer
434
+ .getRawServer()
435
+ .server.sendResourceListChanged()
436
+ .catch(err => this.logger.debug('sendResourceListChanged failed:', err));
437
+ }
438
+ }
439
+
440
+ /** Register `logging/setLevel` so a connected MCP client can adjust its message severity threshold. */
441
+ protected registerLogLevelHandler(glspMcpServer: GLSPMcpServer, sessionId: string): void {
442
+ glspMcpServer.getRawServer().server.setRequestHandler(SetLevelRequestSchema, async request => {
443
+ this.logLevelRegistry.setLevel(sessionId, request.params.level);
444
+ return {};
445
+ });
446
+ }
447
+
448
+ protected createGlspMcpServer({ name, options }: FullMcpServerConfiguration): GLSPMcpServer {
449
+ const resourcesAsResources = options.dataMode === 'resources';
450
+ const server = new McpServer(
451
+ { name, version: SERVER_VERSION },
452
+ {
453
+ capabilities: this.buildCapabilities(resourcesAsResources),
454
+ instructions: options.agentPersona
455
+ }
456
+ );
457
+ const glspMcpServer = this.glspMcpServerFactory(server, options);
458
+ this.registerHandlers(glspMcpServer, resourcesAsResources);
459
+ return glspMcpServer;
460
+ }
461
+
462
+ /**
463
+ * Build the MCP capabilities map from what is actually bound. Only declare a key when at
464
+ * least one handler contributes — declaring a capability the SDK never registers a handler
465
+ * for produces `-32601 Method not found` on `<cap>/list`. Resources surfaced as tools
466
+ * (`dataMode === 'tools'`) count toward `tools`, not `resources`.
467
+ */
468
+ protected buildCapabilities(resourcesAsResources: boolean): ServerCapabilities {
469
+ const hasStaticTools = this.toolHandlers.length > 0;
470
+ const hasStaticPrompts = this.promptHandlers.length > 0;
471
+ const hasStaticResources = this.resourceHandlers.length > 0;
472
+ const hasDiagramTools = this.dispatcher.hasDiagramTools();
473
+ const hasDiagramPrompts = this.dispatcher.hasDiagramPrompts();
474
+ const hasDiagramResources = this.dispatcher.hasDiagramResources();
475
+ const anyResources = hasStaticResources || hasDiagramResources;
476
+
477
+ const hasTools = hasStaticTools || hasDiagramTools || (!resourcesAsResources && anyResources);
478
+ const hasPrompts = hasStaticPrompts || hasDiagramPrompts;
479
+ const hasResources = resourcesAsResources && anyResources;
480
+
481
+ return {
482
+ logging: {},
483
+ ...(hasTools ? { tools: { listChanged: false } } : {}),
484
+ ...(hasResources ? { resources: { listChanged: hasDiagramResources } } : {}),
485
+ ...(hasPrompts ? { prompts: { listChanged: false } } : {})
486
+ };
487
+ }
488
+
489
+ protected registerHandlers(glspMcpServer: GLSPMcpServer, resourcesAsResources: boolean): void {
490
+ this.toolHandlers.forEach(handler => handler.registerTool(glspMcpServer));
491
+ this.promptHandlers.forEach(handler => handler.registerPrompt(glspMcpServer));
492
+ if (resourcesAsResources) {
493
+ this.resourceHandlers.forEach(handler => handler.registerResource(glspMcpServer));
494
+ } else {
495
+ this.resourceHandlers.forEach(handler => handler.registerToolAlternative?.(glspMcpServer));
496
+ }
497
+
498
+ this.dispatcher.registerAll(glspMcpServer, resourcesAsResources);
499
+ this.validatePromptToolReferences(glspMcpServer);
500
+ }
501
+
502
+ /**
503
+ * Warn when a server-scope prompt references a tool that isn't registered on this MCP session
504
+ * — catches adopters who unbind a tool a shipped prompt mentions via `${OtherHandler.NAME}`.
505
+ */
506
+ protected validatePromptToolReferences(glspMcpServer: GLSPMcpServer): void {
507
+ for (const handler of this.promptHandlers) {
508
+ const missing = handler.referencedToolNames().filter(name => !glspMcpServer.hasTool(name));
509
+ if (missing.length > 0) {
510
+ this.logger.warn(
511
+ `Prompt '${handler.name}' references unbound tool(s): ${missing.join(', ')}. ` +
512
+ 'The prompt will still register but its text points at tools the LLM cannot invoke.'
513
+ );
514
+ }
515
+ }
516
+ }
517
+
518
+ protected jsonRpcErrorResponse(status: number, code: number, message: string): Response {
519
+ return new Response(JSON.stringify({ jsonrpc: '2.0', error: { code, message }, id: JSON_RPC_NULL_ID }), {
520
+ status,
521
+ headers: { 'Content-Type': 'application/json' }
522
+ });
523
+ }
524
+ }
@@ -90,7 +90,7 @@ export class DefaultGLSPMcpServer implements GLSPMcpServer {
90
90
  protected readonly tools = new Map<string, RegisteredTool>();
91
91
  protected readonly resources = new Map<string, GLSPMcpResource>();
92
92
  protected readonly prompts = new Map<string, RegisteredPrompt>();
93
- protected keepAliveTimer?: NodeJS.Timeout;
93
+ protected keepAliveTimer?: ReturnType<typeof setInterval>;
94
94
 
95
95
  readonly registerTool: McpServer['registerTool'];
96
96
  readonly registerResource: McpServer['registerResource'];
@@ -152,7 +152,12 @@ export class DefaultGLSPMcpServer implements GLSPMcpServer {
152
152
  }),
153
153
  KEEP_ALIVE_INTERVAL_MS
154
154
  );
155
- this.keepAliveTimer.unref();
155
+ // `unref` lives on Node's Timeout but not on the browser's numeric handle; guard so the
156
+ // call is a no-op when the runtime doesn't ship it.
157
+ const maybeUnref = (this.keepAliveTimer as unknown as { unref?: () => void }).unref;
158
+ if (typeof maybeUnref === 'function') {
159
+ maybeUnref.call(this.keepAliveTimer);
160
+ }
156
161
  }
157
162
 
158
163
  isConnected(): boolean {
@@ -15,7 +15,7 @@
15
15
  ********************************************************************************/
16
16
 
17
17
  import { Logger } from '@eclipse-glsp/server';
18
- import { EventId, EventStore, StreamId } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
18
+ import type { EventId, EventStore, StreamId } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
19
19
  import { JSONRPCMessage } from '@modelcontextprotocol/sdk/types.js';
20
20
 
21
21
  /**
@@ -25,7 +25,7 @@ import {
25
25
  import { CompleteResourceTemplateCallback, ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js';
26
26
  import { Variables } from '@modelcontextprotocol/sdk/shared/uriTemplate.js';
27
27
  import { CallToolResult, GetPromptResult, ListResourcesResult, ReadResourceResult } from '@modelcontextprotocol/sdk/types.js';
28
- import { Container, ContainerModule, inject, injectable, interfaces } from 'inversify';
28
+ import { Container, ContainerModule, inject, injectable, interfaces, optional } from 'inversify';
29
29
  import { GLSPMcpServer } from './glsp-mcp-server';
30
30
  import { McpDiagramPromptHandlerRegistry } from './mcp-diagram-prompt-handler-registry';
31
31
  import { McpDiagramResourceHandlerRegistry } from './mcp-diagram-resource-handler-registry';
@@ -33,7 +33,7 @@ import { McpDiagramToolHandlerRegistry } from './mcp-diagram-tool-handler-regist
33
33
  import { McpMissingParamError, McpSessionNotFoundError, McpToolError, runWithToolErrorEnvelope } from './mcp-handler-shared';
34
34
  import { McpDiagramScopedInput } from './mcp-input-schemas';
35
35
  import { AbstractMcpDiagramPromptHandler, McpDiagramPromptHandlerConstructor } from './mcp-prompt-handler';
36
- import { mcpRequestContext } from './mcp-request-context';
36
+ import { McpRequestContext, NoopMcpRequestContext } from './mcp-request-context';
37
37
  import { AbstractMcpDiagramResourceHandler, McpDiagramResourceHandlerConstructor, toParams } from './mcp-resource-handler';
38
38
  import { BaseMcpDiagramToolHandler, McpDiagramToolHandlerConstructor } from './mcp-tool-handler';
39
39
 
@@ -53,7 +53,7 @@ export interface DiagramTypeCatalog {
53
53
 
54
54
  /**
55
55
  * Owns diagram-scope handler discovery, SDK registration, and per-MCP-call dispatch routing.
56
- * Extracted from {@link McpServerLauncher} so adopters can `rebind(McpDiagramHandlerDispatcher)`
56
+ * Extracted from {@link AbstractMcpServerLauncher} so adopters can `rebind(McpDiagramHandlerDispatcher)`
57
57
  * to a custom implementation without subclassing the entire launcher lifecycle.
58
58
  *
59
59
  * Responsibilities:
@@ -84,6 +84,10 @@ export const McpDiagramHandlerDispatcher = Symbol('McpDiagramHandlerDispatcher')
84
84
 
85
85
  @injectable()
86
86
  export class DefaultMcpDiagramHandlerDispatcher implements McpDiagramHandlerDispatcher {
87
+ @inject(McpRequestContext)
88
+ @optional()
89
+ protected requestContext: McpRequestContext = new NoopMcpRequestContext();
90
+
87
91
  @inject(InjectionContainer) protected serverContainer: Container;
88
92
  @inject(DiagramModules) protected diagramModules: Map<string, ContainerModule[]>;
89
93
  @inject(ClientSessionManager) protected clientSessionManager: ClientSessionManager;
@@ -181,7 +185,7 @@ export class DefaultMcpDiagramHandlerDispatcher implements McpDiagramHandlerDisp
181
185
  }
182
186
  seen.set(probe.name, fingerprint);
183
187
  glspMcpServer.registerTool(probe.name, probe.toRegistrationConfig(), (params, extra) =>
184
- mcpRequestContext.run(extra, () => this.dispatchDiagramTool(probe.name, params))
188
+ this.requestContext.run(extra, () => this.dispatchDiagramTool(probe.name, params))
185
189
  );
186
190
  }
187
191
  }
@@ -220,12 +224,12 @@ export class DefaultMcpDiagramHandlerDispatcher implements McpDiagramHandlerDisp
220
224
  if (typeof probe.uri === 'string') {
221
225
  const uri = probe.uri;
222
226
  glspMcpServer.registerResource(name, uri, config, (_uri, extra) =>
223
- mcpRequestContext.run(extra, () => this.dispatchStaticDiagramRead(name, uri))
227
+ this.requestContext.run(extra, () => this.dispatchStaticDiagramRead(name, uri))
224
228
  );
225
229
  } else {
226
230
  const template = this.buildAggregatingResourceTemplate(probe.uri.template, name);
227
231
  glspMcpServer.registerResource(name, template, config, (uri, params, extra) =>
228
- mcpRequestContext.run(extra, () => this.dispatchTemplatedDiagramRead(name, uri, params))
232
+ this.requestContext.run(extra, () => this.dispatchTemplatedDiagramRead(name, uri, params))
229
233
  );
230
234
  }
231
235
  }
@@ -247,7 +251,7 @@ export class DefaultMcpDiagramHandlerDispatcher implements McpDiagramHandlerDisp
247
251
  inputSchema: inputSchema.strict(),
248
252
  outputSchema: probe.toolAlternativeOutputSchema
249
253
  },
250
- (params, extra) => mcpRequestContext.run(extra, () => this.dispatchDiagramResourceAsTool(name, params))
254
+ (params, extra) => this.requestContext.run(extra, () => this.dispatchDiagramResourceAsTool(name, params))
251
255
  );
252
256
  }
253
257
 
@@ -262,7 +266,7 @@ export class DefaultMcpDiagramHandlerDispatcher implements McpDiagramHandlerDisp
262
266
  seenNames.add(probe.name);
263
267
  // Prompt errors propagate as JSON-RPC errors per spec — no `runWithToolErrorEnvelope` wrap.
264
268
  glspMcpServer.registerPrompt(probe.name, probe.toRegistrationConfig(), (args, extra) =>
265
- mcpRequestContext.run(extra, () => this.dispatchDiagramPrompt(probe.name, args))
269
+ this.requestContext.run(extra, () => this.dispatchDiagramPrompt(probe.name, args))
266
270
  );
267
271
  }
268
272
  }
@@ -276,7 +280,7 @@ export class DefaultMcpDiagramHandlerDispatcher implements McpDiagramHandlerDisp
276
280
  */
277
281
  protected buildAggregatingResourceTemplate(uriTemplate: string, name: string): ResourceTemplate {
278
282
  return new ResourceTemplate(uriTemplate, {
279
- list: extra => mcpRequestContext.run(extra, () => this.aggregateList(name)),
283
+ list: extra => this.requestContext.run(extra, () => this.aggregateList(name)),
280
284
  complete: this.buildAggregatedCompleters(name)
281
285
  });
282
286
  }
@@ -63,7 +63,10 @@ export class McpDiagramResourceHandlerRegistryInitializer implements ClientSessi
63
63
  }
64
64
  if (!handler.canRegister()) {
65
65
  if (!isProbe) {
66
- this.logger.warn(`Skipping MCP diagram resource handler '${handler.name}': canRegister() returned false.`);
66
+ // Debug-level: returning false is the designed-for outcome when the connecting
67
+ // client doesn't speak the action the handler relies on (e.g. RequestExportAction
68
+ // for diagram-png / diagram-svg). Not actionable for operators.
69
+ this.logger.debug(`Skipping MCP diagram resource handler '${handler.name}': canRegister() returned false.`);
67
70
  }
68
71
  continue;
69
72
  }
@@ -87,7 +87,9 @@ export class McpDiagramToolHandlerRegistryInitializer implements ClientSessionIn
87
87
  }
88
88
  if (!handler.canRegister()) {
89
89
  if (!isProbe) {
90
- this.logger.warn(`Skipping MCP diagram tool handler '${handler.name}': canRegister() returned false.`);
90
+ // Debug-level: returning false is the designed-for outcome when the connecting
91
+ // client doesn't speak the action the handler relies on. Not actionable for operators.
92
+ this.logger.debug(`Skipping MCP diagram tool handler '${handler.name}': canRegister() returned false.`);
91
93
  }
92
94
  continue;
93
95
  }