@structured-world/gitlab-mcp 6.62.1 → 7.0.1

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 (435) hide show
  1. package/README.md +22 -1
  2. package/README.md.in +21 -0
  3. package/dist/generated/prisma/client.js.map +1 -1
  4. package/dist/generated/prisma/internal/class.js +2 -2
  5. package/dist/generated/prisma/internal/class.js.map +1 -1
  6. package/dist/generated/prisma/internal/prismaNamespace.js +2 -2
  7. package/dist/generated/prisma/models/AuthCodeFlowState.d.ts +1 -2
  8. package/dist/generated/prisma/models/AuthorizationCode.d.ts +1 -2
  9. package/dist/generated/prisma/models/DeviceFlowState.d.ts +1 -2
  10. package/dist/generated/prisma/models/McpSessionMapping.d.ts +1 -2
  11. package/dist/generated/prisma/models/OAuthSession.d.ts +1 -2
  12. package/dist/src/cli/docker/container-runtime.d.ts +1 -1
  13. package/dist/src/cli/docker/container-runtime.js +14 -14
  14. package/dist/src/cli/docker/docker-command.d.ts +1 -1
  15. package/dist/src/cli/docker/docker-command.js +113 -113
  16. package/dist/src/cli/docker/docker-command.js.map +1 -1
  17. package/dist/src/cli/docker/docker-utils.d.ts +3 -3
  18. package/dist/src/cli/docker/docker-utils.js +74 -74
  19. package/dist/src/cli/docker/docker-utils.js.map +1 -1
  20. package/dist/src/cli/docker/index.d.ts +4 -4
  21. package/dist/src/cli/docker/types.d.ts +3 -3
  22. package/dist/src/cli/docker/types.js +5 -5
  23. package/dist/src/cli/init/browser.js +2 -2
  24. package/dist/src/cli/init/config-generator.d.ts +2 -2
  25. package/dist/src/cli/init/config-generator.js +22 -22
  26. package/dist/src/cli/init/connection.d.ts +1 -1
  27. package/dist/src/cli/init/connection.js +27 -27
  28. package/dist/src/cli/init/connection.js.map +1 -1
  29. package/dist/src/cli/init/index.d.ts +4 -4
  30. package/dist/src/cli/init/types.d.ts +3 -3
  31. package/dist/src/cli/init/types.js +36 -36
  32. package/dist/src/cli/init/wizard.js +80 -80
  33. package/dist/src/cli/init/wizard.js.map +1 -1
  34. package/dist/src/cli/inject-tool-refs.js +47 -47
  35. package/dist/src/cli/inject-tool-refs.js.map +1 -1
  36. package/dist/src/cli/install/backup.d.ts +1 -1
  37. package/dist/src/cli/install/backup.js +3 -3
  38. package/dist/src/cli/install/detector.d.ts +2 -2
  39. package/dist/src/cli/install/detector.js +18 -18
  40. package/dist/src/cli/install/detector.js.map +1 -1
  41. package/dist/src/cli/install/index.d.ts +5 -5
  42. package/dist/src/cli/install/install-command.d.ts +2 -2
  43. package/dist/src/cli/install/install-command.js +68 -68
  44. package/dist/src/cli/install/install-command.js.map +1 -1
  45. package/dist/src/cli/install/installers.d.ts +2 -2
  46. package/dist/src/cli/install/installers.js +55 -55
  47. package/dist/src/cli/install/installers.js.map +1 -1
  48. package/dist/src/cli/install/types.d.ts +4 -4
  49. package/dist/src/cli/install/types.js +48 -48
  50. package/dist/src/cli/instances/index.d.ts +2 -2
  51. package/dist/src/cli/instances/instances-command.d.ts +1 -1
  52. package/dist/src/cli/instances/instances-command.js +70 -66
  53. package/dist/src/cli/instances/instances-command.js.map +1 -1
  54. package/dist/src/cli/list-tools.js +396 -396
  55. package/dist/src/cli/list-tools.js.map +1 -1
  56. package/dist/src/cli/setup/discovery.d.ts +1 -1
  57. package/dist/src/cli/setup/discovery.js +10 -10
  58. package/dist/src/cli/setup/discovery.js.map +1 -1
  59. package/dist/src/cli/setup/flows/configure-existing.d.ts +1 -1
  60. package/dist/src/cli/setup/flows/configure-existing.js +57 -57
  61. package/dist/src/cli/setup/flows/configure-existing.js.map +1 -1
  62. package/dist/src/cli/setup/flows/local-setup.d.ts +1 -1
  63. package/dist/src/cli/setup/flows/local-setup.js +51 -51
  64. package/dist/src/cli/setup/flows/local-setup.js.map +1 -1
  65. package/dist/src/cli/setup/flows/server-setup.d.ts +1 -1
  66. package/dist/src/cli/setup/flows/server-setup.js +50 -50
  67. package/dist/src/cli/setup/flows/server-setup.js.map +1 -1
  68. package/dist/src/cli/setup/flows/tool-selection.d.ts +1 -1
  69. package/dist/src/cli/setup/flows/tool-selection.js +94 -94
  70. package/dist/src/cli/setup/flows/tool-selection.js.map +1 -1
  71. package/dist/src/cli/setup/index.d.ts +4 -4
  72. package/dist/src/cli/setup/presets.d.ts +1 -1
  73. package/dist/src/cli/setup/presets.js +157 -157
  74. package/dist/src/cli/setup/presets.js.map +1 -1
  75. package/dist/src/cli/setup/types.d.ts +7 -7
  76. package/dist/src/cli/setup/wizard.d.ts +1 -1
  77. package/dist/src/cli/setup/wizard.js +25 -25
  78. package/dist/src/cli/utils/index.d.ts +1 -1
  79. package/dist/src/cli/utils/path-utils.js +3 -3
  80. package/dist/src/cli-utils.d.ts +2 -2
  81. package/dist/src/cli-utils.js +46 -46
  82. package/dist/src/config/index.d.ts +4 -4
  83. package/dist/src/config/instances-loader.d.ts +3 -3
  84. package/dist/src/config/instances-loader.js +53 -53
  85. package/dist/src/config/instances-loader.js.map +1 -1
  86. package/dist/src/config/instances-schema.d.ts +1 -1
  87. package/dist/src/config/instances-schema.js +33 -33
  88. package/dist/src/config/instances-schema.js.map +1 -1
  89. package/dist/src/config.d.ts +11 -4
  90. package/dist/src/config.js +112 -111
  91. package/dist/src/config.js.map +1 -1
  92. package/dist/src/dashboard/handler.d.ts +2 -2
  93. package/dist/src/dashboard/handler.js +7 -7
  94. package/dist/src/dashboard/html-template.d.ts +1 -1
  95. package/dist/src/dashboard/html-template.js +44 -44
  96. package/dist/src/dashboard/html-template.js.map +1 -1
  97. package/dist/src/dashboard/index.d.ts +4 -4
  98. package/dist/src/dashboard/metrics.d.ts +3 -3
  99. package/dist/src/dashboard/metrics.js +42 -42
  100. package/dist/src/discovery/auto.d.ts +3 -3
  101. package/dist/src/discovery/auto.js +28 -28
  102. package/dist/src/discovery/git-remote.d.ts +2 -2
  103. package/dist/src/discovery/git-remote.js +18 -18
  104. package/dist/src/discovery/index.d.ts +3 -3
  105. package/dist/src/discovery/profile-matcher.d.ts +2 -2
  106. package/dist/src/discovery/profile-matcher.js +8 -8
  107. package/dist/src/discovery/profile-matcher.js.map +1 -1
  108. package/dist/src/entities/context/context-manager.d.ts +3 -3
  109. package/dist/src/entities/context/context-manager.js +34 -34
  110. package/dist/src/entities/context/context-manager.js.map +1 -1
  111. package/dist/src/entities/context/handlers.d.ts +2 -2
  112. package/dist/src/entities/context/handlers.js +8 -8
  113. package/dist/src/entities/context/index.d.ts +8 -8
  114. package/dist/src/entities/context/index.js +1 -1
  115. package/dist/src/entities/context/registry.d.ts +1 -1
  116. package/dist/src/entities/context/registry.js +4 -4
  117. package/dist/src/entities/context/schema.d.ts +1 -1
  118. package/dist/src/entities/context/schema.js +19 -19
  119. package/dist/src/entities/context/types.d.ts +9 -9
  120. package/dist/src/entities/context/whoami.d.ts +1 -1
  121. package/dist/src/entities/context/whoami.js +31 -31
  122. package/dist/src/entities/context/whoami.js.map +1 -1
  123. package/dist/src/entities/core/index.d.ts +5 -5
  124. package/dist/src/entities/core/index.js +1 -1
  125. package/dist/src/entities/core/registry.d.ts +1 -1
  126. package/dist/src/entities/core/registry.js +194 -194
  127. package/dist/src/entities/core/registry.js.map +1 -1
  128. package/dist/src/entities/core/schema-readonly.d.ts +1 -1
  129. package/dist/src/entities/core/schema-readonly.js +117 -117
  130. package/dist/src/entities/core/schema.d.ts +1 -1
  131. package/dist/src/entities/core/schema.js +67 -67
  132. package/dist/src/entities/files/index.d.ts +5 -5
  133. package/dist/src/entities/files/index.js +1 -1
  134. package/dist/src/entities/files/registry.d.ts +1 -1
  135. package/dist/src/entities/files/registry.js +45 -45
  136. package/dist/src/entities/files/registry.js.map +1 -1
  137. package/dist/src/entities/files/schema-readonly.d.ts +1 -1
  138. package/dist/src/entities/files/schema-readonly.js +13 -13
  139. package/dist/src/entities/files/schema.d.ts +1 -1
  140. package/dist/src/entities/files/schema.js +29 -29
  141. package/dist/src/entities/index.d.ts +17 -17
  142. package/dist/src/entities/integrations/index.d.ts +4 -4
  143. package/dist/src/entities/integrations/registry.d.ts +1 -1
  144. package/dist/src/entities/integrations/registry.js +17 -17
  145. package/dist/src/entities/integrations/registry.js.map +1 -1
  146. package/dist/src/entities/integrations/schema-readonly.d.ts +1 -1
  147. package/dist/src/entities/integrations/schema-readonly.js +5 -5
  148. package/dist/src/entities/integrations/schema.d.ts +1 -1
  149. package/dist/src/entities/integrations/schema.js +69 -69
  150. package/dist/src/entities/iterations/index.d.ts +2 -2
  151. package/dist/src/entities/iterations/registry.d.ts +1 -1
  152. package/dist/src/entities/iterations/registry.js +13 -13
  153. package/dist/src/entities/iterations/registry.js.map +1 -1
  154. package/dist/src/entities/iterations/schema-readonly.d.ts +1 -1
  155. package/dist/src/entities/iterations/schema-readonly.js +9 -9
  156. package/dist/src/entities/labels/index.d.ts +5 -5
  157. package/dist/src/entities/labels/index.js +1 -1
  158. package/dist/src/entities/labels/registry.d.ts +1 -1
  159. package/dist/src/entities/labels/registry.js +19 -19
  160. package/dist/src/entities/labels/registry.js.map +1 -1
  161. package/dist/src/entities/labels/schema-readonly.d.ts +1 -1
  162. package/dist/src/entities/labels/schema-readonly.js +8 -8
  163. package/dist/src/entities/labels/schema.d.ts +1 -1
  164. package/dist/src/entities/labels/schema.js +11 -11
  165. package/dist/src/entities/members/index.d.ts +3 -3
  166. package/dist/src/entities/members/registry.d.ts +1 -1
  167. package/dist/src/entities/members/registry.js +26 -26
  168. package/dist/src/entities/members/registry.js.map +1 -1
  169. package/dist/src/entities/members/schema-readonly.d.ts +1 -1
  170. package/dist/src/entities/members/schema-readonly.js +32 -32
  171. package/dist/src/entities/members/schema-readonly.js.map +1 -1
  172. package/dist/src/entities/members/schema.d.ts +1 -1
  173. package/dist/src/entities/members/schema.js +28 -28
  174. package/dist/src/entities/milestones/index.d.ts +5 -5
  175. package/dist/src/entities/milestones/index.js +1 -1
  176. package/dist/src/entities/milestones/registry.d.ts +1 -1
  177. package/dist/src/entities/milestones/registry.js +25 -25
  178. package/dist/src/entities/milestones/registry.js.map +1 -1
  179. package/dist/src/entities/milestones/schema-readonly.d.ts +2 -2
  180. package/dist/src/entities/milestones/schema-readonly.js +15 -15
  181. package/dist/src/entities/milestones/schema.d.ts +1 -1
  182. package/dist/src/entities/milestones/schema.js +16 -16
  183. package/dist/src/entities/milestones/schema.js.map +1 -1
  184. package/dist/src/entities/mrs/index.d.ts +5 -5
  185. package/dist/src/entities/mrs/index.js +1 -1
  186. package/dist/src/entities/mrs/registry.d.ts +1 -1
  187. package/dist/src/entities/mrs/registry.js +102 -102
  188. package/dist/src/entities/mrs/registry.js.map +1 -1
  189. package/dist/src/entities/mrs/schema-readonly.d.ts +1 -1
  190. package/dist/src/entities/mrs/schema-readonly.js +126 -126
  191. package/dist/src/entities/mrs/schema-readonly.js.map +1 -1
  192. package/dist/src/entities/mrs/schema.d.ts +1 -1
  193. package/dist/src/entities/mrs/schema.js +111 -111
  194. package/dist/src/entities/mrs/schema.js.map +1 -1
  195. package/dist/src/entities/pipelines/index.d.ts +5 -5
  196. package/dist/src/entities/pipelines/index.js +1 -1
  197. package/dist/src/entities/pipelines/registry.d.ts +1 -1
  198. package/dist/src/entities/pipelines/registry.js +45 -45
  199. package/dist/src/entities/pipelines/registry.js.map +1 -1
  200. package/dist/src/entities/pipelines/schema-readonly.d.ts +2 -2
  201. package/dist/src/entities/pipelines/schema-readonly.js +73 -73
  202. package/dist/src/entities/pipelines/schema.d.ts +1 -1
  203. package/dist/src/entities/pipelines/schema.js +21 -21
  204. package/dist/src/entities/refs/index.d.ts +3 -3
  205. package/dist/src/entities/refs/registry.d.ts +1 -1
  206. package/dist/src/entities/refs/registry.js +31 -31
  207. package/dist/src/entities/refs/registry.js.map +1 -1
  208. package/dist/src/entities/refs/schema-readonly.d.ts +1 -1
  209. package/dist/src/entities/refs/schema-readonly.js +21 -21
  210. package/dist/src/entities/refs/schema.d.ts +1 -1
  211. package/dist/src/entities/refs/schema.js +56 -56
  212. package/dist/src/entities/releases/index.d.ts +3 -3
  213. package/dist/src/entities/releases/registry.d.ts +1 -1
  214. package/dist/src/entities/releases/registry.js +21 -21
  215. package/dist/src/entities/releases/registry.js.map +1 -1
  216. package/dist/src/entities/releases/schema-readonly.d.ts +1 -1
  217. package/dist/src/entities/releases/schema-readonly.js +13 -13
  218. package/dist/src/entities/releases/schema.d.ts +1 -1
  219. package/dist/src/entities/releases/schema.js +21 -21
  220. package/dist/src/entities/search/index.d.ts +2 -2
  221. package/dist/src/entities/search/registry.d.ts +1 -1
  222. package/dist/src/entities/search/registry.js +13 -13
  223. package/dist/src/entities/search/schema-readonly.d.ts +1 -1
  224. package/dist/src/entities/search/schema-readonly.js +23 -23
  225. package/dist/src/entities/shared.d.ts +1 -1
  226. package/dist/src/entities/shared.js +5 -5
  227. package/dist/src/entities/snippets/index.d.ts +5 -5
  228. package/dist/src/entities/snippets/index.js +1 -1
  229. package/dist/src/entities/snippets/registry.d.ts +1 -1
  230. package/dist/src/entities/snippets/registry.js +24 -24
  231. package/dist/src/entities/snippets/registry.js.map +1 -1
  232. package/dist/src/entities/snippets/schema-readonly.d.ts +1 -1
  233. package/dist/src/entities/snippets/schema-readonly.js +11 -11
  234. package/dist/src/entities/snippets/schema.d.ts +1 -1
  235. package/dist/src/entities/snippets/schema.js +27 -27
  236. package/dist/src/entities/snippets/schema.js.map +1 -1
  237. package/dist/src/entities/utils.d.ts +2 -2
  238. package/dist/src/entities/utils.js +8 -8
  239. package/dist/src/entities/utils.js.map +1 -1
  240. package/dist/src/entities/variables/index.d.ts +5 -5
  241. package/dist/src/entities/variables/index.js +1 -1
  242. package/dist/src/entities/variables/registry.d.ts +1 -1
  243. package/dist/src/entities/variables/registry.js +22 -22
  244. package/dist/src/entities/variables/registry.js.map +1 -1
  245. package/dist/src/entities/variables/schema-readonly.d.ts +1 -1
  246. package/dist/src/entities/variables/schema-readonly.js +6 -6
  247. package/dist/src/entities/variables/schema.d.ts +1 -1
  248. package/dist/src/entities/variables/schema.js +21 -21
  249. package/dist/src/entities/variables/schema.js.map +1 -1
  250. package/dist/src/entities/webhooks/index.d.ts +4 -4
  251. package/dist/src/entities/webhooks/registry.d.ts +1 -1
  252. package/dist/src/entities/webhooks/registry.js +29 -29
  253. package/dist/src/entities/webhooks/registry.js.map +1 -1
  254. package/dist/src/entities/webhooks/schema-readonly.d.ts +1 -1
  255. package/dist/src/entities/webhooks/schema-readonly.js +9 -9
  256. package/dist/src/entities/webhooks/schema.d.ts +1 -1
  257. package/dist/src/entities/webhooks/schema.js +59 -59
  258. package/dist/src/entities/wiki/index.d.ts +5 -5
  259. package/dist/src/entities/wiki/index.js +1 -1
  260. package/dist/src/entities/wiki/registry.d.ts +1 -1
  261. package/dist/src/entities/wiki/registry.js +19 -19
  262. package/dist/src/entities/wiki/registry.js.map +1 -1
  263. package/dist/src/entities/wiki/schema-readonly.d.ts +1 -1
  264. package/dist/src/entities/wiki/schema-readonly.js +6 -6
  265. package/dist/src/entities/wiki/schema.d.ts +1 -1
  266. package/dist/src/entities/wiki/schema.js +12 -12
  267. package/dist/src/entities/workitems/index.d.ts +5 -5
  268. package/dist/src/entities/workitems/index.js +1 -1
  269. package/dist/src/entities/workitems/registry.d.ts +1 -1
  270. package/dist/src/entities/workitems/registry.js +101 -101
  271. package/dist/src/entities/workitems/registry.js.map +1 -1
  272. package/dist/src/entities/workitems/schema-readonly.d.ts +1 -1
  273. package/dist/src/entities/workitems/schema-readonly.js +27 -27
  274. package/dist/src/entities/workitems/schema-readonly.js.map +1 -1
  275. package/dist/src/entities/workitems/schema.d.ts +1 -1
  276. package/dist/src/entities/workitems/schema.js +58 -58
  277. package/dist/src/graphql/DynamicWorkItemsQuery.d.ts +2 -2
  278. package/dist/src/graphql/DynamicWorkItemsQuery.js +47 -47
  279. package/dist/src/graphql/DynamicWorkItemsQuery.js.map +1 -1
  280. package/dist/src/graphql/client.d.ts +1 -1
  281. package/dist/src/graphql/client.js +4 -4
  282. package/dist/src/graphql/client.js.map +1 -1
  283. package/dist/src/graphql/index.d.ts +2 -2
  284. package/dist/src/graphql/workItems.d.ts +38 -38
  285. package/dist/src/graphql/workItems.js +30 -30
  286. package/dist/src/handlers.d.ts +2 -1
  287. package/dist/src/handlers.js +258 -86
  288. package/dist/src/handlers.js.map +1 -1
  289. package/dist/src/http-client.js +3 -3
  290. package/dist/src/logger.js +25 -25
  291. package/dist/src/logging/access-log.d.ts +2 -2
  292. package/dist/src/logging/access-log.js +25 -25
  293. package/dist/src/logging/connection-tracker.d.ts +1 -1
  294. package/dist/src/logging/connection-tracker.js +3 -3
  295. package/dist/src/logging/index.d.ts +5 -5
  296. package/dist/src/logging/request-tracker.d.ts +3 -3
  297. package/dist/src/logging/request-tracker.js +4 -4
  298. package/dist/src/logging/types.d.ts +3 -3
  299. package/dist/src/logging/types.js +1 -1
  300. package/dist/src/logging/types.js.map +1 -1
  301. package/dist/src/main.js +28 -28
  302. package/dist/src/middleware/index.d.ts +3 -2
  303. package/dist/src/middleware/index.js +3 -1
  304. package/dist/src/middleware/index.js.map +1 -1
  305. package/dist/src/middleware/oauth-auth.d.ts +1 -1
  306. package/dist/src/middleware/oauth-auth.js +17 -17
  307. package/dist/src/middleware/rate-limiter.d.ts +1 -1
  308. package/dist/src/middleware/rate-limiter.js +32 -32
  309. package/dist/src/middleware/response-write-timeout.d.ts +2 -0
  310. package/dist/src/middleware/response-write-timeout.js +62 -0
  311. package/dist/src/middleware/response-write-timeout.js.map +1 -0
  312. package/dist/src/oauth/config.d.ts +1 -1
  313. package/dist/src/oauth/config.js +18 -18
  314. package/dist/src/oauth/config.js.map +1 -1
  315. package/dist/src/oauth/endpoints/authorize.d.ts +1 -1
  316. package/dist/src/oauth/endpoints/authorize.js +32 -32
  317. package/dist/src/oauth/endpoints/callback.d.ts +1 -1
  318. package/dist/src/oauth/endpoints/callback.js +26 -26
  319. package/dist/src/oauth/endpoints/index.d.ts +5 -5
  320. package/dist/src/oauth/endpoints/metadata.d.ts +1 -1
  321. package/dist/src/oauth/endpoints/metadata.js +12 -12
  322. package/dist/src/oauth/endpoints/register.d.ts +1 -1
  323. package/dist/src/oauth/endpoints/register.js +9 -9
  324. package/dist/src/oauth/endpoints/token.d.ts +1 -1
  325. package/dist/src/oauth/endpoints/token.js +28 -28
  326. package/dist/src/oauth/gitlab-device-flow.d.ts +2 -2
  327. package/dist/src/oauth/gitlab-device-flow.js +73 -68
  328. package/dist/src/oauth/gitlab-device-flow.js.map +1 -1
  329. package/dist/src/oauth/index.d.ts +10 -10
  330. package/dist/src/oauth/session-store.d.ts +2 -2
  331. package/dist/src/oauth/session-store.js +40 -40
  332. package/dist/src/oauth/session-store.js.map +1 -1
  333. package/dist/src/oauth/storage/factory.d.ts +2 -2
  334. package/dist/src/oauth/storage/factory.js +16 -16
  335. package/dist/src/oauth/storage/file.d.ts +2 -2
  336. package/dist/src/oauth/storage/file.js +22 -22
  337. package/dist/src/oauth/storage/file.js.map +1 -1
  338. package/dist/src/oauth/storage/index.d.ts +5 -5
  339. package/dist/src/oauth/storage/memory.d.ts +2 -2
  340. package/dist/src/oauth/storage/memory.js +18 -18
  341. package/dist/src/oauth/storage/memory.js.map +1 -1
  342. package/dist/src/oauth/storage/postgresql.d.ts +2 -2
  343. package/dist/src/oauth/storage/postgresql.js +11 -11
  344. package/dist/src/oauth/storage/postgresql.js.map +1 -1
  345. package/dist/src/oauth/storage/types.d.ts +3 -3
  346. package/dist/src/oauth/token-context.d.ts +1 -1
  347. package/dist/src/oauth/token-context.js +1 -1
  348. package/dist/src/oauth/token-utils.d.ts +1 -1
  349. package/dist/src/oauth/token-utils.js +20 -20
  350. package/dist/src/oauth/types.d.ts +3 -3
  351. package/dist/src/profiles/applicator.d.ts +1 -1
  352. package/dist/src/profiles/applicator.js +48 -48
  353. package/dist/src/profiles/index.d.ts +5 -5
  354. package/dist/src/profiles/loader.d.ts +3 -3
  355. package/dist/src/profiles/loader.js +25 -25
  356. package/dist/src/profiles/loader.js.map +1 -1
  357. package/dist/src/profiles/project-loader.d.ts +1 -1
  358. package/dist/src/profiles/project-loader.js +23 -23
  359. package/dist/src/profiles/project-loader.js.map +1 -1
  360. package/dist/src/profiles/scope-enforcer.d.ts +2 -2
  361. package/dist/src/profiles/scope-enforcer.js +25 -25
  362. package/dist/src/profiles/scope-enforcer.js.map +1 -1
  363. package/dist/src/profiles/types.d.ts +2 -2
  364. package/dist/src/profiles/types.js +50 -48
  365. package/dist/src/profiles/types.js.map +1 -1
  366. package/dist/src/registry-manager.d.ts +19 -11
  367. package/dist/src/registry-manager.js +257 -172
  368. package/dist/src/registry-manager.js.map +1 -1
  369. package/dist/src/server.js +165 -149
  370. package/dist/src/server.js.map +1 -1
  371. package/dist/src/services/ConnectionManager.d.ts +33 -24
  372. package/dist/src/services/ConnectionManager.js +304 -179
  373. package/dist/src/services/ConnectionManager.js.map +1 -1
  374. package/dist/src/services/GitLabVersionDetector.d.ts +2 -2
  375. package/dist/src/services/GitLabVersionDetector.js +45 -45
  376. package/dist/src/services/GitLabVersionDetector.js.map +1 -1
  377. package/dist/src/services/HealthMonitor.d.ts +42 -0
  378. package/dist/src/services/HealthMonitor.js +544 -0
  379. package/dist/src/services/HealthMonitor.js.map +1 -0
  380. package/dist/src/services/InstanceConnectionPool.d.ts +2 -2
  381. package/dist/src/services/InstanceConnectionPool.js +13 -13
  382. package/dist/src/services/InstanceConnectionPool.js.map +1 -1
  383. package/dist/src/services/InstanceRateLimiter.js +6 -6
  384. package/dist/src/services/InstanceRateLimiter.js.map +1 -1
  385. package/dist/src/services/InstanceRegistry.d.ts +4 -5
  386. package/dist/src/services/InstanceRegistry.js +29 -41
  387. package/dist/src/services/InstanceRegistry.js.map +1 -1
  388. package/dist/src/services/NamespaceTierDetector.d.ts +2 -2
  389. package/dist/src/services/NamespaceTierDetector.js +30 -30
  390. package/dist/src/services/NamespaceTierDetector.js.map +1 -1
  391. package/dist/src/services/SchemaIntrospector.d.ts +2 -1
  392. package/dist/src/services/SchemaIntrospector.js +45 -42
  393. package/dist/src/services/SchemaIntrospector.js.map +1 -1
  394. package/dist/src/services/TokenScopeDetector.d.ts +4 -4
  395. package/dist/src/services/TokenScopeDetector.js +133 -110
  396. package/dist/src/services/TokenScopeDetector.js.map +1 -1
  397. package/dist/src/services/ToolAvailability.d.ts +15 -11
  398. package/dist/src/services/ToolAvailability.js +150 -130
  399. package/dist/src/services/ToolAvailability.js.map +1 -1
  400. package/dist/src/services/WidgetAvailability.d.ts +5 -5
  401. package/dist/src/services/WidgetAvailability.js +40 -39
  402. package/dist/src/services/WidgetAvailability.js.map +1 -1
  403. package/dist/src/session-manager.d.ts +3 -2
  404. package/dist/src/session-manager.js +17 -14
  405. package/dist/src/session-manager.js.map +1 -1
  406. package/dist/src/types.js +4 -4
  407. package/dist/src/utils/description-utils.js +4 -4
  408. package/dist/src/utils/description-utils.js.map +1 -1
  409. package/dist/src/utils/error-handler.d.ts +19 -10
  410. package/dist/src/utils/error-handler.js +272 -187
  411. package/dist/src/utils/error-handler.js.map +1 -1
  412. package/dist/src/utils/fetch.d.ts +7 -0
  413. package/dist/src/utils/fetch.js +136 -122
  414. package/dist/src/utils/fetch.js.map +1 -1
  415. package/dist/src/utils/gitlab-api.d.ts +1 -1
  416. package/dist/src/utils/gitlab-api.js +29 -26
  417. package/dist/src/utils/gitlab-api.js.map +1 -1
  418. package/dist/src/utils/idConversion.js +47 -47
  419. package/dist/src/utils/idConversion.js.map +1 -1
  420. package/dist/src/utils/namespace.d.ts +2 -2
  421. package/dist/src/utils/namespace.js +15 -15
  422. package/dist/src/utils/projectIdentifier.js +4 -4
  423. package/dist/src/utils/request-logger.d.ts +4 -4
  424. package/dist/src/utils/request-logger.js +5 -5
  425. package/dist/src/utils/schema-utils.js +24 -24
  426. package/dist/src/utils/schema-utils.js.map +1 -1
  427. package/dist/src/utils/smart-user-search.d.ts +1 -1
  428. package/dist/src/utils/smart-user-search.js +10 -10
  429. package/dist/src/utils/url.d.ts +1 -0
  430. package/dist/src/utils/url.js +38 -0
  431. package/dist/src/utils/url.js.map +1 -0
  432. package/dist/src/utils/version.js +1 -1
  433. package/dist/tsconfig.build.tsbuildinfo +1 -1
  434. package/package.json +22 -31
  435. package/dist/structured-world-gitlab-mcp-6.62.1.tgz +0 -0
