efficient-gitlab-mcp-server 2.6.1 → 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 +16 -4
- 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) {
|
package/package.json
CHANGED