@padua/cli 1.13.1 → 2.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 (265) hide show
  1. package/README.md +121 -6
  2. package/dist/commands/doctor/index.d.ts.map +1 -1
  3. package/dist/commands/doctor/index.js +85 -0
  4. package/dist/commands/doctor/index.js.map +1 -1
  5. package/dist/commands/doctor/mcp-checks.d.ts +36 -0
  6. package/dist/commands/doctor/mcp-checks.d.ts.map +1 -0
  7. package/dist/commands/doctor/mcp-checks.js +235 -0
  8. package/dist/commands/doctor/mcp-checks.js.map +1 -0
  9. package/dist/commands/doctor/mcp-service-checks.d.ts +35 -0
  10. package/dist/commands/doctor/mcp-service-checks.d.ts.map +1 -0
  11. package/dist/commands/doctor/mcp-service-checks.js +146 -0
  12. package/dist/commands/doctor/mcp-service-checks.js.map +1 -0
  13. package/dist/commands/doctor/types.d.ts +4 -1
  14. package/dist/commands/doctor/types.d.ts.map +1 -1
  15. package/dist/commands/doctor/types.js +1 -0
  16. package/dist/commands/doctor/types.js.map +1 -1
  17. package/dist/commands/login/index.d.ts +1 -1
  18. package/dist/commands/login/index.d.ts.map +1 -1
  19. package/dist/commands/login/index.js +44 -185
  20. package/dist/commands/login/index.js.map +1 -1
  21. package/dist/commands/login/mcp-steps.d.ts +38 -0
  22. package/dist/commands/login/mcp-steps.d.ts.map +1 -0
  23. package/dist/commands/login/mcp-steps.js +176 -0
  24. package/dist/commands/login/mcp-steps.js.map +1 -0
  25. package/dist/commands/login/orchestrator.d.ts +9 -0
  26. package/dist/commands/login/orchestrator.d.ts.map +1 -0
  27. package/dist/commands/login/orchestrator.js +251 -0
  28. package/dist/commands/login/orchestrator.js.map +1 -0
  29. package/dist/commands/login/types.d.ts +11 -0
  30. package/dist/commands/login/types.d.ts.map +1 -1
  31. package/dist/commands/login/types.js.map +1 -1
  32. package/dist/commands/status/aws-checks.d.ts +14 -0
  33. package/dist/commands/status/aws-checks.d.ts.map +1 -0
  34. package/dist/commands/status/aws-checks.js +145 -0
  35. package/dist/commands/status/aws-checks.js.map +1 -0
  36. package/dist/commands/status/checks.d.ts +9 -25
  37. package/dist/commands/status/checks.d.ts.map +1 -1
  38. package/dist/commands/status/checks.js +52 -254
  39. package/dist/commands/status/checks.js.map +1 -1
  40. package/dist/commands/status/index.d.ts.map +1 -1
  41. package/dist/commands/status/index.js +53 -1
  42. package/dist/commands/status/index.js.map +1 -1
  43. package/dist/commands/status/mcp-checks.d.ts +35 -0
  44. package/dist/commands/status/mcp-checks.d.ts.map +1 -0
  45. package/dist/commands/status/mcp-checks.js +175 -0
  46. package/dist/commands/status/mcp-checks.js.map +1 -0
  47. package/dist/commands/status/types.d.ts +34 -0
  48. package/dist/commands/status/types.d.ts.map +1 -1
  49. package/dist/mcp/config/index.d.ts +4 -0
  50. package/dist/mcp/config/index.d.ts.map +1 -0
  51. package/dist/mcp/config/index.js +14 -0
  52. package/dist/mcp/config/index.js.map +1 -0
  53. package/dist/mcp/config/loaders.d.ts +45 -0
  54. package/dist/mcp/config/loaders.d.ts.map +1 -0
  55. package/dist/mcp/config/loaders.js +149 -0
  56. package/dist/mcp/config/loaders.js.map +1 -0
  57. package/dist/mcp/config/types.d.ts +234 -0
  58. package/dist/mcp/config/types.d.ts.map +1 -0
  59. package/dist/mcp/config/types.js +45 -0
  60. package/dist/mcp/config/types.js.map +1 -0
  61. package/dist/mcp/daemon/entry-logic.d.ts +28 -0
  62. package/dist/mcp/daemon/entry-logic.d.ts.map +1 -0
  63. package/dist/mcp/daemon/entry-logic.js +82 -0
  64. package/dist/mcp/daemon/entry-logic.js.map +1 -0
  65. package/dist/mcp/daemon/entry.d.ts +8 -0
  66. package/dist/mcp/daemon/entry.d.ts.map +1 -0
  67. package/dist/mcp/daemon/entry.js +34 -0
  68. package/dist/mcp/daemon/entry.js.map +1 -0
  69. package/dist/mcp/daemon/fork.d.ts +21 -0
  70. package/dist/mcp/daemon/fork.d.ts.map +1 -0
  71. package/dist/mcp/daemon/fork.js +188 -0
  72. package/dist/mcp/daemon/fork.js.map +1 -0
  73. package/dist/mcp/daemon/health.d.ts +8 -0
  74. package/dist/mcp/daemon/health.d.ts.map +1 -0
  75. package/dist/mcp/daemon/health.js +50 -0
  76. package/dist/mcp/daemon/health.js.map +1 -0
  77. package/dist/mcp/daemon/index.d.ts +6 -0
  78. package/dist/mcp/daemon/index.d.ts.map +1 -0
  79. package/dist/mcp/daemon/index.js +22 -0
  80. package/dist/mcp/daemon/index.js.map +1 -0
  81. package/dist/mcp/daemon/types.d.ts +63 -0
  82. package/dist/mcp/daemon/types.d.ts.map +1 -0
  83. package/dist/mcp/daemon/types.js +18 -0
  84. package/dist/mcp/daemon/types.js.map +1 -0
  85. package/dist/mcp/errors/index.d.ts +3 -0
  86. package/dist/mcp/errors/index.d.ts.map +1 -0
  87. package/dist/mcp/errors/index.js +13 -0
  88. package/dist/mcp/errors/index.js.map +1 -0
  89. package/dist/mcp/errors/types.d.ts +83 -0
  90. package/dist/mcp/errors/types.d.ts.map +1 -0
  91. package/dist/mcp/errors/types.js +148 -0
  92. package/dist/mcp/errors/types.js.map +1 -0
  93. package/dist/mcp/providers/atlassian/auth.d.ts +34 -0
  94. package/dist/mcp/providers/atlassian/auth.d.ts.map +1 -0
  95. package/dist/mcp/providers/atlassian/auth.js +107 -0
  96. package/dist/mcp/providers/atlassian/auth.js.map +1 -0
  97. package/dist/mcp/providers/atlassian/client.d.ts +15 -0
  98. package/dist/mcp/providers/atlassian/client.d.ts.map +1 -0
  99. package/dist/mcp/providers/atlassian/client.js +38 -0
  100. package/dist/mcp/providers/atlassian/client.js.map +1 -0
  101. package/dist/mcp/providers/atlassian/index.d.ts +6 -0
  102. package/dist/mcp/providers/atlassian/index.d.ts.map +1 -0
  103. package/dist/mcp/providers/atlassian/index.js +11 -0
  104. package/dist/mcp/providers/atlassian/index.js.map +1 -0
  105. package/dist/mcp/providers/atlassian/markdown-to-adf/index.d.ts +17 -0
  106. package/dist/mcp/providers/atlassian/markdown-to-adf/index.d.ts.map +1 -0
  107. package/dist/mcp/providers/atlassian/markdown-to-adf/index.js +29 -0
  108. package/dist/mcp/providers/atlassian/markdown-to-adf/index.js.map +1 -0
  109. package/dist/mcp/providers/atlassian/markdown-to-adf/nodes.d.ts +43 -0
  110. package/dist/mcp/providers/atlassian/markdown-to-adf/nodes.d.ts.map +1 -0
  111. package/dist/mcp/providers/atlassian/markdown-to-adf/nodes.js +101 -0
  112. package/dist/mcp/providers/atlassian/markdown-to-adf/nodes.js.map +1 -0
  113. package/dist/mcp/providers/atlassian/markdown-to-adf/parser.d.ts +14 -0
  114. package/dist/mcp/providers/atlassian/markdown-to-adf/parser.d.ts.map +1 -0
  115. package/dist/mcp/providers/atlassian/markdown-to-adf/parser.js +250 -0
  116. package/dist/mcp/providers/atlassian/markdown-to-adf/parser.js.map +1 -0
  117. package/dist/mcp/providers/atlassian/provider.d.ts +38 -0
  118. package/dist/mcp/providers/atlassian/provider.d.ts.map +1 -0
  119. package/dist/mcp/providers/atlassian/provider.js +101 -0
  120. package/dist/mcp/providers/atlassian/provider.js.map +1 -0
  121. package/dist/mcp/providers/atlassian/resources.d.ts +4 -0
  122. package/dist/mcp/providers/atlassian/resources.d.ts.map +1 -0
  123. package/dist/mcp/providers/atlassian/resources.js +67 -0
  124. package/dist/mcp/providers/atlassian/resources.js.map +1 -0
  125. package/dist/mcp/providers/atlassian/tools/confluence.d.ts +4 -0
  126. package/dist/mcp/providers/atlassian/tools/confluence.d.ts.map +1 -0
  127. package/dist/mcp/providers/atlassian/tools/confluence.js +169 -0
  128. package/dist/mcp/providers/atlassian/tools/confluence.js.map +1 -0
  129. package/dist/mcp/providers/atlassian/tools/jira.d.ts +4 -0
  130. package/dist/mcp/providers/atlassian/tools/jira.d.ts.map +1 -0
  131. package/dist/mcp/providers/atlassian/tools/jira.js +274 -0
  132. package/dist/mcp/providers/atlassian/tools/jira.js.map +1 -0
  133. package/dist/mcp/providers/gitlab/auth.d.ts +10 -0
  134. package/dist/mcp/providers/gitlab/auth.d.ts.map +1 -0
  135. package/dist/mcp/providers/gitlab/auth.js +23 -0
  136. package/dist/mcp/providers/gitlab/auth.js.map +1 -0
  137. package/dist/mcp/providers/gitlab/client.d.ts +23 -0
  138. package/dist/mcp/providers/gitlab/client.d.ts.map +1 -0
  139. package/dist/mcp/providers/gitlab/client.js +17 -0
  140. package/dist/mcp/providers/gitlab/client.js.map +1 -0
  141. package/dist/mcp/providers/gitlab/index.d.ts +5 -0
  142. package/dist/mcp/providers/gitlab/index.d.ts.map +1 -0
  143. package/dist/mcp/providers/gitlab/index.js +10 -0
  144. package/dist/mcp/providers/gitlab/index.js.map +1 -0
  145. package/dist/mcp/providers/gitlab/provider.d.ts +25 -0
  146. package/dist/mcp/providers/gitlab/provider.d.ts.map +1 -0
  147. package/dist/mcp/providers/gitlab/provider.js +48 -0
  148. package/dist/mcp/providers/gitlab/provider.js.map +1 -0
  149. package/dist/mcp/providers/gitlab/resources.d.ts +11 -0
  150. package/dist/mcp/providers/gitlab/resources.d.ts.map +1 -0
  151. package/dist/mcp/providers/gitlab/resources.js +54 -0
  152. package/dist/mcp/providers/gitlab/resources.js.map +1 -0
  153. package/dist/mcp/providers/gitlab/tools/issues.d.ts +4 -0
  154. package/dist/mcp/providers/gitlab/tools/issues.d.ts.map +1 -0
  155. package/dist/mcp/providers/gitlab/tools/issues.js +120 -0
  156. package/dist/mcp/providers/gitlab/tools/issues.js.map +1 -0
  157. package/dist/mcp/providers/gitlab/tools/merge-requests.d.ts +11 -0
  158. package/dist/mcp/providers/gitlab/tools/merge-requests.d.ts.map +1 -0
  159. package/dist/mcp/providers/gitlab/tools/merge-requests.js +282 -0
  160. package/dist/mcp/providers/gitlab/tools/merge-requests.js.map +1 -0
  161. package/dist/mcp/providers/gitlab/tools/pipelines.d.ts +10 -0
  162. package/dist/mcp/providers/gitlab/tools/pipelines.d.ts.map +1 -0
  163. package/dist/mcp/providers/gitlab/tools/pipelines.js +173 -0
  164. package/dist/mcp/providers/gitlab/tools/pipelines.js.map +1 -0
  165. package/dist/mcp/providers/gitlab/tools/repository.d.ts +4 -0
  166. package/dist/mcp/providers/gitlab/tools/repository.d.ts.map +1 -0
  167. package/dist/mcp/providers/gitlab/tools/repository.js +191 -0
  168. package/dist/mcp/providers/gitlab/tools/repository.js.map +1 -0
  169. package/dist/mcp/providers/index.d.ts +4 -0
  170. package/dist/mcp/providers/index.d.ts.map +1 -0
  171. package/dist/mcp/providers/index.js +6 -0
  172. package/dist/mcp/providers/index.js.map +1 -0
  173. package/dist/mcp/providers/registry.d.ts +90 -0
  174. package/dist/mcp/providers/registry.d.ts.map +1 -0
  175. package/dist/mcp/providers/registry.js +128 -0
  176. package/dist/mcp/providers/registry.js.map +1 -0
  177. package/dist/mcp/providers/tool-helpers.d.ts +14 -0
  178. package/dist/mcp/providers/tool-helpers.d.ts.map +1 -0
  179. package/dist/mcp/providers/tool-helpers.js +12 -0
  180. package/dist/mcp/providers/tool-helpers.js.map +1 -0
  181. package/dist/mcp/providers/types.d.ts +80 -0
  182. package/dist/mcp/providers/types.d.ts.map +1 -0
  183. package/dist/mcp/providers/types.js +13 -0
  184. package/dist/mcp/providers/types.js.map +1 -0
  185. package/dist/mcp/server/auth.d.ts +8 -0
  186. package/dist/mcp/server/auth.d.ts.map +1 -0
  187. package/dist/mcp/server/auth.js +36 -0
  188. package/dist/mcp/server/auth.js.map +1 -0
  189. package/dist/mcp/server/health.d.ts +24 -0
  190. package/dist/mcp/server/health.d.ts.map +1 -0
  191. package/dist/mcp/server/health.js +37 -0
  192. package/dist/mcp/server/health.js.map +1 -0
  193. package/dist/mcp/server/index.d.ts +11 -0
  194. package/dist/mcp/server/index.d.ts.map +1 -0
  195. package/dist/mcp/server/index.js +27 -0
  196. package/dist/mcp/server/index.js.map +1 -0
  197. package/dist/mcp/server/logging.d.ts +46 -0
  198. package/dist/mcp/server/logging.d.ts.map +1 -0
  199. package/dist/mcp/server/logging.js +109 -0
  200. package/dist/mcp/server/logging.js.map +1 -0
  201. package/dist/mcp/server/ratelimit.d.ts +3 -0
  202. package/dist/mcp/server/ratelimit.d.ts.map +1 -0
  203. package/dist/mcp/server/ratelimit.js +70 -0
  204. package/dist/mcp/server/ratelimit.js.map +1 -0
  205. package/dist/mcp/server/routes.d.ts +3 -0
  206. package/dist/mcp/server/routes.d.ts.map +1 -0
  207. package/dist/mcp/server/routes.js +8 -0
  208. package/dist/mcp/server/routes.js.map +1 -0
  209. package/dist/mcp/server/server.d.ts +21 -0
  210. package/dist/mcp/server/server.d.ts.map +1 -0
  211. package/dist/mcp/server/server.js +114 -0
  212. package/dist/mcp/server/server.js.map +1 -0
  213. package/dist/mcp/server/validation.d.ts +22 -0
  214. package/dist/mcp/server/validation.d.ts.map +1 -0
  215. package/dist/mcp/server/validation.js +32 -0
  216. package/dist/mcp/server/validation.js.map +1 -0
  217. package/dist/mcp/store/encrypt.d.ts +22 -0
  218. package/dist/mcp/store/encrypt.d.ts.map +1 -0
  219. package/dist/mcp/store/encrypt.js +66 -0
  220. package/dist/mcp/store/encrypt.js.map +1 -0
  221. package/dist/mcp/store/index.d.ts +12 -0
  222. package/dist/mcp/store/index.d.ts.map +1 -0
  223. package/dist/mcp/store/index.js +16 -0
  224. package/dist/mcp/store/index.js.map +1 -0
  225. package/dist/mcp/store/migrate.d.ts +70 -0
  226. package/dist/mcp/store/migrate.d.ts.map +1 -0
  227. package/dist/mcp/store/migrate.js +211 -0
  228. package/dist/mcp/store/migrate.js.map +1 -0
  229. package/dist/mcp/store/null-token-store.d.ts +22 -0
  230. package/dist/mcp/store/null-token-store.d.ts.map +1 -0
  231. package/dist/mcp/store/null-token-store.js +40 -0
  232. package/dist/mcp/store/null-token-store.js.map +1 -0
  233. package/dist/mcp/store/sqlite.d.ts +27 -0
  234. package/dist/mcp/store/sqlite.d.ts.map +1 -0
  235. package/dist/mcp/store/sqlite.js +100 -0
  236. package/dist/mcp/store/sqlite.js.map +1 -0
  237. package/dist/mcp/store/types.d.ts +183 -0
  238. package/dist/mcp/store/types.d.ts.map +1 -0
  239. package/dist/mcp/store/types.js +13 -0
  240. package/dist/mcp/store/types.js.map +1 -0
  241. package/dist/mcp/token/http-client.d.ts +3 -0
  242. package/dist/mcp/token/http-client.d.ts.map +1 -0
  243. package/dist/mcp/token/http-client.js +186 -0
  244. package/dist/mcp/token/http-client.js.map +1 -0
  245. package/dist/mcp/token/index.d.ts +5 -0
  246. package/dist/mcp/token/index.d.ts.map +1 -0
  247. package/dist/mcp/token/index.js +15 -0
  248. package/dist/mcp/token/index.js.map +1 -0
  249. package/dist/mcp/token/manager.d.ts +54 -0
  250. package/dist/mcp/token/manager.d.ts.map +1 -0
  251. package/dist/mcp/token/manager.js +194 -0
  252. package/dist/mcp/token/manager.js.map +1 -0
  253. package/dist/mcp/token/null-token-manager.d.ts +19 -0
  254. package/dist/mcp/token/null-token-manager.d.ts.map +1 -0
  255. package/dist/mcp/token/null-token-manager.js +50 -0
  256. package/dist/mcp/token/null-token-manager.js.map +1 -0
  257. package/dist/mcp/token/oauth.d.ts +44 -0
  258. package/dist/mcp/token/oauth.d.ts.map +1 -0
  259. package/dist/mcp/token/oauth.js +257 -0
  260. package/dist/mcp/token/oauth.js.map +1 -0
  261. package/dist/mcp/token/types.d.ts +81 -0
  262. package/dist/mcp/token/types.d.ts.map +1 -0
  263. package/dist/mcp/token/types.js +6 -0
  264. package/dist/mcp/token/types.js.map +1 -0
  265. package/package.json +10 -3
