efficient-gitlab-mcp-server 2.6.0 → 2.7.0
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/dist/index.js +28 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -53563,16 +53563,28 @@ var logger = new Logger(config2.logLevel, config2.logFormat);
|
|
|
53563
53563
|
class GitLabClient {
|
|
53564
53564
|
apiUrl;
|
|
53565
53565
|
token;
|
|
53566
|
+
tokenHeader;
|
|
53566
53567
|
constructor(apiUrl, token) {
|
|
53567
53568
|
this.apiUrl = apiUrl ?? config2.gitlabApiUrl;
|
|
53568
|
-
|
|
53569
|
+
const pat = token ?? process.env.GITLAB_PERSONAL_ACCESS_TOKEN;
|
|
53570
|
+
const jobToken = process.env.CI_JOB_TOKEN;
|
|
53571
|
+
if (pat) {
|
|
53572
|
+
this.token = pat;
|
|
53573
|
+
this.tokenHeader = "PRIVATE-TOKEN";
|
|
53574
|
+
} else if (jobToken) {
|
|
53575
|
+
this.token = jobToken;
|
|
53576
|
+
this.tokenHeader = "JOB-TOKEN";
|
|
53577
|
+
} else {
|
|
53578
|
+
this.token = "";
|
|
53579
|
+
this.tokenHeader = "PRIVATE-TOKEN";
|
|
53580
|
+
}
|
|
53569
53581
|
}
|
|
53570
53582
|
getHeaders() {
|
|
53571
53583
|
const headers = {
|
|
53572
53584
|
"Content-Type": "application/json"
|
|
53573
53585
|
};
|
|
53574
53586
|
if (this.token) {
|
|
53575
|
-
headers[
|
|
53587
|
+
headers[this.tokenHeader] = this.token;
|
|
53576
53588
|
}
|
|
53577
53589
|
return headers;
|
|
53578
53590
|
}
|
|
@@ -53625,8 +53637,8 @@ ${errorBody}`);
|
|
|
53625
53637
|
async rawFetch(endpoint, options = {}) {
|
|
53626
53638
|
const url2 = endpoint.startsWith("http") ? endpoint : `${this.apiUrl}${endpoint}`;
|
|
53627
53639
|
const headers = new Headers(options.headers);
|
|
53628
|
-
if (this.token && !headers.has(
|
|
53629
|
-
headers.set(
|
|
53640
|
+
if (this.token && !headers.has(this.tokenHeader)) {
|
|
53641
|
+
headers.set(this.tokenHeader, this.token);
|
|
53630
53642
|
}
|
|
53631
53643
|
const response = await fetch(url2, { ...options, headers });
|
|
53632
53644
|
if (!response.ok) {
|
|
@@ -53878,7 +53890,9 @@ var ListIssueDiscussionsSchema = exports_external.object({
|
|
|
53878
53890
|
var CreateIssueNoteSchema = exports_external.object({
|
|
53879
53891
|
project_id: exports_external.string().describe("Project ID or URL-encoded path"),
|
|
53880
53892
|
issue_iid: exports_external.number().describe("Issue IID"),
|
|
53881
|
-
body: exports_external.string().describe("Note body")
|
|
53893
|
+
body: exports_external.string().describe("Note body"),
|
|
53894
|
+
discussion_id: exports_external.string().optional().describe("Discussion thread ID to reply to instead of creating a top-level note"),
|
|
53895
|
+
created_at: exports_external.string().optional().describe("ISO 8601 creation date (admin/project owner only)")
|
|
53882
53896
|
});
|
|
53883
53897
|
var UpdateIssueNoteSchema = exports_external.object({
|
|
53884
53898
|
project_id: exports_external.string().describe("Project ID or URL-encoded path"),
|
|
@@ -54097,17 +54111,23 @@ function registerIssueTools(server, logger2) {
|
|
|
54097
54111
|
tools.set("list_issue_discussions", toolRef10);
|
|
54098
54112
|
const toolRef11 = server.registerTool("create_issue_note", {
|
|
54099
54113
|
title: "Create Issue Note",
|
|
54100
|
-
description: "Add a
|
|
54114
|
+
description: "Add a note to an issue, or reply to a discussion thread",
|
|
54101
54115
|
inputSchema: {
|
|
54102
54116
|
project_id: exports_external.string().describe("Project ID or URL-encoded path"),
|
|
54103
54117
|
issue_iid: exports_external.number().describe("Issue IID"),
|
|
54104
|
-
body: exports_external.string().describe("Note body")
|
|
54118
|
+
body: exports_external.string().describe("Note body"),
|
|
54119
|
+
discussion_id: exports_external.string().optional().describe("Discussion thread ID to reply to instead of creating a top-level note"),
|
|
54120
|
+
created_at: exports_external.string().optional().describe("ISO 8601 creation date (admin/project owner only)")
|
|
54105
54121
|
},
|
|
54106
54122
|
annotations: { destructiveHint: false }
|
|
54107
54123
|
}, async (params) => {
|
|
54108
54124
|
const args = CreateIssueNoteSchema.parse(params);
|
|
54109
54125
|
const projectId = encodeProjectId(args.project_id);
|
|
54110
|
-
const
|
|
54126
|
+
const endpoint = args.discussion_id ? `/projects/${projectId}/issues/${args.issue_iid}/discussions/${args.discussion_id}/notes` : `/projects/${projectId}/issues/${args.issue_iid}/notes`;
|
|
54127
|
+
const note = await defaultClient.post(endpoint, {
|
|
54128
|
+
body: args.body,
|
|
54129
|
+
...args.created_at && { created_at: args.created_at }
|
|
54130
|
+
});
|
|
54111
54131
|
return { content: [{ type: "text", text: JSON.stringify(note, null, 2) }] };
|
|
54112
54132
|
});
|
|
54113
54133
|
toolRef11.disable();
|
package/package.json
CHANGED