@zereight/mcp-gitlab 1.0.24 → 1.0.26
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/README.md +6 -8
- package/build/index.js +261 -204
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ GitLab MCP(Model Context Protocol) Server. **Includes bug fixes and improvements
|
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
|
-
### Using with Claude App, Cline, Roo Code
|
|
13
|
+
### Using with Claude App, Cline, Roo Code, Cursor
|
|
14
14
|
|
|
15
15
|
When using with the Claude App, you need to set up your API key and URLs directly.
|
|
16
16
|
|
|
@@ -22,23 +22,20 @@ When using with the Claude App, you need to set up your API key and URLs directl
|
|
|
22
22
|
"args": ["-y", "@zereight/mcp-gitlab"],
|
|
23
23
|
"env": {
|
|
24
24
|
"GITLAB_PERSONAL_ACCESS_TOKEN": "your_gitlab_token",
|
|
25
|
-
"GITLAB_API_URL": "your_gitlab_api_url"
|
|
25
|
+
"GITLAB_API_URL": "your_gitlab_api_url",
|
|
26
|
+
"GITLAB_READ_ONLY_MODE": "true"
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
```
|
|
31
32
|
|
|
32
|
-
###
|
|
33
|
+
### Environment Variables
|
|
33
34
|
|
|
34
|
-
When using with Cursor, you can set up environment variables and run the server as follows:
|
|
35
|
-
|
|
36
|
-
```
|
|
37
|
-
env GITLAB_PERSONAL_ACCESS_TOKEN=your_gitlab_token GITLAB_API_URL=your_gitlab_api_url npx @zereight/mcp-gitlab
|
|
38
|
-
```
|
|
39
35
|
|
|
40
36
|
- `GITLAB_PERSONAL_ACCESS_TOKEN`: Your GitLab personal access token.
|
|
41
37
|
- `GITLAB_API_URL`: Your GitLab API URL. (Default: `https://gitlab.com/api/v4`)
|
|
38
|
+
- `GITLAB_READ_ONLY_MODE`: When set to 'true', restricts the server to only expose read-only operations. Useful for enhanced security or when write access is not needed. Also useful for using with Cursor and it's 40 tool limit.
|
|
42
39
|
|
|
43
40
|
## Tools 🛠️
|
|
44
41
|
|
|
@@ -272,6 +269,7 @@ Before running the server, you need to set the following environment variables:
|
|
|
272
269
|
```
|
|
273
270
|
GITLAB_PERSONAL_ACCESS_TOKEN=your_gitlab_token
|
|
274
271
|
GITLAB_API_URL=your_gitlab_api_url # Default: https://gitlab.com/api/v4
|
|
272
|
+
GITLAB_READ_ONLY_MODE=true # Optional: Enable read-only mode
|
|
275
273
|
```
|
|
276
274
|
|
|
277
275
|
## License
|
package/build/index.js
CHANGED
|
@@ -19,11 +19,11 @@ ListMergeRequestDiscussionsSchema, } from "./schemas.js";
|
|
|
19
19
|
*/
|
|
20
20
|
const __filename = fileURLToPath(import.meta.url);
|
|
21
21
|
const __dirname = dirname(__filename);
|
|
22
|
-
const packageJsonPath = path.resolve(__dirname,
|
|
22
|
+
const packageJsonPath = path.resolve(__dirname, "../package.json");
|
|
23
23
|
let SERVER_VERSION = "unknown";
|
|
24
24
|
try {
|
|
25
25
|
if (fs.existsSync(packageJsonPath)) {
|
|
26
|
-
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath,
|
|
26
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
|
|
27
27
|
SERVER_VERSION = packageJson.version || SERVER_VERSION;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -39,6 +39,200 @@ const server = new Server({
|
|
|
39
39
|
},
|
|
40
40
|
});
|
|
41
41
|
const GITLAB_PERSONAL_ACCESS_TOKEN = process.env.GITLAB_PERSONAL_ACCESS_TOKEN;
|
|
42
|
+
const GITLAB_READ_ONLY_MODE = process.env.GITLAB_READ_ONLY_MODE === "true";
|
|
43
|
+
// Define all available tools
|
|
44
|
+
const allTools = [
|
|
45
|
+
{
|
|
46
|
+
name: "create_or_update_file",
|
|
47
|
+
description: "Create or update a single file in a GitLab project",
|
|
48
|
+
inputSchema: zodToJsonSchema(CreateOrUpdateFileSchema),
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: "search_repositories",
|
|
52
|
+
description: "Search for GitLab projects",
|
|
53
|
+
inputSchema: zodToJsonSchema(SearchRepositoriesSchema),
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: "create_repository",
|
|
57
|
+
description: "Create a new GitLab project",
|
|
58
|
+
inputSchema: zodToJsonSchema(CreateRepositorySchema),
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: "get_file_contents",
|
|
62
|
+
description: "Get the contents of a file or directory from a GitLab project",
|
|
63
|
+
inputSchema: zodToJsonSchema(GetFileContentsSchema),
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: "push_files",
|
|
67
|
+
description: "Push multiple files to a GitLab project in a single commit",
|
|
68
|
+
inputSchema: zodToJsonSchema(PushFilesSchema),
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: "create_issue",
|
|
72
|
+
description: "Create a new issue in a GitLab project",
|
|
73
|
+
inputSchema: zodToJsonSchema(CreateIssueSchema),
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: "create_merge_request",
|
|
77
|
+
description: "Create a new merge request in a GitLab project",
|
|
78
|
+
inputSchema: zodToJsonSchema(CreateMergeRequestSchema),
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: "fork_repository",
|
|
82
|
+
description: "Fork a GitLab project to your account or specified namespace",
|
|
83
|
+
inputSchema: zodToJsonSchema(ForkRepositorySchema),
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: "create_branch",
|
|
87
|
+
description: "Create a new branch in a GitLab project",
|
|
88
|
+
inputSchema: zodToJsonSchema(CreateBranchSchema),
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: "get_merge_request",
|
|
92
|
+
description: "Get details of a merge request",
|
|
93
|
+
inputSchema: zodToJsonSchema(GetMergeRequestSchema),
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: "get_merge_request_diffs",
|
|
97
|
+
description: "Get the changes/diffs of a merge request",
|
|
98
|
+
inputSchema: zodToJsonSchema(GetMergeRequestDiffsSchema),
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: "update_merge_request",
|
|
102
|
+
description: "Update a merge request",
|
|
103
|
+
inputSchema: zodToJsonSchema(UpdateMergeRequestSchema),
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: "create_note",
|
|
107
|
+
description: "Create a new note (comment) to an issue or merge request",
|
|
108
|
+
inputSchema: zodToJsonSchema(CreateNoteSchema),
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: "list_merge_request_discussions",
|
|
112
|
+
description: "List discussion items for a merge request",
|
|
113
|
+
inputSchema: zodToJsonSchema(ListMergeRequestDiscussionsSchema),
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
name: "update_merge_request_note",
|
|
117
|
+
description: "Modify an existing merge request thread note",
|
|
118
|
+
inputSchema: zodToJsonSchema(UpdateMergeRequestNoteSchema),
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: "list_issues",
|
|
122
|
+
description: "List issues in a GitLab project with filtering options",
|
|
123
|
+
inputSchema: zodToJsonSchema(ListIssuesSchema),
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
name: "get_issue",
|
|
127
|
+
description: "Get details of a specific issue in a GitLab project",
|
|
128
|
+
inputSchema: zodToJsonSchema(GetIssueSchema),
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
name: "update_issue",
|
|
132
|
+
description: "Update an issue in a GitLab project",
|
|
133
|
+
inputSchema: zodToJsonSchema(UpdateIssueSchema),
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
name: "delete_issue",
|
|
137
|
+
description: "Delete an issue from a GitLab project",
|
|
138
|
+
inputSchema: zodToJsonSchema(DeleteIssueSchema),
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
name: "list_issue_links",
|
|
142
|
+
description: "List all issue links for a specific issue",
|
|
143
|
+
inputSchema: zodToJsonSchema(ListIssueLinksSchema),
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
name: "get_issue_link",
|
|
147
|
+
description: "Get a specific issue link",
|
|
148
|
+
inputSchema: zodToJsonSchema(GetIssueLinkSchema),
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
name: "create_issue_link",
|
|
152
|
+
description: "Create an issue link between two issues",
|
|
153
|
+
inputSchema: zodToJsonSchema(CreateIssueLinkSchema),
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
name: "delete_issue_link",
|
|
157
|
+
description: "Delete an issue link",
|
|
158
|
+
inputSchema: zodToJsonSchema(DeleteIssueLinkSchema),
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
name: "list_namespaces",
|
|
162
|
+
description: "List all namespaces available to the current user",
|
|
163
|
+
inputSchema: zodToJsonSchema(ListNamespacesSchema),
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
name: "get_namespace",
|
|
167
|
+
description: "Get details of a namespace by ID or path",
|
|
168
|
+
inputSchema: zodToJsonSchema(GetNamespaceSchema),
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
name: "verify_namespace",
|
|
172
|
+
description: "Verify if a namespace path exists",
|
|
173
|
+
inputSchema: zodToJsonSchema(VerifyNamespaceSchema),
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: "get_project",
|
|
177
|
+
description: "Get details of a specific project",
|
|
178
|
+
inputSchema: zodToJsonSchema(GetProjectSchema),
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
name: "list_projects",
|
|
182
|
+
description: "List projects accessible by the current user",
|
|
183
|
+
inputSchema: zodToJsonSchema(ListProjectsSchema),
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
name: "list_labels",
|
|
187
|
+
description: "List labels for a project",
|
|
188
|
+
inputSchema: zodToJsonSchema(ListLabelsSchema),
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
name: "get_label",
|
|
192
|
+
description: "Get a single label from a project",
|
|
193
|
+
inputSchema: zodToJsonSchema(GetLabelSchema),
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
name: "create_label",
|
|
197
|
+
description: "Create a new label in a project",
|
|
198
|
+
inputSchema: zodToJsonSchema(CreateLabelSchema),
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
name: "update_label",
|
|
202
|
+
description: "Update an existing label in a project",
|
|
203
|
+
inputSchema: zodToJsonSchema(UpdateLabelSchema),
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
name: "delete_label",
|
|
207
|
+
description: "Delete a label from a project",
|
|
208
|
+
inputSchema: zodToJsonSchema(DeleteLabelSchema),
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
name: "list_group_projects",
|
|
212
|
+
description: "List projects in a GitLab group with filtering options",
|
|
213
|
+
inputSchema: zodToJsonSchema(ListGroupProjectsSchema),
|
|
214
|
+
},
|
|
215
|
+
];
|
|
216
|
+
// Define which tools are read-only
|
|
217
|
+
const readOnlyTools = [
|
|
218
|
+
"search_repositories",
|
|
219
|
+
"get_file_contents",
|
|
220
|
+
"get_merge_request",
|
|
221
|
+
"get_merge_request_diffs",
|
|
222
|
+
"list_merge_request_discussions",
|
|
223
|
+
"list_issues",
|
|
224
|
+
"get_issue",
|
|
225
|
+
"list_issue_links",
|
|
226
|
+
"get_issue_link",
|
|
227
|
+
"list_namespaces",
|
|
228
|
+
"get_namespace",
|
|
229
|
+
"verify_namespace",
|
|
230
|
+
"get_project",
|
|
231
|
+
"list_projects",
|
|
232
|
+
"list_labels",
|
|
233
|
+
"get_label",
|
|
234
|
+
"list_group_projects",
|
|
235
|
+
];
|
|
42
236
|
/**
|
|
43
237
|
* Smart URL handling for GitLab API
|
|
44
238
|
*
|
|
@@ -50,9 +244,10 @@ function normalizeGitLabApiUrl(url) {
|
|
|
50
244
|
return "https://gitlab.com/api/v4";
|
|
51
245
|
}
|
|
52
246
|
// Remove trailing slash if present
|
|
53
|
-
let normalizedUrl = url.endsWith(
|
|
247
|
+
let normalizedUrl = url.endsWith("/") ? url.slice(0, -1) : url;
|
|
54
248
|
// Check if URL already has /api/v4
|
|
55
|
-
if (!normalizedUrl.endsWith(
|
|
249
|
+
if (!normalizedUrl.endsWith("/api/v4") &&
|
|
250
|
+
!normalizedUrl.endsWith("/api/v4/")) {
|
|
56
251
|
// Append /api/v4 if not already present
|
|
57
252
|
normalizedUrl = `${normalizedUrl}/api/v4`;
|
|
58
253
|
}
|
|
@@ -226,9 +421,9 @@ async function listIssues(projectId, options = {}) {
|
|
|
226
421
|
// Add all query parameters
|
|
227
422
|
Object.entries(options).forEach(([key, value]) => {
|
|
228
423
|
if (value !== undefined) {
|
|
229
|
-
if (key ===
|
|
424
|
+
if (key === "label_name" && Array.isArray(value)) {
|
|
230
425
|
// Handle array of labels
|
|
231
|
-
url.searchParams.append(key, value.join(
|
|
426
|
+
url.searchParams.append(key, value.join(","));
|
|
232
427
|
}
|
|
233
428
|
else {
|
|
234
429
|
url.searchParams.append(key, value.toString());
|
|
@@ -273,7 +468,7 @@ async function updateIssue(projectId, issueIid, options) {
|
|
|
273
468
|
// Convert labels array to comma-separated string if present
|
|
274
469
|
const body = { ...options };
|
|
275
470
|
if (body.labels && Array.isArray(body.labels)) {
|
|
276
|
-
body.labels = body.labels.join(
|
|
471
|
+
body.labels = body.labels.join(",");
|
|
277
472
|
}
|
|
278
473
|
const response = await fetch(url.toString(), {
|
|
279
474
|
method: "PUT",
|
|
@@ -346,7 +541,7 @@ async function getIssueLink(projectId, issueIid, issueLinkId) {
|
|
|
346
541
|
* @param {string} linkType - The type of the relation (relates_to, blocks, is_blocked_by)
|
|
347
542
|
* @returns {Promise<GitLabIssueLink>} The created issue link
|
|
348
543
|
*/
|
|
349
|
-
async function createIssueLink(projectId, issueIid, targetProjectId, targetIssueIid, linkType =
|
|
544
|
+
async function createIssueLink(projectId, issueIid, targetProjectId, targetIssueIid, linkType = "relates_to") {
|
|
350
545
|
const url = new URL(`${GITLAB_API_URL}/projects/${encodeURIComponent(projectId)}/issues/${issueIid}/links`);
|
|
351
546
|
const response = await fetch(url.toString(), {
|
|
352
547
|
method: "POST",
|
|
@@ -354,7 +549,7 @@ async function createIssueLink(projectId, issueIid, targetProjectId, targetIssue
|
|
|
354
549
|
body: JSON.stringify({
|
|
355
550
|
target_project_id: targetProjectId,
|
|
356
551
|
target_issue_iid: targetIssueIid,
|
|
357
|
-
link_type: linkType
|
|
552
|
+
link_type: linkType,
|
|
358
553
|
}),
|
|
359
554
|
});
|
|
360
555
|
await handleGitLabError(response);
|
|
@@ -1013,37 +1208,37 @@ async function listGroupProjects(options) {
|
|
|
1013
1208
|
const url = new URL(`${GITLAB_API_URL}/groups/${encodeURIComponent(options.group_id)}/projects`);
|
|
1014
1209
|
// Add optional parameters to URL
|
|
1015
1210
|
if (options.include_subgroups)
|
|
1016
|
-
url.searchParams.append(
|
|
1211
|
+
url.searchParams.append("include_subgroups", "true");
|
|
1017
1212
|
if (options.search)
|
|
1018
|
-
url.searchParams.append(
|
|
1213
|
+
url.searchParams.append("search", options.search);
|
|
1019
1214
|
if (options.order_by)
|
|
1020
|
-
url.searchParams.append(
|
|
1215
|
+
url.searchParams.append("order_by", options.order_by);
|
|
1021
1216
|
if (options.sort)
|
|
1022
|
-
url.searchParams.append(
|
|
1217
|
+
url.searchParams.append("sort", options.sort);
|
|
1023
1218
|
if (options.page)
|
|
1024
|
-
url.searchParams.append(
|
|
1219
|
+
url.searchParams.append("page", options.page.toString());
|
|
1025
1220
|
if (options.per_page)
|
|
1026
|
-
url.searchParams.append(
|
|
1221
|
+
url.searchParams.append("per_page", options.per_page.toString());
|
|
1027
1222
|
if (options.archived !== undefined)
|
|
1028
|
-
url.searchParams.append(
|
|
1223
|
+
url.searchParams.append("archived", options.archived.toString());
|
|
1029
1224
|
if (options.visibility)
|
|
1030
|
-
url.searchParams.append(
|
|
1225
|
+
url.searchParams.append("visibility", options.visibility);
|
|
1031
1226
|
if (options.with_issues_enabled !== undefined)
|
|
1032
|
-
url.searchParams.append(
|
|
1227
|
+
url.searchParams.append("with_issues_enabled", options.with_issues_enabled.toString());
|
|
1033
1228
|
if (options.with_merge_requests_enabled !== undefined)
|
|
1034
|
-
url.searchParams.append(
|
|
1229
|
+
url.searchParams.append("with_merge_requests_enabled", options.with_merge_requests_enabled.toString());
|
|
1035
1230
|
if (options.min_access_level !== undefined)
|
|
1036
|
-
url.searchParams.append(
|
|
1231
|
+
url.searchParams.append("min_access_level", options.min_access_level.toString());
|
|
1037
1232
|
if (options.with_programming_language)
|
|
1038
|
-
url.searchParams.append(
|
|
1233
|
+
url.searchParams.append("with_programming_language", options.with_programming_language);
|
|
1039
1234
|
if (options.starred !== undefined)
|
|
1040
|
-
url.searchParams.append(
|
|
1235
|
+
url.searchParams.append("starred", options.starred.toString());
|
|
1041
1236
|
if (options.statistics !== undefined)
|
|
1042
|
-
url.searchParams.append(
|
|
1237
|
+
url.searchParams.append("statistics", options.statistics.toString());
|
|
1043
1238
|
if (options.with_custom_attributes !== undefined)
|
|
1044
|
-
url.searchParams.append(
|
|
1239
|
+
url.searchParams.append("with_custom_attributes", options.with_custom_attributes.toString());
|
|
1045
1240
|
if (options.with_security_reports !== undefined)
|
|
1046
|
-
url.searchParams.append(
|
|
1241
|
+
url.searchParams.append("with_security_reports", options.with_security_reports.toString());
|
|
1047
1242
|
const response = await fetch(url.toString(), {
|
|
1048
1243
|
method: "GET",
|
|
1049
1244
|
headers: DEFAULT_HEADERS,
|
|
@@ -1053,179 +1248,12 @@ async function listGroupProjects(options) {
|
|
|
1053
1248
|
return GitLabProjectSchema.array().parse(projects);
|
|
1054
1249
|
}
|
|
1055
1250
|
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
1251
|
+
// If read-only mode is enabled, filter out write operations
|
|
1252
|
+
const tools = GITLAB_READ_ONLY_MODE
|
|
1253
|
+
? allTools.filter((tool) => readOnlyTools.includes(tool.name))
|
|
1254
|
+
: allTools;
|
|
1056
1255
|
return {
|
|
1057
|
-
tools
|
|
1058
|
-
{
|
|
1059
|
-
name: "create_or_update_file",
|
|
1060
|
-
description: "Create or update a single file in a GitLab project",
|
|
1061
|
-
inputSchema: zodToJsonSchema(CreateOrUpdateFileSchema),
|
|
1062
|
-
},
|
|
1063
|
-
{
|
|
1064
|
-
name: "search_repositories",
|
|
1065
|
-
description: "Search for GitLab projects",
|
|
1066
|
-
inputSchema: zodToJsonSchema(SearchRepositoriesSchema),
|
|
1067
|
-
},
|
|
1068
|
-
{
|
|
1069
|
-
name: "create_repository",
|
|
1070
|
-
description: "Create a new GitLab project",
|
|
1071
|
-
inputSchema: zodToJsonSchema(CreateRepositorySchema),
|
|
1072
|
-
},
|
|
1073
|
-
{
|
|
1074
|
-
name: "get_file_contents",
|
|
1075
|
-
description: "Get the contents of a file or directory from a GitLab project",
|
|
1076
|
-
inputSchema: zodToJsonSchema(GetFileContentsSchema),
|
|
1077
|
-
},
|
|
1078
|
-
{
|
|
1079
|
-
name: "push_files",
|
|
1080
|
-
description: "Push multiple files to a GitLab project in a single commit",
|
|
1081
|
-
inputSchema: zodToJsonSchema(PushFilesSchema),
|
|
1082
|
-
},
|
|
1083
|
-
{
|
|
1084
|
-
name: "create_issue",
|
|
1085
|
-
description: "Create a new issue in a GitLab project",
|
|
1086
|
-
inputSchema: zodToJsonSchema(CreateIssueSchema),
|
|
1087
|
-
},
|
|
1088
|
-
{
|
|
1089
|
-
name: "create_merge_request",
|
|
1090
|
-
description: "Create a new merge request in a GitLab project",
|
|
1091
|
-
inputSchema: zodToJsonSchema(CreateMergeRequestSchema),
|
|
1092
|
-
},
|
|
1093
|
-
{
|
|
1094
|
-
name: "fork_repository",
|
|
1095
|
-
description: "Fork a GitLab project to your account or specified namespace",
|
|
1096
|
-
inputSchema: zodToJsonSchema(ForkRepositorySchema),
|
|
1097
|
-
},
|
|
1098
|
-
{
|
|
1099
|
-
name: "create_branch",
|
|
1100
|
-
description: "Create a new branch in a GitLab project",
|
|
1101
|
-
inputSchema: zodToJsonSchema(CreateBranchSchema),
|
|
1102
|
-
},
|
|
1103
|
-
{
|
|
1104
|
-
name: "get_merge_request",
|
|
1105
|
-
description: "Get details of a merge request",
|
|
1106
|
-
inputSchema: zodToJsonSchema(GetMergeRequestSchema),
|
|
1107
|
-
},
|
|
1108
|
-
{
|
|
1109
|
-
name: "get_merge_request_diffs",
|
|
1110
|
-
description: "Get the changes/diffs of a merge request",
|
|
1111
|
-
inputSchema: zodToJsonSchema(GetMergeRequestDiffsSchema),
|
|
1112
|
-
},
|
|
1113
|
-
{
|
|
1114
|
-
name: "update_merge_request",
|
|
1115
|
-
description: "Update a merge request",
|
|
1116
|
-
inputSchema: zodToJsonSchema(UpdateMergeRequestSchema),
|
|
1117
|
-
},
|
|
1118
|
-
{
|
|
1119
|
-
name: "create_note",
|
|
1120
|
-
description: "Create a new note (comment) to an issue or merge request",
|
|
1121
|
-
inputSchema: zodToJsonSchema(CreateNoteSchema),
|
|
1122
|
-
},
|
|
1123
|
-
{
|
|
1124
|
-
name: "list_merge_request_discussions",
|
|
1125
|
-
description: "List discussion items for a merge request",
|
|
1126
|
-
inputSchema: zodToJsonSchema(ListMergeRequestDiscussionsSchema),
|
|
1127
|
-
},
|
|
1128
|
-
{
|
|
1129
|
-
name: "update_merge_request_note",
|
|
1130
|
-
description: "Modify an existing merge request thread note",
|
|
1131
|
-
inputSchema: zodToJsonSchema(UpdateMergeRequestNoteSchema),
|
|
1132
|
-
},
|
|
1133
|
-
{
|
|
1134
|
-
name: "list_issues",
|
|
1135
|
-
description: "List issues in a GitLab project with filtering options",
|
|
1136
|
-
inputSchema: zodToJsonSchema(ListIssuesSchema),
|
|
1137
|
-
},
|
|
1138
|
-
{
|
|
1139
|
-
name: "get_issue",
|
|
1140
|
-
description: "Get details of a specific issue in a GitLab project",
|
|
1141
|
-
inputSchema: zodToJsonSchema(GetIssueSchema),
|
|
1142
|
-
},
|
|
1143
|
-
{
|
|
1144
|
-
name: "update_issue",
|
|
1145
|
-
description: "Update an issue in a GitLab project",
|
|
1146
|
-
inputSchema: zodToJsonSchema(UpdateIssueSchema),
|
|
1147
|
-
},
|
|
1148
|
-
{
|
|
1149
|
-
name: "delete_issue",
|
|
1150
|
-
description: "Delete an issue from a GitLab project",
|
|
1151
|
-
inputSchema: zodToJsonSchema(DeleteIssueSchema),
|
|
1152
|
-
},
|
|
1153
|
-
{
|
|
1154
|
-
name: "list_issue_links",
|
|
1155
|
-
description: "List all issue links for a specific issue",
|
|
1156
|
-
inputSchema: zodToJsonSchema(ListIssueLinksSchema),
|
|
1157
|
-
},
|
|
1158
|
-
{
|
|
1159
|
-
name: "get_issue_link",
|
|
1160
|
-
description: "Get a specific issue link",
|
|
1161
|
-
inputSchema: zodToJsonSchema(GetIssueLinkSchema),
|
|
1162
|
-
},
|
|
1163
|
-
{
|
|
1164
|
-
name: "create_issue_link",
|
|
1165
|
-
description: "Create an issue link between two issues",
|
|
1166
|
-
inputSchema: zodToJsonSchema(CreateIssueLinkSchema),
|
|
1167
|
-
},
|
|
1168
|
-
{
|
|
1169
|
-
name: "delete_issue_link",
|
|
1170
|
-
description: "Delete an issue link",
|
|
1171
|
-
inputSchema: zodToJsonSchema(DeleteIssueLinkSchema),
|
|
1172
|
-
},
|
|
1173
|
-
{
|
|
1174
|
-
name: "list_namespaces",
|
|
1175
|
-
description: "List all namespaces available to the current user",
|
|
1176
|
-
inputSchema: zodToJsonSchema(ListNamespacesSchema),
|
|
1177
|
-
},
|
|
1178
|
-
{
|
|
1179
|
-
name: "get_namespace",
|
|
1180
|
-
description: "Get details of a namespace by ID or path",
|
|
1181
|
-
inputSchema: zodToJsonSchema(GetNamespaceSchema),
|
|
1182
|
-
},
|
|
1183
|
-
{
|
|
1184
|
-
name: "verify_namespace",
|
|
1185
|
-
description: "Verify if a namespace path exists",
|
|
1186
|
-
inputSchema: zodToJsonSchema(VerifyNamespaceSchema),
|
|
1187
|
-
},
|
|
1188
|
-
{
|
|
1189
|
-
name: "get_project",
|
|
1190
|
-
description: "Get details of a specific project",
|
|
1191
|
-
inputSchema: zodToJsonSchema(GetProjectSchema),
|
|
1192
|
-
},
|
|
1193
|
-
{
|
|
1194
|
-
name: "list_projects",
|
|
1195
|
-
description: "List projects accessible by the current user",
|
|
1196
|
-
inputSchema: zodToJsonSchema(ListProjectsSchema),
|
|
1197
|
-
},
|
|
1198
|
-
{
|
|
1199
|
-
name: "list_labels",
|
|
1200
|
-
description: "List labels for a project",
|
|
1201
|
-
inputSchema: zodToJsonSchema(ListLabelsSchema),
|
|
1202
|
-
},
|
|
1203
|
-
{
|
|
1204
|
-
name: "get_label",
|
|
1205
|
-
description: "Get a single label from a project",
|
|
1206
|
-
inputSchema: zodToJsonSchema(GetLabelSchema),
|
|
1207
|
-
},
|
|
1208
|
-
{
|
|
1209
|
-
name: "create_label",
|
|
1210
|
-
description: "Create a new label in a project",
|
|
1211
|
-
inputSchema: zodToJsonSchema(CreateLabelSchema),
|
|
1212
|
-
},
|
|
1213
|
-
{
|
|
1214
|
-
name: "update_label",
|
|
1215
|
-
description: "Update an existing label in a project",
|
|
1216
|
-
inputSchema: zodToJsonSchema(UpdateLabelSchema),
|
|
1217
|
-
},
|
|
1218
|
-
{
|
|
1219
|
-
name: "delete_label",
|
|
1220
|
-
description: "Delete a label from a project",
|
|
1221
|
-
inputSchema: zodToJsonSchema(DeleteLabelSchema),
|
|
1222
|
-
},
|
|
1223
|
-
{
|
|
1224
|
-
name: "list_group_projects",
|
|
1225
|
-
description: "List projects in a GitLab group with filtering options",
|
|
1226
|
-
inputSchema: zodToJsonSchema(ListGroupProjectsSchema),
|
|
1227
|
-
},
|
|
1228
|
-
],
|
|
1256
|
+
tools,
|
|
1229
1257
|
};
|
|
1230
1258
|
});
|
|
1231
1259
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
@@ -1239,7 +1267,9 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
1239
1267
|
try {
|
|
1240
1268
|
const forkedProject = await forkProject(forkArgs.project_id, forkArgs.namespace);
|
|
1241
1269
|
return {
|
|
1242
|
-
content: [
|
|
1270
|
+
content: [
|
|
1271
|
+
{ type: "text", text: JSON.stringify(forkedProject, null, 2) },
|
|
1272
|
+
],
|
|
1243
1273
|
};
|
|
1244
1274
|
}
|
|
1245
1275
|
catch (forkError) {
|
|
@@ -1249,7 +1279,12 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
1249
1279
|
forkErrorMessage = `${forkErrorMessage}: ${forkError.message}`;
|
|
1250
1280
|
}
|
|
1251
1281
|
return {
|
|
1252
|
-
content: [
|
|
1282
|
+
content: [
|
|
1283
|
+
{
|
|
1284
|
+
type: "text",
|
|
1285
|
+
text: JSON.stringify({ error: forkErrorMessage }, null, 2),
|
|
1286
|
+
},
|
|
1287
|
+
],
|
|
1253
1288
|
};
|
|
1254
1289
|
}
|
|
1255
1290
|
}
|
|
@@ -1387,7 +1422,9 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
1387
1422
|
const data = await response.json();
|
|
1388
1423
|
const namespaces = z.array(GitLabNamespaceSchema).parse(data);
|
|
1389
1424
|
return {
|
|
1390
|
-
content: [
|
|
1425
|
+
content: [
|
|
1426
|
+
{ type: "text", text: JSON.stringify(namespaces, null, 2) },
|
|
1427
|
+
],
|
|
1391
1428
|
};
|
|
1392
1429
|
}
|
|
1393
1430
|
case "get_namespace": {
|
|
@@ -1413,7 +1450,9 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
1413
1450
|
const data = await response.json();
|
|
1414
1451
|
const namespaceExists = GitLabNamespaceExistsResponseSchema.parse(data);
|
|
1415
1452
|
return {
|
|
1416
|
-
content: [
|
|
1453
|
+
content: [
|
|
1454
|
+
{ type: "text", text: JSON.stringify(namespaceExists, null, 2) },
|
|
1455
|
+
],
|
|
1417
1456
|
};
|
|
1418
1457
|
}
|
|
1419
1458
|
case "get_project": {
|
|
@@ -1471,7 +1510,12 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
1471
1510
|
const args = DeleteIssueSchema.parse(request.params.arguments);
|
|
1472
1511
|
await deleteIssue(args.project_id, args.issue_iid);
|
|
1473
1512
|
return {
|
|
1474
|
-
content: [
|
|
1513
|
+
content: [
|
|
1514
|
+
{
|
|
1515
|
+
type: "text",
|
|
1516
|
+
text: JSON.stringify({ status: "success", message: "Issue deleted successfully" }, null, 2),
|
|
1517
|
+
},
|
|
1518
|
+
],
|
|
1475
1519
|
};
|
|
1476
1520
|
}
|
|
1477
1521
|
case "list_issue_links": {
|
|
@@ -1499,7 +1543,15 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
1499
1543
|
const args = DeleteIssueLinkSchema.parse(request.params.arguments);
|
|
1500
1544
|
await deleteIssueLink(args.project_id, args.issue_iid, args.issue_link_id);
|
|
1501
1545
|
return {
|
|
1502
|
-
content: [
|
|
1546
|
+
content: [
|
|
1547
|
+
{
|
|
1548
|
+
type: "text",
|
|
1549
|
+
text: JSON.stringify({
|
|
1550
|
+
status: "success",
|
|
1551
|
+
message: "Issue link deleted successfully",
|
|
1552
|
+
}, null, 2),
|
|
1553
|
+
},
|
|
1554
|
+
],
|
|
1503
1555
|
};
|
|
1504
1556
|
}
|
|
1505
1557
|
case "list_labels": {
|
|
@@ -1535,7 +1587,12 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
1535
1587
|
const args = DeleteLabelSchema.parse(request.params.arguments);
|
|
1536
1588
|
await deleteLabel(args.project_id, args.label_id);
|
|
1537
1589
|
return {
|
|
1538
|
-
content: [
|
|
1590
|
+
content: [
|
|
1591
|
+
{
|
|
1592
|
+
type: "text",
|
|
1593
|
+
text: JSON.stringify({ status: "success", message: "Label deleted successfully" }, null, 2),
|
|
1594
|
+
},
|
|
1595
|
+
],
|
|
1539
1596
|
};
|
|
1540
1597
|
}
|
|
1541
1598
|
case "list_group_projects": {
|