@zereight/mcp-gitlab 1.0.3 β†’ 1.0.4

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
@@ -1,4 +1,6 @@
1
- # @zereight/mcp-gitlab
1
+ # Better GitLab MCP Server
2
+
3
+ ## @zereight/mcp-gitlab
2
4
 
3
5
  [![smithery badge](https://smithery.ai/badge/@zereight/gitlab-mcp)](https://smithery.ai/server/@zereight/gitlab-mcp)
4
6
 
@@ -6,37 +8,160 @@ GitLab MCP(Model Context Protocol) Server.
6
8
 
7
9
  <a href="https://glama.ai/mcp/servers/7jwbk4r6d7"><img width="380" height="200" src="https://glama.ai/mcp/servers/7jwbk4r6d7/badge" alt="gitlab mcp MCP server" /></a>
8
10
 
9
- ## Installation and Execution
10
-
11
- ### Installing via Smithery
12
-
13
- To install GitLab MCP Server for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@zereight/gitlab-mcp):
14
-
15
- ```bash
16
- npx -y @smithery/cli install @zereight/gitlab-mcp --client claude
17
- ```
18
-
19
- ### Manual Installation
20
- ```bash
21
- npx @zereight/mcp-gitlab
22
- ```
11
+ ## Features ✨
12
+
13
+ - **Automatic Branch Creation**: Automatically creates a branch if it doesn't exist when creating/updating files or pushing changes. 🌿
14
+ - **Comprehensive Error Handling**: Provides clear error messages for common issues. ⚠️
15
+ - **Git History Preservation**: Operates without force-pushing, maintaining Git history. πŸ“œ
16
+ - **Batch Operations**: Supports both single and multi-file operations. 묢음
17
+ - **Versatile Search**: Supports project search functionality. πŸ”
18
+
19
+ ## Tools πŸ› οΈ
20
+
21
+ 1. `create_or_update_file`
22
+
23
+ - Create or update a single file in a GitLab project. πŸ“
24
+ - Inputs:
25
+ - `project_id` (string): Project ID or namespace/project_path
26
+ - `file_path` (string): Path to create/update the file
27
+ - `content` (string): File content
28
+ - `commit_message` (string): Commit message
29
+ - `branch` (string): Branch to create/update the file in
30
+ - `previous_path` (optional string): Previous file path when renaming a file
31
+ - Returns: File content and commit details
32
+
33
+ 2. `push_files`
34
+
35
+ - Push multiple files in a single commit. πŸ“€
36
+ - Inputs:
37
+ - `project_id` (string): Project ID or namespace/project_path
38
+ - `branch` (string): Branch to push to
39
+ - `files` (array): Array of files to push, each with `file_path` and `content` properties
40
+ - `commit_message` (string): Commit message
41
+ - Returns: Updated branch reference
42
+
43
+ 3. `search_repositories`
44
+
45
+ - Search for GitLab projects. πŸ”
46
+ - Inputs:
47
+ - `search` (string): Search query
48
+ - `page` (optional number): Page number (default: 1)
49
+ - `per_page` (optional number): Results per page (default: 20, max: 100)
50
+ - Returns: Project search results
51
+
52
+ 4. `create_repository`
53
+
54
+ - Create a new GitLab project. βž•
55
+ - Inputs:
56
+ - `name` (string): Project name
57
+ - `description` (optional string): Project description
58
+ - `visibility` (optional string): Project visibility level (public, private, internal)
59
+ - `initialize_with_readme` (optional boolean): Initialize with README
60
+ - Returns: Details of the created project
61
+
62
+ 5. `get_file_contents`
63
+
64
+ - Get the contents of a file or directory. πŸ“‚
65
+ - Inputs:
66
+ - `project_id` (string): Project ID or namespace/project_path
67
+ - `file_path` (string): Path to the file/directory
68
+ - `ref` (optional string): Branch, tag, or commit SHA (default: default branch)
69
+ - Returns: File/directory content
70
+
71
+ 6. `create_issue`
72
+
73
+ - Create a new issue. πŸ›
74
+ - Inputs:
75
+ - `project_id` (string): Project ID or namespace/project_path
76
+ - `title` (string): Issue title
77
+ - `description` (string): Issue description
78
+ - `assignee_ids` (optional number[]): Array of assignee IDs
79
+ - `milestone_id` (optional number): Milestone ID
80
+ - `labels` (optional string[]): Array of labels
81
+ - Returns: Details of the created issue
82
+
83
+ 7. `create_merge_request`
84
+
85
+ - Create a new merge request. πŸš€
86
+ - Inputs:
87
+ - `project_id` (string): Project ID or namespace/project_path
88
+ - `title` (string): Merge request title
89
+ - `description` (string): Merge request description
90
+ - `source_branch` (string): Branch with changes
91
+ - `target_branch` (string): Branch to merge into
92
+ - `allow_collaboration` (optional boolean): Allow collaborators to push commits to the source branch
93
+ - `draft` (optional boolean): Create as a draft merge request
94
+ - Returns: Details of the created merge request
95
+
96
+ 8. `fork_repository`
97
+
98
+ - Fork a project. 🍴
99
+ - Inputs:
100
+ - `project_id` (string): Project ID or namespace/project_path to fork
101
+ - `namespace` (optional string): Namespace to fork into (default: user namespace)
102
+ - Returns: Details of the forked project
103
+
104
+ 9. `create_branch`
105
+
106
+ - Create a new branch. 🌿
107
+ - Inputs:
108
+ - `project_id` (string): Project ID or namespace/project_path
109
+ - `name` (string): New branch name
110
+ - `ref` (optional string): Ref to create the branch from (branch, tag, commit SHA, default: default branch)
111
+ - Returns: Created branch reference
112
+
113
+ 10. `get_merge_request`
114
+
115
+ - Get details of a merge request. ℹ️
116
+ - Inputs:
117
+ - `project_id` (string): Project ID or namespace/project_path
118
+ - `merge_request_iid` (number): Merge request IID
119
+ - Returns: Merge request details
120
+
121
+ 11. `get_merge_request_diffs`
122
+
123
+ - Get changes (diffs) of a merge request. diff
124
+ - Inputs:
125
+ - `project_id` (string): Project ID or namespace/project_path
126
+ - `merge_request_iid` (number): Merge request IID
127
+ - `view` (optional string): Diff view type ('inline' or 'parallel')
128
+ - Returns: Array of merge request diff information
129
+
130
+ 12. `update_merge_request`
131
+
132
+ - Update a merge request. πŸ”„
133
+ - Inputs:
134
+ - `project_id` (string): Project ID or namespace/project_path
135
+ - `merge_request_iid` (number): Merge request IID
136
+ - `title` (optional string): New title
137
+ - `description` (string): New description
138
+ - `target_branch` (optional string): New target branch
139
+ - `state_event` (optional string): Merge request state change event ('close', 'reopen')
140
+ - `remove_source_branch` (optional boolean): Remove source branch after merge
141
+ - `allow_collaboration` (optional boolean): Allow collaborators to push commits to the source branch
142
+ - Returns: Updated merge request details
143
+
144
+ 13. `create_note`
145
+ - Create a new note (comment) to an issue or merge request. πŸ’¬
146
+ - Inputs:
147
+ - `project_id` (string): Project ID or namespace/project_path
148
+ - `noteable_type` (string): Type of noteable ("issue" or "merge_request")
149
+ - `noteable_iid` (number): IID of the issue or merge request
150
+ - `body` (string): Note content
151
+ - Returns: Details of the created note
23
152
 
24
153
  ## Environment Variable Configuration
25
154
 
26
155
  Before running the server, you need to set the following environment variables:
27
156
 
28
- ```bash
157
+ ```
29
158
  GITLAB_PERSONAL_ACCESS_TOKEN=your_gitlab_token
30
159
  GITLAB_API_URL=your_gitlab_api_url # Default: https://gitlab.com/api/v4
31
160
  ```
32
161
 
33
- ## License
162
+ ## Usage
34
163
 
35
- MIT License
36
-
37
- ## How to use
38
-
39
- ## Using with Claude App, Cline, Roo Code
164
+ ### Using with Claude App, Cline, Roo Code
40
165
 
41
166
  When using with the Claude App, you need to set up your API key and URLs directly.
42
167
 
@@ -55,13 +180,17 @@ When using with the Claude App, you need to set up your API key and URLs directl
55
180
  }
56
181
  ```
57
182
 
58
- ## Using with Cursor
183
+ ### Using with Cursor
59
184
 
60
185
  When using with Cursor, you can set up environment variables and run the server as follows:
61
186
 
62
- ```bash
187
+ ```
63
188
  env GITLAB_PERSONAL_ACCESS_TOKEN=your_gitlab_token GITLAB_API_URL=your_gitlab_api_url npx @zereight/mcp-gitlab
64
189
  ```
65
190
 
66
191
  - `GITLAB_PERSONAL_ACCESS_TOKEN`: Your GitLab personal access token.
67
192
  - `GITLAB_API_URL`: Your GitLab API URL. (Default: `https://gitlab.com/api/v4`)
193
+
194
+ ## License
195
+
196
+ MIT License
package/build/index.js CHANGED
@@ -5,7 +5,7 @@ import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextpro
5
5
  import fetch from "node-fetch";
6
6
  import { z } from "zod";
7
7
  import { zodToJsonSchema } from "zod-to-json-schema";
8
- import { GitLabForkSchema, GitLabReferenceSchema, GitLabRepositorySchema, GitLabIssueSchema, GitLabMergeRequestSchema, GitLabContentSchema, GitLabCreateUpdateFileResponseSchema, GitLabSearchResponseSchema, GitLabTreeSchema, GitLabCommitSchema, CreateOrUpdateFileSchema, SearchRepositoriesSchema, CreateRepositorySchema, GetFileContentsSchema, PushFilesSchema, CreateIssueSchema, CreateMergeRequestSchema, ForkRepositorySchema, CreateBranchSchema, GitLabMergeRequestDiffSchema, GetMergeRequestSchema, GetMergeRequestDiffsSchema, UpdateMergeRequestSchema, } from "./schemas.js";
8
+ import { GitLabForkSchema, GitLabReferenceSchema, GitLabRepositorySchema, GitLabIssueSchema, GitLabMergeRequestSchema, GitLabContentSchema, GitLabCreateUpdateFileResponseSchema, GitLabSearchResponseSchema, GitLabTreeSchema, GitLabCommitSchema, CreateOrUpdateFileSchema, SearchRepositoriesSchema, CreateRepositorySchema, GetFileContentsSchema, PushFilesSchema, CreateIssueSchema, CreateMergeRequestSchema, ForkRepositorySchema, CreateBranchSchema, GitLabMergeRequestDiffSchema, GetMergeRequestSchema, GetMergeRequestDiffsSchema, UpdateMergeRequestSchema, CreateNoteSchema, } from "./schemas.js";
9
9
  const server = new Server({
10
10
  name: "gitlab-mcp-server",
11
11
  version: "0.0.1",
@@ -341,6 +341,19 @@ async function updateMergeRequest(projectId, mergeRequestIid, options) {
341
341
  await handleGitLabError(response);
342
342
  return GitLabMergeRequestSchema.parse(await response.json());
343
343
  }
344
+ // πŸ“¦ μƒˆλ‘œμš΄ ν•¨μˆ˜: createNote - 이슈 λ˜λŠ” 병합 μš”μ²­μ— λ…ΈνŠΈ(λŒ“κΈ€)λ₯Ό μΆ”κ°€ν•˜λŠ” ν•¨μˆ˜
345
+ async function createNote(projectId, noteableType, // 'issue' λ˜λŠ” 'merge_request' νƒ€μž… λͺ…μ‹œ
346
+ noteableIid, body) {
347
+ // βš™οΈ 응닡 νƒ€μž…μ€ GitLab API λ¬Έμ„œμ— 따라 μ‘°μ • κ°€λŠ₯
348
+ const url = new URL(`${GITLAB_API_URL}/projects/${encodeURIComponent(projectId)}/${noteableType}/${noteableIid}/notes`);
349
+ const response = await fetch(url.toString(), {
350
+ method: "POST",
351
+ headers: DEFAULT_HEADERS,
352
+ body: JSON.stringify({ body }),
353
+ });
354
+ await handleGitLabError(response);
355
+ return await response.json(); // βš™οΈ 응닡 νƒ€μž…μ€ GitLab API λ¬Έμ„œμ— 따라 μ‘°μ • κ°€λŠ₯, ν•„μš”ν•˜λ©΄ μŠ€ν‚€λ§ˆ μ •μ˜
356
+ }
344
357
  server.setRequestHandler(ListToolsRequestSchema, async () => {
345
358
  return {
346
359
  tools: [
@@ -404,6 +417,11 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
404
417
  description: "Update a merge request",
405
418
  inputSchema: zodToJsonSchema(UpdateMergeRequestSchema),
406
419
  },
420
+ {
421
+ name: "create_note",
422
+ description: "Create a new note (comment) to an issue or merge request",
423
+ inputSchema: zodToJsonSchema(CreateNoteSchema),
424
+ },
407
425
  ],
408
426
  };
409
427
  });
@@ -515,6 +533,24 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
515
533
  ],
516
534
  };
