@zereight/mcp-gitlab 1.0.33 → 1.0.35

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 CHANGED
@@ -51,9 +51,9 @@ When using with the Claude App, you need to set up your API key and URLs directl
51
51
  7. `create_merge_request` - Create a new merge request in a GitLab project
52
52
  8. `fork_repository` - Fork a GitLab project to your account or specified namespace
53
53
  9. `create_branch` - Create a new branch in a GitLab project
54
- 10. `get_merge_request` - Get details of a merge request
55
- 11. `get_merge_request_diffs` - Get the changes/diffs of a merge request
56
- 12. `update_merge_request` - Update a merge request
54
+ 10. `get_merge_request` - Get details of a merge request (Either mergeRequestIid or branchName must be provided)
55
+ 11. `get_merge_request_diffs` - Get the changes/diffs of a merge request (Either mergeRequestIid or branchName must be provided)
56
+ 12. `update_merge_request` - Update a merge request (Either mergeRequestIid or branchName must be provided)
57
57
  13. `create_note` - Create a new note (comment) to an issue or merge request
58
58
  14. `mr_discussions` - List discussion items for a merge request
59
59
  15. `update_merge_request_note` - Modify an existing merge request thread note
@@ -81,4 +81,5 @@ When using with the Claude App, you need to set up your API key and URLs directl
81
81
  37. `create_wiki_page` - Create a new wiki page in a GitLab project
82
82
  38. `update_wiki_page` - Update an existing wiki page in a GitLab project
83
83
  39. `delete_wiki_page` - Delete a wiki page from a GitLab project
84
+ 40. `get_repository_tree` - Get the repository tree for a GitLab project (list files and directories)
84
85
  <!-- TOOLS-END -->
package/build/index.js CHANGED
@@ -17,7 +17,7 @@ import { GitLabForkSchema, GitLabReferenceSchema, GitLabRepositorySchema, GitLab
17
17
  // Discussion Schemas
18
18
  GitLabDiscussionNoteSchema, // Added
19
19
  GitLabDiscussionSchema, UpdateMergeRequestNoteSchema, // Added
20
- ListMergeRequestDiscussionsSchema, } from "./schemas.js";
20
+ ListMergeRequestDiscussionsSchema, GitLabTreeItemSchema, GetRepositoryTreeSchema, } from "./schemas.js";
21
21
  /**
22
22
  * Read version from package.json
23
23
  */
@@ -280,6 +280,11 @@ const allTools = [
280
280
  description: "Delete a wiki page from a GitLab project",
281
281
  inputSchema: zodToJsonSchema(DeleteWikiPageSchema),
282
282
  },
283
+ {
284
+ name: "get_repository_tree",
285
+ description: "Get the repository tree for a GitLab project (list files and directories)",
286
+ inputSchema: zodToJsonSchema(GetRepositoryTreeSchema),
287
+ },
283
288
  ];
284
289
  // Define which tools are read-only
285
290
  const readOnlyTools = [
@@ -1401,6 +1406,41 @@ async function deleteWikiPage(projectId, slug) {
1401
1406
  });
1402
1407
  await handleGitLabError(response);
1403
1408
  }
1409
+ /**
1410
+ * Get the repository tree for a project
1411
+ * @param {string} projectId - The ID or URL-encoded path of the project
1412
+ * @param {GetRepositoryTreeOptions} options - Options for the tree
1413
+ * @returns {Promise<GitLabTreeItem[]>}
1414
+ */
1415
+ async function getRepositoryTree(options) {
1416
+ const queryParams = new URLSearchParams();
1417
+ if (options.path)
1418
+ queryParams.append("path", options.path);
1419
+ if (options.ref)
1420
+ queryParams.append("ref", options.ref);
1421
+ if (options.recursive)
1422
+ queryParams.append("recursive", "true");
1423
+ if (options.per_page)
1424
+ queryParams.append("per_page", options.per_page.toString());
1425
+ if (options.page_token)
1426
+ queryParams.append("page_token", options.page_token);
1427
+ if (options.pagination)
1428
+ queryParams.append("pagination", options.pagination);
1429
+ const response = await fetch(`${GITLAB_API_URL}/projects/${encodeURIComponent(options.project_id)}/repository/tree?${queryParams.toString()}`, {
1430
+ headers: {
1431
+ Authorization: `Bearer ${GITLAB_PERSONAL_ACCESS_TOKEN}`,
1432
+ "Content-Type": "application/json",
1433
+ },
1434
+ });
1435
+ if (response.status === 404) {
1436
+ throw new Error("Repository or path not found");
1437
+ }
1438
+ if (!response.ok) {
1439
+ throw new Error(`Failed to get repository tree: ${response.statusText}`);
1440
+ }
1441
+ const data = await response.json();
1442
+ return z.array(GitLabTreeItemSchema).parse(data);
1443
+ }
1404
1444
  server.setRequestHandler(ListToolsRequestSchema, async () => {
1405
1445
  // Apply read-only filter first
1406
1446
  const tools0 = GITLAB_READ_ONLY_MODE
@@ -1803,6 +1843,13 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
1803
1843
  ],
1804
1844
  };
