@zereight/mcp-gitlab 1.0.3 β†’ 1.0.5

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,42 +1,16 @@
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
 
5
- GitLab MCP(Model Context Protocol) Server.
7
+ GitLab MCP(Model Context Protocol) Server. **Includes bug fixes and improvements over the original GitLab MCP 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
- ```
23
-
24
- ## Environment Variable Configuration
25
-
26
- Before running the server, you need to set the following environment variables:
11
+ ## Usage
27
12
 
28
- ```bash
29
- GITLAB_PERSONAL_ACCESS_TOKEN=your_gitlab_token
30
- GITLAB_API_URL=your_gitlab_api_url # Default: https://gitlab.com/api/v4
31
- ```
32
-
33
- ## License
34
-
35
- MIT License
36
-
37
- ## How to use
38
-
39
- ## Using with Claude App, Cline, Roo Code
13
+ ### Using with Claude App, Cline, Roo Code
40
14
 
41
15
  When using with the Claude App, you need to set up your API key and URLs directly.
42
16
 
@@ -55,13 +29,160 @@ When using with the Claude App, you need to set up your API key and URLs directl
55
29
  }
56
30
  ```
57
31
 
58
- ## Using with Cursor
32
+ ### Using with Cursor
59
33
 
60
34
  When using with Cursor, you can set up environment variables and run the server as follows:
61
35
 
62
- ```bash
36
+ ```
63
37
  env GITLAB_PERSONAL_ACCESS_TOKEN=your_gitlab_token GITLAB_API_URL=your_gitlab_api_url npx @zereight/mcp-gitlab
64
38
  ```
65
39
 
66
40
  - `GITLAB_PERSONAL_ACCESS_TOKEN`: Your GitLab personal access token.
67
41
  - `GITLAB_API_URL`: Your GitLab API URL. (Default: `https://gitlab.com/api/v4`)
