Compare commits
24 Commits
feat/issue
...
feat/88-2
Author | SHA1 | Date | |
---|---|---|---|
011efbdd4b | |||
ed032bad48 | |||
5200cc526c | |||
1ba54342bc | |||
29659db0b7 | |||
44d8d11b4a | |||
622c112f7f | |||
0930ce3636 | |||
061e19d861 | |||
511d2d9c06 | |||
8cb7703aa1 | |||
5e254836e8 | |||
93710f2846 | |||
f3854126ac | |||
c07356bd46 | |||
c82be8c94f | |||
cd8f0e5525 | |||
547b05c88d | |||
ed0b3915aa | |||
0bcccd95ca | |||
0b5453b3fd | |||
e23739bb38 | |||
2a9b8f1a25 | |||
82a944427d |
20
CHANGELOG.md
20
CHANGELOG.md
@ -1,8 +1,28 @@
|
||||
## [1.0.60] - 2025-06-07
|
||||
|
||||
### Added
|
||||
|
||||
- 📄 **Merge Request Enhancement**: Added support for `remove_source_branch` and `squash` options for merge requests
|
||||
- Enhanced merge request functionality with additional configuration options
|
||||
- Allows automatic source branch removal after merge
|
||||
- Supports squash commits for cleaner Git history
|
||||
- See: [PR #86](https://github.com/zereight/gitlab-mcp/pull/86)
|
||||
|
||||
### Fixed
|
||||
|
||||
- 🔧 **Issue Assignment Fix**: Fixed list issues assignee username handling
|
||||
- Corrected assignee username field in issue listing functionality
|
||||
- Improved user assignment data processing for GitLab issues
|
||||
- See: [PR #87](https://github.com/zereight/gitlab-mcp/pull/87), [Issue #74](https://github.com/zereight/gitlab-mcp/issues/74)
|
||||
|
||||
---
|
||||
|
||||
## [1.0.54] - 2025-05-31
|
||||
|
||||
### Added
|
||||
|
||||
- 🌐 **Multi-Platform Support**: Added support for multiple platforms to improve compatibility across different environments
|
||||
|
||||
- Enhanced platform detection and configuration handling
|
||||
- Improved cross-platform functionality for GitLab MCP server
|
||||
- See: [PR #71](https://github.com/zereight/gitlab-mcp/pull/71), [Issue #69](https://github.com/zereight/gitlab-mcp/issues/69)
|
||||
|
28
README.md
28
README.md
@ -36,8 +36,8 @@ When using with the Claude App, you need to set up your API key and URLs directl
|
||||
```
|
||||
|
||||
#### Docker
|
||||
|
||||
```json
|
||||
- stdio
|
||||
```mcp.json
|
||||
{
|
||||
"mcpServers": {
|
||||
"GitLab communication server": {
|
||||
@ -73,6 +73,30 @@ When using with the Claude App, you need to set up your API key and URLs directl
|
||||
}
|
||||
```
|
||||
|
||||
- sse
|
||||
```shell
|
||||
docker run -i --rm \
|
||||
-e GITLAB_PERSONAL_ACCESS_TOKEN=your_gitlab_token \
|
||||
-e GITLAB_API_URL= "https://gitlab.com/api/v4"\
|
||||
-e GITLAB_READ_ONLY_MODE=true \
|
||||
-e USE_GITLAB_WIKI=true \
|
||||
-e USE_MILESTONE=true \
|
||||
-e USE_PIPELINE=true \
|
||||
-e SSE=true \
|
||||
-p 3333:3002 \
|
||||
iwakitakuma/gitlab-mcp
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"GitLab communication server": {
|
||||
"url": "http://localhost:3333/sse"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Docker Image Push
|
||||
|
||||
```shell
|
||||
|
18
RELEASE_NOTES.md
Normal file
18
RELEASE_NOTES.md
Normal file
@ -0,0 +1,18 @@
|
||||
## [1.0.60] - 2025-06-07
|
||||
|
||||
### Added
|
||||
|
||||
- 📄 **Merge Request Enhancement**: Added support for `remove_source_branch` and `squash` options for merge requests
|
||||
- Enhanced merge request functionality with additional configuration options
|
||||
- Allows automatic source branch removal after merge
|
||||
- Supports squash commits for cleaner Git history
|
||||
- See: [PR #86](https://github.com/zereight/gitlab-mcp/pull/86)
|
||||
|
||||
### Fixed
|
||||
|
||||
- 🔧 **Issue Assignment Fix**: Fixed list issues assignee username handling
|
||||
- Corrected assignee username field in issue listing functionality
|
||||
- Improved user assignment data processing for GitLab issues
|
||||
- See: [PR #87](https://github.com/zereight/gitlab-mcp/pull/87), [Issue #74](https://github.com/zereight/gitlab-mcp/issues/74)
|
||||
|
||||
---
|
252
index.ts
252
index.ts
@ -2,8 +2,8 @@
|
||||
|
||||
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
||||
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
||||
import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js";
|
||||
import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js";
|
||||
import FormData from "form-data";
|
||||
import fetch from "node-fetch";
|
||||
import { SocksProxyAgent } from "socks-proxy-agent";
|
||||
import { HttpsProxyAgent } from "https-proxy-agent";
|
||||
@ -14,9 +14,10 @@ import { fileURLToPath } from "url";
|
||||
import { dirname } from "path";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import express, { Request, Response } from "express";
|
||||
// Add type imports for proxy agents
|
||||
import { Agent } from "http";
|
||||
import { Agent as HttpsAgent } from 'https';
|
||||
import { Agent as HttpsAgent } from "https";
|
||||
import { URL } from "url";
|
||||
|
||||
import {
|
||||
@ -99,6 +100,7 @@ import {
|
||||
// Discussion Schemas
|
||||
GitLabDiscussionNoteSchema, // Added
|
||||
GitLabDiscussionSchema,
|
||||
PaginatedDiscussionsResponseSchema,
|
||||
UpdateMergeRequestNoteSchema, // Added
|
||||
CreateMergeRequestNoteSchema, // Added
|
||||
ListMergeRequestDiscussionsSchema,
|
||||
@ -141,8 +143,10 @@ import {
|
||||
type PromoteProjectMilestoneOptions,
|
||||
type GetMilestoneBurndownEventsOptions,
|
||||
// Discussion Types
|
||||
type GitLabDiscussionNote, // Added
|
||||
type GitLabDiscussionNote,
|
||||
type GitLabDiscussion,
|
||||
type PaginatedDiscussionsResponse,
|
||||
type PaginationOptions,
|
||||
type MergeRequestThreadPosition,
|
||||
type GetWikiPageOptions,
|
||||
type CreateWikiPageOptions,
|
||||
@ -167,6 +171,7 @@ import {
|
||||
GitLabCompareResult,
|
||||
GitLabCompareResultSchema,
|
||||
GetBranchDiffsSchema,
|
||||
ListWikiPagesOptions,
|
||||
} from "./schemas.js";
|
||||
|
||||
/**
|
||||
@ -182,7 +187,7 @@ try {
|
||||
SERVER_VERSION = packageJson.version || SERVER_VERSION;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Warning: Could not read version from package.json:", error);
|
||||
// Warning: Could not read version from package.json - silently continue
|
||||
}
|
||||
|
||||
const server = new Server(
|
||||
@ -198,10 +203,12 @@ const server = new Server(
|
||||
);
|
||||
|
||||
const GITLAB_PERSONAL_ACCESS_TOKEN = process.env.GITLAB_PERSONAL_ACCESS_TOKEN;
|
||||
const IS_OLD = process.env.GITLAB_IS_OLD === "true";
|
||||
const GITLAB_READ_ONLY_MODE = process.env.GITLAB_READ_ONLY_MODE === "true";
|
||||
const USE_GITLAB_WIKI = process.env.USE_GITLAB_WIKI === "true";
|
||||
const USE_MILESTONE = process.env.USE_MILESTONE === "true";
|
||||
const USE_PIPELINE = process.env.USE_PIPELINE === "true";
|
||||
const SSE = process.env.SSE === "true";
|
||||
|
||||
// Add proxy configuration
|
||||
const HTTP_PROXY = process.env.HTTP_PROXY;
|
||||
@ -210,7 +217,7 @@ const NODE_TLS_REJECT_UNAUTHORIZED = process.env.NODE_TLS_REJECT_UNAUTHORIZED;
|
||||
const GITLAB_CA_CERT_PATH = process.env.GITLAB_CA_CERT_PATH;
|
||||
|
||||
let sslOptions = undefined;
|
||||
if (NODE_TLS_REJECT_UNAUTHORIZED === '0') {
|
||||
if (NODE_TLS_REJECT_UNAUTHORIZED === "0") {
|
||||
sslOptions = { rejectUnauthorized: false };
|
||||
} else if (GITLAB_CA_CERT_PATH) {
|
||||
const ca = fs.readFileSync(GITLAB_CA_CERT_PATH);
|
||||
@ -239,11 +246,15 @@ httpsAgent = httpsAgent || new HttpsAgent(sslOptions);
|
||||
httpAgent = httpAgent || new Agent();
|
||||
|
||||
// Modify DEFAULT_HEADERS to include agent configuration
|
||||
const DEFAULT_HEADERS = {
|
||||
const DEFAULT_HEADERS: Record<string, string> = {
|
||||
Accept: "application/json",
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${GITLAB_PERSONAL_ACCESS_TOKEN}`,
|
||||
};
|
||||
if (IS_OLD) {
|
||||
DEFAULT_HEADERS["Private-Token"] = `${GITLAB_PERSONAL_ACCESS_TOKEN}`;
|
||||
} else {
|
||||
DEFAULT_HEADERS["Authorization"] = `Bearer ${GITLAB_PERSONAL_ACCESS_TOKEN}`;
|
||||
}
|
||||
|
||||
// Create a default fetch configuration object that includes proxy agents if set
|
||||
const DEFAULT_FETCH_CONFIG = {
|
||||
@ -317,8 +328,7 @@ const allTools = [
|
||||
},
|
||||
{
|
||||
name: "get_branch_diffs",
|
||||
description:
|
||||
"Get the changes/diffs between two branches or commits in a GitLab project",
|
||||
description: "Get the changes/diffs between two branches or commits in a GitLab project",
|
||||
inputSchema: zodToJsonSchema(GetBranchDiffsSchema),
|
||||
},
|
||||
{
|
||||
@ -901,9 +911,16 @@ async function listIssues(
|
||||
// Add all query parameters
|
||||
Object.entries(options).forEach(([key, value]) => {
|
||||
if (value !== undefined) {
|
||||
if (key === "label_name" && Array.isArray(value)) {
|
||||
const keys = ["labels", "assignee_username"];
|
||||
if (keys.includes(key)) {
|
||||
if (Array.isArray(value)) {
|
||||
// Handle array of labels
|
||||
url.searchParams.append(key, value.join(","));
|
||||
value.forEach(label => {
|
||||
url.searchParams.append(`${key}[]`, label.toString());
|
||||
});
|
||||
} else {
|
||||
url.searchParams.append(`${key}[]`, value.toString());
|
||||
}
|
||||
} else {
|
||||
url.searchParams.append(key, value.toString());
|
||||
}
|
||||
@ -1187,6 +1204,8 @@ async function createMergeRequest(
|
||||
labels: options.labels?.join(","),
|
||||
allow_collaboration: options.allow_collaboration,
|
||||
draft: options.draft,
|
||||
remove_source_branch: options.remove_source_branch,
|
||||
squash: options.squash,
|
||||
}),
|
||||
});
|
||||
|
||||
@ -1205,55 +1224,26 @@ async function createMergeRequest(
|
||||
}
|
||||
|
||||
/**
|
||||
* List merge request discussion items
|
||||
* 병합 요청 토론 목록 조회
|
||||
* Shared helper function for listing discussions
|
||||
* 토론 목록 조회를 위한 공유 헬퍼 함수
|
||||
*
|
||||
* @param {string} projectId - The ID or URL-encoded path of the project
|
||||
* @param {number} mergeRequestIid - The IID of a merge request
|
||||
* @returns {Promise<GitLabDiscussion[]>} List of discussions
|
||||
* @param {"issues" | "merge_requests"} resourceType - The type of resource (issues or merge_requests)
|
||||
* @param {number} resourceIid - The IID of the issue or merge request
|
||||
* @param {PaginationOptions} options - Pagination and sorting options
|
||||
* @returns {Promise<PaginatedDiscussionsResponse>} Paginated list of discussions
|
||||
*/
|
||||
async function listMergeRequestDiscussions(
|
||||
async function listDiscussions(
|
||||
projectId: string,
|
||||
mergeRequestIid: number
|
||||
): Promise<GitLabDiscussion[]> {
|
||||
resourceType: "issues" | "merge_requests",
|
||||
resourceIid: number,
|
||||
options: PaginationOptions = {}
|
||||
): Promise<PaginatedDiscussionsResponse> {
|
||||
projectId = decodeURIComponent(projectId); // Decode project ID
|
||||
const url = new URL(
|
||||
`${GITLAB_API_URL}/projects/${encodeURIComponent(
|
||||
projectId
|
||||
)}/merge_requests/${mergeRequestIid}/discussions`
|
||||
);
|
||||
|
||||
const response = await fetch(url.toString(), {
|
||||
...DEFAULT_FETCH_CONFIG,
|
||||
});
|
||||
|
||||
await handleGitLabError(response);
|
||||
const data = await response.json();
|
||||
// Ensure the response is parsed as an array of discussions
|
||||
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`
|
||||
)}/${resourceType}/${resourceIid}/discussions`
|
||||
);
|
||||
|
||||
// Add query parameters for pagination and sorting
|
||||
@ -1263,22 +1253,69 @@ async function listIssueDiscussions(
|
||||
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();
|
||||
const discussions = await response.json();
|
||||
|
||||
// Parse the response as an array of discussions
|
||||
return z.array(GitLabDiscussionSchema).parse(data);
|
||||
// Extract pagination headers
|
||||
const pagination = {
|
||||
x_next_page: response.headers.get("x-next-page")
|
||||
? parseInt(response.headers.get("x-next-page")!)
|
||||
: null,
|
||||
x_page: response.headers.get("x-page") ? parseInt(response.headers.get("x-page")!) : undefined,
|
||||
x_per_page: response.headers.get("x-per-page")
|
||||
? parseInt(response.headers.get("x-per-page")!)
|
||||
: undefined,
|
||||
x_prev_page: response.headers.get("x-prev-page")
|
||||
? parseInt(response.headers.get("x-prev-page")!)
|
||||
: null,
|
||||
x_total: response.headers.get("x-total") ? parseInt(response.headers.get("x-total")!) : null,
|
||||
x_total_pages: response.headers.get("x-total-pages")
|
||||
? parseInt(response.headers.get("x-total-pages")!)
|
||||
: null,
|
||||
};
|
||||
|
||||
return PaginatedDiscussionsResponseSchema.parse({
|
||||
items: discussions,
|
||||
pagination: pagination,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* List merge request discussion items
|
||||
* 병합 요청 토론 목록 조회
|
||||
*
|
||||
* @param {string} projectId - The ID or URL-encoded path of the project
|
||||
* @param {number} mergeRequestIid - The IID of a merge request
|
||||
* @param {DiscussionPaginationOptions} options - Pagination and sorting options
|
||||
* @returns {Promise<GitLabDiscussion[]>} List of discussions
|
||||
*/
|
||||
async function listMergeRequestDiscussions(
|
||||
projectId: string,
|
||||
mergeRequestIid: number,
|
||||
options: PaginationOptions = {}
|
||||
): Promise<PaginatedDiscussionsResponse> {
|
||||
return listDiscussions(projectId, "merge_requests", mergeRequestIid, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 {DiscussionPaginationOptions} options - Pagination and sorting options
|
||||
* @returns {Promise<GitLabDiscussion[]>} List of issue discussions
|
||||
*/
|
||||
async function listIssueDiscussions(
|
||||
projectId: string,
|
||||
issueIid: number,
|
||||
options: PaginationOptions = {}
|
||||
): Promise<PaginatedDiscussionsResponse> {
|
||||
return listDiscussions(projectId, "issues", issueIid, options);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1834,9 +1871,7 @@ async function getBranchDiffs(
|
||||
|
||||
if (!response.ok) {
|
||||
const errorBody = await response.text();
|
||||
throw new Error(
|
||||
`GitLab API error: ${response.status} ${response.statusText}\n${errorBody}`
|
||||
);
|
||||
throw new Error(`GitLab API error: ${response.status} ${response.statusText}\n${errorBody}`);
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
@ -2359,12 +2394,14 @@ async function listGroupProjects(
|
||||
*/
|
||||
async function listWikiPages(
|
||||
projectId: string,
|
||||
options: Omit<z.infer<typeof ListWikiPagesSchema>, "project_id"> = {}
|
||||
options: Omit<ListWikiPagesOptions, "project_id"> = {}
|
||||
): Promise<GitLabWikiPage[]> {
|
||||
projectId = decodeURIComponent(projectId); // Decode project ID
|
||||
const url = new URL(`${GITLAB_API_URL}/projects/${encodeURIComponent(projectId)}/wikis`);
|
||||
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.with_content)
|
||||
url.searchParams.append("with_content", options.with_content.toString());
|
||||
const response = await fetch(url.toString(), {
|
||||
...DEFAULT_FETCH_CONFIG,
|
||||
});
|
||||
@ -2616,10 +2653,13 @@ async function createPipeline(
|
||||
|
||||
const body: any = { ref };
|
||||
if (variables && variables.length > 0) {
|
||||
body.variables = variables.reduce((acc, { key, value }) => {
|
||||
body.variables = variables.reduce(
|
||||
(acc, { key, value }) => {
|
||||
acc[key] = value;
|
||||
return acc;
|
||||
}, {} as Record<string, string>);
|
||||
},
|
||||
{} as Record<string, string>
|
||||
);
|
||||
}
|
||||
|
||||
const response = await fetch(url.toString(), {
|
||||
@ -2695,15 +2735,20 @@ async function getRepositoryTree(options: GetRepositoryTreeOptions): Promise<Git
|
||||
if (options.page_token) queryParams.append("page_token", options.page_token);
|
||||
if (options.pagination) queryParams.append("pagination", options.pagination);
|
||||
|
||||
const headers: Record<string, string> = {
|
||||
"Content-Type": "application/json",
|
||||
};
|
||||
if (IS_OLD) {
|
||||
headers["Private-Token"] = `${GITLAB_PERSONAL_ACCESS_TOKEN}`;
|
||||
} else {
|
||||
headers["Authorization"] = `Bearer ${GITLAB_PERSONAL_ACCESS_TOKEN}`;
|
||||
}
|
||||
const response = await fetch(
|
||||
`${GITLAB_API_URL}/projects/${encodeURIComponent(
|
||||
options.project_id
|
||||
)}/repository/tree?${queryParams.toString()}`,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${GITLAB_PERSONAL_ACCESS_TOKEN}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
headers,
|
||||
}
|
||||
);
|
||||
|
||||
@ -3008,9 +3053,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
||||
? tools1
|
||||
: tools1.filter(tool => !milestoneToolNames.includes(tool.name));
|
||||
// Toggle pipeline tools by USE_PIPELINE flag
|
||||
let tools = USE_PIPELINE
|
||||
? tools2
|
||||
: tools2.filter(tool => !pipelineToolNames.includes(tool.name));
|
||||
let tools = USE_PIPELINE ? tools2 : tools2.filter(tool => !pipelineToolNames.includes(tool.name));
|
||||
|
||||
// <<< START: Gemini 호환성을 위해 $schema 제거 >>>
|
||||
tools = tools.map(tool => {
|
||||
@ -3084,12 +3127,7 @@ server.setRequestHandler(CallToolRequestSchema, async request => {
|
||||
|
||||
case "get_branch_diffs": {
|
||||
const args = GetBranchDiffsSchema.parse(request.params.arguments);
|
||||
const diffResp = await getBranchDiffs(
|
||||
args.project_id,
|
||||
args.from,
|
||||
args.to,
|
||||
args.straight
|
||||
);
|
||||
const diffResp = await getBranchDiffs(args.project_id, args.from, args.to, args.straight);
|
||||
|
||||
if (args.excluded_file_patterns?.length) {
|
||||
const regexPatterns = args.excluded_file_patterns.map(pattern => new RegExp(pattern));
|
||||
@ -3101,9 +3139,7 @@ server.setRequestHandler(CallToolRequestSchema, async request => {
|
||||
};
|
||||
|
||||
// Filter out files that match any of the regex patterns on new files
|
||||
diffResp.diffs = diffResp.diffs.filter(diff =>
|
||||
!matchesAnyPattern(diff.new_path)
|
||||
);
|
||||
diffResp.diffs = diffResp.diffs.filter(diff => !matchesAnyPattern(diff.new_path));
|
||||
}
|
||||
return {
|
||||
content: [{ type: "text", text: JSON.stringify(diffResp, null, 2) }],
|
||||
@ -3280,9 +3316,11 @@ server.setRequestHandler(CallToolRequestSchema, async request => {
|
||||
|
||||
case "mr_discussions": {
|
||||
const args = ListMergeRequestDiscussionsSchema.parse(request.params.arguments);
|
||||
const { project_id, merge_request_iid, ...options } = args;
|
||||
const discussions = await listMergeRequestDiscussions(
|
||||
args.project_id,
|
||||
args.merge_request_iid
|
||||
project_id,
|
||||
merge_request_iid,
|
||||
options
|
||||
);
|
||||
return {
|
||||
content: [{ type: "text", text: JSON.stringify(discussions, null, 2) }],
|
||||
@ -3578,8 +3616,10 @@ server.setRequestHandler(CallToolRequestSchema, async request => {
|
||||
}
|
||||
|
||||
case "list_wiki_pages": {
|
||||
const { project_id, page, per_page } = ListWikiPagesSchema.parse(request.params.arguments);
|
||||
const wikiPages = await listWikiPages(project_id, { page, per_page });
|
||||
const { project_id, page, per_page, with_content } = ListWikiPagesSchema.parse(
|
||||
request.params.arguments
|
||||
);
|
||||
const wikiPages = await listWikiPages(project_id, { page, per_page, with_content });
|
||||
return {
|
||||
content: [{ type: "text", text: JSON.stringify(wikiPages, null, 2) }],
|
||||
};
|
||||
@ -3914,14 +3954,40 @@ server.setRequestHandler(CallToolRequestSchema, async request => {
|
||||
*/
|
||||
async function runServer() {
|
||||
try {
|
||||
console.error("========================");
|
||||
console.error(`GitLab MCP Server v${SERVER_VERSION}`);
|
||||
console.error(`API URL: ${GITLAB_API_URL}`);
|
||||
console.error("========================");
|
||||
|
||||
// Server startup banner removed - inappropriate use of console.error for logging
|
||||
// Server version banner removed - inappropriate use of console.error for logging
|
||||
// API URL banner removed - inappropriate use of console.error for logging
|
||||
// Server startup banner removed - inappropriate use of console.error for logging
|
||||
if (!SSE) {
|
||||
const transport = new StdioServerTransport();
|
||||
await server.connect(transport);
|
||||
console.error("GitLab MCP Server running on stdio");
|
||||
} else {
|
||||
const app = express();
|
||||
const transports: { [sessionId: string]: SSEServerTransport } = {};
|
||||
app.get("/sse", async (_: Request, res: Response) => {
|
||||
const transport = new SSEServerTransport("/messages", res);
|
||||
transports[transport.sessionId] = transport;
|
||||
res.on("close", () => {
|
||||
delete transports[transport.sessionId];
|
||||
});
|
||||
await server.connect(transport);
|
||||
});
|
||||
|
||||
app.post("/messages", async (req: Request, res: Response) => {
|
||||
const sessionId = req.query.sessionId as string;
|
||||
const transport = transports[sessionId];
|
||||
if (transport) {
|
||||
await transport.handlePostMessage(req, res);
|
||||
} else {
|
||||
res.status(400).send("No transport found for sessionId");
|
||||
}
|
||||
});
|
||||
|
||||
const PORT = process.env.PORT || 3002;
|
||||
app.listen(PORT, () => {
|
||||
console.log(`Server is running on port ${PORT}`);
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error initializing server:", error);
|
||||
process.exit(1);
|
||||
|
487
package-lock.json
generated
487
package-lock.json
generated
@ -1,16 +1,17 @@
|
||||
{
|
||||
"name": "@zereight/mcp-gitlab",
|
||||
"version": "1.0.50",
|
||||
"version": "1.0.60",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@zereight/mcp-gitlab",
|
||||
"version": "1.0.50",
|
||||
"version": "1.0.60",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@modelcontextprotocol/sdk": "1.8.0",
|
||||
"@types/node-fetch": "^2.6.12",
|
||||
"express": "^5.1.0",
|
||||
"form-data": "^4.0.0",
|
||||
"http-proxy-agent": "^7.0.2",
|
||||
"https-proxy-agent": "^7.0.6",
|
||||
@ -22,9 +23,11 @@
|
||||
"mcp-gitlab": "build/index.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/express": "^5.0.2",
|
||||
"@types/node": "^22.13.10",
|
||||
"@typescript-eslint/eslint-plugin": "^8.21.0",
|
||||
"@typescript-eslint/parser": "^8.21.0",
|
||||
"auto-changelog": "^2.4.0",
|
||||
"eslint": "^9.18.0",
|
||||
"prettier": "^3.4.2",
|
||||
"ts-node": "^10.9.2",
|
||||
@ -415,6 +418,27 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/body-parser": {
|
||||
"version": "1.19.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.5.tgz",
|
||||
"integrity": "sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/connect": "*",
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/connect": {
|
||||
"version": "3.4.38",
|
||||
"resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz",
|
||||
"integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/estree": {
|
||||
"version": "1.0.7",
|
||||
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.7.tgz",
|
||||
@ -422,6 +446,38 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/express": {
|
||||
"version": "5.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/express/-/express-5.0.2.tgz",
|
||||
"integrity": "sha512-BtjL3ZwbCQriyb0DGw+Rt12qAXPiBTPs815lsUvtt1Grk0vLRMZNMUZ741d5rjk+UQOxfDiBZ3dxpX00vSkK3g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/body-parser": "*",
|
||||
"@types/express-serve-static-core": "^5.0.0",
|
||||
"@types/serve-static": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/express-serve-static-core": {
|
||||
"version": "5.0.6",
|
||||
"resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-5.0.6.tgz",
|
||||
"integrity": "sha512-3xhRnjJPkULekpSzgtoNYYcTWgEZkp4myc+Saevii5JPnHNvHMRlBSHDbs7Bh1iPPoVTERHEZXyhyLbMEsExsA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/node": "*",
|
||||
"@types/qs": "*",
|
||||
"@types/range-parser": "*",
|
||||
"@types/send": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/http-errors": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.4.tgz",
|
||||
"integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/json-schema": {
|
||||
"version": "7.0.15",
|
||||
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
|
||||
@ -429,6 +485,13 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/mime": {
|
||||
"version": "1.3.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz",
|
||||
"integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "22.13.14",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.14.tgz",
|
||||
@ -448,6 +511,43 @@
|
||||
"form-data": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/qs": {
|
||||
"version": "6.14.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.14.0.tgz",
|
||||
"integrity": "sha512-eOunJqu0K1923aExK6y8p6fsihYEn/BYuQ4g0CxAAgFc4b/ZLN4CrsRZ55srTdqoiLzU2B2evC+apEIxprEzkQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/range-parser": {
|
||||
"version": "1.2.7",
|
||||
"resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.7.tgz",
|
||||
"integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/send": {
|
||||
"version": "0.17.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.4.tgz",
|
||||
"integrity": "sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/mime": "^1",
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/serve-static": {
|
||||
"version": "1.15.7",
|
||||
"resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.7.tgz",
|
||||
"integrity": "sha512-W8Ym+h8nhuRwaKPaDw34QUkwsGi6Rc4yYqvKFo5rm2FUEhCFbzVWrxXUxuKK8TASjWsysJY0nsmNCGhCOIsrOw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/http-errors": "*",
|
||||
"@types/node": "*",
|
||||
"@types/send": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/eslint-plugin": {
|
||||
"version": "8.33.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.33.0.tgz",
|
||||
@ -790,6 +890,48 @@
|
||||
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/auto-changelog": {
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/auto-changelog/-/auto-changelog-2.5.0.tgz",
|
||||
"integrity": "sha512-UTnLjT7I9U2U/xkCUH5buDlp8C7g0SGChfib+iDrJkamcj5kaMqNKHNfbKJw1kthJUq8sUo3i3q2S6FzO/l/wA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"commander": "^7.2.0",
|
||||
"handlebars": "^4.7.7",
|
||||
"import-cwd": "^3.0.0",
|
||||
"node-fetch": "^2.6.1",
|
||||
"parse-github-url": "^1.0.3",
|
||||
"semver": "^7.3.5"
|
||||
},
|
||||
"bin": {
|
||||
"auto-changelog": "src/index.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.3"
|
||||
}
|
||||
},
|
||||
"node_modules/auto-changelog/node_modules/node-fetch": {
|
||||
"version": "2.7.0",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
|
||||
"integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"whatwg-url": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "4.x || >=6.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"encoding": "^0.1.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"encoding": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/balanced-match": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
||||
@ -817,44 +959,6 @@
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/body-parser/node_modules/debug": {
|
||||
"version": "4.4.0",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz",
|
||||
"integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ms": "^2.1.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"supports-color": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/body-parser/node_modules/ms": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/body-parser/node_modules/qs": {
|
||||
"version": "6.14.0",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.14.0.tgz",
|
||||
"integrity": "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==",
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
"side-channel": "^1.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.6"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/brace-expansion": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
|
||||
@ -975,6 +1079,16 @@
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/commander": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz",
|
||||
"integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/concat-map": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||
@ -1065,12 +1179,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "4.3.6",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz",
|
||||
"integrity": "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==",
|
||||
"version": "4.4.1",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz",
|
||||
"integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ms": "2.1.2"
|
||||
"ms": "^2.1.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0"
|
||||
@ -1455,46 +1569,45 @@
|
||||
}
|
||||
},
|
||||
"node_modules/express": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/express/-/express-5.0.1.tgz",
|
||||
"integrity": "sha512-ORF7g6qGnD+YtUG9yx4DFoqCShNMmUKiXuT5oWMHiOvt/4WFbHC6yCwQMTSBMno7AqntNCAzzcnnjowRkTL9eQ==",
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/express/-/express-5.1.0.tgz",
|
||||
"integrity": "sha512-DT9ck5YIRU+8GYzzU5kT3eHGA5iL+1Zd0EutOmTE9Dtk+Tvuzd23VBU+ec7HPNSTxXYO55gPV/hq4pSBJDjFpA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"accepts": "^2.0.0",
|
||||
"body-parser": "^2.0.1",
|
||||
"body-parser": "^2.2.0",
|
||||
"content-disposition": "^1.0.0",
|
||||
"content-type": "~1.0.4",
|
||||
"cookie": "0.7.1",
|
||||
"content-type": "^1.0.5",
|
||||
"cookie": "^0.7.1",
|
||||
"cookie-signature": "^1.2.1",
|
||||
"debug": "4.3.6",
|
||||
"depd": "2.0.0",
|
||||
"encodeurl": "~2.0.0",
|
||||
"escape-html": "~1.0.3",
|
||||
"etag": "~1.8.1",
|
||||
"finalhandler": "^2.0.0",
|
||||
"fresh": "2.0.0",
|
||||
"http-errors": "2.0.0",
|
||||
"debug": "^4.4.0",
|
||||
"encodeurl": "^2.0.0",
|
||||
"escape-html": "^1.0.3",
|
||||
"etag": "^1.8.1",
|
||||
"finalhandler": "^2.1.0",
|
||||
"fresh": "^2.0.0",
|
||||
"http-errors": "^2.0.0",
|
||||
"merge-descriptors": "^2.0.0",
|
||||
"methods": "~1.1.2",
|
||||
"mime-types": "^3.0.0",
|
||||
"on-finished": "2.4.1",
|
||||
"once": "1.4.0",
|
||||
"parseurl": "~1.3.3",
|
||||
"proxy-addr": "~2.0.7",
|
||||
"qs": "6.13.0",
|
||||
"range-parser": "~1.2.1",
|
||||
"router": "^2.0.0",
|
||||
"safe-buffer": "5.2.1",
|
||||
"on-finished": "^2.4.1",
|
||||
"once": "^1.4.0",
|
||||
"parseurl": "^1.3.3",
|
||||
"proxy-addr": "^2.0.7",
|
||||
"qs": "^6.14.0",
|
||||
"range-parser": "^1.2.1",
|
||||
"router": "^2.2.0",
|
||||
"send": "^1.1.0",
|
||||
"serve-static": "^2.1.0",
|
||||
"setprototypeof": "1.2.0",
|
||||
"statuses": "2.0.1",
|
||||
"type-is": "^2.0.0",
|
||||
"utils-merge": "1.0.1",
|
||||
"vary": "~1.1.2"
|
||||
"serve-static": "^2.2.0",
|
||||
"statuses": "^2.0.1",
|
||||
"type-is": "^2.0.1",
|
||||
"vary": "^1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/express-rate-limit": {
|
||||
@ -1639,29 +1752,6 @@
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/finalhandler/node_modules/debug": {
|
||||
"version": "4.4.0",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz",
|
||||
"integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ms": "^2.1.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"supports-color": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/finalhandler/node_modules/ms": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/find-up": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
|
||||
@ -1857,6 +1947,28 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/handlebars": {
|
||||
"version": "4.7.8",
|
||||
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz",
|
||||
"integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"minimist": "^1.2.5",
|
||||
"neo-async": "^2.6.2",
|
||||
"source-map": "^0.6.1",
|
||||
"wordwrap": "^1.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"handlebars": "bin/handlebars"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.4.7"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"uglify-js": "^3.1.4"
|
||||
}
|
||||
},
|
||||
"node_modules/has-flag": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
||||
@ -1970,6 +2082,19 @@
|
||||
"node": ">= 4"
|
||||
}
|
||||
},
|
||||
"node_modules/import-cwd": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/import-cwd/-/import-cwd-3.0.0.tgz",
|
||||
"integrity": "sha512-4pnzH16plW+hgvRECbDWpQl3cqtvSofHWh44met7ESfZ8UZOWWddm8hEyDTqREJ9RbYHY8gi8DqmaelApoOGMg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"import-from": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/import-fresh": {
|
||||
"version": "3.3.1",
|
||||
"resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz",
|
||||
@ -1987,6 +2112,29 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/import-from": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/import-from/-/import-from-3.0.0.tgz",
|
||||
"integrity": "sha512-CiuXOFFSzkU5x/CR0+z7T91Iht4CXgfCxVOFRhh2Zyhg5wOpWvvDLQUsWl+gcN+QscYBjez8hDCt85O7RLDttQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"resolve-from": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/import-from/node_modules/resolve-from": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz",
|
||||
"integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/imurmurhash": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
|
||||
@ -2204,15 +2352,6 @@
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/methods": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
|
||||
"integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/micromatch": {
|
||||
"version": "4.0.8",
|
||||
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz",
|
||||
@ -2264,10 +2403,20 @@
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/minimist": {
|
||||
"version": "1.2.8",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
|
||||
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/natural-compare": {
|
||||
@ -2286,6 +2435,13 @@
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/neo-async": {
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz",
|
||||
"integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/node-domexception": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz",
|
||||
@ -2428,6 +2584,19 @@
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/parse-github-url": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/parse-github-url/-/parse-github-url-1.0.3.tgz",
|
||||
"integrity": "sha512-tfalY5/4SqGaV/GIGzWyHnFjlpTPTNpENR9Ea2lLldSJ8EWXMsvacWucqY3m3I4YPtas15IxTLQVQ5NSYXPrww==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"parse-github-url": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/parseurl": {
|
||||
"version": "1.3.3",
|
||||
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
|
||||
@ -2537,12 +2706,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/qs": {
|
||||
"version": "6.13.0",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz",
|
||||
"integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==",
|
||||
"version": "6.14.0",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.14.0.tgz",
|
||||
"integrity": "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==",
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
"side-channel": "^1.0.6"
|
||||
"side-channel": "^1.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.6"
|
||||
@ -2633,29 +2802,6 @@
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/router/node_modules/debug": {
|
||||
"version": "4.4.0",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz",
|
||||
"integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ms": "^2.1.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"supports-color": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/router/node_modules/ms": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/run-parallel": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz",
|
||||
@ -2741,12 +2887,6 @@
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/send/node_modules/ms": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/serve-static": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.0.tgz",
|
||||
@ -2899,6 +3039,16 @@
|
||||
"node": ">= 14"
|
||||
}
|
||||
},
|
||||
"node_modules/source-map": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
||||
"dev": true,
|
||||
"license": "BSD-3-Clause",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/sprintf-js": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz",
|
||||
@ -2962,6 +3112,13 @@
|
||||
"node": ">=0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/tr46": {
|
||||
"version": "0.0.3",
|
||||
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
||||
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/ts-api-utils": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.1.0.tgz",
|
||||
@ -3060,6 +3217,20 @@
|
||||
"node": ">=14.17"
|
||||
}
|
||||
},
|
||||
"node_modules/uglify-js": {
|
||||
"version": "3.19.3",
|
||||
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.19.3.tgz",
|
||||
"integrity": "sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ==",
|
||||
"dev": true,
|
||||
"license": "BSD-2-Clause",
|
||||
"optional": true,
|
||||
"bin": {
|
||||
"uglifyjs": "bin/uglifyjs"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/undici-types": {
|
||||
"version": "6.20.0",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz",
|
||||
@ -3085,15 +3256,6 @@
|
||||
"punycode": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/utils-merge": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
|
||||
"integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/v8-compile-cache-lib": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",
|
||||
@ -3119,6 +3281,24 @@
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/webidl-conversions": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
|
||||
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==",
|
||||
"dev": true,
|
||||
"license": "BSD-2-Clause"
|
||||
},
|
||||
"node_modules/whatwg-url": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
|
||||
"integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"tr46": "~0.0.3",
|
||||
"webidl-conversions": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/which": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||
@ -3144,6 +3324,13 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/wordwrap": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz",
|
||||
"integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
|
14
package.json
14
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@zereight/mcp-gitlab",
|
||||
"version": "1.0.55",
|
||||
"version": "1.0.61",
|
||||
"description": "MCP server for using the GitLab API",
|
||||
"license": "MIT",
|
||||
"author": "zereight",
|
||||
@ -21,6 +21,7 @@
|
||||
"watch": "tsc --watch",
|
||||
"deploy": "npm publish --access public",
|
||||
"generate-tools": "npx ts-node scripts/generate-tools-readme.ts",
|
||||
"changelog": "auto-changelog -p",
|
||||
"test": "node test/validate-api.js",
|
||||
"test:integration": "node test/validate-api.js",
|
||||
"lint": "eslint . --ext .ts",
|
||||
@ -30,8 +31,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@modelcontextprotocol/sdk": "1.8.0",
|
||||
"form-data": "^4.0.0",
|
||||
"@types/node-fetch": "^2.6.12",
|
||||
"express": "^5.1.0",
|
||||
"form-data": "^4.0.0",
|
||||
"http-proxy-agent": "^7.0.2",
|
||||
"https-proxy-agent": "^7.0.6",
|
||||
"node-fetch": "^3.3.2",
|
||||
@ -39,13 +41,15 @@
|
||||
"zod-to-json-schema": "^3.23.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/express": "^5.0.2",
|
||||
"@types/node": "^22.13.10",
|
||||
"typescript": "^5.8.2",
|
||||
"zod": "^3.24.2",
|
||||
"@typescript-eslint/eslint-plugin": "^8.21.0",
|
||||
"@typescript-eslint/parser": "^8.21.0",
|
||||
"eslint": "^9.18.0",
|
||||
"prettier": "^3.4.2",
|
||||
"ts-node": "^10.9.2"
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.8.2",
|
||||
"zod": "^3.24.2",
|
||||
"auto-changelog": "^2.4.0"
|
||||
}
|
||||
}
|
||||
|
127
schemas.ts
127
schemas.ts
@ -94,6 +94,13 @@ export const GitLabPipelineJobSchema = z.object({
|
||||
web_url: z.string().optional(),
|
||||
});
|
||||
|
||||
// Shared base schema for various pagination options
|
||||
// See https://docs.gitlab.com/api/rest/#pagination
|
||||
export const PaginationOptionsSchema = z.object({
|
||||
page: z.number().optional().describe("Page number for pagination (default: 1)"),
|
||||
per_page: z.number().optional().describe("Number of items per page (max: 100, default: 20)"),
|
||||
});
|
||||
|
||||
// Schema for listing pipelines
|
||||
export const ListPipelinesSchema = z.object({
|
||||
project_id: z.string().describe("Project ID or URL-encoded path"),
|
||||
@ -134,9 +141,7 @@ export const ListPipelinesSchema = z.object({
|
||||
.optional()
|
||||
.describe("Order pipelines by"),
|
||||
sort: z.enum(["asc", "desc"]).optional().describe("Sort pipelines"),
|
||||
page: z.number().optional().describe("Page number for pagination"),
|
||||
per_page: z.number().optional().describe("Number of items per page (max 100)"),
|
||||
});
|
||||
}).merge(PaginationOptionsSchema);
|
||||
|
||||
// Schema for getting a specific pipeline
|
||||
export const GetPipelineSchema = z.object({
|
||||
@ -153,9 +158,7 @@ export const ListPipelineJobsSchema = z.object({
|
||||
.optional()
|
||||
.describe("The scope of jobs to show"),
|
||||
include_retried: z.boolean().optional().describe("Whether to include retried jobs"),
|
||||
page: z.number().optional().describe("Page number for pagination"),
|
||||
per_page: z.number().optional().describe("Number of items per page (max 100)"),
|
||||
});
|
||||
}).merge(PaginationOptionsSchema);
|
||||
|
||||
// Schema for creating a new pipeline
|
||||
export const CreatePipelineSchema = z.object({
|
||||
@ -209,7 +212,7 @@ export const GitLabUsersResponseSchema = z.record(
|
||||
id: z.number(),
|
||||
username: z.string(),
|
||||
name: z.string(),
|
||||
avatar_url: z.string(),
|
||||
avatar_url: z.string().nullable(),
|
||||
web_url: z.string(),
|
||||
}).nullable()
|
||||
);
|
||||
@ -250,7 +253,7 @@ export const GitLabNamespaceExistsResponseSchema = z.object({
|
||||
export const GitLabOwnerSchema = z.object({
|
||||
username: z.string(), // Changed from login to match GitLab API
|
||||
id: z.number(),
|
||||
avatar_url: z.string(),
|
||||
avatar_url: z.string().nullable(),
|
||||
web_url: z.string(), // Changed from html_url to match GitLab API
|
||||
name: z.string(), // Added as GitLab includes full name
|
||||
state: z.string(), // Added as GitLab includes user state
|
||||
@ -310,7 +313,7 @@ export const GitLabRepositorySchema = z.object({
|
||||
container_registry_access_level: z.string().optional(),
|
||||
issues_enabled: z.boolean().optional(),
|
||||
merge_requests_enabled: z.boolean().optional(),
|
||||
merge_requests_template: z.string().optional(),
|
||||
merge_requests_template: z.string().nullable().optional(),
|
||||
wiki_enabled: z.boolean().optional(),
|
||||
jobs_enabled: z.boolean().optional(),
|
||||
snippets_enabled: z.boolean().optional(),
|
||||
@ -464,6 +467,8 @@ export const CreateMergeRequestOptionsSchema = z.object({
|
||||
labels: z.array(z.string()).optional(),
|
||||
allow_collaboration: z.boolean().optional(), // Changed from maintainer_can_modify to match GitLab API
|
||||
draft: z.boolean().optional(),
|
||||
remove_source_branch: z.boolean().optional().describe("Flag indicating if a merge request should remove the source branch when merging."),
|
||||
squash: z.boolean().optional().describe("If true, squash all commits into a single commit on merge.")
|
||||
});
|
||||
|
||||
export const GitLabDiffSchema = z.object({
|
||||
@ -590,7 +595,7 @@ export const GitLabForkParentSchema = z.object({
|
||||
.object({
|
||||
username: z.string(), // Changed from login to match GitLab API
|
||||
id: z.number(),
|
||||
avatar_url: z.string(),
|
||||
avatar_url: z.string().nullable(),
|
||||
})
|
||||
.optional(), // Made optional to handle cases where GitLab API doesn't include it
|
||||
web_url: z.string(), // Changed from html_url to match GitLab API
|
||||
@ -698,6 +703,24 @@ export const GitLabDiscussionNoteSchema = z.object({
|
||||
});
|
||||
export type GitLabDiscussionNote = z.infer<typeof GitLabDiscussionNoteSchema>;
|
||||
|
||||
// Reusable pagination schema for GitLab API responses.
|
||||
// See https://docs.gitlab.com/api/rest/#pagination
|
||||
export const GitLabPaginationSchema = z.object({
|
||||
x_next_page: z.number().nullable().optional(),
|
||||
x_page: z.number().optional(),
|
||||
x_per_page: z.number().optional(),
|
||||
x_prev_page: z.number().nullable().optional(),
|
||||
x_total: z.number().nullable().optional(),
|
||||
x_total_pages: z.number().nullable().optional(),
|
||||
});
|
||||
export type GitLabPagination = z.infer<typeof GitLabPaginationSchema>;
|
||||
|
||||
// Base paginated response schema that can be extended.
|
||||
// See https://docs.gitlab.com/api/rest/#pagination
|
||||
export const PaginatedResponseSchema = z.object({
|
||||
pagination: GitLabPaginationSchema.optional(),
|
||||
});
|
||||
|
||||
export const GitLabDiscussionSchema = z.object({
|
||||
id: z.string(),
|
||||
individual_note: z.boolean(),
|
||||
@ -705,10 +728,24 @@ export const GitLabDiscussionSchema = z.object({
|
||||
});
|
||||
export type GitLabDiscussion = z.infer<typeof GitLabDiscussionSchema>;
|
||||
|
||||
// Create a schema for paginated discussions response
|
||||
export const PaginatedDiscussionsResponseSchema = z.object({
|
||||
items: z.array(GitLabDiscussionSchema),
|
||||
pagination: GitLabPaginationSchema,
|
||||
});
|
||||
|
||||
// Export the paginated response type for discussions
|
||||
export type PaginatedDiscussionsResponse = z.infer<typeof PaginatedDiscussionsResponseSchema>;
|
||||
|
||||
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"),
|
||||
}).merge(PaginationOptionsSchema);
|
||||
|
||||
// Input schema for listing merge request discussions
|
||||
export const ListMergeRequestDiscussionsSchema = ProjectParamsSchema.extend({
|
||||
merge_request_iid: z.number().describe("The IID of a merge request"),
|
||||
});
|
||||
}).merge(PaginationOptionsSchema);
|
||||
|
||||
// Input schema for updating a merge request discussion note
|
||||
export const UpdateMergeRequestNoteSchema = ProjectParamsSchema.extend({
|
||||
@ -763,9 +800,7 @@ export const CreateOrUpdateFileSchema = ProjectParamsSchema.extend({
|
||||
|
||||
export const SearchRepositoriesSchema = z.object({
|
||||
search: z.string().describe("Search query"), // Changed from query to match GitLab API
|
||||
page: z.number().optional().describe("Page number for pagination (default: 1)"),
|
||||
per_page: z.number().optional().describe("Number of results per page (default: 20)"),
|
||||
});
|
||||
}).merge(PaginationOptionsSchema);
|
||||
|
||||
export const CreateRepositorySchema = z.object({
|
||||
name: z.string().describe("Repository name"),
|
||||
@ -883,14 +918,14 @@ export const CreateNoteSchema = z.object({
|
||||
export const ListIssuesSchema = z.object({
|
||||
project_id: z.string().describe("Project ID or URL-encoded path"),
|
||||
assignee_id: z.number().optional().describe("Return issues assigned to the given user ID"),
|
||||
assignee_username: z.string().optional().describe("Return issues assigned to the given username"),
|
||||
assignee_username: z.array(z.string()).optional().describe("Return issues assigned to the given username"),
|
||||
author_id: z.number().optional().describe("Return issues created by the given user ID"),
|
||||
author_username: z.string().optional().describe("Return issues created by the given username"),
|
||||
confidential: z.boolean().optional().describe("Filter confidential or public issues"),
|
||||
created_after: z.string().optional().describe("Return issues created after the given time"),
|
||||
created_before: z.string().optional().describe("Return issues created before the given time"),
|
||||
due_date: z.string().optional().describe("Return issues that have the due date"),
|
||||
label_name: z.array(z.string()).optional().describe("Array of label names"),
|
||||
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"])
|
||||
@ -904,9 +939,7 @@ export const ListIssuesSchema = z.object({
|
||||
updated_after: z.string().optional().describe("Return issues updated after the given time"),
|
||||
updated_before: z.string().optional().describe("Return issues updated before the given time"),
|
||||
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"),
|
||||
});
|
||||
}).merge(PaginationOptionsSchema);
|
||||
|
||||
// Merge Requests API operation schemas
|
||||
export const ListMergeRequestsSchema = z.object({
|
||||
@ -977,9 +1010,7 @@ export const ListMergeRequestsSchema = z.object({
|
||||
.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"),
|
||||
});
|
||||
}).merge(PaginationOptionsSchema);
|
||||
|
||||
export const GetIssueSchema = z.object({
|
||||
project_id: z.string().describe("Project ID or URL-encoded path"),
|
||||
@ -1018,21 +1049,6 @@ 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"),
|
||||
@ -1059,10 +1075,8 @@ export const DeleteIssueLinkSchema = z.object({
|
||||
// Namespace API operation schemas
|
||||
export const ListNamespacesSchema = z.object({
|
||||
search: z.string().optional().describe("Search term for namespaces"),
|
||||
page: z.number().optional().describe("Page number for pagination"),
|
||||
per_page: z.number().optional().describe("Number of items per page"),
|
||||
owned: z.boolean().optional().describe("Filter for namespaces owned by current user"),
|
||||
});
|
||||
}).merge(PaginationOptionsSchema);
|
||||
|
||||
export const GetNamespaceSchema = z.object({
|
||||
namespace_id: z.string().describe("Namespace ID or full path"),
|
||||
@ -1079,8 +1093,6 @@ export const GetProjectSchema = z.object({
|
||||
|
||||
export const ListProjectsSchema = z.object({
|
||||
search: z.string().optional().describe("Search term for projects"),
|
||||
page: z.number().optional().describe("Page number for pagination"),
|
||||
per_page: z.number().optional().describe("Number of items per page"),
|
||||
search_namespaces: z.boolean().optional().describe("Needs to be true if search is full path"),
|
||||
owned: z.boolean().optional().describe("Filter for projects owned by current user"),
|
||||
membership: z.boolean().optional().describe("Filter for projects where current user is a member"),
|
||||
@ -1107,7 +1119,7 @@ export const ListProjectsSchema = z.object({
|
||||
.optional()
|
||||
.describe("Filter projects with merge requests feature enabled"),
|
||||
min_access_level: z.number().optional().describe("Filter by minimum access level"),
|
||||
});
|
||||
}).merge(PaginationOptionsSchema);
|
||||
|
||||
// Label operation schemas
|
||||
export const ListLabelsSchema = z.object({
|
||||
@ -1163,8 +1175,6 @@ export const ListGroupProjectsSchema = z.object({
|
||||
.optional()
|
||||
.describe("Field to sort by"),
|
||||
sort: z.enum(["asc", "desc"]).optional().describe("Sort direction"),
|
||||
page: z.number().optional().describe("Page number"),
|
||||
per_page: z.number().optional().describe("Number of results per page"),
|
||||
archived: z.boolean().optional().describe("Filter for archived projects"),
|
||||
visibility: z
|
||||
.enum(["public", "internal", "private"])
|
||||
@ -1184,14 +1194,14 @@ export const ListGroupProjectsSchema = z.object({
|
||||
statistics: z.boolean().optional().describe("Include project statistics"),
|
||||
with_custom_attributes: z.boolean().optional().describe("Include custom attributes"),
|
||||
with_security_reports: z.boolean().optional().describe("Include security reports"),
|
||||
});
|
||||
}).merge(PaginationOptionsSchema);
|
||||
|
||||
// Add wiki operation schemas
|
||||
export const ListWikiPagesSchema = z.object({
|
||||
project_id: z.string().describe("Project ID or URL-encoded path"),
|
||||
page: z.number().optional().describe("Page number for pagination"),
|
||||
per_page: z.number().optional().describe("Number of items per page"),
|
||||
});
|
||||
with_content: z.boolean().optional().describe("Include content of the wiki pages"),
|
||||
}).merge(PaginationOptionsSchema);
|
||||
|
||||
export const GetWikiPageSchema = z.object({
|
||||
project_id: z.string().describe("Project ID or URL-encoded path"),
|
||||
slug: z.string().describe("URL-encoded slug of the wiki page"),
|
||||
@ -1209,6 +1219,7 @@ export const UpdateWikiPageSchema = z.object({
|
||||
content: z.string().optional().describe("New content of the wiki page"),
|
||||
format: z.string().optional().describe("Content format, e.g., markdown, rdoc"),
|
||||
});
|
||||
|
||||
export const DeleteWikiPageSchema = z.object({
|
||||
project_id: z.string().describe("Project ID or URL-encoded path"),
|
||||
slug: z.string().describe("URL-encoded slug of the wiki page"),
|
||||
@ -1219,7 +1230,7 @@ export const GitLabWikiPageSchema = z.object({
|
||||
title: z.string(),
|
||||
slug: z.string(),
|
||||
format: z.string(),
|
||||
content: z.string(),
|
||||
content: z.string().optional(),
|
||||
created_at: z.string().optional(),
|
||||
updated_at: z.string().optional(),
|
||||
});
|
||||
@ -1275,9 +1286,7 @@ export const ListProjectMilestonesSchema = ProjectParamsSchema.extend({
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Return milestones updated after the specified date (ISO 8601 format)"),
|
||||
page: z.number().optional().describe("Page number for pagination"),
|
||||
per_page: z.number().optional().describe("Number of items per page (max 100)"),
|
||||
});
|
||||
}).merge(PaginationOptionsSchema);
|
||||
|
||||
// Schema for getting a single milestone
|
||||
export const GetProjectMilestoneSchema = ProjectParamsSchema.extend({
|
||||
@ -1311,19 +1320,13 @@ export const DeleteProjectMilestoneSchema = GetProjectMilestoneSchema;
|
||||
export const GetMilestoneIssuesSchema = GetProjectMilestoneSchema;
|
||||
|
||||
// Schema for getting merge requests assigned to a milestone
|
||||
export const GetMilestoneMergeRequestsSchema = GetProjectMilestoneSchema.extend({
|
||||
page: z.number().optional().describe("Page number for pagination"),
|
||||
per_page: z.number().optional().describe("Number of items per page (max 100)"),
|
||||
});
|
||||
export const GetMilestoneMergeRequestsSchema = GetProjectMilestoneSchema.merge(PaginationOptionsSchema);
|
||||
|
||||
// Schema for promoting a project milestone to a group milestone
|
||||
export const PromoteProjectMilestoneSchema = GetProjectMilestoneSchema;
|
||||
|
||||
// Schema for getting burndown chart events for a milestone
|
||||
export const GetMilestoneBurndownEventsSchema = GetProjectMilestoneSchema.extend({
|
||||
page: z.number().optional().describe("Page number for pagination"),
|
||||
per_page: z.number().optional().describe("Number of items per page (max 100)"),
|
||||
});
|
||||
export const GetMilestoneBurndownEventsSchema = GetProjectMilestoneSchema.merge(PaginationOptionsSchema);
|
||||
|
||||
// Export types
|
||||
export type GitLabAuthor = z.infer<typeof GitLabAuthorSchema>;
|
||||
@ -1352,6 +1355,7 @@ 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 ListMergeRequestDiscussionsOptions = z.infer<typeof ListMergeRequestDiscussionsSchema>;
|
||||
export type UpdateIssueNoteOptions = z.infer<typeof UpdateIssueNoteSchema>;
|
||||
export type CreateIssueNoteOptions = z.infer<typeof CreateIssueNoteSchema>;
|
||||
export type GitLabNamespace = z.infer<typeof GitLabNamespaceSchema>;
|
||||
@ -1389,3 +1393,4 @@ export type PromoteProjectMilestoneOptions = z.infer<typeof PromoteProjectMilest
|
||||
export type GetMilestoneBurndownEventsOptions = z.infer<typeof GetMilestoneBurndownEventsSchema>;
|
||||
export type GitLabUser = z.infer<typeof GitLabUserSchema>;
|
||||
export type GitLabUsersResponse = z.infer<typeof GitLabUsersResponseSchema>;
|
||||
export type PaginationOptions = z.infer<typeof PaginationOptionsSchema>;
|
||||
|
38
scripts/create-github-release.sh
Executable file
38
scripts/create-github-release.sh
Executable file
@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Extract version from package.json
|
||||
VERSION=$(jq -r .version package.json)
|
||||
|
||||
if [ -z "$VERSION" ]; then
|
||||
echo "Could not read version from package.json."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if release notes file exists
|
||||
if [ ! -f RELEASE_NOTES.md ]; then
|
||||
echo "RELEASE_NOTES.md file does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Generate RELEASE_NOTES.md from CHANGELOG.md for the current version
|
||||
node <<'EOF'
|
||||
const fs = require('fs');
|
||||
const changelog = fs.readFileSync('CHANGELOG.md', 'utf8');
|
||||
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
|
||||
const version = pkg.version;
|
||||
|
||||
const regex = new RegExp(`## \\[${version.replace(/\./g, '\\.')}\\][\\s\\S]*?(?=\\n## |\\n?$)`, 'g');
|
||||
const match = changelog.match(regex);
|
||||
|
||||
if (match && match[0]) {
|
||||
fs.writeFileSync('RELEASE_NOTES.md', match[0].trim() + '\n');
|
||||
console.log('RELEASE_NOTES.md generated for version', version);
|
||||
} else {
|
||||
console.error('No changelog entry found for version', version);
|
||||
process.exit(1);
|
||||
}
|
||||
EOF
|
||||
|
||||
# Create GitHub release using CLI
|
||||
gh release create "$VERSION" -t "Release $VERSION" -F RELEASE_NOTES.md
|
Reference in New Issue
Block a user