@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,67 @@
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.ElementIdentitySchema = exports.McpDiagramScopedInputSchema = exports.position = exports.elementIds = exports.elementId = exports.sessionId = void 0;
19
+ const z = require("zod/v4");
20
+ /**
21
+ * Common Zod input-schema fragments shared across MCP tool / resource / prompt handlers.
22
+ * Adopters compose these via `z.object({ ... })` or `McpDiagramScopedInputSchema.extend(...)`
23
+ * — Zod's modifiers (`.describe`, `.optional`, `.min`, ...) return new schemas without mutating
24
+ * the exports, so the shared fragments can be safely adapted at the call site.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * import { McpDiagramScopedInputSchema, elementIds } from '@eclipse-glsp/server-mcp';
29
+ *
30
+ * // Use as-is — the tool's `description` field already conveys the action context:
31
+ * const inputSchema = McpDiagramScopedInputSchema.extend({ elementIds });
32
+ *
33
+ * // Override `describe` only when there's genuinely new info (defaults, conditional applicability):
34
+ * const inputSchema = McpDiagramScopedInputSchema.extend({
35
+ * elementIds: elementIds.optional().describe('If not provided, validates entire model.')
36
+ * });
37
+ * ```
38
+ */
39
+ /** GLSP client session id (open diagram). Resolved by the launcher dispatcher via `ClientSessionManager`. */
40
+ exports.sessionId = z.string().describe('GLSP client session id (open diagram).');
41
+ /** Single element id — alias or real; handlers translate via `resolveIds` on the diagram base. */
42
+ exports.elementId = z.string();
43
+ /** One or more element ids. Empty arrays are rejected. */
44
+ exports.elementIds = z.array(z.string()).min(1);
45
+ /** Cartesian position used by node-creation / -modification tools. */
46
+ exports.position = z
47
+ .object({
48
+ x: z.number().describe('X coordinate in diagram space'),
49
+ y: z.number().describe('Y coordinate in diagram space')
50
+ })
51
+ .strict();
52
+ /**
53
+ * Base schema for diagram-scope tool / prompt / resource-tool-alternative input. Adopter
54
+ * schemas extend this via {@link z.ZodObject.extend} and add their tool-specific fields.
55
+ */
56
+ exports.McpDiagramScopedInputSchema = z.object({ sessionId: exports.sessionId });
57
+ /**
58
+ * Compact identity echoed by mutating tools (create / modify / delete) so the LLM has enough
59
+ * context to refer to the element by label or type in user-facing prose without a follow-up
60
+ * `query-elements`. The `id` is the alias.
61
+ */
62
+ exports.ElementIdentitySchema = z.object({
63
+ id: z.string().describe('Aliased element id.'),
64
+ elementTypeId: z.string().describe('Element type id (e.g. `node:foo`, `edge`).'),
65
+ label: z.string().optional().describe('Primary label text, when the element has one.')
66
+ });
67
+ //# sourceMappingURL=mcp-input-schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-input-schemas.js","sourceRoot":"","sources":["../../src/server/mcp-input-schemas.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAElF,4BAA4B;AAE5B;;;;;;;;;;;;;;;;;;GAkBG;AAEH,6GAA6G;AAChG,QAAA,SAAS,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wCAAwC,CAAC,CAAC;AAEvF,kGAAkG;AACrF,QAAA,SAAS,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;AAEpC,0DAA0D;AAC7C,QAAA,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAErD,sEAAsE;AACzD,QAAA,QAAQ,GAAG,CAAC;KACpB,MAAM,CAAC;IACJ,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+BAA+B,CAAC;IACvD,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+BAA+B,CAAC;CAC1D,CAAC;KACD,MAAM,EAAE,CAAC;AAEd;;;GAGG;AACU,QAAA,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,SAAS,EAAT,iBAAS,EAAE,CAAC,CAAC;AAEnE;;;;GAIG;AACU,QAAA,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;IAC9C,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,4CAA4C,CAAC;IAChF,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,+CAA+C,CAAC;CACzF,CAAC,CAAC"}
@@ -0,0 +1,45 @@
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 { GLabel, GModelElement } from '@eclipse-glsp/server';
17
+ export declare const McpLabelProvider: unique symbol;
18
+ /**
19
+ * Locates the {@link GLabel} that primarily represents an element to a user. Centralises the
20
+ * label-lookup logic so both LLM-facing reads (label-text echoes in tool results,
21
+ * `query-elements` rendering) and writes (`ApplyLabelEditOperation` from `create-nodes` /
22
+ * `modify-nodes`) share one override point.
23
+ *
24
+ * Diagram-scope: bound per GLSP session via {@link DefaultMcpDiagramModule.bindLabelProvider}.
25
+ * Adopters with non-trivial label structures (nested headers, compartments) override the
26
+ * {@link DefaultMcpLabelProvider} once instead of per-handler.
27
+ *
28
+ * @experimental
29
+ */
30
+ export interface McpLabelProvider {
31
+ /**
32
+ * The {@link GLabel} primarily representing this element to a user. Returns `undefined`
33
+ * when the element has no label.
34
+ */
35
+ getLabel(element: GModelElement): GLabel | undefined;
36
+ }
37
+ /**
38
+ * Default {@link McpLabelProvider}: returns the first direct {@link GLabel} child. Adopters
39
+ * whose elements wrap labels in intermediary container nodes (headers, compartments) subclass
40
+ * and override {@link getLabel}.
41
+ */
42
+ export declare class DefaultMcpLabelProvider implements McpLabelProvider {
43
+ getLabel(element: GModelElement): GLabel | undefined;
44
+ }
45
+ //# sourceMappingURL=mcp-label-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-label-provider.d.ts","sourceRoot":"","sources":["../../src/server/mcp-label-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG7D,eAAO,MAAM,gBAAgB,eAA6B,CAAC;AAE3D;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,gBAAgB;IAC7B;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,GAAG,SAAS,CAAC;CACxD;AAED;;;;GAIG;AACH,qBACa,uBAAwB,YAAW,gBAAgB;IAC5D,QAAQ,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,GAAG,SAAS;CAGvD"}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (c) 2026 EclipseSource and others.
4
+ *
5
+ * This program and the accompanying materials are made available under the
6
+ * terms of the Eclipse Public License v. 2.0 which is available at
7
+ * http://www.eclipse.org/legal/epl-2.0.
8
+ *
9
+ * This Source Code may also be made available under the following Secondary
10
+ * Licenses when the conditions for such availability set forth in the Eclipse
11
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ * with the GNU Classpath Exception which is available at
13
+ * https://www.gnu.org/software/classpath/license.html.
14
+ *
15
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
+ ********************************************************************************/
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.DefaultMcpLabelProvider = exports.McpLabelProvider = void 0;
25
+ const server_1 = require("@eclipse-glsp/server");
26
+ const inversify_1 = require("inversify");
27
+ exports.McpLabelProvider = Symbol('McpLabelProvider');
28
+ /**
29
+ * Default {@link McpLabelProvider}: returns the first direct {@link GLabel} child. Adopters
30
+ * whose elements wrap labels in intermediary container nodes (headers, compartments) subclass
31
+ * and override {@link getLabel}.
32
+ */
33
+ let DefaultMcpLabelProvider = class DefaultMcpLabelProvider {
34
+ getLabel(element) {
35
+ return element.children.find((child) => child instanceof server_1.GLabel);
36
+ }
37
+ };
38
+ exports.DefaultMcpLabelProvider = DefaultMcpLabelProvider;
39
+ exports.DefaultMcpLabelProvider = DefaultMcpLabelProvider = __decorate([
40
+ (0, inversify_1.injectable)()
41
+ ], DefaultMcpLabelProvider);
42
+ //# sourceMappingURL=mcp-label-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-label-provider.js","sourceRoot":"","sources":["../../src/server/mcp-label-provider.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;AAElF,iDAA6D;AAC7D,yCAAuC;AAE1B,QAAA,gBAAgB,GAAG,MAAM,CAAC,kBAAkB,CAAC,CAAC;AAsB3D;;;;GAIG;AAEI,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAChC,QAAQ,CAAC,OAAsB;QAC3B,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,KAAK,EAAmB,EAAE,CAAC,KAAK,YAAY,eAAM,CAAC,CAAC;IACtF,CAAC;CACJ,CAAA;AAJY,0DAAuB;kCAAvB,uBAAuB;IADnC,IAAA,sBAAU,GAAE;GACA,uBAAuB,CAInC"}
@@ -0,0 +1,54 @@
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 { LoggingLevel } from '@modelcontextprotocol/sdk/types.js';
17
+ export declare const McpLogLevelRegistry: unique symbol;
18
+ /**
19
+ * Per-MCP-session minimum-severity threshold for `notifications/message`. Updated by the
20
+ * server's `logging/setLevel` request handler (registered in {@link McpServerLauncher} on
21
+ * session-init); read by {@link McpLogger} to gate message delivery.
22
+ *
23
+ * Bound as a server-scope singleton: one registry shared across MCP sessions, keyed by
24
+ * session id. On session-close, the entry is cleared so a recycled session id does not
25
+ * inherit a stale threshold.
26
+ */
27
+ export interface McpLogLevelRegistry {
28
+ /** Update the minimum severity for a session. Called by the SDK setLevel request handler. */
29
+ setLevel(sessionId: string, level: LoggingLevel): void;
30
+ /** Resolve the active threshold for a session, falling back to the default for unknown ids. */
31
+ getLevel(sessionId: string | undefined): LoggingLevel;
32
+ /** Drop the per-session entry on session-close. */
33
+ clear(sessionId: string): void;
34
+ }
35
+ /**
36
+ * Returns `true` iff a message of severity {@link level} should be delivered given the
37
+ * session's current {@link threshold}. A `setLevel('warning')` call drops `notice`, `info`,
38
+ * and `debug`; `setLevel('debug')` keeps everything (the default).
39
+ */
40
+ export declare function passesLogThreshold(level: LoggingLevel, threshold: LoggingLevel): boolean;
41
+ export declare class DefaultMcpLogLevelRegistry implements McpLogLevelRegistry {
42
+ /**
43
+ * Default threshold used when the client has not sent `logging/setLevel`. `'debug'` is the
44
+ * MCP-spec-permitted "send everything" mode (the spec lets the server decide if no
45
+ * setLevel was received). Set wide so adopters who never wire setLevel see the same
46
+ * verbose behavior the server had before this registry existed.
47
+ */
48
+ static readonly DEFAULT_LEVEL: LoggingLevel;
49
+ protected readonly levels: Map<string, LoggingLevel>;
50
+ setLevel(sessionId: string, level: LoggingLevel): void;
51
+ getLevel(sessionId: string | undefined): LoggingLevel;
52
+ clear(sessionId: string): void;
53
+ }
54
+ //# sourceMappingURL=mcp-log-level-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-log-level-registry.d.ts","sourceRoot":"","sources":["../../src/server/mcp-log-level-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAGlE,eAAO,MAAM,mBAAmB,eAAgC,CAAC;AAEjE;;;;;;;;GAQG;AACH,MAAM,WAAW,mBAAmB;IAChC,6FAA6F;IAC7F,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IACvD,+FAA+F;IAC/F,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,YAAY,CAAC;IACtD,mDAAmD;IACnD,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC;AAiBD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,GAAG,OAAO,CAExF;AAED,qBACa,0BAA2B,YAAW,mBAAmB;IAClE;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CAAC,aAAa,EAAE,YAAY,CAAW;IAEtD,SAAS,CAAC,QAAQ,CAAC,MAAM,4BAAmC;IAE5D,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,GAAG,IAAI;IAItD,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,YAAY;IAOrD,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;CAGjC"}
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (c) 2026 EclipseSource and others.
4
+ *
5
+ * This program and the accompanying materials are made available under the
6
+ * terms of the Eclipse Public License v. 2.0 which is available at
7
+ * http://www.eclipse.org/legal/epl-2.0.
8
+ *
9
+ * This Source Code may also be made available under the following Secondary
10
+ * Licenses when the conditions for such availability set forth in the Eclipse
11
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ * with the GNU Classpath Exception which is available at
13
+ * https://www.gnu.org/software/classpath/license.html.
14
+ *
15
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
+ ********************************************************************************/
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ var DefaultMcpLogLevelRegistry_1;
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.DefaultMcpLogLevelRegistry = exports.McpLogLevelRegistry = void 0;
26
+ exports.passesLogThreshold = passesLogThreshold;
27
+ const inversify_1 = require("inversify");
28
+ exports.McpLogLevelRegistry = Symbol('McpLogLevelRegistry');
29
+ /**
30
+ * RFC 5424 severity numbering, mirroring the MCP `LoggingLevel` enum. Lower number = more
31
+ * severe; the threshold compares numerically.
32
+ */
33
+ const SEVERITY = {
34
+ emergency: 0,
35
+ alert: 1,
36
+ critical: 2,
37
+ error: 3,
38
+ warning: 4,
39
+ notice: 5,
40
+ info: 6,
41
+ debug: 7
42
+ };
43
+ /**
44
+ * Returns `true` iff a message of severity {@link level} should be delivered given the
45
+ * session's current {@link threshold}. A `setLevel('warning')` call drops `notice`, `info`,
46
+ * and `debug`; `setLevel('debug')` keeps everything (the default).
47
+ */
48
+ function passesLogThreshold(level, threshold) {
49
+ return SEVERITY[level] <= SEVERITY[threshold];
50
+ }
51
+ let DefaultMcpLogLevelRegistry = DefaultMcpLogLevelRegistry_1 = class DefaultMcpLogLevelRegistry {
52
+ constructor() {
53
+ this.levels = new Map();
54
+ }
55
+ setLevel(sessionId, level) {
56
+ this.levels.set(sessionId, level);
57
+ }
58
+ getLevel(sessionId) {
59
+ var _a;
60
+ if (sessionId === undefined) {
61
+ return DefaultMcpLogLevelRegistry_1.DEFAULT_LEVEL;
62
+ }
63
+ return (_a = this.levels.get(sessionId)) !== null && _a !== void 0 ? _a : DefaultMcpLogLevelRegistry_1.DEFAULT_LEVEL;
64
+ }
65
+ clear(sessionId) {
66
+ this.levels.delete(sessionId);
67
+ }
68
+ };
69
+ exports.DefaultMcpLogLevelRegistry = DefaultMcpLogLevelRegistry;
70
+ /**
71
+ * Default threshold used when the client has not sent `logging/setLevel`. `'debug'` is the
72
+ * MCP-spec-permitted "send everything" mode (the spec lets the server decide if no
73
+ * setLevel was received). Set wide so adopters who never wire setLevel see the same
74
+ * verbose behavior the server had before this registry existed.
75
+ */
76
+ DefaultMcpLogLevelRegistry.DEFAULT_LEVEL = 'debug';
77
+ exports.DefaultMcpLogLevelRegistry = DefaultMcpLogLevelRegistry = DefaultMcpLogLevelRegistry_1 = __decorate([
78
+ (0, inversify_1.injectable)()
79
+ ], DefaultMcpLogLevelRegistry);
80
+ //# sourceMappingURL=mcp-log-level-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-log-level-registry.js","sourceRoot":"","sources":["../../src/server/mcp-log-level-registry.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;AA6ClF,gDAEC;AA5CD,yCAAuC;AAE1B,QAAA,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAoBjE;;;GAGG;AACH,MAAM,QAAQ,GAAiC;IAC3C,SAAS,EAAE,CAAC;IACZ,KAAK,EAAE,CAAC;IACR,QAAQ,EAAE,CAAC;IACX,KAAK,EAAE,CAAC;IACR,OAAO,EAAE,CAAC;IACV,MAAM,EAAE,CAAC;IACT,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;CACX,CAAC;AAEF;;;;GAIG;AACH,SAAgB,kBAAkB,CAAC,KAAmB,EAAE,SAAuB;IAC3E,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,SAAS,CAAC,CAAC;AAClD,CAAC;AAGM,IAAM,0BAA0B,kCAAhC,MAAM,0BAA0B;IAAhC;QASgB,WAAM,GAAG,IAAI,GAAG,EAAwB,CAAC;IAgBhE,CAAC;IAdG,QAAQ,CAAC,SAAiB,EAAE,KAAmB;QAC3C,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IACtC,CAAC;IAED,QAAQ,CAAC,SAA6B;;QAClC,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;YAC1B,OAAO,4BAA0B,CAAC,aAAa,CAAC;QACpD,CAAC;QACD,OAAO,MAAA,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,mCAAI,4BAA0B,CAAC,aAAa,CAAC;IAClF,CAAC;IAED,KAAK,CAAC,SAAiB;QACnB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAClC,CAAC;;AAxBQ,gEAA0B;AACnC;;;;;GAKG;AACa,wCAAa,GAAiB,OAAO,AAAxB,CAAyB;qCAP7C,0BAA0B;IADtC,IAAA,sBAAU,GAAE;GACA,0BAA0B,CAyBtC"}
@@ -0,0 +1,59 @@
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 { Logger } from '@eclipse-glsp/server';
17
+ import type { LoggingLevel } from '@modelcontextprotocol/sdk/types.js';
18
+ import { McpLogLevelRegistry } from './mcp-log-level-registry';
19
+ /**
20
+ * Logger that writes to BOTH the GLSP-side server log and the connected MCP client.
21
+ *
22
+ * Mirrors the {@link Logger} shape so handlers can drop-in switch from `@inject(Logger)` to
23
+ * `@inject(McpLogger)`. The server-side route always fires; the MCP-side route fires only when
24
+ * a call is made from inside an MCP request callback (tracked via {@link mcpRequestContext}).
25
+ *
26
+ * We deliberately do NOT auto-forward arbitrary GLSP `Logger.info` calls to MCP clients —
27
+ * that would leak unrelated server-wide log lines into every connected LLM. Adopters opt in
28
+ * per-handler by injecting `McpLogger` instead of `Logger`.
29
+ *
30
+ * Level mapping (GLSP → MCP, RFC 5424 names per the MCP spec):
31
+ * - `info` → `info`
32
+ * - `warn` → `warning`
33
+ * - `error` → `error`
34
+ * - `debug` → `debug`
35
+ *
36
+ * Shared across MCP clients on the same GLSP session; per-client routing is handled by the
37
+ * active `mcpRequestContext` frame, and the per-MCP-session `logging/setLevel` threshold is
38
+ * stored in {@link McpLogLevelRegistry}.
39
+ *
40
+ * @experimental
41
+ */
42
+ export declare class McpLogger {
43
+ protected glspLogger: Logger;
44
+ protected levelRegistry: McpLogLevelRegistry;
45
+ info(message: string, ...meta: unknown[]): void;
46
+ warn(message: string, ...meta: unknown[]): void;
47
+ error(message: string, ...meta: unknown[]): void;
48
+ debug(message: string, ...meta: unknown[]): void;
49
+ /**
50
+ * Send a `notifications/message` to the connected MCP client when invoked inside an active
51
+ * request context AND the message passes the session's `logging/setLevel` threshold.
52
+ * Outside a request context (init contributions, background timers) this is a no-op so the
53
+ * same logger can be used everywhere without orphan-notification leaks.
54
+ *
55
+ * Failures to deliver are swallowed — a broken transport must not break the producing tool.
56
+ */
57
+ protected notify(level: LoggingLevel, data: string): void;
58
+ }
59
+ //# sourceMappingURL=mcp-logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-logger.d.ts","sourceRoot":"","sources":["../../src/server/mcp-logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAEvE,OAAO,EAAE,mBAAmB,EAAsB,MAAM,0BAA0B,CAAC;AAGnF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBACa,SAAS;IACF,SAAS,CAAC,UAAU,EAAE,MAAM,CAAC;IAEhB,SAAS,CAAC,aAAa,EAAE,mBAAmB,CAAC;IAE1E,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAK/C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAK/C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAKhD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAKhD;;;;;;;OAOG;IACH,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;CAW5D"}
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (c) 2026 EclipseSource and others.
4
+ *
5
+ * This program and the accompanying materials are made available under the
6
+ * terms of the Eclipse Public License v. 2.0 which is available at
7
+ * http://www.eclipse.org/legal/epl-2.0.
8
+ *
9
+ * This Source Code may also be made available under the following Secondary
10
+ * Licenses when the conditions for such availability set forth in the Eclipse
11
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ * with the GNU Classpath Exception which is available at
13
+ * https://www.gnu.org/software/classpath/license.html.
14
+ *
15
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
+ ********************************************************************************/
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ var __metadata = (this && this.__metadata) || function (k, v) {
24
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.McpLogger = void 0;
28
+ const server_1 = require("@eclipse-glsp/server");
29
+ const inversify_1 = require("inversify");
30
+ const mcp_log_level_registry_1 = require("./mcp-log-level-registry");
31
+ const mcp_request_context_1 = require("./mcp-request-context");
32
+ /**
33
+ * Logger that writes to BOTH the GLSP-side server log and the connected MCP client.
34
+ *
35
+ * Mirrors the {@link Logger} shape so handlers can drop-in switch from `@inject(Logger)` to
36
+ * `@inject(McpLogger)`. The server-side route always fires; the MCP-side route fires only when
37
+ * a call is made from inside an MCP request callback (tracked via {@link mcpRequestContext}).
38
+ *
39
+ * We deliberately do NOT auto-forward arbitrary GLSP `Logger.info` calls to MCP clients —
40
+ * that would leak unrelated server-wide log lines into every connected LLM. Adopters opt in
41
+ * per-handler by injecting `McpLogger` instead of `Logger`.
42
+ *
43
+ * Level mapping (GLSP → MCP, RFC 5424 names per the MCP spec):
44
+ * - `info` → `info`
45
+ * - `warn` → `warning`
46
+ * - `error` → `error`
47
+ * - `debug` → `debug`
48
+ *
49
+ * Shared across MCP clients on the same GLSP session; per-client routing is handled by the
50
+ * active `mcpRequestContext` frame, and the per-MCP-session `logging/setLevel` threshold is
51
+ * stored in {@link McpLogLevelRegistry}.
52
+ *
53
+ * @experimental
54
+ */
55
+ let McpLogger = class McpLogger {
56
+ info(message, ...meta) {
57
+ this.glspLogger.info(message, ...meta);
58
+ this.notify('info', message);
59
+ }
60
+ warn(message, ...meta) {
61
+ this.glspLogger.warn(message, ...meta);
62
+ this.notify('warning', message);
63
+ }
64
+ error(message, ...meta) {
65
+ this.glspLogger.error(message, ...meta);
66
+ this.notify('error', message);
67
+ }
68
+ debug(message, ...meta) {
69
+ this.glspLogger.debug(message, ...meta);
70
+ this.notify('debug', message);
71
+ }
72
+ /**
73
+ * Send a `notifications/message` to the connected MCP client when invoked inside an active
74
+ * request context AND the message passes the session's `logging/setLevel` threshold.
75
+ * Outside a request context (init contributions, background timers) this is a no-op so the
76
+ * same logger can be used everywhere without orphan-notification leaks.
77
+ *
78
+ * Failures to deliver are swallowed — a broken transport must not break the producing tool.
79
+ */
80
+ notify(level, data) {
81
+ const extra = mcp_request_context_1.mcpRequestContext.getStore();
82
+ if (!extra) {
83
+ return;
84
+ }
85
+ const threshold = this.levelRegistry.getLevel(extra.sessionId);
86
+ if (!(0, mcp_log_level_registry_1.passesLogThreshold)(level, threshold)) {
87
+ return;
88
+ }
89
+ extra.sendNotification({ method: 'notifications/message', params: { level, data } }).catch(() => undefined);
90
+ }
91
+ };
92
+ exports.McpLogger = McpLogger;
93
+ __decorate([
94
+ (0, inversify_1.inject)(server_1.Logger),
95
+ __metadata("design:type", server_1.Logger)
96
+ ], McpLogger.prototype, "glspLogger", void 0);
97
+ __decorate([
98
+ (0, inversify_1.inject)(mcp_log_level_registry_1.McpLogLevelRegistry),
99
+ __metadata("design:type", Object)
100
+ ], McpLogger.prototype, "levelRegistry", void 0);
101
+ exports.McpLogger = McpLogger = __decorate([
102
+ (0, inversify_1.injectable)()
103
+ ], McpLogger);
104
+ //# sourceMappingURL=mcp-logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-logger.js","sourceRoot":"","sources":["../../src/server/mcp-logger.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;AAElF,iDAA8C;AAE9C,yCAA+C;AAC/C,qEAAmF;AACnF,+DAA0D;AAE1D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEI,IAAM,SAAS,GAAf,MAAM,SAAS;IAKlB,IAAI,CAAC,OAAe,EAAE,GAAG,IAAe;QACpC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,CAAC;IAED,IAAI,CAAC,OAAe,EAAE,GAAG,IAAe;QACpC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACpC,CAAC;IAED,KAAK,CAAC,OAAe,EAAE,GAAG,IAAe;QACrC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;QACxC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAClC,CAAC;IAED,KAAK,CAAC,OAAe,EAAE,GAAG,IAAe;QACrC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;QACxC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAClC,CAAC;IAED;;;;;;;OAOG;IACO,MAAM,CAAC,KAAmB,EAAE,IAAY;QAC9C,MAAM,KAAK,GAAG,uCAAiB,CAAC,QAAQ,EAAE,CAAC;QAC3C,IAAI,CAAC,KAAK,EAAE,CAAC;YACT,OAAO;QACX,CAAC;QACD,MAAM,SAAS,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAC/D,IAAI,CAAC,IAAA,2CAAkB,EAAC,KAAK,EAAE,SAAS,CAAC,EAAE,CAAC;YACxC,OAAO;QACX,CAAC;QACD,KAAK,CAAC,gBAAgB,CAAC,EAAE,MAAM,EAAE,uBAAuB,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IAChH,CAAC;CACJ,CAAA;AA5CY,8BAAS;AACQ;IAAzB,IAAA,kBAAM,EAAC,eAAM,CAAC;8BAAuB,eAAM;6CAAC;AAEN;IAAtC,IAAA,kBAAM,EAAC,4CAAmB,CAAC;;gDAA8C;oBAHjE,SAAS;IADrB,IAAA,sBAAU,GAAE;GACA,SAAS,CA4CrB"}
@@ -0,0 +1,28 @@
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 { ProposalString } from '@eclipse-glsp/protocol';
17
+ /**
18
+ * MIME type for an MCP resource. Annotating a `mimeType` field with this type prompts the IDE
19
+ * to suggest the listed common values; any other string the MCP SDK accepts is also valid (the
20
+ * `(string & {})` part of `ProposalString` keeps the field free-form).
21
+ *
22
+ * Unlike `MarkersReason` / `EditMode` (closed sets of framework-defined enum values), MIME
23
+ * types are open and IANA-defined — the listed literals are common, not exhaustive. There's
24
+ * no companion const object: at the call site, adopters write the string literal directly
25
+ * (`readonly mimeType: McpMimeType = 'image/png';`).
26
+ */
27
+ export type McpMimeType = ProposalString<'text/plain' | 'text/markdown' | 'text/html' | 'application/json' | 'image/png' | 'image/jpeg' | 'image/svg+xml'>;
28
+ //# sourceMappingURL=mcp-mime-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-mime-types.d.ts","sourceRoot":"","sources":["../../src/server/mcp-mime-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD;;;;;;;;;GASG;AACH,MAAM,MAAM,WAAW,GAAG,cAAc,CACpC,YAAY,GAAG,eAAe,GAAG,WAAW,GAAG,kBAAkB,GAAG,WAAW,GAAG,YAAY,GAAG,eAAe,CACnH,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-mime-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-mime-types.js","sourceRoot":"","sources":["../../src/server/mcp-mime-types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF"}
@@ -0,0 +1,39 @@
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 { McpServerOptions as McpServerOptionsType } from '@eclipse-glsp/protocol';
17
+ /**
18
+ * Holds the launcher-scoped MCP options. The launcher merges adopter-provided defaults
19
+ * (passed to the {@link AbstractMcpServerModule} constructor, bound as
20
+ * {@link McpServerDefaults}) with deployment-time overrides from the GLSP `initialize` request,
21
+ * then writes the merged result to `values`. Consumers `@inject(McpServerOptions)` and read
22
+ * `.values.<key>` directly.
23
+ *
24
+ * Bound as a singleton on the server container — the shared reference means server-scope
25
+ * singletons constructed before init still observe populated values once init runs.
26
+ *
27
+ * @experimental
28
+ */
29
+ export declare class McpServerOptions {
30
+ values: McpServerOptionsType;
31
+ }
32
+ /**
33
+ * DI binding identifier for adopter-provided default options. Supplied via the
34
+ * {@link AbstractMcpServerModule} constructor and merged with init-time options by
35
+ * `McpServerLauncher.initializeServer` — init-time wins per field.
36
+ */
37
+ export declare const McpServerDefaults: unique symbol;
38
+ export type McpServerDefaults = McpServerOptionsType;
39
+ //# sourceMappingURL=mcp-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-options.d.ts","sourceRoot":"","sources":["../../src/server/mcp-options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,gBAAgB,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAGlF;;;;;;;;;;;GAWG;AACH,qBACa,gBAAgB;IACzB,MAAM,EAAE,oBAAoB,CAAM;CACrC;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,eAA8B,CAAC;AAC7D,MAAM,MAAM,iBAAiB,GAAG,oBAAoB,CAAC"}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (c) 2026 EclipseSource and others.
4
+ *
5
+ * This program and the accompanying materials are made available under the
6
+ * terms of the Eclipse Public License v. 2.0 which is available at
7
+ * http://www.eclipse.org/legal/epl-2.0.
8
+ *
9
+ * This Source Code may also be made available under the following Secondary
10
+ * Licenses when the conditions for such availability set forth in the Eclipse
11
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ * with the GNU Classpath Exception which is available at
13
+ * https://www.gnu.org/software/classpath/license.html.
14
+ *
15
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
+ ********************************************************************************/
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.McpServerDefaults = exports.McpServerOptions = void 0;
25
+ const inversify_1 = require("inversify");
26
+ /**
27
+ * Holds the launcher-scoped MCP options. The launcher merges adopter-provided defaults
28
+ * (passed to the {@link AbstractMcpServerModule} constructor, bound as
29
+ * {@link McpServerDefaults}) with deployment-time overrides from the GLSP `initialize` request,
30
+ * then writes the merged result to `values`. Consumers `@inject(McpServerOptions)` and read
31
+ * `.values.<key>` directly.
32
+ *
33
+ * Bound as a singleton on the server container — the shared reference means server-scope
34
+ * singletons constructed before init still observe populated values once init runs.
35
+ *
36
+ * @experimental
37
+ */
38
+ let McpServerOptions = class McpServerOptions {
39
+ constructor() {
40
+ this.values = {};
41
+ }
42
+ };
43
+ exports.McpServerOptions = McpServerOptions;
44
+ exports.McpServerOptions = McpServerOptions = __decorate([
45
+ (0, inversify_1.injectable)()
46
+ ], McpServerOptions);
47
+ /**
48
+ * DI binding identifier for adopter-provided default options. Supplied via the
49
+ * {@link AbstractMcpServerModule} constructor and merged with init-time options by
50
+ * `McpServerLauncher.initializeServer` — init-time wins per field.
51
+ */
52
+ exports.McpServerDefaults = Symbol('McpServerDefaults');
53
+ //# sourceMappingURL=mcp-options.js.map