@zereight/mcp-gitlab 2.3.6-next.128 → 2.3.6-next.130

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.
package/build/index.js CHANGED
@@ -91,6 +91,7 @@ import { determineTransportMode, TransportMode } from "./server/transport-mode.j
91
91
  import { formatPrometheusMetrics } from "./server/metrics.js";
92
92
  import { SERVER_VERSION } from "./server/version.js";
93
93
  import { listMcpResources, listMcpResourceTemplates, readMcpResource, } from "./server/mcp-resources.js";
94
+ import { getMcpPrompt, listMcpPrompts } from "./server/mcp-prompts.js";
94
95
  import { isInitializationRequestBody, isUnauthenticatedDiscoveryRequestBody, readAcceptHeader, readMcpSessionIdHeader, redactSessionIdForLog, } from "./server/request-helpers.js";
95
96
  export { readMcpSessionIdHeader } from "./server/request-helpers.js";
96
97
  import { apiUrlUserinfoWarning, encodeGitLabPath, encodeGitLabPathSegment, isCleartextRemoteUrl, normalizeGitLabApiUrl, parseConfiguredGitLabApiUrls, } from "./utils/url.js";
@@ -147,53 +148,6 @@ const SERVER_NAME = process.env.MCP_SERVER_NAME?.trim() || "zereight-gitlab-mcp-
147
148
  // No `title`: clients would show it instead of `name`, hiding MCP_SERVER_NAME.
148
149
  const SERVER_DESCRIPTION = "GitLab MCP server for projects, merge requests, issues, pipelines, wiki, releases, and more.";
149
150
  const SERVER_WEBSITE_URL = "https://zereight.github.io/gitlab-mcp/";