1805
1845
  }
1846
+ case "get_repository_tree": {
1847
+ const args = GetRepositoryTreeSchema.parse(request.params.arguments);
1848
+ const tree = await getRepositoryTree(args);
1849
+ return {
1850
+ content: [{ type: "text", text: JSON.stringify(tree, null, 2) }],
1851
+ };
1852
+ }
1806
1853
  default:
1807
1854
  throw new Error(`Unknown tool: ${request.params.name}`);
1808
1855
  }
package/build/schemas.js CHANGED
@@ -146,16 +146,37 @@ export const FileOperationSchema = z.object({
146
146
  content: z.string(),
147
147
  });
148
148
  // Tree and commit schemas
149
- export const GitLabTreeEntrySchema = z.object({
150
- id: z.string(), // Changed from sha to match GitLab API
149
+ export const GitLabTreeItemSchema = z.object({
150
+ id: z.string(),
151
151
  name: z.string(),
152
- type: z.enum(["blob", "tree"]),
152
+ type: z.enum(["tree", "blob"]),
153
153
  path: z.string(),
154
154
  mode: z.string(),
155
155
  });
156
+ export const GetRepositoryTreeSchema = z.object({
157
+ project_id: z.string().describe("The ID or URL-encoded path of the project"),
158
+ path: z.string().optional().describe("The path inside the repository"),
159
+ ref: z
160
+ .string()
161
+ .optional()
162
+ .describe("The name of a repository branch or tag. Defaults to the default branch."),
163
+ recursive: z
164
+ .boolean()
165
+ .optional()
166
+ .describe("Boolean value to get a recursive tree"),
167
+ per_page: z
168
+ .number()
169
+ .optional()
170
+ .describe("Number of results to show per page"),
171
+ page_token: z
172
+ .string()
173
+ .optional()
174
+ .describe("The tree record ID for pagination"),
175
+ pagination: z.string().optional().describe("Pagination method (keyset)"),
176
+ });
156
177
  export const GitLabTreeSchema = z.object({
157
178
  id: z.string(), // Changed from sha to match GitLab API
158
- tree: z.array(GitLabTreeEntrySchema),
179
+ tree: z.array(GitLabTreeItemSchema),
159
180
  });
160
181
  export const GitLabCommitSchema = z.object({
161
182
  id: z.string(), // Changed from sha to match GitLab API
@@ -768,9 +789,7 @@ export const ListLabelsSchema = z.object({
768
789
  });
769
790
  export const GetLabelSchema = z.object({
770
791
  project_id: z.string().describe("Project ID or URL-encoded path"),
771
- label_id: z
772
- .union([z.number(), z.string()])
773
- .describe("The ID or title of a project's label"),
792
+ label_id: z.string().describe("The ID or title of a project's label"),
774
793
  include_ancestor_groups: z
775
794
  .boolean()
776
795
  .optional()
@@ -791,9 +810,7 @@ export const CreateLabelSchema = z.object({
791
810
  });
792
811
  export const UpdateLabelSchema = z.object({
793
812
  project_id: z.string().describe("Project ID or URL-encoded path"),
794
- label_id: z
795
- .union([z.number(), z.string()])
796
- .describe("The ID or title of a project's label"),
813
+ label_id: z.string().describe("The ID or title of a project's label"),
797
814
  new_name: z.string().optional().describe("The new name of the label"),
798
815
  color: z
799
816
  .string()
@@ -811,9 +828,7 @@ export const UpdateLabelSchema = z.object({
811
828
  });
812
829
  export const DeleteLabelSchema = z.object({
813
830
  project_id: z.string().describe("Project ID or URL-encoded path"),
814
- label_id: z
815
- .union([z.number(), z.string()])
816
- .describe("The ID or title of a project's label"),
831
+ label_id: z.string().describe("The ID or title of a project's label"),
817
832
  });
818
833
  // Group projects schema
819
834
  export const ListGroupProjectsSchema = z.object({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zereight/mcp-gitlab",
3
- "version": "1.0.33",
3
+ "version": "1.0.35",
4
4
  "description": "MCP server for using the GitLab API",
5
5
  "license": "MIT",
6
6
  "author": "zereight",