Compare commits

...

8 Commits

Author SHA1 Message Date
25be1947b9 chore(release): 1.0.42 - issue note 기능 추가 (#47) 2025-05-22 21:24:29 +09:00
864ee77ae6 Merge pull request #47 from svengt/feat/add-issue-notes-support
feat: add support for creating and updating issue notes
2025-05-22 21:22:04 +09:00
dc6cc59434 feat: add support for creating and updating issue notes
- Added create_issue_note to add a new note to an existing issue thread
- Added update_issue_note to modify an existing issue thread note
- Similar to existing merge request note functions but for issues
2025-05-22 13:25:31 +02:00
5924fd3ed4 Merge pull request #45 from vlucaswang/fix/docs
fix: fix README
2025-05-21 14:28:08 +09:00
f4b265bf2e fix: fix README 2025-05-21 14:35:37 +09:30
b326f4c3c3 docs: update release notes for v1.0.40 (2025-05-21) 2025-05-21 03:40:02 +09:00
1350a024b5 Merge pull request #44 from huerlisi/feat/add-issue-notes-support
feat: add issue discussions support
2025-05-21 03:36:33 +09:00
4c57c37888 feat: add issue discussions support
Added `list_issue_discussions` tool to support GitLab issue discussions
similar to merge request discussions.
2025-05-20 15:45:23 +02:00
6 changed files with 265 additions and 37 deletions

View File

@ -1,3 +1,15 @@
## [1.0.42] - 2025-05-22
### Added
- 이슈(issues)에 노트(note)를 생성하고 수정할 수 있는 기능이 추가되었습니다.
- 이제 버그나 할 일 같은 이슈에도 댓글(메모)을 달거나, 이미 단 댓글을 고칠 수 있습니다.
- 예시: "버그를 고쳤어요!"라는 댓글을 이슈에 달 수 있고, 필요하면 "버그를 완전히 고쳤어요!"로 바꿀 수 있습니다.
- 함수형 프로그래밍 원칙과 SOLID 원칙을 준수하여, 코드의 재사용성과 유지보수성이 높아졌습니다.
- 출처: [PR #47](https://github.com/zereight/gitlab-mcp/pull/47)
---
## [1.0.38] - 2025-05-17
### Fixed

View File

@ -52,10 +52,10 @@ When using with the Claude App, you need to set up your API key and URLs directl
"GITLAB_READ_ONLY_MODE",
"-e",
"USE_GITLAB_WIKI",
"nkwd/mcp-gitlab"
"nkwd/gitlab-mcp"
],
"env": {
"GITLAB_PERSONAL_ACCESS": "your_gitlab_token",
"GITLAB_PERSONAL_ACCESS_TOKEN": "your_gitlab_token",
"GITLAB_API_URL": "https://gitlab.com/api/v4", // Optional, for self-hosted GitLab
"GITLAB_READ_ONLY_MODE": "false",
"USE_GITLAB_WIKI": "true"
@ -93,29 +93,32 @@ When using with the Claude App, you need to set up your API key and URLs directl
15. `mr_discussions` - List discussion items for a merge request
16. `update_merge_request_note` - Modify an existing merge request thread note
17. `create_merge_request_note` - Add a new note to an existing merge request thread
18. `list_issues` - List issues in a GitLab project with filtering options
19. `get_issue` - Get details of a specific issue in a GitLab project
20. `update_issue` - Update an issue in a GitLab project
21. `delete_issue` - Delete an issue from a GitLab project
22. `list_issue_links` - List all issue links for a specific issue
23. `get_issue_link` - Get a specific issue link
24. `create_issue_link` - Create an issue link between two issues
25. `delete_issue_link` - Delete an issue link
26. `list_namespaces` - List all namespaces available to the current user
27. `get_namespace` - Get details of a namespace by ID or path
28. `verify_namespace` - Verify if a namespace path exists
29. `get_project` - Get details of a specific project
30. `list_projects` - List projects accessible by the current user
31. `list_labels` - List labels for a project
32. `get_label` - Get a single label from a project
33. `create_label` - Create a new label in a project
34. `update_label` - Update an existing label in a project
35. `delete_label` - Delete a label from a project
36. `list_group_projects` - List projects in a GitLab group with filtering options
37. `list_wiki_pages` - List wiki pages in a GitLab project
38. `get_wiki_page` - Get details of a specific wiki page
39. `create_wiki_page` - Create a new wiki page in a GitLab project
40. `update_wiki_page` - Update an existing wiki page in a GitLab project
41. `delete_wiki_page` - Delete a wiki page from a GitLab project
42. `get_repository_tree` - Get the repository tree for a GitLab project (list files and directories)
18. `update_issue_note` - Update the content of an existing issue note
19. `create_issue_note` - Add a new note to an existing issue thread
20. `list_issues` - List issues in a GitLab project with filtering options
21. `get_issue` - Get details of a specific issue in a GitLab project
22. `update_issue` - Update an issue in a GitLab project
23. `delete_issue` - Delete an issue from a GitLab project
24. `list_issue_links` - List all issue links for a specific issue
25. `list_issue_discussions` - List discussions for an issue in a GitLab project
26. `get_issue_link` - Get a specific issue link
27. `create_issue_link` - Create an issue link between two issues
28. `delete_issue_link` - Delete an issue link
29. `list_namespaces` - List all namespaces available to the current user
30. `get_namespace` - Get details of a namespace by ID or path
31. `verify_namespace` - Verify if a namespace path exists
32. `get_project` - Get details of a specific project
33. `list_projects` - List projects accessible by the current user
34. `list_labels` - List labels for a project
35. `get_label` - Get a single label from a project
36. `create_label` - Create a new label in a project
37. `update_label` - Update an existing label in a project
38. `delete_label` - Delete a label from a project
39. `list_group_projects` - List projects in a GitLab group with filtering options
40. `list_wiki_pages` - List wiki pages in a GitLab project
41. `get_wiki_page` - Get details of a specific wiki page
42. `create_wiki_page` - Create a new wiki page in a GitLab project
43. `update_wiki_page` - Update an existing wiki page in a GitLab project
44. `delete_wiki_page` - Delete a wiki page from a GitLab project
45. `get_repository_tree` - Get the repository tree for a GitLab project (list files and directories)
<!-- TOOLS-END -->

186
index.ts
View File

@ -61,6 +61,7 @@ import {
GitLabIssueLinkSchema,
GitLabIssueWithLinkDetailsSchema,
ListIssueLinksSchema,
ListIssueDiscussionsSchema,
GetIssueLinkSchema,
CreateIssueLinkSchema,
DeleteIssueLinkSchema,
@ -120,6 +121,8 @@ import {
GetRepositoryTreeSchema,
type GitLabTreeItem,
type GetRepositoryTreeOptions,
UpdateIssueNoteSchema,
CreateIssueNoteSchema,
} from "./schemas.js";
/**
@ -286,6 +289,16 @@ const allTools = [
description: "Add a new note to an existing merge request thread",
inputSchema: zodToJsonSchema(CreateMergeRequestNoteSchema),
},
{
name: "update_issue_note",
description: "Modify an existing issue thread note",
inputSchema: zodToJsonSchema(UpdateIssueNoteSchema),
},
{
name: "create_issue_note",
description: "Add a new note to an existing issue thread",
inputSchema: zodToJsonSchema(CreateIssueNoteSchema),
},
{
name: "list_issues",
description: "List issues in a GitLab project with filtering options",
@ -311,6 +324,11 @@ const allTools = [
description: "List all issue links for a specific issue",
inputSchema: zodToJsonSchema(ListIssueLinksSchema),
},
{
name: "list_issue_discussions",
description: "List discussions for an issue in a GitLab project",
inputSchema: zodToJsonSchema(ListIssueDiscussionsSchema),
},
{
name: "get_issue_link",
description: "Get a specific issue link",
@ -424,6 +442,7 @@ const readOnlyTools = [
"list_issues",
"get_issue",
"list_issue_links",
"list_issue_discussions",
"get_issue_link",
"list_namespaces",
"get_namespace",
@ -1023,6 +1042,56 @@ async function listMergeRequestDiscussions(
return z.array(GitLabDiscussionSchema).parse(data);
}
/**
* List discussions for an issue
*
* @param {string} projectId - The ID or URL-encoded path of the project
* @param {number} issueIid - The internal ID of the project issue
* @param {Object} options - Pagination and sorting options
* @returns {Promise<GitLabDiscussion[]>} List of issue discussions
*/
async function listIssueDiscussions(
projectId: string,
issueIid: number,
options: {
page?: number,
per_page?: number,
sort?: "asc" | "desc",
order_by?: "created_at" | "updated_at"
} = {}
): Promise<GitLabDiscussion[]> {
projectId = decodeURIComponent(projectId); // Decode project ID
const url = new URL(
`${GITLAB_API_URL}/projects/${encodeURIComponent(
projectId
)}/issues/${issueIid}/discussions`
);
// Add query parameters for pagination and sorting
if (options.page) {
url.searchParams.append("page", options.page.toString());
}
if (options.per_page) {
url.searchParams.append("per_page", options.per_page.toString());
}
if (options.sort) {
url.searchParams.append("sort", options.sort);
}
if (options.order_by) {
url.searchParams.append("order_by", options.order_by);
}
const response = await fetch(url.toString(), {
...DEFAULT_FETCH_CONFIG,
});
await handleGitLabError(response);
const data = await response.json();
// Parse the response as an array of discussions
return z.array(GitLabDiscussionSchema).parse(data);
}
/**
* Modify an existing merge request thread note
* 병합 요청 토론 노트 수정
@ -1069,6 +1138,81 @@ async function updateMergeRequestNote(
return GitLabDiscussionNoteSchema.parse(data);
}
/**
* Update an issue discussion note
* @param {string} projectId - The ID or URL-encoded path of the project
* @param {number} issueIid - The IID of an issue
* @param {string} discussionId - The ID of a thread
* @param {number} noteId - The ID of a thread note
* @param {string} body - The new content of the note
* @returns {Promise<GitLabDiscussionNote>} The updated note
*/
async function updateIssueNote(
projectId: string,
issueIid: number,
discussionId: string,
noteId: number,
body: string
): Promise<GitLabDiscussionNote> {
projectId = decodeURIComponent(projectId); // Decode project ID
const url = new URL(
`${GITLAB_API_URL}/projects/${encodeURIComponent(
projectId
)}/issues/${issueIid}/discussions/${discussionId}/notes/${noteId}`
);
const payload = { body };
const response = await fetch(url.toString(), {
...DEFAULT_FETCH_CONFIG,
method: "PUT",
body: JSON.stringify(payload),
});
await handleGitLabError(response);
const data = await response.json();
return GitLabDiscussionNoteSchema.parse(data);
}
/**
* Create a note in an issue discussion
* @param {string} projectId - The ID or URL-encoded path of the project
* @param {number} issueIid - The IID of an issue
* @param {string} discussionId - The ID of a thread
* @param {string} body - The content of the new note
* @param {string} [createdAt] - The creation date of the note (ISO 8601 format)
* @returns {Promise<GitLabDiscussionNote>} The created note
*/
async function createIssueNote(
projectId: string,
issueIid: number,
discussionId: string,
body: string,
createdAt?: string
): Promise<GitLabDiscussionNote> {
projectId = decodeURIComponent(projectId); // Decode project ID
const url = new URL(
`${GITLAB_API_URL}/projects/${encodeURIComponent(
projectId
)}/issues/${issueIid}/discussions/${discussionId}/notes`
);
const payload: { body: string; created_at?: string } = { body };
if (createdAt) {
payload.created_at = createdAt;
}
const response = await fetch(url.toString(), {
...DEFAULT_FETCH_CONFIG,
method: "POST",
body: JSON.stringify(payload),
});
await handleGitLabError(response);
const data = await response.json();
return GitLabDiscussionNoteSchema.parse(data);
}
/**
* Add a new note to an existing merge request thread
* 기존 병합 요청 스레드에 새 노트 추가
@ -2404,6 +2548,38 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
};
}
case "update_issue_note": {
const args = UpdateIssueNoteSchema.parse(
request.params.arguments
);
const note = await updateIssueNote(
args.project_id,
args.issue_iid,
args.discussion_id,
args.note_id,
args.body
);
return {
content: [{ type: "text", text: JSON.stringify(note, null, 2) }],
};
}
case "create_issue_note": {
const args = CreateIssueNoteSchema.parse(
request.params.arguments
);
const note = await createIssueNote(
args.project_id,
args.issue_iid,
args.discussion_id,
args.body,
args.created_at
);
return {
content: [{ type: "text", text: JSON.stringify(note, null, 2) }],
};
}
case "get_merge_request": {
const args = GetMergeRequestSchema.parse(request.params.arguments);
const mergeRequest = await getMergeRequest(
@ -2647,6 +2823,16 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
};
}
case "list_issue_discussions": {
const args = ListIssueDiscussionsSchema.parse(request.params.arguments);
const { project_id, issue_iid, ...options } = args;
const discussions = await listIssueDiscussions(project_id, issue_iid, options);
return {
content: [{ type: "text", text: JSON.stringify(discussions, null, 2) }],
};
}
case "get_issue_link": {
const args = GetIssueLinkSchema.parse(request.params.arguments);
const link = await getIssueLink(

View File

@ -1,6 +1,6 @@
{
"name": "@zereight/mcp-gitlab",
"version": "1.0.39",
"version": "1.0.42",
"description": "MCP server for using the GitLab API",
"license": "MIT",
"author": "zereight",

View File

@ -1,6 +1,5 @@
### Fixed
### 1.0.40 (2025-05-21)
- Added `expanded` property to `start` and `end` in `GitLabDiscussionNoteSchema`
Now you can expand or collapse more information at the start and end of discussion notes.
Example: In code review, you can choose to show or hide specific parts of the discussion.
(See: [PR #40](https://github.com/zereight/gitlab-mcp/pull/40))
- Added support for listing discussions (comments/notes) on GitLab issues.
- Example: You can now easily fetch all conversations (comments) attached to an issue via the API.
- Related PR: [#44](https://github.com/zereight/gitlab-mcp/pull/44)

View File

@ -491,6 +491,22 @@ export const CreateMergeRequestNoteSchema = ProjectParamsSchema.extend({
created_at: z.string().optional().describe("Date the note was created at (ISO 8601 format)"),
});
// Input schema for updating an issue discussion note
export const UpdateIssueNoteSchema = ProjectParamsSchema.extend({
issue_iid: z.number().describe("The IID of an issue"),
discussion_id: z.string().describe("The ID of a thread"),
note_id: z.number().describe("The ID of a thread note"),
body: z.string().describe("The content of the note or reply"),
});
// Input schema for adding a note to an existing issue discussion
export const CreateIssueNoteSchema = ProjectParamsSchema.extend({
issue_iid: z.number().describe("The IID of an issue"),
discussion_id: z.string().describe("The ID of a thread"),
body: z.string().describe("The content of the note or reply"),
created_at: z.string().optional().describe("Date the note was created at (ISO 8601 format)"),
});
// API Operation Parameter Schemas
export const CreateOrUpdateFileSchema = ProjectParamsSchema.extend({
@ -757,6 +773,15 @@ export const ListIssueLinksSchema = z.object({
issue_iid: z.number().describe("The internal ID of a project's issue"),
});
export const ListIssueDiscussionsSchema = z.object({
project_id: z.string().describe("Project ID or URL-encoded path"),
issue_iid: z.number().describe("The internal ID of the project issue"),
page: z.number().optional().describe("Page number for pagination"),
per_page: z.number().optional().describe("Number of items per page"),
sort: z.enum(["asc", "desc"]).optional().describe("Return issue discussions sorted in ascending or descending order"),
order_by: z.enum(["created_at", "updated_at"]).optional().describe("Return issue discussions ordered by created_at or updated_at fields"),
});
export const GetIssueLinkSchema = z.object({
project_id: z.string().describe("Project ID or URL-encoded path"),
issue_iid: z.number().describe("The internal ID of a project's issue"),
@ -1075,6 +1100,9 @@ export type GitLabMergeRequestDiff = z.infer<
>;
export type CreateNoteOptions = z.infer<typeof CreateNoteSchema>;
export type GitLabIssueLink = z.infer<typeof GitLabIssueLinkSchema>;
export type ListIssueDiscussionsOptions = z.infer<typeof ListIssueDiscussionsSchema>;
export type UpdateIssueNoteOptions = z.infer<typeof UpdateIssueNoteSchema>;
export type CreateIssueNoteOptions = z.infer<typeof CreateIssueNoteSchema>;
export type GitLabNamespace = z.infer<typeof GitLabNamespaceSchema>;
export type GitLabNamespaceExistsResponse = z.infer<
typeof GitLabNamespaceExistsResponseSchema