@@ -22,16 +22,19 @@ const registry_18 = require("./entities/iterations/registry");
22
22
  const config_1 = require("./config");
23
23
  const ToolAvailability_1 = require("./services/ToolAvailability");
24
24
  const ConnectionManager_1 = require("./services/ConnectionManager");
25
+ const HealthMonitor_1 = require("./services/HealthMonitor");
25
26
  const TokenScopeDetector_1 = require("./services/TokenScopeDetector");
26
27
  const logger_1 = require("./logger");
27
28
  const schema_utils_1 = require("./utils/schema-utils");
28
29
  const description_utils_1 = require("./utils/description-utils");
30
+ const url_1 = require("./utils/url");
31
+ const token_context_1 = require("./oauth/token-context");
29
32
  class RegistryManager {
30
33
  static instance;
31
34
  registries = new Map();
32
- toolLookupCache = new Map();
33
- toolDefinitionsCache = null;
34
- toolNamesCache = null;
35
+ toolLookupCaches = new Map();
36
+ toolDefinitionsCaches = new Map();
37
+ toolNamesCaches = new Map();
35
38
  descriptionOverrides = new Map();
36
39
  readOnlyToolsCache = null;
37
40
  constructor() {
@@ -46,63 +49,63 @@ class RegistryManager {
46
49
  return RegistryManager.instance;
47
50
  }
48
51
  initializeRegistries() {
49
- this.registries.set("core", registry_1.coreToolRegistry);
50
- this.registries.set("context", registry_17.contextToolRegistry);
52
+ this.registries.set('core', registry_1.coreToolRegistry);
53
+ this.registries.set('context', registry_17.contextToolRegistry);
51
54
  if (config_1.USE_LABELS) {
52
- this.registries.set("labels", registry_2.labelsToolRegistry);
55
+ this.registries.set('labels', registry_2.labelsToolRegistry);
53
56
  }
54
57
  if (config_1.USE_MRS) {
55
- this.registries.set("mrs", registry_3.mrsToolRegistry);
58
+ this.registries.set('mrs', registry_3.mrsToolRegistry);
56
59
  }
57
60
  if (config_1.USE_FILES) {
58
- this.registries.set("files", registry_4.filesToolRegistry);
61
+ this.registries.set('files', registry_4.filesToolRegistry);
59
62
  }
60
63
  if (config_1.USE_MILESTONE) {
61
- this.registries.set("milestones", registry_5.milestonesToolRegistry);
64
+ this.registries.set('milestones', registry_5.milestonesToolRegistry);
62
65
  }
63
66
  if (config_1.USE_PIPELINE) {
64
- this.registries.set("pipelines", registry_6.pipelinesToolRegistry);
67
+ this.registries.set('pipelines', registry_6.pipelinesToolRegistry);
65
68
  }
66
69
  if (config_1.USE_VARIABLES) {
67
- this.registries.set("variables", registry_7.variablesToolRegistry);
70
+ this.registries.set('variables', registry_7.variablesToolRegistry);
68
71
  }
69
72
  if (config_1.USE_GITLAB_WIKI) {
70
- this.registries.set("wiki", registry_8.wikiToolRegistry);
73
+ this.registries.set('wiki', registry_8.wikiToolRegistry);
71
74
  }
72
75
  if (config_1.USE_WORKITEMS) {
73
- this.registries.set("workitems", registry_9.workitemsToolRegistry);
76
+ this.registries.set('workitems', registry_9.workitemsToolRegistry);
74
77
  }
75
78
  if (config_1.USE_SNIPPETS) {
76
- this.registries.set("snippets", registry_11.snippetsToolRegistry);
79
+ this.registries.set('snippets', registry_11.snippetsToolRegistry);
77
80
  }
78
81
  if (config_1.USE_WEBHOOKS) {
79
- this.registries.set("webhooks", registry_10.webhooksToolRegistry);
82
+ this.registries.set('webhooks', registry_10.webhooksToolRegistry);
80
83
  }
81
84
  if (config_1.USE_INTEGRATIONS) {
82
- this.registries.set("integrations", registry_12.integrationsToolRegistry);
85
+ this.registries.set('integrations', registry_12.integrationsToolRegistry);
83
86
  }
84
87
  if (config_1.USE_RELEASES) {
85
- this.registries.set("releases", registry_13.releasesToolRegistry);
88
+ this.registries.set('releases', registry_13.releasesToolRegistry);
86
89
  }
87
90
  if (config_1.USE_REFS) {
88
- this.registries.set("refs", registry_14.refsToolRegistry);
91
+ this.registries.set('refs', registry_14.refsToolRegistry);
89
92
  }
90
93
  if (config_1.USE_MEMBERS) {
91
- this.registries.set("members", registry_15.membersToolRegistry);
94
+ this.registries.set('members', registry_15.membersToolRegistry);
92
95
  }
93
96
  if (config_1.USE_SEARCH) {
94
- this.registries.set("search", registry_16.searchToolRegistry);
97
+ this.registries.set('search', registry_16.searchToolRegistry);
95
98
  }
96
99
  if (config_1.USE_ITERATIONS) {
97
- this.registries.set("iterations", registry_18.iterationsToolRegistry);
100
+ this.registries.set('iterations', registry_18.iterationsToolRegistry);
98
101
  }
99
102
  }
100
103
  loadDescriptionOverrides() {
101
104
  this.descriptionOverrides = (0, config_1.getToolDescriptionOverrides)();
102
105
  if (this.descriptionOverrides.size > 0) {
103
- (0, logger_1.logDebug)("Loaded tool description overrides", { count: this.descriptionOverrides.size });
106
+ (0, logger_1.logDebug)('Loaded tool description overrides', { count: this.descriptionOverrides.size });
104
107
  for (const [toolName, description] of this.descriptionOverrides) {
105
- (0, logger_1.logDebug)("Tool description override", { toolName, description });
108
+ (0, logger_1.logDebug)('Tool description override', { toolName, description });
106
109
  }
107
110
  }
108
111
  }
@@ -164,51 +167,73 @@ class RegistryManager {
164
167
  this.readOnlyToolsCache ??= this.buildReadOnlyToolsList();
165
168
  return this.readOnlyToolsCache;
166
169
  }
167
- buildToolLookupCache() {
168
- this.toolLookupCache.clear();
170
+ loadInstanceContext(instanceUrl) {
169
171
  let instanceInfo;
170
172
  try {
171
- const info = ConnectionManager_1.ConnectionManager.getInstance().getInstanceInfo();
173
+ const info = ConnectionManager_1.ConnectionManager.getInstance().getInstanceInfo(instanceUrl);
172
174
  instanceInfo = { tier: info.tier, version: info.version };
173
175
  }
174
- catch {
176
+ catch (err) {
177
+ const msg = err instanceof Error ? err.message : String(err);
178
+ if (!msg.includes('not initialized') &&
179
+ !msg.includes('not available') &&
180
+ !msg.includes('No connection')) {
181
+ (0, logger_1.logWarn)('Unexpected error loading instance info for tool cache', {
182
+ error: msg,
183
+ instanceUrl,
184
+ });
185
+ }
175
186
  }
176
187
  let tokenScopes;
177
188
  try {
178
- const scopeInfo = ConnectionManager_1.ConnectionManager.getInstance().getTokenScopeInfo();
189
+ const scopeInfo = ConnectionManager_1.ConnectionManager.getInstance().getTokenScopeInfo(instanceUrl);
179
190
  if (scopeInfo) {
180
191
  tokenScopes = scopeInfo.scopes;
181
192
  }
182
193
  }
183
- catch {
194
+ catch (err) {
195
+ const msg = err instanceof Error ? err.message : String(err);
196
+ if (!msg.includes('not initialized') &&
197
+ !msg.includes('not available') &&
198
+ !msg.includes('No connection')) {
199
+ (0, logger_1.logWarn)('Unexpected error loading token scopes for tool cache', {
200
+ error: msg,
201
+ instanceUrl,
202
+ });
203
+ }
184
204
  }
185
- for (const registry of this.registries.values()) {
205
+ return { instanceInfo, tokenScopes };
206
+ }
207
+ getToolExclusionReason(toolName, tool, ctx) {
208
+ if (config_1.GITLAB_READ_ONLY_MODE && !this.getReadOnlyTools().includes(toolName))
209
+ return 'readOnly';
210
+ if (config_1.GITLAB_DENIED_TOOLS_REGEX?.test(toolName))
211
+ return 'deniedRegex';
212
+ if (ctx.tokenScopes && !(0, TokenScopeDetector_1.isToolAvailableForScopes)(toolName, ctx.tokenScopes))
213
+ return 'scopes';
214
+ const isContextTool = this.registries.get('context')?.has(toolName) ?? false;
215
+ if (!isContextTool &&
216
+ ctx.instanceInfo &&
217
+ ctx.instanceInfo.version !== 'unknown' &&
218
+ !ToolAvailability_1.ToolAvailability.isToolAvailableForInstance(toolName, ctx.instanceInfo))
219
+ return 'tier';
220
+ const allActions = (0, schema_utils_1.extractActionsFromSchema)(tool.inputSchema);
221
+ if (allActions.length > 0 && (0, schema_utils_1.shouldRemoveTool)(toolName, allActions))
222
+ return 'actionDenial';
223
+ return null;
224
+ }
225
+ buildFilteredTools(ctx) {
226
+ const result = new Map();
227
+ for (const [, registry] of this.registries) {
186
228
  for (const [toolName, tool] of registry) {
187
- if (config_1.GITLAB_READ_ONLY_MODE && !this.getReadOnlyTools().includes(toolName)) {
188
- (0, logger_1.logDebug)("Tool filtered out: read-only mode", { toolName });
189
- continue;
190
- }
191
- if (config_1.GITLAB_DENIED_TOOLS_REGEX?.test(toolName)) {
192
- (0, logger_1.logDebug)("Tool filtered out: matches denied regex", { toolName });
193
- continue;
194
- }
195
- if (tokenScopes && !(0, TokenScopeDetector_1.isToolAvailableForScopes)(toolName, tokenScopes)) {
196
- (0, logger_1.logDebug)("Tool filtered out: insufficient token scopes", { toolName });
197
- continue;
198
- }
199
- if (!ToolAvailability_1.ToolAvailability.isToolAvailable(toolName)) {
200
- const reason = ToolAvailability_1.ToolAvailability.getUnavailableReason(toolName);
201
- (0, logger_1.logDebug)("Tool filtered out", { toolName, reason });
202
- continue;
203
- }
204
- const allActions = (0, schema_utils_1.extractActionsFromSchema)(tool.inputSchema);
205
- if (allActions.length > 0 && (0, schema_utils_1.shouldRemoveTool)(toolName, allActions)) {
206
- (0, logger_1.logDebug)("Tool filtered out: all actions denied", { toolName });
229
+ const exclusion = this.getToolExclusionReason(toolName, tool, ctx);
230
+ if (exclusion) {
231
+ (0, logger_1.logDebug)('Tool filtered out', { toolName, reason: exclusion });
207
232
  continue;
208
233
  }
209
234
  let transformedSchema = (0, schema_utils_1.transformToolSchema)(toolName, tool.inputSchema);
210
- if (instanceInfo) {
211
- const restrictedParams = ToolAvailability_1.ToolAvailability.getRestrictedParameters(toolName, instanceInfo);
235
+ if (ctx.instanceInfo && ctx.instanceInfo.version !== 'unknown') {
236
+ const restrictedParams = ToolAvailability_1.ToolAvailability.getRestrictedParameters(toolName, ctx.instanceInfo);
212
237
  if (restrictedParams.length > 0) {
213
238
  transformedSchema = (0, schema_utils_1.stripTierRestrictedParameters)(transformedSchema, restrictedParams);
214
239
  }
@@ -220,125 +245,162 @@ class RegistryManager {
220
245
  ...(customDescription && { description: customDescription }),
221
246
  };
222
247
  if (customDescription) {
223
- (0, logger_1.logDebug)("Applied description override", { toolName, customDescription });
248
+ (0, logger_1.logDebug)('Applied description override', { toolName, customDescription });
224
249
  }
225
- this.toolLookupCache.set(toolName, finalTool);
250
+ result.set(toolName, finalTool);
226
251
  }
227
252
  }
228
- if (config_1.GITLAB_CROSS_REFS) {
229
- const availableToolNames = new Set(this.toolLookupCache.keys());
230
- for (const [toolName, tool] of this.toolLookupCache) {
231
- if (this.descriptionOverrides.has(toolName))
232
- continue;
233
- const resolved = (0, description_utils_1.resolveRelatedReferences)(tool.description, availableToolNames);
234
- if (resolved !== tool.description) {
235
- this.toolLookupCache.set(toolName, { ...tool, description: resolved });
236
- }
253
+ return result;
254
+ }
255
+ postProcessRelatedReferences(cache) {
256
+ const availableToolNames = config_1.GITLAB_CROSS_REFS ? new Set(cache.keys()) : undefined;
257
+ for (const [toolName, tool] of cache) {
258
+ if (this.descriptionOverrides.has(toolName))
259
+ continue;
260
+ const nextDescription = availableToolNames
261
+ ? (0, description_utils_1.resolveRelatedReferences)(tool.description, availableToolNames)
262
+ : (0, description_utils_1.stripRelatedSection)(tool.description);
263
+ if (nextDescription !== tool.description) {
264
+ cache.set(toolName, { ...tool, description: nextDescription });
237
265
  }
238
266
  }
239
- else {
240
- for (const [toolName, tool] of this.toolLookupCache) {
241
- if (this.descriptionOverrides.has(toolName))
242
- continue;
243
- const stripped = (0, description_utils_1.stripRelatedSection)(tool.description);
244
- if (stripped !== tool.description) {
245
- this.toolLookupCache.set(toolName, { ...tool, description: stripped });
246
- }
247
- }
267
+ }
268
+ resolveCacheUrl(instanceUrl) {
269
+ if (instanceUrl)
270
+ return (0, url_1.normalizeInstanceUrl)(instanceUrl);
271
+ const contextUrl = (0, token_context_1.getGitLabApiUrlFromContext)();
272
+ if (contextUrl)
273
+ return (0, url_1.normalizeInstanceUrl)(contextUrl);
274
+ try {
275
+ const current = ConnectionManager_1.ConnectionManager.getInstance().getCurrentInstanceUrl();
276
+ if (current)
277
+ return (0, url_1.normalizeInstanceUrl)(current);
278
+ }
279
+ catch {
248
280
  }
249
- (0, logger_1.logDebug)("Registry manager built cache after filtering", {
250
- toolCount: this.toolLookupCache.size,
281
+ return (0, url_1.normalizeInstanceUrl)(config_1.GITLAB_BASE_URL);
282
+ }
283
+ resolveCache(instanceUrl) {
284
+ const url = this.resolveCacheUrl(instanceUrl);
285
+ let cache = this.toolLookupCaches.get(url);
286
+ if (!cache) {
287
+ this.buildToolLookupCache(url);
288
+ cache = this.toolLookupCaches.get(url);
289
+ }
290
+ return cache ?? new Map();
291
+ }
292
+ buildToolLookupCache(instanceUrl) {
293
+ const url = this.resolveCacheUrl(instanceUrl);
294
+ const ctx = this.loadInstanceContext(url);
295
+ const newCache = this.buildFilteredTools(ctx);
296
+ this.postProcessRelatedReferences(newCache);
297
+ this.toolLookupCaches.set(url, newCache);
298
+ (0, logger_1.logDebug)('Registry manager built cache after filtering', {
299
+ toolCount: newCache.size,
300
+ instanceUrl: url,
251
301
  });
252
302
  }
253
- invalidateCaches() {
254
- this.toolDefinitionsCache = null;
255
- this.toolNamesCache = null;
256
- this.readOnlyToolsCache = null;
257
- this.buildToolLookupCache();
303
+ invalidateCaches(instanceUrl) {
304
+ const url = this.resolveCacheUrl(instanceUrl);
305
+ this.toolDefinitionsCaches.delete(url);
306
+ this.toolNamesCaches.delete(url);
307
+ this.buildToolLookupCache(url);
258
308
  }
259
- getTool(toolName) {
260
- return this.toolLookupCache.get(toolName) ?? null;
309
+ getTool(toolName, instanceUrl) {
310
+ return this.resolveCache(instanceUrl).get(toolName) ?? null;
261
311
  }
262
- async executeTool(toolName, args) {
263
- const tool = this.getTool(toolName);
312
+ async executeTool(toolName, args, instanceUrl) {
313
+ const tool = this.getTool(toolName, instanceUrl);
264
314
  if (!tool) {
265
315
  throw new Error(`Tool '${toolName}' not found in any registry`);
266
316
  }
267
317
  return await tool.handler(args);
268
318
  }
269
- refreshCache() {
270
- this.invalidateCaches();
319
+ refreshCache(instanceUrl) {
320
+ this.invalidateCaches(instanceUrl);
271
321
  }
272
- getAllToolDefinitions() {
273
- if (this.toolDefinitionsCache === null) {
274
- this.toolDefinitionsCache = [];
275
- for (const tool of this.toolLookupCache.values()) {
276
- this.toolDefinitionsCache.push({
322
+ getAllToolDefinitions(instanceUrl) {
323
+ const url = this.resolveCacheUrl(instanceUrl);
324
+ const cache = this.resolveCache(instanceUrl);
325
+ const unreachableMode = this.isUnreachableFor(instanceUrl);
326
+ const cachedDefs = this.toolDefinitionsCaches.get(url);
327
+ if (cachedDefs === undefined || unreachableMode) {
328
+ const contextTools = unreachableMode ? this.registries.get('context') : null;
329
+ const defs = [];
330
+ for (const tool of cache.values()) {
331
+ if (contextTools && !contextTools.has(tool.name))
332
+ continue;
333
+ defs.push({
277
334
  name: tool.name,
278
335
  description: tool.description,
279
336
  inputSchema: tool.inputSchema,
280
337
  });
281
338
  }
339
+ if (unreachableMode) {
340
+ return defs;
341
+ }
342
+ this.toolDefinitionsCaches.set(url, defs);
343
+ return defs;
282
344
  }
283
- return this.toolDefinitionsCache;
345
+ return cachedDefs;
284
346
  }
285
347
  getAllToolDefinitionsTierless() {
286
348
  const allTools = [];
287
- const isReadOnly = process.env.GITLAB_READ_ONLY_MODE === "true";
349
+ const isReadOnly = process.env.GITLAB_READ_ONLY_MODE === 'true';
288
350
  const deniedRegex = process.env.GITLAB_DENIED_TOOLS_REGEX
289
351
  ? new RegExp(process.env.GITLAB_DENIED_TOOLS_REGEX)
290
352
  : undefined;
291
- const useLabels = process.env.USE_LABELS !== "false";
292
- const useMrs = process.env.USE_MRS !== "false";
293
- const useFiles = process.env.USE_FILES !== "false";
294
- const useMilestone = process.env.USE_MILESTONE !== "false";
295
- const usePipeline = process.env.USE_PIPELINE !== "false";
296
- const useVariables = process.env.USE_VARIABLES !== "false";
297
- const useWiki = process.env.USE_GITLAB_WIKI !== "false";
298
- const useWorkitems = process.env.USE_WORKITEMS !== "false";
299
- const useSnippets = process.env.USE_SNIPPETS !== "false";
300
- const useWebhooks = process.env.USE_WEBHOOKS !== "false";
301
- const useIntegrations = process.env.USE_INTEGRATIONS !== "false";
302
- const useReleases = process.env.USE_RELEASES !== "false";
303
- const useRefs = process.env.USE_REFS !== "false";
304
- const useMembers = process.env.USE_MEMBERS !== "false";
305
- const useSearch = process.env.USE_SEARCH !== "false";
306
- const useIterations = process.env.USE_ITERATIONS !== "false";
353
+ const useLabels = process.env.USE_LABELS !== 'false';
354
+ const useMrs = process.env.USE_MRS !== 'false';
355
+ const useFiles = process.env.USE_FILES !== 'false';
356
+ const useMilestone = process.env.USE_MILESTONE !== 'false';
357
+ const usePipeline = process.env.USE_PIPELINE !== 'false';
358
+ const useVariables = process.env.USE_VARIABLES !== 'false';
359
+ const useWiki = process.env.USE_GITLAB_WIKI !== 'false';
360
+ const useWorkitems = process.env.USE_WORKITEMS !== 'false';
361
+ const useSnippets = process.env.USE_SNIPPETS !== 'false';
362
+ const useWebhooks = process.env.USE_WEBHOOKS !== 'false';
363
+ const useIntegrations = process.env.USE_INTEGRATIONS !== 'false';
364
+ const useReleases = process.env.USE_RELEASES !== 'false';
365
+ const useRefs = process.env.USE_REFS !== 'false';
366
+ const useMembers = process.env.USE_MEMBERS !== 'false';
367
+ const useSearch = process.env.USE_SEARCH !== 'false';
368
+ const useIterations = process.env.USE_ITERATIONS !== 'false';
307
369
  const registriesToUse = new Map();
308
- registriesToUse.set("core", registry_1.coreToolRegistry);
309
- registriesToUse.set("context", registry_17.contextToolRegistry);
370
+ registriesToUse.set('core', registry_1.coreToolRegistry);
371
+ registriesToUse.set('context', registry_17.contextToolRegistry);
310
372
  if (useLabels)
311
- registriesToUse.set("labels", registry_2.labelsToolRegistry);
373
+ registriesToUse.set('labels', registry_2.labelsToolRegistry);
312
374
  if (useMrs)
313
- registriesToUse.set("mrs", registry_3.mrsToolRegistry);
375
+ registriesToUse.set('mrs', registry_3.mrsToolRegistry);
314
376
  if (useFiles)
315
- registriesToUse.set("files", registry_4.filesToolRegistry);
377
+ registriesToUse.set('files', registry_4.filesToolRegistry);
316
378
  if (useMilestone)
317
- registriesToUse.set("milestones", registry_5.milestonesToolRegistry);
379
+ registriesToUse.set('milestones', registry_5.milestonesToolRegistry);
318
380
  if (usePipeline)
319
- registriesToUse.set("pipelines", registry_6.pipelinesToolRegistry);
381
+ registriesToUse.set('pipelines', registry_6.pipelinesToolRegistry);
320
382
  if (useVariables)
321
- registriesToUse.set("variables", registry_7.variablesToolRegistry);
383
+ registriesToUse.set('variables', registry_7.variablesToolRegistry);
322
384
  if (useWiki)
323
- registriesToUse.set("wiki", registry_8.wikiToolRegistry);
385
+ registriesToUse.set('wiki', registry_8.wikiToolRegistry);
324
386
  if (useWorkitems)
325
- registriesToUse.set("workitems", registry_9.workitemsToolRegistry);
387
+ registriesToUse.set('workitems', registry_9.workitemsToolRegistry);
326
388
  if (useSnippets)
327
- registriesToUse.set("snippets", registry_11.snippetsToolRegistry);
389
+ registriesToUse.set('snippets', registry_11.snippetsToolRegistry);
328
390
  if (useWebhooks)
329
- registriesToUse.set("webhooks", registry_10.webhooksToolRegistry);
391
+ registriesToUse.set('webhooks', registry_10.webhooksToolRegistry);
330
392
  if (useIntegrations)
331
- registriesToUse.set("integrations", registry_12.integrationsToolRegistry);
393
+ registriesToUse.set('integrations', registry_12.integrationsToolRegistry);
332
394
  if (useReleases)
333
- registriesToUse.set("releases", registry_13.releasesToolRegistry);
395
+ registriesToUse.set('releases', registry_13.releasesToolRegistry);
334
396
  if (useRefs)
335
- registriesToUse.set("refs", registry_14.refsToolRegistry);
397
+ registriesToUse.set('refs', registry_14.refsToolRegistry);
336
398
  if (useMembers)
337
- registriesToUse.set("members", registry_15.membersToolRegistry);
399
+ registriesToUse.set('members', registry_15.membersToolRegistry);
338
400
  if (useSearch)
339
- registriesToUse.set("search", registry_16.searchToolRegistry);
401
+ registriesToUse.set('search', registry_16.searchToolRegistry);
340
402
  if (useIterations)
341
- registriesToUse.set("iterations", registry_18.iterationsToolRegistry);
403
+ registriesToUse.set('iterations', registry_18.iterationsToolRegistry);
342
404
  const descOverrides = (0, config_1.getToolDescriptionOverrides)();
343
405
  for (const registry of registriesToUse.values()) {
344
406
  for (const [toolName, tool] of registry) {
@@ -362,9 +424,9 @@ class RegistryManager {
362
424
  allTools.push(finalTool);
363
425
  }
364
426
  }
365
- const crossRefsEnabled = process.env.GITLAB_CROSS_REFS !== "false";
427
+ const crossRefsEnabled = process.env.GITLAB_CROSS_REFS !== 'false';
366
428
  if (crossRefsEnabled) {
367
- const availableToolNames = new Set(allTools.map(t => t.name));
429
+ const availableToolNames = new Set(allTools.map((t) => t.name));
368
430
  for (let i = 0; i < allTools.length; i++) {
369
431
  const tool = allTools[i];
370
432
  if (descOverrides.has(tool.name))
@@ -417,62 +479,85 @@ class RegistryManager {
417
479
  }
418
480
  return allTools;
419
481
  }
420
- hasToolHandler(toolName) {
421
- return this.toolLookupCache.has(toolName);
482
+ hasToolHandler(toolName, instanceUrl) {
483
+ return this.resolveCache(instanceUrl).has(toolName);
422
484
  }
423
- getAvailableToolNames() {
424
- this.toolNamesCache ??= Array.from(this.toolLookupCache.keys());
425
- return this.toolNamesCache;
426
- }
427
- getFilterStats() {
428
- let totalTools = 0;
429
- for (const registry of this.registries.values()) {
430
- totalTools += registry.size;
431
- }
432
- const availableTools = this.toolLookupCache.size;
433
- let filteredByReadOnly = 0;
434
- let filteredByDeniedRegex = 0;
435
- let filteredByScopes = 0;
436
- let filteredByTier = 0;
437
- let filteredByActionDenial = 0;
438
- let tokenScopes;
439
- try {
440
- const scopeInfo = ConnectionManager_1.ConnectionManager.getInstance().getTokenScopeInfo();
441
- if (scopeInfo) {
442
- tokenScopes = scopeInfo.scopes;
485
+ getAvailableToolNames(instanceUrl) {
486
+ const url = this.resolveCacheUrl(instanceUrl);
487
+ const cache = this.resolveCache(instanceUrl);
488
+ const unreachableMode = this.isUnreachableFor(instanceUrl);
489
+ const cachedNames = this.toolNamesCaches.get(url);
490
+ if (cachedNames === undefined || unreachableMode) {
491
+ const contextTools = unreachableMode ? this.registries.get('context') : null;
492
+ const names = Array.from(cache.keys()).filter((name) => !contextTools || contextTools.has(name));
493
+ if (unreachableMode) {
494
+ return names;
443
495
  }
496
+ this.toolNamesCaches.set(url, names);
497
+ return names;
444
498
  }
445
- catch {
499
+ return cachedNames;
500
+ }
501
+ isUnreachableFor(instanceUrl) {
502
+ const healthMonitor = HealthMonitor_1.HealthMonitor.getInstance();
503
+ if (instanceUrl) {
504
+ try {
505
+ return (!healthMonitor.isInstanceReachable(instanceUrl) &&
506
+ healthMonitor.getState(instanceUrl) !== 'connecting');
507
+ }
508
+ catch {
509
+ return false;
510
+ }
446
511
  }
512
+ return (healthMonitor.getMonitoredInstances().length > 0 && !healthMonitor.isAnyInstanceHealthy());
513
+ }
514
+ aggregateFilterCounters(ctx, contextTools) {
515
+ const counts = {
516
+ available: 0,
517
+ byReadOnly: 0,
518
+ byDeniedRegex: 0,
519
+ byScopes: 0,
520
+ byTier: 0,
521
+ byActionDenial: 0,
522
+ };
523
+ const counterByReason = {
524
+ readOnly: 'byReadOnly',
525
+ deniedRegex: 'byDeniedRegex',
526
+ scopes: 'byScopes',
527
+ tier: 'byTier',
528
+ actionDenial: 'byActionDenial',
529
+ };
447
530
  for (const registry of this.registries.values()) {
448
531
  for (const [toolName, tool] of registry) {
449
- if (this.toolLookupCache.has(toolName)) {
532
+ if (contextTools && !contextTools.has(toolName))
450
533
  continue;
534
+ const reason = this.getToolExclusionReason(toolName, tool, ctx);
535
+ if (!reason) {
536
+ counts.available++;
451
537
  }
452
- if (config_1.GITLAB_READ_ONLY_MODE && !this.getReadOnlyTools().includes(toolName)) {
453
- filteredByReadOnly++;
454
- continue;
455
- }
456
- if (config_1.GITLAB_DENIED_TOOLS_REGEX?.test(toolName)) {
457
- filteredByDeniedRegex++;
458
- continue;
459
- }
460
- if (tokenScopes && !(0, TokenScopeDetector_1.isToolAvailableForScopes)(toolName, tokenScopes)) {
461
- filteredByScopes++;
462
- continue;
463
- }
464
- if (!ToolAvailability_1.ToolAvailability.isToolAvailable(toolName)) {
465
- filteredByTier++;
466
- continue;
538
+ else {
539
+ const key = counterByReason[reason];
540
+ if (key)
541
+ counts[key]++;
467
542
  }
468
- const allActions = (0, schema_utils_1.extractActionsFromSchema)(tool.inputSchema);
469
- if (allActions.length > 0 && (0, schema_utils_1.shouldRemoveTool)(toolName, allActions)) {
470
- filteredByActionDenial++;
543
+ }
544
+ }
545
+ return counts;
546
+ }
547
+ getFilterStats(instanceUrl) {
548
+ const url = this.resolveCacheUrl(instanceUrl);
549
+ const unreachableMode = this.isUnreachableFor(instanceUrl);
550
+ const contextTools = unreachableMode ? this.registries.get('context') : null;
551
+ let totalTools = 0;
552
+ for (const registry of this.registries.values()) {
553
+ for (const [toolName] of registry) {
554
+ if (contextTools && !contextTools.has(toolName))
471
555
  continue;
472
- }
473
- filteredByTier++;
556
+ totalTools++;
474
557
  }
475
558
  }
559
+ const ctx = this.loadInstanceContext(url);
560
+ const { available: availableTools, byReadOnly: filteredByReadOnly, byDeniedRegex: filteredByDeniedRegex, byScopes: filteredByScopes, byTier: filteredByTier, byActionDenial: filteredByActionDenial, } = this.aggregateFilterCounters(ctx, contextTools);
476
561
  return {
477
562
  available: availableTools,
478
563
  total: totalTools,