Compare commits
1 Commits
v1.0.47
...
feat/54-li
Author | SHA1 | Date | |
---|---|---|---|
3af10a3844 |
24
CHANGELOG.md
24
CHANGELOG.md
@ -1,27 +1,3 @@
|
|||||||
## [1.0.47] - 2025-05-29
|
|
||||||
|
|
||||||
### Added
|
|
||||||
|
|
||||||
- 🔄 **List Merge Requests Tool**: Added functionality to list and filter merge requests in GitLab projects
|
|
||||||
- `list_merge_requests`: List merge requests with comprehensive filtering options
|
|
||||||
- Supports filtering by state, scope, author, assignee, reviewer, labels, and more
|
|
||||||
- Includes pagination support for large result sets
|
|
||||||
- See: [PR #56](https://github.com/zereight/gitlab-mcp/pull/56)
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
|
|
||||||
- Fixed issue where GitLab users without profile pictures would cause JSON-RPC errors
|
|
||||||
- Changed `avatar_url` field to be nullable in GitLabUserSchema
|
|
||||||
- This allows proper handling of users without avatars in GitLab API responses
|
|
||||||
- See: [PR #55](https://github.com/zereight/gitlab-mcp/pull/55)
|
|
||||||
|
|
||||||
- Fixed issue where GitLab pipelines without illustrations would cause JSON-RPC errors
|
|
||||||
- Changed `illustration` field to be nullable in GitLabPipelineSchema
|
|
||||||
- This allows proper handling of pipelines without illustrations
|
|
||||||
- See: [PR #58](https://github.com/zereight/gitlab-mcp/pull/58), [Issue #57](https://github.com/zereight/gitlab-mcp/issues/57)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## [1.0.46] - 2025-05-27
|
## [1.0.46] - 2025-05-27
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
@ -125,5 +125,4 @@ When using with the Claude App, you need to set up your API key and URLs directl
|
|||||||
48. `list_pipeline_jobs` - List all jobs in a specific pipeline
|
48. `list_pipeline_jobs` - List all jobs in a specific pipeline
|
||||||
49. `get_pipeline_job` - Get details of a GitLab pipeline job number
|
49. `get_pipeline_job` - Get details of a GitLab pipeline job number
|
||||||
50. `get_pipeline_job_output` - Get the output/trace of a GitLab pipeline job number
|
50. `get_pipeline_job_output` - Get the output/trace of a GitLab pipeline job number
|
||||||
51. `list_merge_requests` - List merge requests in a GitLab project with filtering options
|
|
||||||
<!-- TOOLS-END -->
|
<!-- TOOLS-END -->
|
||||||
|
52
index.ts
52
index.ts
@ -134,7 +134,6 @@ import {
|
|||||||
type GetRepositoryTreeOptions,
|
type GetRepositoryTreeOptions,
|
||||||
UpdateIssueNoteSchema,
|
UpdateIssueNoteSchema,
|
||||||
CreateIssueNoteSchema,
|
CreateIssueNoteSchema,
|
||||||
ListMergeRequestsSchema,
|
|
||||||
} from "./schemas.js";
|
} from "./schemas.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -467,11 +466,6 @@ const allTools = [
|
|||||||
description: "Get the output/trace of a GitLab pipeline job number",
|
description: "Get the output/trace of a GitLab pipeline job number",
|
||||||
inputSchema: zodToJsonSchema(GetPipelineJobOutputSchema),
|
inputSchema: zodToJsonSchema(GetPipelineJobOutputSchema),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "list_merge_requests",
|
|
||||||
description: "List merge requests in a GitLab project with filtering options",
|
|
||||||
inputSchema: zodToJsonSchema(ListMergeRequestsSchema),
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
|
||||||
// Define which tools are read-only
|
// Define which tools are read-only
|
||||||
@ -482,7 +476,6 @@ const readOnlyTools = [
|
|||||||
"get_merge_request_diffs",
|
"get_merge_request_diffs",
|
||||||
"mr_discussions",
|
"mr_discussions",
|
||||||
"list_issues",
|
"list_issues",
|
||||||
"list_merge_requests",
|
|
||||||
"get_issue",
|
"get_issue",
|
||||||
"list_issue_links",
|
"list_issue_links",
|
||||||
"list_issue_discussions",
|
"list_issue_discussions",
|
||||||
@ -798,43 +791,6 @@ async function listIssues(
|
|||||||
return z.array(GitLabIssueSchema).parse(data);
|
return z.array(GitLabIssueSchema).parse(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* List merge requests in a GitLab project with optional filtering
|
|
||||||
*
|
|
||||||
* @param {string} projectId - The ID or URL-encoded path of the project
|
|
||||||
* @param {Object} options - Optional filtering parameters
|
|
||||||
* @returns {Promise<GitLabMergeRequest[]>} List of merge requests
|
|
||||||
*/
|
|
||||||
async function listMergeRequests(
|
|
||||||
projectId: string,
|
|
||||||
options: Omit<z.infer<typeof ListMergeRequestsSchema>, "project_id"> = {}
|
|
||||||
): Promise<GitLabMergeRequest[]> {
|
|
||||||
projectId = decodeURIComponent(projectId); // Decode project ID
|
|
||||||
const url = new URL(
|
|
||||||
`${GITLAB_API_URL}/projects/${encodeURIComponent(projectId)}/merge_requests`
|
|
||||||
);
|
|
||||||
|
|
||||||
// Add all query parameters
|
|
||||||
Object.entries(options).forEach(([key, value]) => {
|
|
||||||
if (value !== undefined) {
|
|
||||||
if (key === "labels" && Array.isArray(value)) {
|
|
||||||
// Handle array of labels
|
|
||||||
url.searchParams.append(key, value.join(","));
|
|
||||||
} else {
|
|
||||||
url.searchParams.append(key, value.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const response = await fetch(url.toString(), {
|
|
||||||
...DEFAULT_FETCH_CONFIG,
|
|
||||||
});
|
|
||||||
|
|
||||||
await handleGitLabError(response);
|
|
||||||
const data = await response.json();
|
|
||||||
return z.array(GitLabMergeRequestSchema).parse(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a single issue from a GitLab project
|
* Get a single issue from a GitLab project
|
||||||
* 단일 이슈 조회
|
* 단일 이슈 조회
|
||||||
@ -3344,14 +3300,6 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
case "list_merge_requests": {
|
|
||||||
const args = ListMergeRequestsSchema.parse(request.params.arguments);
|
|
||||||
const mergeRequests = await listMergeRequests(args.project_id, args);
|
|
||||||
return {
|
|
||||||
content: [{ type: "text", text: JSON.stringify(mergeRequests, null, 2) }],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unknown tool: ${request.params.name}`);
|
throw new Error(`Unknown tool: ${request.params.name}`);
|
||||||
}
|
}
|
||||||
|
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@zereight/mcp-gitlab",
|
"name": "@zereight/mcp-gitlab",
|
||||||
"version": "1.0.46",
|
"version": "1.0.38",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@zereight/mcp-gitlab",
|
"name": "@zereight/mcp-gitlab",
|
||||||
"version": "1.0.46",
|
"version": "1.0.38",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@modelcontextprotocol/sdk": "1.8.0",
|
"@modelcontextprotocol/sdk": "1.8.0",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@zereight/mcp-gitlab",
|
"name": "@zereight/mcp-gitlab",
|
||||||
"version": "1.0.47",
|
"version": "1.0.46",
|
||||||
"description": "MCP server for using the GitLab API",
|
"description": "MCP server for using the GitLab API",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": "zereight",
|
"author": "zereight",
|
||||||
|
90
schemas.ts
90
schemas.ts
@ -40,7 +40,7 @@ export const GitLabPipelineSchema = z.object({
|
|||||||
image: z.string().optional(),
|
image: z.string().optional(),
|
||||||
size: z.string().optional(),
|
size: z.string().optional(),
|
||||||
title: z.string().optional(),
|
title: z.string().optional(),
|
||||||
}).nullable().optional(),
|
}).optional(),
|
||||||
favicon: z.string().optional(),
|
favicon: z.string().optional(),
|
||||||
}).optional(),
|
}).optional(),
|
||||||
});
|
});
|
||||||
@ -399,7 +399,7 @@ export const GitLabUserSchema = z.object({
|
|||||||
username: z.string(), // Changed from login to match GitLab API
|
username: z.string(), // Changed from login to match GitLab API
|
||||||
id: z.number(),
|
id: z.number(),
|
||||||
name: z.string(),
|
name: z.string(),
|
||||||
avatar_url: z.string().nullable(),
|
avatar_url: z.string(),
|
||||||
web_url: z.string(), // Changed from html_url to match GitLab API
|
web_url: z.string(), // Changed from html_url to match GitLab API
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -549,13 +549,13 @@ export const GitLabDiscussionNoteSchema = z.object({
|
|||||||
.object({
|
.object({
|
||||||
start: z.object({
|
start: z.object({
|
||||||
line_code: z.string(),
|
line_code: z.string(),
|
||||||
type: z.enum(["new", "old", "expanded"]),
|
type: z.enum(["new", "old", "expanded"]).optional(),
|
||||||
old_line: z.number().nullable(),
|
old_line: z.number().nullable(),
|
||||||
new_line: z.number().nullable(),
|
new_line: z.number().nullable(),
|
||||||
}),
|
}),
|
||||||
end: z.object({
|
end: z.object({
|
||||||
line_code: z.string(),
|
line_code: z.string(),
|
||||||
type: z.enum(["new", "old", "expanded"]),
|
type: z.enum(["new", "old", "expanded"]).optional(),
|
||||||
old_line: z.number().nullable(),
|
old_line: z.number().nullable(),
|
||||||
new_line: z.number().nullable(),
|
new_line: z.number().nullable(),
|
||||||
}),
|
}),
|
||||||
@ -834,88 +834,6 @@ export const ListIssuesSchema = z.object({
|
|||||||
per_page: z.number().optional().describe("Number of items per page"),
|
per_page: z.number().optional().describe("Number of items per page"),
|
||||||
});
|
});
|
||||||
|
|
||||||
// Merge Requests API operation schemas
|
|
||||||
export const ListMergeRequestsSchema = z.object({
|
|
||||||
project_id: z.string().describe("Project ID or URL-encoded path"),
|
|
||||||
assignee_id: z
|
|
||||||
.number()
|
|
||||||
.optional()
|
|
||||||
.describe("Returns merge requests assigned to the given user ID"),
|
|
||||||
assignee_username: z
|
|
||||||
.string()
|
|
||||||
.optional()
|
|
||||||
.describe("Returns merge requests assigned to the given username"),
|
|
||||||
author_id: z
|
|
||||||
.number()
|
|
||||||
.optional()
|
|
||||||
.describe("Returns merge requests created by the given user ID"),
|
|
||||||
author_username: z
|
|
||||||
.string()
|
|
||||||
.optional()
|
|
||||||
.describe("Returns merge requests created by the given username"),
|
|
||||||
reviewer_id: z
|
|
||||||
.number()
|
|
||||||
.optional()
|
|
||||||
.describe("Returns merge requests which have the user as a reviewer"),
|
|
||||||
reviewer_username: z
|
|
||||||
.string()
|
|
||||||
.optional()
|
|
||||||
.describe("Returns merge requests which have the user as a reviewer"),
|
|
||||||
created_after: z
|
|
||||||
.string()
|
|
||||||
.optional()
|
|
||||||
.describe("Return merge requests created after the given time"),
|
|
||||||
created_before: z
|
|
||||||
.string()
|
|
||||||
.optional()
|
|
||||||
.describe("Return merge requests created before the given time"),
|
|
||||||
updated_after: z
|
|
||||||
.string()
|
|
||||||
.optional()
|
|
||||||
.describe("Return merge requests updated after the given time"),
|
|
||||||
updated_before: z
|
|
||||||
.string()
|
|
||||||
.optional()
|
|
||||||
.describe("Return merge requests updated before the given time"),
|
|
||||||
labels: z.array(z.string()).optional().describe("Array of label names"),
|
|
||||||
milestone: z.string().optional().describe("Milestone title"),
|
|
||||||
scope: z
|
|
||||||
.enum(["created_by_me", "assigned_to_me", "all"])
|
|
||||||
.optional()
|
|
||||||
.describe("Return merge requests from a specific scope"),
|
|
||||||
search: z.string().optional().describe("Search for specific terms"),
|
|
||||||
state: z
|
|
||||||
.enum(["opened", "closed", "locked", "merged", "all"])
|
|
||||||
.optional()
|
|
||||||
.describe("Return merge requests with a specific state"),
|
|
||||||
order_by: z
|
|
||||||
.enum(["created_at", "updated_at", "priority", "label_priority", "milestone_due", "popularity"])
|
|
||||||
.optional()
|
|
||||||
.describe("Return merge requests ordered by the given field"),
|
|
||||||
sort: z
|
|
||||||
.enum(["asc", "desc"])
|
|
||||||
.optional()
|
|
||||||
.describe("Return merge requests sorted in ascending or descending order"),
|
|
||||||
target_branch: z
|
|
||||||
.string()
|
|
||||||
.optional()
|
|
||||||
.describe("Return merge requests targeting a specific branch"),
|
|
||||||
source_branch: z
|
|
||||||
.string()
|
|
||||||
.optional()
|
|
||||||
.describe("Return merge requests from a specific source branch"),
|
|
||||||
wip: z
|
|
||||||
.enum(["yes", "no"])
|
|
||||||
.optional()
|
|
||||||
.describe("Filter merge requests against their wip status"),
|
|
||||||
with_labels_details: z
|
|
||||||
.boolean()
|
|
||||||
.optional()
|
|
||||||
.describe("Return more details for each label"),
|
|
||||||
page: z.number().optional().describe("Page number for pagination"),
|
|
||||||
per_page: z.number().optional().describe("Number of items per page"),
|
|
||||||
});
|
|
||||||
|
|
||||||
export const GetIssueSchema = z.object({
|
export const GetIssueSchema = z.object({
|
||||||
project_id: z.string().describe("Project ID or URL-encoded path"),
|
project_id: z.string().describe("Project ID or URL-encoded path"),
|
||||||
issue_iid: z.number().describe("The internal ID of the project issue"),
|
issue_iid: z.number().describe("The internal ID of the project issue"),
|
||||||
|
Reference in New Issue
Block a user