Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
25be1947b9 | |||
864ee77ae6 | |||
dc6cc59434 | |||
5924fd3ed4 | |||
f4b265bf2e | |||
b326f4c3c3 |
12
CHANGELOG.md
12
CHANGELOG.md
@ -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
|
||||
|
58
README.md
58
README.md
@ -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,30 +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. `list_issue_discussions` - List discussions for an issue in a GitLab project
|
||||
24. `get_issue_link` - Get a specific issue link
|
||||
25. `create_issue_link` - Create an issue link between two issues
|
||||
26. `delete_issue_link` - Delete an issue link
|
||||
27. `list_namespaces` - List all namespaces available to the current user
|
||||
28. `get_namespace` - Get details of a namespace by ID or path
|
||||
29. `verify_namespace` - Verify if a namespace path exists
|
||||
30. `get_project` - Get details of a specific project
|
||||
31. `list_projects` - List projects accessible by the current user
|
||||
32. `list_labels` - List labels for a project
|
||||
33. `get_label` - Get a single label from a project
|
||||
34. `create_label` - Create a new label in a project
|
||||
35. `update_label` - Update an existing label in a project
|
||||
36. `delete_label` - Delete a label from a project
|
||||
37. `list_group_projects` - List projects in a GitLab group with filtering options
|
||||
38. `list_wiki_pages` - List wiki pages in a GitLab project
|
||||
39. `get_wiki_page` - Get details of a specific wiki page
|
||||
40. `create_wiki_page` - Create a new wiki page in a GitLab project
|
||||
41. `update_wiki_page` - Update an existing wiki page in a GitLab project
|
||||
42. `delete_wiki_page` - Delete a wiki page from a GitLab project
|
||||
43. `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 -->
|
||||
|
119
index.ts
119
index.ts
@ -121,6 +121,8 @@ import {
|
||||
GetRepositoryTreeSchema,
|
||||
type GitLabTreeItem,
|
||||
type GetRepositoryTreeOptions,
|
||||
UpdateIssueNoteSchema,
|
||||
CreateIssueNoteSchema,
|
||||
} from "./schemas.js";
|
||||
|
||||
/**
|
||||
@ -287,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",
|
||||
@ -1126,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
|
||||
* 기존 병합 요청 스레드에 새 노트 추가
|
||||
@ -2461,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(
|
||||
|
@ -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",
|
||||
|
@ -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)
|
||||
|
18
schemas.ts
18
schemas.ts
@ -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({
|
||||
@ -1085,6 +1101,8 @@ 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
|
||||
|
Reference in New Issue
Block a user