Compare commits
11 Commits
v1.0.45
...
feat/docke
Author | SHA1 | Date | |
---|---|---|---|
0b876ebff6 | |||
a2c2ac185a | |||
2462168697 | |||
88af65fcd0 | |||
0b55cc3cee | |||
40e39d7b36 | |||
cc847772f1 | |||
ab571d211d | |||
f8b1444afd | |||
06f9437329 | |||
dc99f864ca |
35
CHANGELOG.md
35
CHANGELOG.md
@ -1,3 +1,38 @@
|
||||
## [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
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed issue where GitLab issues and milestones with null descriptions would cause JSON-RPC errors
|
||||
- Changed `description` field to be nullable with default empty string in schemas
|
||||
- This allows proper handling of GitLab issues/milestones without descriptions
|
||||
- See: [PR #53](https://github.com/zereight/gitlab-mcp/pull/53), [Issue #51](https://github.com/zereight/gitlab-mcp/issues/51)
|
||||
|
||||
---
|
||||
|
||||
## [1.0.45] - 2025-05-24
|
||||
|
||||
### Added
|
||||
|
@ -52,7 +52,7 @@ 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/gitlab-mcp"
|
||||
"iwakitakuma/gitlab-mcp"
|
||||
],
|
||||
"env": {
|
||||
"GITLAB_PERSONAL_ACCESS_TOKEN": "your_gitlab_token",
|
||||
@ -65,6 +65,12 @@ When using with the Claude App, you need to set up your API key and URLs directl
|
||||
}
|
||||
```
|
||||
|
||||
#### Docker Image Push
|
||||
|
||||
```shell
|
||||
$ sh scripts/image_push.sh docker_user_name
|
||||
```
|
||||
|
||||
### Environment Variables
|
||||
|
||||
- `GITLAB_PERSONAL_ACCESS_TOKEN`: Your GitLab personal access token.
|
||||
@ -125,4 +131,5 @@ 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
|
||||
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
|
||||
51. `list_merge_requests` - List merge requests in a GitLab project with filtering options
|
||||
<!-- TOOLS-END -->
|
||||
|
52
index.ts
52
index.ts
@ -134,6 +134,7 @@ import {
|
||||
type GetRepositoryTreeOptions,
|
||||
UpdateIssueNoteSchema,
|
||||
CreateIssueNoteSchema,
|
||||
ListMergeRequestsSchema,
|
||||
} from "./schemas.js";
|
||||
|
||||
/**
|
||||
@ -466,6 +467,11 @@ const allTools = [
|
||||
description: "Get the output/trace of a GitLab pipeline job number",
|
||||
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
|
||||
@ -476,6 +482,7 @@ const readOnlyTools = [
|
||||
"get_merge_request_diffs",
|
||||
"mr_discussions",
|
||||
"list_issues",
|
||||
"list_merge_requests",
|
||||
"get_issue",
|
||||
"list_issue_links",
|
||||
"list_issue_discussions",
|
||||
@ -791,6 +798,43 @@ async function listIssues(
|
||||
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
|
||||
* 단일 이슈 조회
|
||||
@ -3300,6 +3344,14 @@ 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:
|
||||
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",
|
||||
"version": "1.0.38",
|
||||
"version": "1.0.46",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@zereight/mcp-gitlab",
|
||||
"version": "1.0.38",
|
||||
"version": "1.0.46",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@modelcontextprotocol/sdk": "1.8.0",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@zereight/mcp-gitlab",
|
||||
"version": "1.0.45",
|
||||
"version": "1.0.47",
|
||||
"description": "MCP server for using the GitLab API",
|
||||
"license": "MIT",
|
||||
"author": "zereight",
|
||||
|
90
schemas.ts
90
schemas.ts
@ -40,7 +40,7 @@ export const GitLabPipelineSchema = z.object({
|
||||
image: z.string().optional(),
|
||||
size: z.string().optional(),
|
||||
title: z.string().optional(),
|
||||
}).optional(),
|
||||
}).nullable().optional(),
|
||||
favicon: z.string().optional(),
|
||||
}).optional(),
|
||||
});
|
||||
@ -399,7 +399,7 @@ export const GitLabUserSchema = z.object({
|
||||
username: z.string(), // Changed from login to match GitLab API
|
||||
id: z.number(),
|
||||
name: z.string(),
|
||||
avatar_url: z.string(),
|
||||
avatar_url: z.string().nullable(),
|
||||
web_url: z.string(), // Changed from html_url to match GitLab API
|
||||
});
|
||||
|
||||
@ -407,7 +407,7 @@ export const GitLabMilestoneSchema = z.object({
|
||||
id: z.number(),
|
||||
iid: z.number(), // Added to match GitLab API
|
||||
title: z.string(),
|
||||
description: z.string(),
|
||||
description: z.string().nullable().default(""),
|
||||
state: z.string(),
|
||||
web_url: z.string(), // Changed from html_url to match GitLab API
|
||||
});
|
||||
@ -417,7 +417,7 @@ export const GitLabIssueSchema = z.object({
|
||||
iid: z.number(), // Added to match GitLab API
|
||||
project_id: z.number(), // Added to match GitLab API
|
||||
title: z.string(),
|
||||
description: z.string(), // Changed from body to match GitLab API
|
||||
description: z.string().nullable().default(""), // Changed from body to match GitLab API
|
||||
state: z.string(),
|
||||
author: GitLabUserSchema,
|
||||
assignees: z.array(GitLabUserSchema),
|
||||
@ -834,6 +834,88 @@ export const ListIssuesSchema = z.object({
|
||||
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({
|
||||
project_id: z.string().describe("Project ID or URL-encoded path"),
|
||||
issue_iid: z.number().describe("The internal ID of the project issue"),
|
||||
|
18
scripts/image_push.sh
Normal file
18
scripts/image_push.sh
Normal file
@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Error: docker user name required."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DOCKER_USER=$1
|
||||
IMAGE_NAME=gitlab-mcp
|
||||
IMAGE_VERSION=$(jq -r '.version' package.json)
|
||||
|
||||
echo "${DOCKER_USER}/${IMAGE_NAME}:${IMAGE_VERSION}"
|
||||
docker build --platform=linux/arm64 -t "${DOCKER_USER}/${IMAGE_NAME}:latest" .
|
||||
|
||||
docker tag "${DOCKER_USER}/${IMAGE_NAME}:latest" "${DOCKER_USER}/${IMAGE_NAME}:${IMAGE_VERSION}"
|
||||
|
||||
docker push "${DOCKER_USER}/${IMAGE_NAME}:latest"
|
||||
docker push "${DOCKER_USER}/${IMAGE_NAME}:${IMAGE_VERSION}"
|
Reference in New Issue
Block a user