517
535
  }
536
+ case "create_note": {
537
+ try {
538
+ const args = CreateNoteSchema.parse(request.params.arguments);
539
+ const { project_id, noteable_type, noteable_iid, body } = args;
540
+ const note = await createNote(project_id, noteable_type, noteable_iid, body);
541
+ return {
542
+ content: [{ type: "text", text: JSON.stringify(note, null, 2) }],
543
+ };
544
+ }
545
+ catch (error) {
546
+ if (error instanceof z.ZodError) {
547
+ throw new Error(`Invalid arguments: ${error.errors
548
+ .map((e) => `${e.path.join(".")}: ${e.message}`)
549
+ .join(", ")}`);
550
+ }
551
+ throw error;
552
+ }
553
+ }
518
554
  default:
519
555
  throw new Error(`Unknown tool: ${request.params.name}`);
520
556
  }
package/build/schemas.js CHANGED
@@ -346,3 +346,11 @@ export const UpdateMergeRequestSchema = GetMergeRequestSchema.extend({
346
346
  export const GetMergeRequestDiffsSchema = GetMergeRequestSchema.extend({
347
347
  view: z.enum(["inline", "parallel"]).optional().describe("Diff view type"),
348
348
  });
349
+ export const CreateNoteSchema = z.object({
350
+ project_id: z.string().describe("Project ID or namespace/project_path"),
351
+ noteable_type: z
352
+ .enum(["issue", "merge_request"])
353
+ .describe("Type of noteable (issue or merge_request)"),
354
+ noteable_iid: z.number().describe("IID of the issue or merge request"),
355
+ body: z.string().describe("Note content"),
356
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zereight/mcp-gitlab",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "MCP server for using the GitLab API",
5
5
  "license": "MIT",
6
6
  "author": "zereight",