150
- /**
151
- * Static MCP prompt catalog. These wrap the multi-step tool workflows documented in
152
- * skills/gitlab-mcp/ so MCP clients that surface prompts (e.g. slash commands) can
153
- * trigger them without the agent needing to read the Skill first. Kept inline (not
154
- * loaded from skills/gitlab-mcp/*.md) since only "build" ships in the npm package.
155
- */
156
- const MCP_PROMPTS = [
157
- {
158
- name: "review_merge_request",
159
- description: "Review a merge request's diff in batches and leave threaded comments.",
160
- arguments: [
161
- { name: "project_id", description: "Numeric project ID or URL-encoded path", required: true },
162
- { name: "merge_request_iid", description: "Merge request IID", required: true },
163
- ],
164
- render: (args) => `Review merge request !${args.merge_request_iid ?? "<iid>"} in project ${args.project_id ?? "<project_id>"}:\n` +
165
- `1. Call list_merge_request_changed_files to get the changed file list (use excluded_file_patterns for lockfiles/dist/generated files).\n` +
166
- `2. Call get_merge_request_file_diff in batches of 3-5 files, prioritizing source over config/tests.\n` +
167
- `3. Leave inline findings with create_merge_request_thread (position: new_path/new_line). For a general note, call discover_tools with category "merge_requests", then create_merge_request_note.\n` +
168
- `4. Summarize the review verdict in a final top-level note.`,
169
- },
170
- {
171
- name: "triage_pipeline_failure",
172
- description: "Find the failing job in a pipeline and pull its log tail for diagnosis.",
173
- arguments: [
174
- { name: "project_id", description: "Numeric project ID or URL-encoded path", required: true },
175
- { name: "pipeline_id", description: "Pipeline ID", required: true },
176
- ],
177
- render: (args) => `Diagnose pipeline ${args.pipeline_id ?? "<pipeline_id>"} in project ${args.project_id ?? "<project_id>"}:\n` +
178
- `1. Call list_pipeline_jobs to find jobs with status "failed".\n` +
179
- `2. Call get_pipeline_job_output (or the job trace tool) on each failed job, focusing on the tail of the log.\n` +
180
- `3. Identify the root cause (compile error, test failure, timeout, runner issue) and quote the relevant log lines.\n` +
181
- `4. Suggest the fix or the next diagnostic step.`,
182
- },
183
- {
184
- name: "triage_vulnerabilities",
185
- description: "List a project's open vulnerabilities and propose a remediation priority order.",
186
- arguments: [
187
- { name: "project_id", description: "Numeric project ID or URL-encoded path", required: true },
188
- ],
189
- render: (args) => `Triage vulnerabilities for project ${args.project_id ?? "<project_id>"}:\n` +
190
- `1. Call list_project_vulnerabilities once with state=detected and once with state=confirmed ` +
191
- `(the tool only accepts one state per call). Follow pageInfo.endCursor with the "after" ` +
192
- `param while pageInfo.hasNextPage is true, and aggregate both states' results.\n` +
193
- `2. Group the aggregated results by severity (critical > high > medium > low) and by whether a fix is already available.\n` +
194
- `3. Propose a remediation order, calling out any critical/high items with no available fix.`,
195
- },
196
- ];
197
151
  /**
198
152
  * Error text for a call to a tool that tools/list omits.
199
153
  * Suggests `discover_tools` only when that call would add the tool.
@@ -255,32 +209,8 @@ function createServer() {
255
209
  resources: {},
256
210
  },
257
211
  });
258
- mcpServer.server.setRequestHandler(ListPromptsRequestSchema, async () => ({
259
- prompts: MCP_PROMPTS.map(({ name, description, arguments: args }) => ({
260
- name,
261
- description,
262
- arguments: args,
263
- })),
264
- }));
265
- mcpServer.server.setRequestHandler(GetPromptRequestSchema, async (request) => {
266
- const prompt = MCP_PROMPTS.find(p => p.name === request.params.name);
267
- if (!prompt) {
268
- throw new Error(`Unknown prompt: ${request.params.name}`);
269
- }
270
- const args = (request.params.arguments ?? {});
271
- return {
272
- description: prompt.description,
273
- messages: [
274
- {
275
- role: "user",
276
- content: {
277
- type: "text",
278
- text: prompt.render(args),
279
- },
280
- },
281
- ],
282
- };
283
- });
212
+ mcpServer.server.setRequestHandler(ListPromptsRequestSchema, async () => listMcpPrompts());
213
+ mcpServer.server.setRequestHandler(GetPromptRequestSchema, async (request) => getMcpPrompt(request.params.name, (request.params.arguments ?? {})));
284
214
  mcpServer.server.setRequestHandler(ListResourcesRequestSchema, async () => listMcpResources());
285
215
  mcpServer.server.setRequestHandler(ListResourceTemplatesRequestSchema, async () => listMcpResourceTemplates());
286
216
  mcpServer.server.setRequestHandler(ReadResourceRequestSchema, async (request) => readMcpResource(request.params.uri));
@@ -0,0 +1,75 @@
1
+ // npm ships build/ only, so the text is inlined.
2
+ /**
3
+ * Static MCP prompt catalog. These wrap the multi-step tool workflows documented in
4
+ * skills/gitlab-mcp/ so MCP clients that surface prompts (e.g. slash commands) can
5
+ * trigger them without the agent needing to read the Skill first. Kept inline (not
6
+ * loaded from skills/gitlab-mcp/*.md) since only "build" ships in the npm package.
7
+ */
8
+ const prompts = [
9
+ {
10
+ name: "review_merge_request",
11
+ description: "Review a merge request's diff in batches and leave threaded comments.",
12
+ arguments: [
13
+ { name: "project_id", description: "Numeric project ID or URL-encoded path", required: true },
14
+ { name: "merge_request_iid", description: "Merge request IID", required: true },
15
+ ],
16
+ render: (args) => `Review merge request !${args.merge_request_iid ?? "<iid>"} in project ${args.project_id ?? "<project_id>"}:\n` +
17
+ `1. Call list_merge_request_changed_files to get the changed file list (use excluded_file_patterns for lockfiles/dist/generated files).\n` +
18
+ `2. Call get_merge_request_file_diff in batches of 3-5 files, prioritizing source over config/tests.\n` +
19
+ `3. Leave inline findings with create_merge_request_thread (position: new_path/new_line). For a general note, call discover_tools with category "merge_requests", then create_merge_request_note.\n` +
20
+ `4. Summarize the review verdict in a final top-level note.`,
21
+ },
22
+ {
23
+ name: "triage_pipeline_failure",
24
+ description: "Find the failing job in a pipeline and pull its log tail for diagnosis.",
25
+ arguments: [
26
+ { name: "project_id", description: "Numeric project ID or URL-encoded path", required: true },
27
+ { name: "pipeline_id", description: "Pipeline ID", required: true },
28
+ ],
29
+ render: (args) => `Diagnose pipeline ${args.pipeline_id ?? "<pipeline_id>"} in project ${args.project_id ?? "<project_id>"}:\n` +
30
+ `1. Call list_pipeline_jobs to find jobs with status "failed".\n` +
31
+ `2. Call get_pipeline_job_output (or the job trace tool) on each failed job, focusing on the tail of the log.\n` +
32
+ `3. Identify the root cause (compile error, test failure, timeout, runner issue) and quote the relevant log lines.\n` +
33
+ `4. Suggest the fix or the next diagnostic step.`,
34
+ },
35
+ {
36
+ name: "triage_vulnerabilities",
37
+ description: "List a project's open vulnerabilities and propose a remediation priority order.",
38
+ arguments: [
39
+ { name: "project_id", description: "Numeric project ID or URL-encoded path", required: true },
40
+ ],
41
+ render: (args) => `Triage vulnerabilities for project ${args.project_id ?? "<project_id>"}:\n` +
42
+ `1. Call list_project_vulnerabilities once with state=detected and once with state=confirmed ` +
43
+ `(the tool only accepts one state per call). Follow pageInfo.endCursor with the "after" ` +
44
+ `param while pageInfo.hasNextPage is true, and aggregate both states' results.\n` +
45
+ `2. Group the aggregated results by severity (critical > high > medium > low) and by whether a fix is already available.\n` +
46
+ `3. Propose a remediation order, calling out any critical/high items with no available fix.`,
47
+ },
48
+ ];
49
+ export function listMcpPrompts() {
50
+ return {
51
+ prompts: prompts.map(({ name, description, arguments: args }) => ({
52
+ name,
53
+ description,
54
+ arguments: args,
55
+ })),
56
+ };
57
+ }
58
+ export function getMcpPrompt(name, args) {
59
+ const prompt = prompts.find(p => p.name === name);
60
+ if (!prompt) {
61
+ throw new Error(`Unknown prompt: ${name}`);
62
+ }
63
+ return {
64
+ description: prompt.description,
65
+ messages: [
66
+ {
67
+ role: "user",
68
+ content: {
69
+ type: "text",
70
+ text: prompt.render(args),
71
+ },
72
+ },
73
+ ],
74
+ };
75
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zereight/mcp-gitlab",
3
- "version": "2.3.6-next.128",
3
+ "version": "2.3.6-next.130",
4
4
  "mcpName": "io.github.zereight/gitlab-mcp",
5
5
  "description": "GitLab MCP server for projects, merge requests, issues, pipelines, wiki, releases, and more",
6
6
  "keywords": [