@@ -0,0 +1,173 @@
1
+ "use strict";
2
+ /**
3
+ * GitLab Pipeline MCP tools.
4
+ *
5
+ * Registers 5 tools covering the GitLab pipelines and jobs API:
6
+ * - list_pipelines, get_pipeline, list_pipeline_jobs, get_job_log, retry_pipeline
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.registerPipelineTools = registerPipelineTools;
10
+ const zod_1 = require("zod");
11
+ const tool_helpers_1 = require("../../tool-helpers");
12
+ // ---------------------------------------------------------------------------
13
+ // Constants
14
+ // ---------------------------------------------------------------------------
15
+ const MAX_JOB_LOG_BYTES = 1_048_576; // 1MB
16
+ const TRUNCATION_MARKER = '\n[TRUNCATED: response exceeded 1MB limit]';
17
+ // ---------------------------------------------------------------------------
18
+ // Shared Zod primitives
19
+ // ---------------------------------------------------------------------------
20
+ const projectId = zod_1.z
21
+ .number()
22
+ .int()
23
+ .positive()
24
+ .max(2_147_483_647)
25
+ .describe('The numeric ID of the GitLab project.');
26
+ const pipelineId = zod_1.z
27
+ .number()
28
+ .int()
29
+ .positive()
30
+ .describe('The numeric ID of the pipeline.');
31
+ const pageParam = zod_1.z
32
+ .number()
33
+ .int()
34
+ .positive()
35
+ .optional()
36
+ .describe('Page number for pagination.');
37
+ const perPageParam = zod_1.z
38
+ .number()
39
+ .int()
40
+ .min(1)
41
+ .max(100)
42
+ .optional()
43
+ .describe('Number of results per page (1-100).');
44
+ function buildParams(extra) {
45
+ return Object.fromEntries(Object.entries(extra).filter((entry) => entry[1] !== undefined));
46
+ }
47
+ function capJobLog(raw) {
48
+ const bytes = Buffer.byteLength(raw, 'utf8');
49
+ if (bytes <= MAX_JOB_LOG_BYTES)
50
+ return raw;
51
+ const truncated = Buffer.from(raw, 'utf8').subarray(0, MAX_JOB_LOG_BYTES).toString('utf8');
52
+ return truncated + TRUNCATION_MARKER;
53
+ }
54
+ // ---------------------------------------------------------------------------
55
+ // Tool registrations
56
+ // ---------------------------------------------------------------------------
57
+ function registerListPipelines(client, registrar) {
58
+ const schema = zod_1.z.object({
59
+ project_id: projectId,
60
+ ref: zod_1.z
61
+ .string()
62
+ .max(255)
63
+ .regex(/^[a-zA-Z0-9/_.\\-]+$/)
64
+ .optional()
65
+ .describe('Filter pipelines by git ref (branch or tag name).'),
66
+ status: zod_1.z
67
+ .enum([
68
+ 'created',
69
+ 'waiting_for_resource',
70
+ 'preparing',
71
+ 'pending',
72
+ 'running',
73
+ 'success',
74
+ 'failed',
75
+ 'canceled',
76
+ 'skipped',
77
+ 'manual',
78
+ 'scheduled',
79
+ ])
80
+ .optional()
81
+ .describe('Filter pipelines by status.'),
82
+ page: pageParam,
83
+ per_page: perPageParam,
84
+ });
85
+ registrar.registerTool('gitlab_list_pipelines', {
86
+ description: 'List pipelines for a GitLab project.',
87
+ inputSchema: schema,
88
+ annotations: { readOnlyHint: true },
89
+ }, async (input) => {
90
+ const params = buildParams({
91
+ ref: input.ref,
92
+ status: input.status,
93
+ page: input.page?.toString(),
94
+ per_page: input.per_page?.toString(),
95
+ });
96
+ const resp = await client.get(`/projects/${input.project_id}/pipelines`, params);
97
+ return (0, tool_helpers_1.toMcpResult)(resp.body);
98
+ });
99
+ }
100
+ function registerGetPipeline(client, registrar) {
101
+ const schema = zod_1.z.object({
102
+ project_id: projectId,
103
+ pipeline_id: pipelineId,
104
+ });
105
+ registrar.registerTool('gitlab_get_pipeline', {
106
+ description: 'Get details of a single GitLab pipeline by its ID.',
107
+ inputSchema: schema,
108
+ annotations: { readOnlyHint: true },
109
+ }, async (input) => {
110
+ const resp = await client.get(`/projects/${input.project_id}/pipelines/${input.pipeline_id}`);
111
+ return (0, tool_helpers_1.toMcpResult)(resp.body);
112
+ });
113
+ }
114
+ function registerListPipelineJobs(client, registrar) {
115
+ const schema = zod_1.z.object({
116
+ project_id: projectId,
117
+ pipeline_id: pipelineId,
118
+ page: pageParam,
119
+ per_page: perPageParam,
120
+ });
121
+ registrar.registerTool('gitlab_list_pipeline_jobs', {
122
+ description: 'List jobs for a specific GitLab pipeline.',
123
+ inputSchema: schema,
124
+ annotations: { readOnlyHint: true },
125
+ }, async (input) => {
126
+ const params = buildParams({
127
+ page: input.page?.toString(),
128
+ per_page: input.per_page?.toString(),
129
+ });
130
+ const resp = await client.get(`/projects/${input.project_id}/pipelines/${input.pipeline_id}/jobs`, params);
131
+ return (0, tool_helpers_1.toMcpResult)(resp.body);
132
+ });
133
+ }
134
+ function registerGetJobLog(client, registrar) {
135
+ const schema = zod_1.z.object({
136
+ project_id: projectId,
137
+ job_id: zod_1.z.number().int().positive().describe('The numeric ID of the CI job.'),
138
+ });
139
+ registrar.registerTool('gitlab_get_job_log', {
140
+ description: 'Get the log (trace) output of a specific GitLab CI job. Returns plain text.',
141
+ inputSchema: schema,
142
+ annotations: { readOnlyHint: true },
143
+ }, async (input) => {
144
+ const resp = await client.get(`/projects/${input.project_id}/jobs/${input.job_id}/trace`);
145
+ const raw = typeof resp.body === 'string' ? resp.body : String(resp.body);
146
+ return (0, tool_helpers_1.toRawTextResult)(capJobLog(raw));
147
+ });
148
+ }
149
+ function registerRetryPipeline(client, registrar) {
150
+ const schema = zod_1.z.object({
151
+ project_id: projectId,
152
+ pipeline_id: pipelineId,
153
+ });
154
+ registrar.registerTool('gitlab_retry_pipeline', {
155
+ description: 'Retry all failed jobs in a GitLab pipeline.',
156
+ inputSchema: schema,
157
+ annotations: { destructiveHint: true },
158
+ }, async (input) => {
159
+ const resp = await client.post(`/projects/${input.project_id}/pipelines/${input.pipeline_id}/retry`);
160
+ return (0, tool_helpers_1.toMcpResult)(resp.body);
161
+ });
162
+ }
163
+ // ---------------------------------------------------------------------------
164
+ // Public export
165
+ // ---------------------------------------------------------------------------
166
+ function registerPipelineTools(client, registrar) {
167
+ registerListPipelines(client, registrar);
168
+ registerGetPipeline(client, registrar);
169
+ registerListPipelineJobs(client, registrar);
170
+ registerGetJobLog(client, registrar);
171
+ registerRetryPipeline(client, registrar);
172
+ }
173
+ //# sourceMappingURL=pipelines.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipelines.js","sourceRoot":"","sources":["../../../../../src/mcp/providers/gitlab/tools/pipelines.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AA4NH,sDAMC;AAhOD,6BAAwB;AACxB,qDAAkE;AAIlE,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E,MAAM,iBAAiB,GAAG,SAAS,CAAC,CAAC,MAAM;AAC3C,MAAM,iBAAiB,GAAG,4CAA4C,CAAC;AAEvE,8EAA8E;AAC9E,wBAAwB;AACxB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;KACvC,EACD,KAAK,EAAE,KAA6B,EAAsB,EAAE;QAC1D,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,IAAI,CAC5B,aAAa,KAAK,CAAC,UAAU,cAAc,KAAK,CAAC,WAAW,QAAQ,CACrE,CAAC;QACF,OAAO,IAAA,0BAAW,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC,CACF,CAAC;AACJ,CAAC;AAED,8EAA8E;AAC9E,gBAAgB;AAChB,8EAA8E;AAE9E,SAAgB,qBAAqB,CAAC,MAAoB,EAAE,SAAwB;IAClF,qBAAqB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACzC,mBAAmB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACvC,wBAAwB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC5C,iBAAiB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACrC,qBAAqB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAC3C,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { GitLabClient } from '../client';
2
+ import type { ToolRegistrar } from '../../types';
3
+ export declare function registerRepositoryTools(client: GitLabClient, registrar: ToolRegistrar): void;
4
+ //# sourceMappingURL=repository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../../../../src/mcp/providers/gitlab/tools/repository.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAYjD,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,YAAY,EACpB,SAAS,EAAE,aAAa,GACvB,IAAI,CAwQN"}
@@ -0,0 +1,191 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerRepositoryTools = registerRepositoryTools;
4
+ const zod_1 = require("zod");
5
+ const validation_1 = require("../../../server/validation");
6
+ const tool_helpers_1 = require("../../tool-helpers");
7
+ function buildQueryParams(raw) {
8
+ const params = {};
9
+ for (const [key, val] of Object.entries(raw)) {
10
+ if (val !== undefined)
11
+ params[key] = String(val);
12
+ }
13
+ return params;
14
+ }
15
+ function registerRepositoryTools(client, registrar) {
16
+ // -------------------------------------------------------------------------
17
+ // 1. gitlab_list_projects
18
+ // -------------------------------------------------------------------------
19
+ registrar.registerTool('gitlab_list_projects', {
20
+ description: 'List GitLab projects accessible to the authenticated user',
21
+ inputSchema: zod_1.z.object({
22
+ search: zod_1.z.string().optional().describe('Filter projects by name'),
23
+ page: validation_1.PageSchema.optional().describe('Page number'),
24
+ per_page: validation_1.PerPageSchema.optional().describe('Results per page'),
25
+ }),
26
+ annotations: { readOnlyHint: true },
27
+ }, async (params) => {
28
+ const queryParams = buildQueryParams({
29
+ search: params.search,
30
+ page: params.page,
31
+ per_page: params.per_page,
32
+ });
33
+ const response = await client.get('/projects', queryParams);
34
+ return (0, tool_helpers_1.toMcpResult)(response.body);
35
+ });
36
+ // -------------------------------------------------------------------------
37
+ // 2. gitlab_get_project
38
+ // -------------------------------------------------------------------------
39
+ registrar.registerTool('gitlab_get_project', {
40
+ description: 'Get details of a specific GitLab project by ID',
41
+ inputSchema: zod_1.z.object({
42
+ project_id: validation_1.GitLabProjectIdSchema.describe('The numeric ID of the GitLab project'),
43
+ }),
44
+ annotations: { readOnlyHint: true },
45
+ }, async (params) => {
46
+ const response = await client.get(`/projects/${params.project_id}`);
47
+ return (0, tool_helpers_1.toMcpResult)(response.body);
48
+ });
49
+ // -------------------------------------------------------------------------
50
+ // 3. gitlab_get_file
51
+ // -------------------------------------------------------------------------
52
+ registrar.registerTool('gitlab_get_file', {
53
+ description: 'Get the contents of a file from a GitLab repository',
54
+ inputSchema: zod_1.z.object({
55
+ project_id: validation_1.GitLabProjectIdSchema.describe('The numeric ID of the GitLab project'),
56
+ file_path: validation_1.FilePathSchema.describe('Path to the file in the repository'),
57
+ ref: zod_1.z.string().optional().describe('Branch name, tag, or commit SHA to read from'),
58
+ }),
59
+ annotations: { readOnlyHint: true },
60
+ }, async (params) => {
61
+ const encodedPath = encodeURIComponent(params.file_path);
62
+ const queryParams = buildQueryParams({ ref: params.ref });
63
+ const response = await client.get(`/projects/${params.project_id}/repository/files/${encodedPath}`, queryParams);
64
+ return (0, tool_helpers_1.toMcpResult)(response.body);
65
+ });
66
+ // -------------------------------------------------------------------------
67
+ // 4. gitlab_create_file
68
+ // -------------------------------------------------------------------------
69
+ registrar.registerTool('gitlab_create_file', {
70
+ description: 'Create a new file in a GitLab repository',
71
+ inputSchema: zod_1.z.object({
72
+ project_id: validation_1.GitLabProjectIdSchema.describe('The numeric ID of the GitLab project'),
73
+ file_path: validation_1.FilePathSchema.describe('Path to the file in the repository'),
74
+ branch: validation_1.BranchNameSchema.describe('Branch to commit the change to'),
75
+ content: zod_1.z.string().describe('The new file content'),
76
+ commit_message: zod_1.z.string().min(1).describe('Commit message for the change'),
77
+ }),
78
+ annotations: { destructiveHint: true },
79
+ }, async (params) => {
80
+ const encodedPath = encodeURIComponent(params.file_path);
81
+ const response = await client.post(`/projects/${params.project_id}/repository/files/${encodedPath}`, { branch: params.branch, content: params.content, commit_message: params.commit_message });
82
+ return (0, tool_helpers_1.toMcpResult)(response.body);
83
+ });
84
+ // -------------------------------------------------------------------------
85
+ // 5. gitlab_update_file
86
+ // -------------------------------------------------------------------------
87
+ registrar.registerTool('gitlab_update_file', {
88
+ description: 'Update an existing file in a GitLab repository',
89
+ inputSchema: zod_1.z.object({
90
+ project_id: validation_1.GitLabProjectIdSchema.describe('The numeric ID of the GitLab project'),
91
+ file_path: validation_1.FilePathSchema.describe('Path to the file in the repository'),
92
+ branch: validation_1.BranchNameSchema.describe('Branch to commit the change to'),
93
+ content: zod_1.z.string().describe('The updated file content'),
94
+ commit_message: zod_1.z.string().min(1).describe('Commit message for the change'),
95
+ }),
96
+ annotations: { destructiveHint: true },
97
+ }, async (params) => {
98
+ const encodedPath = encodeURIComponent(params.file_path);
99
+ const response = await client.put(`/projects/${params.project_id}/repository/files/${encodedPath}`, { branch: params.branch, content: params.content, commit_message: params.commit_message });
100
+ return (0, tool_helpers_1.toMcpResult)(response.body);
101
+ });
102
+ // -------------------------------------------------------------------------
103
+ // 6. gitlab_list_branches
104
+ // -------------------------------------------------------------------------
105
+ registrar.registerTool('gitlab_list_branches', {
106
+ description: 'List branches in a GitLab project repository',
107
+ inputSchema: zod_1.z.object({
108
+ project_id: validation_1.GitLabProjectIdSchema.describe('The numeric ID of the GitLab project'),
109
+ search: zod_1.z.string().optional().describe('Filter branches by name'),
110
+ }),
111
+ annotations: { readOnlyHint: true },
112
+ }, async (params) => {
113
+ const queryParams = buildQueryParams({ search: params.search });
114
+ const response = await client.get(`/projects/${params.project_id}/repository/branches`, queryParams);
115
+ return (0, tool_helpers_1.toMcpResult)(response.body);
116
+ });
117
+ // -------------------------------------------------------------------------
118
+ // 7. gitlab_get_branch
119
+ // -------------------------------------------------------------------------
120
+ registrar.registerTool('gitlab_get_branch', {
121
+ description: 'Get details of a specific branch in a GitLab project',
122
+ inputSchema: zod_1.z.object({
123
+ project_id: validation_1.GitLabProjectIdSchema.describe('The numeric ID of the GitLab project'),
124
+ branch: validation_1.BranchNameSchema.describe('The branch name'),
125
+ }),
126
+ annotations: { readOnlyHint: true },
127
+ }, async (params) => {
128
+ const response = await client.get(`/projects/${params.project_id}/repository/branches/${params.branch}`);
129
+ return (0, tool_helpers_1.toMcpResult)(response.body);
130
+ });
131
+ // -------------------------------------------------------------------------
132
+ // 8. gitlab_search_code
133
+ // -------------------------------------------------------------------------
134
+ registrar.registerTool('gitlab_search_code', {
135
+ description: 'Search code (blobs) within a GitLab project',
136
+ inputSchema: zod_1.z.object({
137
+ project_id: validation_1.GitLabProjectIdSchema.describe('The numeric ID of the GitLab project'),
138
+ search: validation_1.SearchQuerySchema.describe('Search query string'),
139
+ ref: zod_1.z.string().optional().describe('Branch or tag to search within'),
140
+ }),
141
+ annotations: { readOnlyHint: true },
142
+ }, async (params) => {
143
+ const queryParams = buildQueryParams({
144
+ scope: 'blobs',
145
+ search: params.search,
146
+ ref: params.ref,
147
+ });
148
+ const response = await client.get(`/projects/${params.project_id}/search`, queryParams);
149
+ return (0, tool_helpers_1.toMcpResult)(response.body);
150
+ });
151
+ // -------------------------------------------------------------------------
152
+ // 9. gitlab_get_repository_tree
153
+ // -------------------------------------------------------------------------
154
+ registrar.registerTool('gitlab_get_repository_tree', {
155
+ description: 'List the repository tree (files and directories) for a GitLab project',
156
+ inputSchema: zod_1.z.object({
157
+ project_id: validation_1.GitLabProjectIdSchema.describe('The numeric ID of the GitLab project'),
158
+ path: zod_1.z.string().optional().describe('Subdirectory path inside the repository'),
159
+ ref: zod_1.z.string().optional().describe('Branch name, tag, or commit SHA'),
160
+ recursive: zod_1.z.boolean().optional().describe('If true, list tree recursively'),
161
+ page: validation_1.PageSchema.optional().describe('Page number for pagination'),
162
+ per_page: validation_1.PerPageSchema.optional().describe('Number of results per page'),
163
+ }),
164
+ annotations: { readOnlyHint: true },
165
+ }, async (params) => {
166
+ const queryParams = buildQueryParams({
167
+ path: params.path,
168
+ ref: params.ref,
169
+ recursive: params.recursive,
170
+ page: params.page,
171
+ per_page: params.per_page,
172
+ });
173
+ const response = await client.get(`/projects/${params.project_id}/repository/tree`, queryParams);
174
+ return (0, tool_helpers_1.toMcpResult)(response.body);
175
+ });
176
+ // -------------------------------------------------------------------------
177
+ // 10. gitlab_get_clone_urls
178
+ // -------------------------------------------------------------------------
179
+ registrar.registerTool('gitlab_get_clone_urls', {
180
+ description: 'Get HTTP and SSH clone URLs for a GitLab project',
181
+ inputSchema: zod_1.z.object({
182
+ project_id: validation_1.GitLabProjectIdSchema.describe('The numeric ID of the GitLab project'),
183
+ }),
184
+ annotations: { readOnlyHint: true },
185
+ }, async (params) => {
186
+ const response = await client.get(`/projects/${params.project_id}`);
187
+ const { http_url_to_repo, ssh_url_to_repo } = response.body;
188
+ return (0, tool_helpers_1.toMcpResult)({ http_url_to_repo, ssh_url_to_repo });
189
+ });
190
+ }
191
+ //# sourceMappingURL=repository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repository.js","sourceRoot":"","sources":["../../../../../src/mcp/providers/gitlab/tools/repository.ts"],"names":[],"mappings":";;AAuBA,0DA2QC;AAlSD,6BAAwB;AACxB,2DAOoC;AACpC,qDAAiD;AAIjD,SAAS,gBAAgB,CACvB,GAA0D;IAE1D,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7C,IAAI,GAAG,KAAK,SAAS;YAAE,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IACnD,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAgB,uBAAuB,CACrC,MAAoB,EACpB,SAAwB;IAExB,4EAA4E;IAC5E,0BAA0B;IAC1B,4EAA4E;IAC5E,SAAS,CAAC,YAAY,CACpB,sBAAsB,EACtB;QACE,WAAW,EAAE,2DAA2D;QACxE,WAAW,EAAE,OAAC,CAAC,MAAM,CAAC;YACpB,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yBAAyB,CAAC;YACjE,IAAI,EAAE,uBAAU,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC;YACnD,QAAQ,EAAE,0BAAa,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kBAAkB,CAAC;SAChE,CAAC;QACF,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;KACpC,EACD,KAAK,EAAE,MAA6D,EAAE,EAAE;QACtE,MAAM,WAAW,GAAG,gBAAgB,CAAC;YACnC,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,IAAI,EAAE,MAAM,CAAC,IA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AI,CAAC;QAC5D,OAAO,IAAA,0BAAW,EAAC,EAAE,gBAAgB,EAAE,eAAe,EAAE,CAAC,CAAC;IAC5D,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ export type { Provider, ToolRegistrar } from './types';
2
+ export { ProviderRegistry } from './registry';
3
+ export type { ProviderReadyResult } from './registry';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mcp/providers/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,YAAY,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProviderRegistry = void 0;
4
+ var registry_1 = require("./registry");
5
+ Object.defineProperty(exports, "ProviderRegistry", { enumerable: true, get: function () { return registry_1.ProviderRegistry; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/mcp/providers/index.ts"],"names":[],"mappings":";;;AACA,uCAA8C;AAArC,4GAAA,gBAAgB,OAAA"}
@@ -0,0 +1,90 @@
1
+ /**
2
+ * ProviderRegistry — lifecycle manager for MCP providers.
3
+ *
4
+ * Holds all registered Provider instances and orchestrates bulk operations:
5
+ * tool/resource registration, readiness checks, and graceful shutdown.
6
+ *
7
+ * Design notes:
8
+ * - Zero MCP SDK imports. Providers are wired through the ToolRegistrar port.
9
+ * - shutdownAll() is intentionally fault-tolerant: every provider's shutdown()
10
+ * is called regardless of earlier failures. Errors are collected and the
11
+ * first is re-thrown after all shutdowns complete.
12
+ * - readyAll() is non-throwing: per-provider errors are captured into the
13
+ * returned ProviderReadyResult array so callers can inspect partial failures.
14
+ */
15
+ import { Provider, ToolRegistrar } from './types';
16
+ /**
17
+ * Result of a single provider's readiness check.
18
+ *
19
+ * When `ready` is true the `error` property is absent.
20
+ * When `ready` is false the `error` property contains the rejection reason.
21
+ */
22
+ export interface ProviderReadyResult {
23
+ /** The provider's stable identifier. */
24
+ name: string;
25
+ /** Whether the provider is ready to serve requests. */
26
+ ready: boolean;
27
+ /** The error thrown by ready(), present only when ready is false. */
28
+ error?: Error;
29
+ }
30
+ /**
31
+ * Registry that manages Provider instances and their lifecycle.
32
+ *
33
+ * Providers are stored by name. Registering a provider with an existing name
34
+ * overwrites the previous registration (last-write-wins).
35
+ */
36
+ export declare class ProviderRegistry {
37
+ private readonly providers;
38
+ /**
39
+ * Register a provider by its name.
40
+ *
41
+ * If a provider with the same name is already registered it is overwritten.
42
+ *
43
+ * @param provider - The provider to register.
44
+ */
45
+ register(provider: Provider): void;
46
+ /**
47
+ * Retrieve a provider by name.
48
+ *
49
+ * @param name - The provider's stable identifier.
50
+ * @returns The provider, or undefined if no provider with that name exists.
51
+ */
52
+ get(name: string): Provider | undefined;
53
+ /**
54
+ * Return a snapshot of all registered providers.
55
+ *
56
+ * The returned array is a new array; mutating it does not affect the registry.
57
+ */
58
+ getAll(): Provider[];
59
+ /**
60
+ * Register all tools and resources from every provider via the ToolRegistrar port.
61
+ *
62
+ * Called once at server startup before the first MCP client connects.
63
+ * For each provider, registerTools() is called before registerResources().
64
+ *
65
+ * @param registrar - The ToolRegistrar port implementation (never the raw McpServer).
66
+ */
67
+ registerAll(registrar: ToolRegistrar): void;
68
+ /**
69
+ * Check the readiness of all registered providers.
70
+ *
71
+ * Does NOT throw on individual provider failures. Instead, every provider's
72
+ * result — success or failure — is captured in the returned array. Callers
73
+ * should inspect the results to decide whether to start the MCP server.
74
+ *
75
+ * @returns A result for each registered provider, in registration order.
76
+ */
77
+ readyAll(): Promise<ProviderReadyResult[]>;
78
+ /**
79
+ * Shut down all registered providers, collecting any errors along the way.
80
+ *
81
+ * Graceful degradation: every provider's shutdown() is called even if a
82
+ * preceding provider throws. After all shutdowns complete, if any errors
83
+ * were collected the first error is re-thrown so callers are notified of
84
+ * partial failure.
85
+ *
86
+ * @throws The first error encountered during shutdown, if any.
87
+ */
88
+ shutdownAll(): Promise<void>;
89
+ }
90
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/mcp/providers/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAMlD;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,KAAK,EAAE,OAAO,CAAC;IACf,qEAAqE;IACrE,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAMD;;;;;GAKG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA+B;IAMzD;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAIlC;;;;;OAKG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS;IAIvC;;;;OAIG;IACH,MAAM,IAAI,QAAQ,EAAE;IAQpB;;;;;;;OAOG;IACH,WAAW,CAAC,SAAS,EAAE,aAAa,GAAG,IAAI;IAO3C;;;;;;;;OAQG;IACG,QAAQ,IAAI,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAmBhD;;;;;;;;;OASG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;CAenC"}
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+ /**
3
+ * ProviderRegistry — lifecycle manager for MCP providers.
4
+ *
5
+ * Holds all registered Provider instances and orchestrates bulk operations:
6
+ * tool/resource registration, readiness checks, and graceful shutdown.
7
+ *
8
+ * Design notes:
9
+ * - Zero MCP SDK imports. Providers are wired through the ToolRegistrar port.
10
+ * - shutdownAll() is intentionally fault-tolerant: every provider's shutdown()
11
+ * is called regardless of earlier failures. Errors are collected and the
12
+ * first is re-thrown after all shutdowns complete.
13
+ * - readyAll() is non-throwing: per-provider errors are captured into the
14
+ * returned ProviderReadyResult array so callers can inspect partial failures.
15
+ */
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.ProviderRegistry = void 0;
18
+ // ---------------------------------------------------------------------------
19
+ // ProviderRegistry
20
+ // ---------------------------------------------------------------------------
21
+ /**
22
+ * Registry that manages Provider instances and their lifecycle.
23
+ *
24
+ * Providers are stored by name. Registering a provider with an existing name
25
+ * overwrites the previous registration (last-write-wins).
26
+ */
27
+ class ProviderRegistry {
28
+ providers = new Map();
29
+ // -------------------------------------------------------------------------
30
+ // Registration and lookup
31
+ // -------------------------------------------------------------------------
32
+ /**
33
+ * Register a provider by its name.
34
+ *
35
+ * If a provider with the same name is already registered it is overwritten.
36
+ *
37
+ * @param provider - The provider to register.
38
+ */
39
+ register(provider) {
40
+ this.providers.set(provider.name, provider);
41
+ }
42
+ /**
43
+ * Retrieve a provider by name.
44
+ *
45
+ * @param name - The provider's stable identifier.
46
+ * @returns The provider, or undefined if no provider with that name exists.
47
+ */
48
+ get(name) {
49
+ return this.providers.get(name);
50
+ }
51
+ /**
52
+ * Return a snapshot of all registered providers.
53
+ *
54
+ * The returned array is a new array; mutating it does not affect the registry.
55
+ */
56
+ getAll() {
57
+ return Array.from(this.providers.values());
58
+ }
59
+ // -------------------------------------------------------------------------
60
+ // Bulk lifecycle operations
61
+ // -------------------------------------------------------------------------
62
+ /**
63
+ * Register all tools and resources from every provider via the ToolRegistrar port.
64
+ *
65
+ * Called once at server startup before the first MCP client connects.
66
+ * For each provider, registerTools() is called before registerResources().
67
+ *
68
+ * @param registrar - The ToolRegistrar port implementation (never the raw McpServer).
69
+ */
70
+ registerAll(registrar) {
71
+ for (const provider of this.providers.values()) {
72
+ provider.registerTools(registrar);
73
+ provider.registerResources(registrar);
74
+ }
75
+ }
76
+ /**
77
+ * Check the readiness of all registered providers.
78
+ *
79
+ * Does NOT throw on individual provider failures. Instead, every provider's
80
+ * result — success or failure — is captured in the returned array. Callers
81
+ * should inspect the results to decide whether to start the MCP server.
82
+ *
83
+ * @returns A result for each registered provider, in registration order.
84
+ */
85
+ async readyAll() {
86
+ const results = [];
87
+ for (const provider of this.providers.values()) {
88
+ try {
89
+ await provider.ready();
90
+ results.push({ name: provider.name, ready: true });
91
+ }
92
+ catch (err) {
93
+ results.push({
94
+ name: provider.name,
95
+ ready: false,
96
+ error: err instanceof Error ? err : new Error(String(err)),
97
+ });
98
+ }
99
+ }
100
+ return results;
101
+ }
102
+ /**
103
+ * Shut down all registered providers, collecting any errors along the way.
104
+ *
105
+ * Graceful degradation: every provider's shutdown() is called even if a
106
+ * preceding provider throws. After all shutdowns complete, if any errors
107
+ * were collected the first error is re-thrown so callers are notified of
108
+ * partial failure.
109
+ *
110
+ * @throws The first error encountered during shutdown, if any.
111
+ */
112
+ async shutdownAll() {
113
+ const errors = [];
114
+ for (const provider of this.providers.values()) {
115
+ try {
116
+ await provider.shutdown();
117
+ }
118
+ catch (err) {
119
+ errors.push(err instanceof Error ? err : new Error(String(err)));
120
+ }
121
+ }
122
+ if (errors.length > 0) {
123
+ throw errors[0];
124
+ }
125
+ }
126
+ }
127
+ exports.ProviderRegistry = ProviderRegistry;
128
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/mcp/providers/registry.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;AAuBH,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E;AAE9E;;;;;GAKG;AACH,MAAa,gBAAgB;IACV,SAAS,GAAG,IAAI,GAAG,EAAoB,CAAC;IAEzD,4EAA4E;IAC5E,0BAA0B;IAC1B,4EAA4E;IAE5E;;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