efficient-gitlab-mcp-server 2.2.0 → 2.3.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 +21 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -53632,6 +53632,25 @@ ${errorBody}`);
|
|
|
53632
53632
|
}
|
|
53633
53633
|
return response;
|
|
53634
53634
|
}
|
|
53635
|
+
async graphql(query, variables = {}) {
|
|
53636
|
+
const idx = this.apiUrl.lastIndexOf("/api/v4");
|
|
53637
|
+
const prefix = idx >= 0 ? this.apiUrl.slice(0, idx) : this.apiUrl;
|
|
53638
|
+
const graphqlUrl = process.env.GITLAB_GRAPHQL_URL || `${prefix}/api/graphql`;
|
|
53639
|
+
const response = await fetch(graphqlUrl, {
|
|
53640
|
+
method: "POST",
|
|
53641
|
+
headers: this.getHeaders(),
|
|
53642
|
+
body: JSON.stringify({ query, variables })
|
|
53643
|
+
});
|
|
53644
|
+
if (!response.ok) {
|
|
53645
|
+
const errorBody = await response.text();
|
|
53646
|
+
throw new Error(`GraphQL request failed (${response.status}): ${errorBody}`);
|
|
53647
|
+
}
|
|
53648
|
+
const json2 = await response.json();
|
|
53649
|
+
if (json2.errors && json2.errors.length > 0) {
|
|
53650
|
+
throw new Error(`GraphQL errors: ${json2.errors.map((e) => e.message).join(", ")}`);
|
|
53651
|
+
}
|
|
53652
|
+
return json2.data;
|
|
53653
|
+
}
|
|
53635
53654
|
getApiUrl() {
|
|
53636
53655
|
return this.apiUrl;
|
|
53637
53656
|
}
|
|
@@ -53760,16 +53779,9 @@ function registerGraphqlTools(server, logger2) {
|
|
|
53760
53779
|
}
|
|
53761
53780
|
}, async (params) => {
|
|
53762
53781
|
const args = ExecuteGraphQLSchema.parse(params);
|
|
53763
|
-
|
|
53764
|
-
const idx = apiUrl.lastIndexOf("/api/v4");
|
|
53765
|
-
const prefix = idx >= 0 ? apiUrl.slice(0, idx) : apiUrl;
|
|
53766
|
-
const graphqlUrl = process.env.GITLAB_GRAPHQL_URL || `${prefix}/api/graphql`;
|
|
53767
|
-
logger2.info("execute_graphql request", { endpoint: graphqlUrl });
|
|
53782
|
+
logger2.info("execute_graphql request");
|
|
53768
53783
|
try {
|
|
53769
|
-
const result = await defaultClient.
|
|
53770
|
-
query: args.query,
|
|
53771
|
-
variables: args.variables || {}
|
|
53772
|
-
});
|
|
53784
|
+
const result = await defaultClient.graphql(args.query, args.variables || {});
|
|
53773
53785
|
return {
|
|
53774
53786
|
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
53775
53787
|
};
|
package/package.json
CHANGED