42
+
43
+ ## Tools πŸ› οΈ
44
+
45
+ 1. `create_or_update_file`
46
+
47
+ - Create or update a single file in a GitLab project. πŸ“
48
+ - Inputs:
49
+ - `project_id` (string): Project ID or namespace/project_path
50
+ - `file_path` (string): Path to create/update the file
51
+ - `content` (string): File content
52
+ - `commit_message` (string): Commit message
53
+ - `branch` (string): Branch to create/update the file in
54
+ - `previous_path` (optional string): Previous file path when renaming a file
55
+ - Returns: File content and commit details
56
+
57
+ 2. `push_files`
58
+
59
+ - Push multiple files in a single commit. πŸ“€
60
+ - Inputs:
61
+ - `project_id` (string): Project ID or namespace/project_path
62
+ - `branch` (string): Branch to push to
63
+ - `files` (array): Array of files to push, each with `file_path` and `content` properties
64
+ - `commit_message` (string): Commit message
65
+ - Returns: Updated branch reference
66
+
67
+ 3. `search_repositories`
68
+
69
+ - Search for GitLab projects. πŸ”
70
+ - Inputs:
71
+ - `search` (string): Search query
72
+ - `page` (optional number): Page number (default: 1)
73
+ - `per_page` (optional number): Results per page (default: 20, max: 100)
74
+ - Returns: Project search results
75
+
76
+ 4. `create_repository`
77
+
78
+ - Create a new GitLab project. βž•
79
+ - Inputs:
80
+ - `name` (string): Project name
81
+ - `description` (optional string): Project description
82
+ - `visibility` (optional string): Project visibility level (public, private, internal)
83
+ - `initialize_with_readme` (optional boolean): Initialize with README
84
+ - Returns: Details of the created project
85
+
86
+ 5. `get_file_contents`
87
+
88
+ - Get the contents of a file or directory. πŸ“‚
89
+ - Inputs:
90
+ - `project_id` (string): Project ID or namespace/project_path
91
+ - `file_path` (string): Path to the file/directory
92
+ - `ref` (optional string): Branch, tag, or commit SHA (default: default branch)
93
+ - Returns: File/directory content
94
+
95
+ 6. `create_issue`
96
+
97
+ - Create a new issue. πŸ›
98
+ - Inputs:
99
+ - `project_id` (string): Project ID or namespace/project_path
100
+ - `title` (string): Issue title
101
+ - `description` (string): Issue description
102
+ - `assignee_ids` (optional number[]): Array of assignee IDs
103
+ - `milestone_id` (optional number): Milestone ID
104
+ - `labels` (optional string[]): Array of labels
105
+ - Returns: Details of the created issue
106
+
107
+ 7. `create_merge_request`
108
+
109
+ - Create a new merge request. πŸš€
110
+ - Inputs:
111
+ - `project_id` (string): Project ID or namespace/project_path
112
+ - `title` (string): Merge request title
113
+ - `description` (string): Merge request description
114
+ - `source_branch` (string): Branch with changes
115
+ - `target_branch` (string): Branch to merge into
116
+ - `allow_collaboration` (optional boolean): Allow collaborators to push commits to the source branch
117
+ - `draft` (optional boolean): Create as a draft merge request
118
+ - Returns: Details of the created merge request
119
+
120
+ 8. `fork_repository`
121
+
122
+ - Fork a project. 🍴
123
+ - Inputs:
124
+ - `project_id` (string): Project ID or namespace/project_path to fork
125
+ - `namespace` (optional string): Namespace to fork into (default: user namespace)
126
+ - Returns: Details of the forked project
127
+
128
+ 9. `create_branch`
129
+
130
+ - Create a new branch. 🌿
131
+ - Inputs:
132
+ - `project_id` (string): Project ID or namespace/project_path
133
+ - `name` (string): New branch name
134
+ - `ref` (optional string): Ref to create the branch from (branch, tag, commit SHA, default: default branch)
135
+ - Returns: Created branch reference
136
+
137
+ 10. `get_merge_request`
138
+
139
+ - Get details of a merge request. ℹ️
140
+ - Inputs:
141
+ - `project_id` (string): Project ID or namespace/project_path
142
+ - `merge_request_iid` (number): Merge request IID
143
+ - Returns: Merge request details
144
+
145
+ 11. `get_merge_request_diffs`
146
+
147
+ - Get changes (diffs) of a merge request. diff
148
+ - Inputs:
149
+ - `project_id` (string): Project ID or namespace/project_path
150
+ - `merge_request_iid` (number): Merge request IID
151
+ - `view` (optional string): Diff view type ('inline' or 'parallel')
152
+ - Returns: Array of merge request diff information
153
+
154
+ 12. `update_merge_request`
155
+
156
+ - Update a merge request. πŸ”„
157
+ - Inputs:
158
+ - `project_id` (string): Project ID or namespace/project_path
159
+ - `merge_request_iid` (number): Merge request IID
160
+ - `title` (optional string): New title
161
+ - `description` (string): New description
162
+ - `target_branch` (optional string): New target branch
163
+ - `state_event` (optional string): Merge request state change event ('close', 'reopen')
164
+ - `remove_source_branch` (optional boolean): Remove source branch after merge
165
+ - `allow_collaboration` (optional boolean): Allow collaborators to push commits to the source branch
166
+ - Returns: Updated merge request details
167
+
168
+ 13. `create_note`
169
+ - Create a new note (comment) to an issue or merge request. πŸ’¬
170
+ - Inputs:
171
+ - `project_id` (string): Project ID or namespace/project_path
172
+ - `noteable_type` (string): Type of noteable ("issue" or "merge_request")
173
+ - `noteable_iid` (number): IID of the issue or merge request
174
+ - `body` (string): Note content
175
+ - Returns: Details of the created note
176
+
177
+ ## Environment Variable Configuration
178
+
179
+ Before running the server, you need to set the following environment variables:
180
+
181
+ ```
182
+ GITLAB_PERSONAL_ACCESS_TOKEN=your_gitlab_token
183
+ GITLAB_API_URL=your_gitlab_api_url # Default: https://gitlab.com/api/v4
184
+ ```
185
+
186
+ ## License
187
+
188
+ MIT License
package/build/index.js CHANGED
@@ -5,9 +5,9 @@ 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
- name: "gitlab-mcp-server",
10
+ name: "better-gitlab-mcp-server",
11
11
  version: "0.0.1",
12
12
  }, {
13
13
  capabilities: {
@@ -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.5",
4
4
  "description": "MCP server for using the GitLab API",
5
5
  "license": "MIT",
6
6
  "author": "zereight",