@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,143 @@
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 { BindingContext } from '@eclipse-glsp/protocol/lib/di';
17
+ import { AbstractMultiBinding, BindingTarget, GLSPModule } from '@eclipse-glsp/server';
18
+ import { interfaces } from 'inversify';
19
+ import { GLSPMcpServerFactory } from './glsp-mcp-server';
20
+ import { McpDiagramHandlerDispatcher } from './mcp-diagram-handler-dispatcher';
21
+ import { McpLogLevelRegistry } from './mcp-log-level-registry';
22
+ import { McpHttpTransport } from './mcp-http-transport';
23
+ import { McpLogger } from './mcp-logger';
24
+ import { McpServerDefaults, McpServerOptions } from './mcp-options';
25
+ import { McpProgressReporter } from './mcp-progress-reporter';
26
+ import { McpPromptHandler } from './mcp-prompt-handler';
27
+ import { McpResourceHandler } from './mcp-resource-handler';
28
+ import { McpServerLauncher } from './mcp-server-launcher';
29
+ import { McpToolHandler } from './mcp-tool-handler';
30
+ /**
31
+ * Multi-binding helper for MCP handler classes. Singleton-scoped sibling of core's
32
+ * `MultiBinding<T>` — same `binding.add(...)` / `binding.rebind(old, new)` adopter shape, but
33
+ * core's plain `MultiBinding` binds in transient scope, while MCP handlers cache deferred
34
+ * resolvers (selection/PNG round-trips) and need singleton scope to keep their state.
35
+ */
36
+ export declare class McpHandlerMultiBinding<T> extends AbstractMultiBinding<interfaces.Newable<T>> {
37
+ applyBindings(context: BindingContext): void;
38
+ }
39
+ /**
40
+ * Server-scope DI module for the MCP server. Adopters subclass {@link DefaultMcpServerModule}
41
+ * and override the `bind*` hooks to swap single-instance services or the `configure*` hooks to
42
+ * add/replace handlers in the multi-bindings. Mirrors the `DiagramModule` pattern from core
43
+ * (`bindGModelSerializer()`, `configureActionHandlers(binding)`, etc.).
44
+ *
45
+ * Adopter-provided default option values flow through the constructor — pass a
46
+ * `Partial<McpServerOptions>` to override individual fields. The launcher then merges these
47
+ * defaults with init-time options from the GLSP `initialize` request (init-time wins per field).
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * // Drop-in: GLSP defaults.
52
+ * launcher.configure(serverModule, new DefaultMcpServerModule());
53
+ *
54
+ * // Drop-in with a product-specific override.
55
+ * launcher.configure(serverModule, new DefaultMcpServerModule({ dataMode: 'resources' }));
56
+ *
57
+ * // Subclass when handler customization is needed.
58
+ * class WorkflowMcpServerModule extends DefaultMcpServerModule {
59
+ * constructor() { super({ agentPersona: WORKFLOW_PERSONA }); }
60
+ * protected override configureToolHandlers(binding) {
61
+ * super.configureToolHandlers(binding);
62
+ * binding.add(WorkflowSpecificTool);
63
+ * }
64
+ * }
65
+ * ```
66
+ */
67
+ export declare abstract class AbstractMcpServerModule extends GLSPModule {
68
+ protected readonly defaultOptions: McpServerDefaults;
69
+ protected bind: interfaces.Bind;
70
+ protected rebind: interfaces.Rebind;
71
+ constructor(defaultOptions?: McpServerDefaults);
72
+ protected configure(bind: interfaces.Bind, _unbind: interfaces.Unbind, isBound: interfaces.IsBound, rebind: interfaces.Rebind): void;
73
+ /**
74
+ * {@link McpServerLauncher} binding. Bound as a singleton AND aliased to
75
+ * `GLSPServerInitializer` + `GLSPServerListener` (the launcher implements both).
76
+ * Override to swap in a custom launcher impl.
77
+ */
78
+ protected bindMcpServerLauncher(): BindingTarget<McpServerLauncher>;
79
+ /** {@link McpHttpTransport} binding. Override to swap to a different transport implementation. */
80
+ protected bindMcpHttpTransport(): BindingTarget<McpHttpTransport>;
81
+ /**
82
+ * {@link McpDiagramHandlerDispatcher} binding. Owns diagram-scope handler discovery,
83
+ * SDK registration, and per-call dispatch routing. Override (or `rebind` to a subclass)
84
+ * to customize registration without subclassing the launcher itself.
85
+ */
86
+ protected bindMcpDiagramHandlerDispatcher(): BindingTarget<McpDiagramHandlerDispatcher>;
87
+ /** {@link McpServerOptions} holder binding. Mutated at init by the launcher. */
88
+ protected bindMcpServerOptions(): BindingTarget<McpServerOptions>;
89
+ /**
90
+ * {@link McpServerDefaults} binding — adopter-supplied default option values flow through
91
+ * the constructor and land here as a constant. The launcher merges these defaults with
92
+ * init-time options at server init (init-time wins per field).
93
+ */
94
+ protected bindMcpServerDefaults(): BindingTarget<McpServerDefaults>;
95
+ /**
96
+ * {@link McpLogger} binding. Bound on the server container; per-session containers inherit
97
+ * it, so handlers at any scope can inject it; routes through the active MCP request via
98
+ * {@link mcpRequestContext}.
99
+ */
100
+ protected bindMcpLogger(): BindingTarget<McpLogger>;
101
+ /** {@link McpProgressReporter} binding. Same scope/lifecycle story as {@link bindMcpLogger}. */
102
+ protected bindMcpProgressReporter(): BindingTarget<McpProgressReporter>;
103
+ /**
104
+ * {@link McpLogLevelRegistry} binding — holds per-MCP-session `logging/setLevel` thresholds
105
+ * read by {@link McpLogger} when filtering `notifications/message`.
106
+ */
107
+ protected bindMcpLogLevelRegistry(): BindingTarget<McpLogLevelRegistry>;
108
+ /**
109
+ * {@link GLSPMcpServerFactory} binding — produces a fresh {@link DefaultGLSPMcpServer} per
110
+ * MCP-session-init call. Override to wrap the SDK `McpServer` differently (e.g. add custom
111
+ * middleware, swap the Proxy strategy).
112
+ */
113
+ protected bindGLSPMcpServerFactory(): BindingTarget<GLSPMcpServerFactory>;
114
+ /**
115
+ * Override to add or replace tool handlers. Adopters typically `super.configureToolHandlers(binding)`
116
+ * to keep the defaults, then `binding.add(MyTool)` for additions or
117
+ * `binding.rebind(StandardTool, MyTool)` for overrides.
118
+ */
119
+ protected configureToolHandlers(binding: McpHandlerMultiBinding<McpToolHandler>): void;
120
+ /** See {@link configureToolHandlers}. No server-scope resources ship by default. */
121
+ protected configureResourceHandlers(_binding: McpHandlerMultiBinding<McpResourceHandler>): void;
122
+ /**
123
+ * See {@link configureToolHandlers}. Server-scope by default because the shipped prompts
124
+ * (`describe-diagram`, `suggest-improvements`) are diagram-type-agnostic and resolve their
125
+ * target session at invocation time — diagram-scope adopters add prompts via
126
+ * {@link DefaultMcpDiagramModule.configurePromptHandlers}.
127
+ */
128
+ protected configurePromptHandlers(binding: McpHandlerMultiBinding<McpPromptHandler>): void;
129
+ }
130
+ /**
131
+ * Default {@link AbstractMcpServerModule} entry point. Ships GLSP-default option values (see
132
+ * {@link DEFAULT_OPTIONS}) on top of the abstract module's hook defaults. Adopter-provided
133
+ * overrides via the constructor merge on top.
134
+ *
135
+ * @experimental The MCP integration is under active development. Option names, schema shapes,
136
+ * and handler contracts MAY change in minor releases until the feature graduates from
137
+ * experimental status.
138
+ */
139
+ export declare class DefaultMcpServerModule extends AbstractMcpServerModule {
140
+ static readonly DEFAULT_OPTIONS: McpServerDefaults;
141
+ constructor(overrides?: McpServerDefaults);
142
+ }
143
+ //# sourceMappingURL=mcp-server-module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-server-module.d.ts","sourceRoot":"","sources":["../../src/server/mcp-server-module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAGlF,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EACH,oBAAoB,EAEpB,aAAa,EACb,UAAU,EAIb,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAGvC,OAAO,EAAwB,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAsC,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AACnH,OAAO,EAA8B,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AA+BpD;;;;;GAKG;A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I,aAAa,CAAC,oBAAoB,CAAC;IAUzE;;;;OAIG;IACH,SAAS,CAAC,qBAAqB,CAAC,OAAO,EAAE,sBAAsB,CAAC,cAAc,CAAC,GAAG,IAAI;IAKtF,oFAAoF;IACpF,SAAS,CAAC,yBAAyB,CAAC,QAAQ,EAAE,sBAAsB,CAAC,kBAAkB,CAAC,GAAG,IAAI;IAI/F;;;;;OAKG;IACH,SAAS,CAAC,uBAAuB,CAAC,OAAO,EAAE,sBAAsB,CAAC,gBAAgB,CAAC,GAAG,IAAI;CAI7F;AAED;;;;;;;;GAQG;AACH,qBAAa,sBAAuB,SAAQ,uBAAuB;IAC/D,MAAM,CAAC,QAAQ,CAAC,eAAe,EAAE,iBAAiB,CAWhD;gBAEU,SAAS,GAAE,iBAAsB;CAGhD"}
@@ -0,0 +1,249 @@
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.DefaultMcpServerModule = exports.AbstractMcpServerModule = exports.McpHandlerMultiBinding = void 0;
19
+ const server_1 = require("@eclipse-glsp/server");
20
+ const prompts_1 = require("../prompts");
21
+ const tools_1 = require("../tools");
22
+ const glsp_mcp_server_1 = require("./glsp-mcp-server");
23
+ const mcp_diagram_handler_dispatcher_1 = require("./mcp-diagram-handler-dispatcher");
24
+ const mcp_log_level_registry_1 = require("./mcp-log-level-registry");
25
+ const lru_event_store_1 = require("./lru-event-store");
26
+ const mcp_http_transport_1 = require("./mcp-http-transport");
27
+ const mcp_logger_1 = require("./mcp-logger");
28
+ const mcp_options_1 = require("./mcp-options");
29
+ const mcp_progress_reporter_1 = require("./mcp-progress-reporter");
30
+ const mcp_prompt_handler_1 = require("./mcp-prompt-handler");
31
+ const mcp_resource_handler_1 = require("./mcp-resource-handler");
32
+ const mcp_server_launcher_1 = require("./mcp-server-launcher");
33
+ const mcp_tool_handler_1 = require("./mcp-tool-handler");
34
+ /**
35
+ * GLSP-generic default agent persona — adopters typically pass a product-specific persona to
36
+ * the {@link DefaultMcpServerModule} constructor (e.g. workflow-server might say "You are the
37
+ * Workflow Modeling Agent...").
38
+ *
39
+ * **Spec note.** This is wired to the MCP `instructions` field, which the spec describes as
40
+ * "concise instructions". This persona is intentionally verbose (~700 chars of behavior rules)
41
+ * — within the spec's "free-form server-supplied instructions" allowance and adopter-overridable
42
+ * via `mcpDefaults.agentPersona`. Don't trim on autopilot if a "concise" interpretation drifts
43
+ * back: the verbose form materially improves LLM tool-use compliance for graphical modelling.
44
+ */
45
+ const DEFAULT_AGENT_PERSONA = `
46
+ You are the GLSP Modeling Agent. Your primary goal is to assist in the creation and modification of graphical models using the
47
+ GLSP MCP server. You have to adhere to the following principles:
48
+ - MCP-Interaction: Any modeling related activity has to occur using the MCP server.
49
+ - Real Data: The diagram model is the ground truth regarding the existing graphical model. Always query it before modifying the diagram.
50
+ - Real Creation: Consult the available element types before creating elements.
51
+ - Visual Proof: An image of the graphical model can be created, if you deem it useful for calculating or verifying layout decisions.
52
+ - Precision: All IDs and types must be exact.
53
+ - Visualization: When creating nodes, suggest sensible default positions and avoid visual overlapping.
54
+ - Careful: Under no circumstances save the model without explicit instruction. If you deem it sensible, you may ask the user for permission.
55
+ The same goes for Undo/Redo operations.
56
+ - Layouting: If available, make use of automatic layouting when not given explicit custom layouting requirements.
57
+ - Human-friendly references: When mentioning an element in user-visible prose, prefer its label, then its element type
58
+ (the bare ids returned by the tools are internal aliases that mean nothing to the user). Append the alias in parentheses
59
+ so the user can correlate it with follow-up tools. Use the \`set-selection\` tool — or the \`set-view\` tool with
60
+ \`action: "center-on-elements"\` — to point the user at the elements you reference.
61
+ `;
62
+ /**
63
+ * Multi-binding helper for MCP handler classes. Singleton-scoped sibling of core's
64
+ * `MultiBinding<T>` — same `binding.add(...)` / `binding.rebind(old, new)` adopter shape, but
65
+ * core's plain `MultiBinding` binds in transient scope, while MCP handlers cache deferred
66
+ * resolvers (selection/PNG round-trips) and need singleton scope to keep their state.
67
+ */
68
+ class McpHandlerMultiBinding extends server_1.AbstractMultiBinding {
69
+ applyBindings(context) {
70
+ this.bindings.forEach(handlerClass => {
71
+ if (!context.isBound(handlerClass)) {
72
+ context.bind(handlerClass).toSelf().inSingletonScope();
73
+ }
74
+ context.bind(this.identifier).toService(handlerClass);
75
+ });
76
+ }
77
+ }
78
+ exports.McpHandlerMultiBinding = McpHandlerMultiBinding;
79
+ /**
80
+ * Server-scope DI module for the MCP server. Adopters subclass {@link DefaultMcpServerModule}
81
+ * and override the `bind*` hooks to swap single-instance services or the `configure*` hooks to
82
+ * add/replace handlers in the multi-bindings. Mirrors the `DiagramModule` pattern from core
83
+ * (`bindGModelSerializer()`, `configureActionHandlers(binding)`, etc.).
84
+ *
85
+ * Adopter-provided default option values flow through the constructor — pass a
86
+ * `Partial<McpServerOptions>` to override individual fields. The launcher then merges these
87
+ * defaults with init-time options from the GLSP `initialize` request (init-time wins per field).
88
+ *
89
+ * @example
90
+ * ```ts
91
+ * // Drop-in: GLSP defaults.
92
+ * launcher.configure(serverModule, new DefaultMcpServerModule());
93
+ *
94
+ * // Drop-in with a product-specific override.
95
+ * launcher.configure(serverModule, new DefaultMcpServerModule({ dataMode: 'resources' }));
96
+ *
97
+ * // Subclass when handler customization is needed.
98
+ * class WorkflowMcpServerModule extends DefaultMcpServerModule {
99
+ * constructor() { super({ agentPersona: WORKFLOW_PERSONA }); }
100
+ * protected override configureToolHandlers(binding) {
101
+ * super.configureToolHandlers(binding);
102
+ * binding.add(WorkflowSpecificTool);
103
+ * }
104
+ * }
105
+ * ```
106
+ */
107
+ class AbstractMcpServerModule extends server_1.GLSPModule {
108
+ constructor(defaultOptions = {}) {
109
+ super();
110
+ this.defaultOptions = defaultOptions;
111
+ }
112
+ configure(bind, _unbind, isBound, rebind) {
113
+ this.bind = bind;
114
+ this.rebind = rebind;
115
+ const context = { bind, isBound };
116
+ (0, server_1.applyBindingTarget)(context, mcp_server_launcher_1.McpServerLauncher, this.bindMcpServerLauncher()).inSingletonScope();
117
+ // The launcher is bound under two additional service identifiers so core's existing
118
+ // multi-bindings pick it up alongside the rest of the server's contributions/listeners.
119
+ bind(server_1.GLSPServerInitializer).toService(mcp_server_launcher_1.McpServerLauncher);
120
+ bind(server_1.GLSPServerListener).toService(mcp_server_launcher_1.McpServerLauncher);
121
+ (0, server_1.applyBindingTarget)(context, mcp_http_transport_1.McpHttpTransport, this.bindMcpHttpTransport()).inSingletonScope();
122
+ (0, server_1.applyBindingTarget)(context, mcp_diagram_handler_dispatcher_1.McpDiagramHandlerDispatcher, this.bindMcpDiagramHandlerDispatcher()).inSingletonScope();
123
+ (0, server_1.applyBindingTarget)(context, mcp_options_1.McpServerOptions, this.bindMcpServerOptions()).inSingletonScope();
124
+ (0, server_1.applyBindingTarget)(context, mcp_options_1.McpServerDefaults, this.bindMcpServerDefaults());
125
+ (0, server_1.applyBindingTarget)(context, mcp_logger_1.McpLogger, this.bindMcpLogger()).inSingletonScope();
126
+ (0, server_1.applyBindingTarget)(context, mcp_log_level_registry_1.McpLogLevelRegistry, this.bindMcpLogLevelRegistry()).inSingletonScope();
127
+ (0, server_1.applyBindingTarget)(context, mcp_progress_reporter_1.McpProgressReporter, this.bindMcpProgressReporter()).inSingletonScope();
128
+ (0, server_1.applyBindingTarget)(context, glsp_mcp_server_1.GLSPMcpServerFactory, this.bindGLSPMcpServerFactory());
129
+ this.configureMultiBinding(new McpHandlerMultiBinding(mcp_tool_handler_1.McpToolHandler), binding => this.configureToolHandlers(binding));
130
+ this.configureMultiBinding(new McpHandlerMultiBinding(mcp_resource_handler_1.McpResourceHandler), binding => this.configureResourceHandlers(binding));
131
+ this.configureMultiBinding(new McpHandlerMultiBinding(mcp_prompt_handler_1.McpPromptHandler), binding => this.configurePromptHandlers(binding));
132
+ }
133
+ /**
134
+ * {@link McpServerLauncher} binding. Bound as a singleton AND aliased to
135
+ * `GLSPServerInitializer` + `GLSPServerListener` (the launcher implements both).
136
+ * Override to swap in a custom launcher impl.
137
+ */
138
+ bindMcpServerLauncher() {
139
+ return mcp_server_launcher_1.McpServerLauncher;
140
+ }
141
+ /** {@link McpHttpTransport} binding. Override to swap to a different transport implementation. */
142
+ bindMcpHttpTransport() {
143
+ return mcp_http_transport_1.McpHttpTransport;
144
+ }
145
+ /**
146
+ * {@link McpDiagramHandlerDispatcher} binding. Owns diagram-scope handler discovery,
147
+ * SDK registration, and per-call dispatch routing. Override (or `rebind` to a subclass)
148
+ * to customize registration without subclassing the launcher itself.
149
+ */
150
+ bindMcpDiagramHandlerDispatcher() {
151
+ return mcp_diagram_handler_dispatcher_1.DefaultMcpDiagramHandlerDispatcher;
152
+ }
153
+ /** {@link McpServerOptions} holder binding. Mutated at init by the launcher. */
154
+ bindMcpServerOptions() {
155
+ return mcp_options_1.McpServerOptions;
156
+ }
157
+ /**
158
+ * {@link McpServerDefaults} binding — adopter-supplied default option values flow through
159
+ * the constructor and land here as a constant. The launcher merges these defaults with
160
+ * init-time options at server init (init-time wins per field).
161
+ */
162
+ bindMcpServerDefaults() {
163
+ return { constantValue: this.defaultOptions };
164
+ }
165
+ /**
166
+ * {@link McpLogger} binding. Bound on the server container; per-session containers inherit
167
+ * it, so handlers at any scope can inject it; routes through the active MCP request via
168
+ * {@link mcpRequestContext}.
169
+ */
170
+ bindMcpLogger() {
171
+ return mcp_logger_1.McpLogger;
172
+ }
173
+ /** {@link McpProgressReporter} binding. Same scope/lifecycle story as {@link bindMcpLogger}. */
174
+ bindMcpProgressReporter() {
175
+ return mcp_progress_reporter_1.McpProgressReporter;
176
+ }
177
+ /**
178
+ * {@link McpLogLevelRegistry} binding — holds per-MCP-session `logging/setLevel` thresholds
179
+ * read by {@link McpLogger} when filtering `notifications/message`.
180
+ */
181
+ bindMcpLogLevelRegistry() {
182
+ return mcp_log_level_registry_1.DefaultMcpLogLevelRegistry;
183
+ }
184
+ /**
185
+ * {@link GLSPMcpServerFactory} binding — produces a fresh {@link DefaultGLSPMcpServer} per
186
+ * MCP-session-init call. Override to wrap the SDK `McpServer` differently (e.g. add custom
187
+ * middleware, swap the Proxy strategy).
188
+ */
189
+ bindGLSPMcpServerFactory() {
190
+ return {
191
+ dynamicValue: ctx => {
192
+ const logger = ctx.container.get(server_1.Logger);
193
+ return (mcpServer, options) => new glsp_mcp_server_1.DefaultGLSPMcpServer(mcpServer, options, logger);
194
+ }
195
+ };
196
+ }
197
+ /**
198
+ * Override to add or replace tool handlers. Adopters typically `super.configureToolHandlers(binding)`
199
+ * to keep the defaults, then `binding.add(MyTool)` for additions or
200
+ * `binding.rebind(StandardTool, MyTool)` for overrides.
201
+ */
202
+ configureToolHandlers(binding) {
203
+ binding.add(tools_1.SessionInfoMcpToolHandler);
204
+ binding.add(tools_1.ElementTypesMcpToolHandler);
205
+ }
206
+ /** See {@link configureToolHandlers}. No server-scope resources ship by default. */
207
+ configureResourceHandlers(_binding) {
208
+ // empty by default
209
+ }
210
+ /**
211
+ * See {@link configureToolHandlers}. Server-scope by default because the shipped prompts
212
+ * (`describe-diagram`, `suggest-improvements`) are diagram-type-agnostic and resolve their
213
+ * target session at invocation time — diagram-scope adopters add prompts via
214
+ * {@link DefaultMcpDiagramModule.configurePromptHandlers}.
215
+ */
216
+ configurePromptHandlers(binding) {
217
+ binding.add(prompts_1.DescribeDiagramMcpPromptHandler);
218
+ binding.add(prompts_1.SuggestImprovementsMcpPromptHandler);
219
+ }
220
+ }
221
+ exports.AbstractMcpServerModule = AbstractMcpServerModule;
222
+ /**
223
+ * Default {@link AbstractMcpServerModule} entry point. Ships GLSP-default option values (see
224
+ * {@link DEFAULT_OPTIONS}) on top of the abstract module's hook defaults. Adopter-provided
225
+ * overrides via the constructor merge on top.
226
+ *
227
+ * @experimental The MCP integration is under active development. Option names, schema shapes,
228
+ * and handler contracts MAY change in minor releases until the feature graduates from
229
+ * experimental status.
230
+ */
231
+ class DefaultMcpServerModule extends AbstractMcpServerModule {
232
+ constructor(overrides = {}) {
233
+ super({ ...DefaultMcpServerModule.DEFAULT_OPTIONS, ...overrides });
234
+ }
235
+ }
236
+ exports.DefaultMcpServerModule = DefaultMcpServerModule;
237
+ DefaultMcpServerModule.DEFAULT_OPTIONS = {
238
+ host: '127.0.0.1',
239
+ allowedHosts: ['127.0.0.1', 'localhost'],
240
+ // `allowedOrigins` deliberately undefined: accept absent Origin (typical for desktop-IDE
241
+ // MCP clients) and rely on Host validation to gate DNS-rebinding. Adopters whose
242
+ // deployment is browser-fronted set this explicitly to their frontend's origin.
243
+ dataMode: 'tools',
244
+ agentPersona: DEFAULT_AGENT_PERSONA,
245
+ // 10K events per session is generous for typical workloads (a few MB) and large enough
246
+ // that disconnects within seconds recover via `Last-Event-ID` resumability.
247
+ eventStoreLimit: lru_event_store_1.LruEventStore.DEFAULT_LIMIT
248
+ };
249
+ //# sourceMappingURL=mcp-server-module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-server-module.js","sourceRoot":"","sources":["../../src/server/mcp-server-module.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAIlF,iDAQ8B;AAG9B,wCAAkG;AAClG,oCAAiF;AACjF,uDAA+E;AAC/E,qFAAmH;AACnH,qEAA2F;AAC3F,uDAAkD;AAClD,6DAAwD;AACxD,6CAAyC;AACzC,+CAAoE;AACpE,mEAA8D;AAC9D,6DAAwD;AACxD,iEAA4D;AAC5D,+DAA0D;AAC1D,yDAAoD;AAEpD;;;;;;;;;;GAUG;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;QAC7C,OAAO,CAAC,GAAG,CAAC,6CAAmC,CAAC,CAAC;IACrD,CAAC;CACJ;AA5ID,0DA4IC;AAED;;;;;;;;GAQG;AACH,MAAa,sBAAuB,SAAQ,uBAAuB;IAc/D,YAAY,YAA+B,EAAE;QACzC,KAAK,CAAC,EAAE,GAAG,sBAAsB,CAAC,eAAe,EAAE,GAAG,SAAS,EAAE,CAAC,CAAC;IACvE,CAAC;;AAhBL,wDAiBC;AAhBmB,sCAAe,GAAsB;IACjD,IAAI,EAAE,WAAW;IACjB,YAAY,EAAE,CAAC,WAAW,EAAE,WAAW,CAAC;IACxC,yFAAyF;IACzF,iFAAiF;IACjF,gFAAgF;IAChF,QAAQ,EAAE,OAAO;IACjB,YAAY,EAAE,qBAAqB;IACnC,uFAAuF;IACvF,4EAA4E;IAC5E,eAAe,EAAE,+BAAa,CAAC,aAAa;CAC/C,CAAC"}
@@ -0,0 +1,44 @@
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 type { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
17
+ /**
18
+ * **Note on terminology** — the word "session" is overloaded in this codebase. Two
19
+ * independent concepts exist and must not be conflated:
20
+ *
21
+ * 1. **MCP session** (this file): one MCP client connection to the MCP HTTP endpoint, tracked by
22
+ * {@link McpHttpTransport.sessions} keyed by the SDK-issued `mcp-session-id` HTTP header.
23
+ * Created in `onsessioninitialized`, supports resumability across reconnects via
24
+ * `Last-Event-ID`. Each {@link McpSession} corresponds to one underlying SDK `McpServer`
25
+ * instance — multiple LLM clients can connect simultaneously, each with its own MCP session
26
+ * and its own SDK server.
27
+ *
28
+ * 2. **GLSP client session** (core): one open diagram, tracked by core's `ClientSessionManager`
29
+ * and represented by `ClientSession`. Tools/resources/prompts that target a specific diagram
30
+ * receive the GLSP session id via `params.sessionId` in their input schema.
31
+ *
32
+ * The two are independent in lifetime and cardinality: a single MCP session sees ALL open GLSP
33
+ * sessions; a single GLSP session is visible to every connected MCP session. Names in this
34
+ * package distinguish them: anything with the `Mcp` prefix in {@link mcp-session.ts} or
35
+ * `mcp-http-transport.ts` is MCP-side; anything talking about diagrams (`AbstractMcpDiagram*`,
36
+ * `requireGlspSession`, `GlspSession`) is GLSP-side.
37
+ */
38
+ export type McpSessionId = string;
39
+ export type WithSessionId<T> = T & {
40
+ get sessionId(): McpSessionId;
41
+ };
42
+ /** SDK {@link Transport} widened with the session-id accessor every concrete MCP transport carries post-handshake. */
43
+ export type McpSession = WithSessionId<Transport>;
44
+ //# sourceMappingURL=mcp-session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-session.d.ts","sourceRoot":"","sources":["../../src/server/mcp-session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAE/E;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAElC,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,GAAG;IAAE,IAAI,SAAS,IAAI,YAAY,CAAA;CAAE,CAAC;AAErE,sHAAsH;AACtH,MAAM,MAAM,UAAU,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC"}
@@ -0,0 +1,18 @@
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
+ //# sourceMappingURL=mcp-session.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-session.js","sourceRoot":"","sources":["../../src/server/mcp-session.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF"}