@zereight/mcp-gitlab 2.3.30-next.254 → 2.3.31-next.257
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ko.md +1 -1
- package/README.md +1 -1
- package/README.pt-BR.md +1 -1
- package/README.zh-CN.md +1 -1
- package/build/index.js +13 -61
- package/build/tools/todos.js +85 -0
- package/package.json +1 -1
package/README.ko.md
CHANGED
|
@@ -262,7 +262,7 @@ command = lib.getExe inputs.gitlab-mcp.packages.${system}.default;
|
|
|
262
262
|
|
|
263
263
|
예시는 기존 `mcp-gitlab`보다 충돌 가능성이 낮은 `zereight-mcp-gitlab` 별칭을 사용합니다. MCP 클라이언트가 찾지 못하면 `which zereight-mcp-gitlab`의 절대 경로를 사용하세요.
|
|
264
264
|
|
|
265
|
-
전역 설치를 쓰지 않으려면 `npx -y @zereight/mcp-gitlab@2.3.
|
|
265
|
+
전역 설치를 쓰지 않으려면 `npx -y @zereight/mcp-gitlab@2.3.29`처럼 직전 안정 버전(문서가 권장하는 버전)으로 고정하세요. `GITLAB_MASKING_ENABLED`를 쓴다면 2.3.29 이상(또는 `@latest`)을 사용하세요. 이전 버전은 GitLab이 masked 또는 hidden으로 지정한 CI/CD 변수 값을 평문으로 반환합니다. 항상 최신 버전을 원하면 `npx -y @zereight/mcp-gitlab@latest`를 사용하세요. `main`에 머지된 수정을 다음 안정 버전 전에 확인하려면 프리릴리스 빌드인 `npx -y @zereight/mcp-gitlab@next`를 사용하세요(운영 환경용이 아닙니다). 새 버전이 나오면 서버가 시작 시 stderr로 알려줍니다(`GITLAB_DISABLE_VERSION_CHECK=true`로 비활성화 가능).
|
|
266
266
|
|
|
267
267
|
#### Claude Desktop 원클릭 설치(MCP Bundle)
|
|
268
268
|
|
package/README.md
CHANGED
|
@@ -267,7 +267,7 @@ The store path is pinned by your lock file; update it with `nix flake update git
|
|
|
267
267
|
|
|
268
268
|
The examples use `zereight-mcp-gitlab`, a less collision-prone alias for the legacy `mcp-gitlab` binary. If your MCP client cannot find it, use the absolute path from `which zereight-mcp-gitlab`.
|
|
269
269
|
|
|
270
|
-
No global install? Pin `npx` to the previous stable release (the version these docs recommend), for example `npx -y @zereight/mcp-gitlab@2.3.
|
|
270
|
+
No global install? Pin `npx` to the previous stable release (the version these docs recommend), for example `npx -y @zereight/mcp-gitlab@2.3.29`. If you set `GITLAB_MASKING_ENABLED`, use 2.3.29 or later (or `@latest`): older releases return the values of CI/CD variables that GitLab flags masked or hidden in plain text. If you always want the newest release, use `npx -y @zereight/mcp-gitlab@latest` instead. To try a fix merged to `main` before the next stable release, use `npx -y @zereight/mcp-gitlab@next`, a pre-release build that is not meant for production. The server prints a notice to stderr on startup when a newer version is available (disable with `GITLAB_DISABLE_VERSION_CHECK=true`).
|
|
271
271
|
|
|
272
272
|
#### Claude Desktop one-click install (MCP Bundle)
|
|
273
273
|
|
package/README.pt-BR.md
CHANGED
|
@@ -262,7 +262,7 @@ O caminho no store é fixado pelo seu lock file; atualize-o com `nix flake updat
|
|
|
262
262
|
|
|
263
263
|
Os exemplos usam `zereight-mcp-gitlab`, um alias com menor chance de conflito que o binário legado `mcp-gitlab`. Se o seu cliente MCP não o encontrar, use o caminho absoluto retornado por `which zereight-mcp-gitlab`.
|
|
264
264
|
|
|
265
|
-
Não quer instalar globalmente? Fixe o `npx` na versão estável anterior (a versão recomendada por esta documentação), por exemplo `npx -y @zereight/mcp-gitlab@2.3.
|
|
265
|
+
Não quer instalar globalmente? Fixe o `npx` na versão estável anterior (a versão recomendada por esta documentação), por exemplo `npx -y @zereight/mcp-gitlab@2.3.29`. Se você usa `GITLAB_MASKING_ENABLED`, use a 2.3.29 ou posterior (ou `@latest`): versões anteriores retornam em texto puro os valores de variáveis de CI/CD que o GitLab marca como masked ou hidden. Se quiser sempre a versão mais recente, use `npx -y @zereight/mcp-gitlab@latest`. Para testar uma correção já mesclada na `main` antes da próxima versão estável, use `npx -y @zereight/mcp-gitlab@next`, um build de pré-lançamento que não é indicado para produção. O servidor exibe um aviso no stderr durante a inicialização quando existe uma versão mais nova disponível (desative com `GITLAB_DISABLE_VERSION_CHECK=true`).
|
|
266
266
|
|
|
267
267
|
#### Instalação com um clique no Claude Desktop (MCP Bundle)
|
|
268
268
|
|
package/README.zh-CN.md
CHANGED
|
@@ -262,7 +262,7 @@ command = lib.getExe inputs.gitlab-mcp.packages.${system}.default;
|
|
|
262
262
|
|
|
263
263
|
示例使用 `zereight-mcp-gitlab`,这是比旧的 `mcp-gitlab` 更不容易冲突的别名。如果 MCP 客户端找不到它,请使用 `which zereight-mcp-gitlab` 输出的绝对路径。
|
|
264
264
|
|
|
265
|
-
如果不想全局安装,请将 `npx` 固定到上一个稳定版本(即文档推荐的版本),例如 `npx -y @zereight/mcp-gitlab@2.3.
|
|
265
|
+
如果不想全局安装,请将 `npx` 固定到上一个稳定版本(即文档推荐的版本),例如 `npx -y @zereight/mcp-gitlab@2.3.29`。如果设置了 `GITLAB_MASKING_ENABLED`,请使用 2.3.29 或更高版本(或 `@latest`):更早的版本会以明文返回 GitLab 标记为 masked 或 hidden 的 CI/CD 变量值。如果始终想使用最新版本,请改用 `npx -y @zereight/mcp-gitlab@latest`。如需在下一个稳定版本发布前试用已合并到 `main` 的修复,请使用 `npx -y @zereight/mcp-gitlab@next`(预发布版本,不适用于生产环境)。有新版本发布时,服务器会在启动时通过 stderr 提示(可用 `GITLAB_DISABLE_VERSION_CHECK=true` 关闭)。
|
|
266
266
|
|
|
267
267
|
#### Claude Desktop 一键安装(MCP Bundle)
|
|
268
268
|
|
package/build/index.js
CHANGED
|
@@ -138,6 +138,7 @@ import { configureLabelTools, handleLabelToolCall } from "./tools/labels.js";
|
|
|
138
138
|
import { configureTagTools, handleTagToolCall } from "./tools/tags.js";
|
|
139
139
|
import { configureVariableTools, handleVariableToolCall } from "./tools/variables.js";
|
|
140
140
|
import { configureWebhookTools, handleWebhookToolCall } from "./tools/webhooks.js";
|
|
141
|
+
import { configureTodoTools, handleTodoToolCall } from "./tools/todos.js";
|
|
141
142
|
import { buildUnavailableToolMessage, isSkippedByDiscoverActivation, } from "./tools/discover-activation.js";
|
|
142
143
|
import { selectCallableHiddenToolNames, selectExposedTools } from "./tools/exposed-tools.js";
|
|
143
144
|
import { createListedToolsCache, decorateToolsForList, } from "./tools/listed-tools.js";
|
|
@@ -148,8 +149,8 @@ import { BulkPublishDraftNotesSchema, CancelPipelineJobSchema, ErasePipelineJobS
|
|
|
148
149
|
GitLabDiscussionNoteSchema, // Added
|
|
149
150
|
GitLabDiscussionSchema,
|
|
150
151
|
// Draft Notes Schemas
|
|
151
|
-
GitLabDraftNoteSchema, GitLabForkSchema, GitLabBranchSchema, GitLabProtectedBranchSchema, GitLabGroupSchema, GitLabIssueLinkSchema, GitLabIssueSchema, GitLabIssueWithLinkDetailsSchema, GitLabResourceLabelEventSchema, GitLabResourceStateEventSchema, GitLabMarkdownUploadSchema, GitLabMergeRequestPipelineSchema, GitLabMergeRequestSchema, GitLabNamespaceExistsResponseSchema, GitLabNamespaceSchema, GitLabPipelineJobSchema, GitLabDeploymentSchema, GitLabEnvironmentSchema, GitLabPipelineSchema, GitLabPipelineScheduleSchema, GitLabPipelineScheduleVariableSchema, GitLabPipelineSchedulePlayResultSchema, ListPipelineSchedulesSchema, GetPipelineScheduleSchema, ListPipelineSchedulePipelinesSchema, CreatePipelineScheduleSchema, UpdatePipelineScheduleSchema, DeletePipelineScheduleSchema, PlayPipelineScheduleSchema, TakeOwnershipPipelineScheduleSchema, GetPipelineScheduleVariableSchema, CreatePipelineScheduleVariableSchema, UpdatePipelineScheduleVariableSchema, DeletePipelineScheduleVariableSchema, GitLabPipelineTriggerJobSchema, GitLabProjectMemberSchema, GitLabProjectSchema,
|
|
152
|
-
GetMergeRequestFileDiffSchema, ListMergeRequestChangedFilesSchema, ListMergeRequestDiscussionsSchema, ListMergeRequestPipelinesSchema, ListMergeRequestsSchema, ListGroupMergeRequestsSchema, ListMergeRequestVersionsSchema, GetMergeRequestVersionSchema, GitLabMergeRequestVersionSchema, GitLabMergeRequestVersionDetailSchema, ListNamespacesSchema, ListPipelineJobsSchema, ListPipelinesSchema, ListDeploymentsSchema, ListEnvironmentsSchema, ListProjectRunnersSchema, GetRunnerSchema, ListPipelineTriggerJobsSchema, ValidateCiLintSchema, ValidateProjectCiLintSchema, ListCiCatalogResourcesSchema, GetCiCatalogResourceSchema, ListProjectMembersSchema, ListGroupMembersSchema, ListProjectsSchema, MarkdownUploadSchema, MarkdownUploadRemoteSchema, DownloadAttachmentSchema, DownloadJobArtifactsSchema, GetJobArtifactFileSchema, GitLabArtifactEntrySchema, ListJobArtifactsSchema, MergeMergeRequestSchema, ApproveMergeRequestSchema, UnapproveMergeRequestSchema, RebaseMergeRequestSchema, GetMergeRequestApprovalStateSchema, GetMergeRequestConflictsSchema, GitLabMergeRequestApprovalStateSchema, MyIssuesSchema, OrbitQuerySchema, OrbitSchemaSchema, OrbitStatusSchema, OrbitToolsSchema,
|
|
152
|
+
GitLabDraftNoteSchema, GitLabForkSchema, GitLabBranchSchema, GitLabProtectedBranchSchema, GitLabGroupSchema, GitLabIssueLinkSchema, GitLabIssueSchema, GitLabIssueWithLinkDetailsSchema, GitLabResourceLabelEventSchema, GitLabResourceStateEventSchema, GitLabMarkdownUploadSchema, GitLabMergeRequestPipelineSchema, GitLabMergeRequestSchema, GitLabNamespaceExistsResponseSchema, GitLabNamespaceSchema, GitLabPipelineJobSchema, GitLabDeploymentSchema, GitLabEnvironmentSchema, GitLabPipelineSchema, GitLabPipelineScheduleSchema, GitLabPipelineScheduleVariableSchema, GitLabPipelineSchedulePlayResultSchema, ListPipelineSchedulesSchema, GetPipelineScheduleSchema, ListPipelineSchedulePipelinesSchema, CreatePipelineScheduleSchema, UpdatePipelineScheduleSchema, DeletePipelineScheduleSchema, PlayPipelineScheduleSchema, TakeOwnershipPipelineScheduleSchema, GetPipelineScheduleVariableSchema, CreatePipelineScheduleVariableSchema, UpdatePipelineScheduleVariableSchema, DeletePipelineScheduleVariableSchema, GitLabPipelineTriggerJobSchema, GitLabProjectMemberSchema, GitLabProjectSchema, GitLabReferenceSchema, GitLabRepositorySchema, GitLabSearchBlobResultSchema, GitLabSearchResponseSchema, GitLabTreeItemSchema, GitLabUserSchema, GitLabUsersResponseSchema, GroupIteration, ListCommitStatusesSchema, ListBranchesSchema, ListCommitsSchema, ListDraftNotesSchema, ListGroupIterationsSchema, GetGroupIterationSchema, UpdateGroupIterationSchema, CreateGroupIterationSchema, GroupIterationCadence, ListGroupIterationCadencesSchema, DeleteGroupIterationSchema, ListProjectIterationsSchema, CreateGroupIterationCadenceSchema, UpdateGroupIterationCadenceSchema, DeleteGroupIterationCadenceSchema, ListGroupProjectsSchema, GitLabDependencyProxySchema, GitLabDependencyProxyBlobSchema, GetDependencyProxySettingsSchema, UpdateDependencyProxySettingsSchema, ListDependencyProxyBlobsSchema, PurgeDependencyProxyCacheSchema, ListProjectVulnerabilitiesSchema, GetVulnerabilitySchema, DismissVulnerabilitySchema, ConfirmVulnerabilitySchema, ListIssueDiscussionsSchema, ListIssueLinksSchema, ListIssueLabelEventsSchema, ListIssueStateEventsSchema, ListIssuesSchema, ListMergeRequestDiffsSchema, // Added
|
|
153
|
+
GetMergeRequestFileDiffSchema, ListMergeRequestChangedFilesSchema, ListMergeRequestDiscussionsSchema, ListMergeRequestPipelinesSchema, ListMergeRequestsSchema, ListGroupMergeRequestsSchema, ListMergeRequestVersionsSchema, GetMergeRequestVersionSchema, GitLabMergeRequestVersionSchema, GitLabMergeRequestVersionDetailSchema, ListNamespacesSchema, ListPipelineJobsSchema, ListPipelinesSchema, ListDeploymentsSchema, ListEnvironmentsSchema, ListProjectRunnersSchema, GetRunnerSchema, ListPipelineTriggerJobsSchema, ValidateCiLintSchema, ValidateProjectCiLintSchema, ListCiCatalogResourcesSchema, GetCiCatalogResourceSchema, ListProjectMembersSchema, ListGroupMembersSchema, ListProjectsSchema, MarkdownUploadSchema, MarkdownUploadRemoteSchema, DownloadAttachmentSchema, DownloadJobArtifactsSchema, GetJobArtifactFileSchema, GitLabArtifactEntrySchema, ListJobArtifactsSchema, MergeMergeRequestSchema, ApproveMergeRequestSchema, UnapproveMergeRequestSchema, RebaseMergeRequestSchema, GetMergeRequestApprovalStateSchema, GetMergeRequestConflictsSchema, GitLabMergeRequestApprovalStateSchema, MyIssuesSchema, OrbitQuerySchema, OrbitSchemaSchema, OrbitStatusSchema, OrbitToolsSchema, PaginatedDiscussionsResponseSchema, PublishDraftNoteSchema, PlayPipelineJobSchema, PushFilesSchema, RetryPipelineJobSchema, RetryPipelineSchema, SearchCodeSchema, SearchGroupCodeSchema, SearchProjectCodeSchema, SearchRepositoriesSchema, UpdateDraftNoteSchema, UpdateIssueNoteSchema, UpdateIssueSchema, UpdateIssueDescriptionPatchSchema, ReorderIssueSchema, UpdateProjectSchema, UpdateMergeRequestNoteSchema, UpdateMergeRequestDiscussionNoteSchema, UpdateMergeRequestSchema, VerifyNamespaceSchema, GitLabEventSchema, ListEventsSchema, GetProjectEventsSchema, ExecuteGraphQLSchema, GitLabReleaseSchema, ListReleasesSchema, GetReleaseSchema, CreateReleaseSchema, UpdateReleaseSchema, DeleteReleaseSchema, CreateReleaseEvidenceSchema, DownloadReleaseAssetSchema, ListSnippetsSchema, GetSnippetSchema, CreateSnippetSchema, UpdateSnippetSchema, DeleteSnippetSchema, GitLabSnippetSchema, GetMergeRequestNotesSchema, GetMergeRequestNoteSchema, GetMergeRequestDiscussionSchema, DeleteMergeRequestDiscussionNoteSchema, ResolveMergeRequestThreadSchema, GetWorkItemSchema, ListWorkItemsSchema, CreateWorkItemSchema, UpdateWorkItemSchema, ConvertWorkItemTypeSchema, ListWorkItemStatusesSchema, ListWorkItemNotesSchema, CreateWorkItemNoteSchema, CreateWorkItemEmojiReactionSchema, CreateWorkItemNoteEmojiReactionSchema, ListWorkItemEmojiReactionsSchema, ListWorkItemNoteEmojiReactionsSchema, DeleteWorkItemEmojiReactionSchema, DeleteWorkItemNoteEmojiReactionSchema, MoveWorkItemSchema, ListCustomFieldDefinitionsSchema, GetTimelineEventsSchema, CreateTimelineEventSchema, HealthCheckSchema, } from "./schemas.js";
|
|
153
154
|
import { createHash, randomUUID, timingSafeEqual } from "node:crypto";
|
|
154
155
|
import { createGraphQLAuditFailure, createToolCallAuditor, graphqlPayloadHasErrors, markToolResultAsAuditFailure, readKnownGitLabUserId, readKnownGitLabUsername, } from "./utils/audit-log.js";
|
|
155
156
|
import { createLogger, flushBufferedLogs, flushStartupLogs } from "./utils/logger.js";
|
|
@@ -1006,7 +1007,7 @@ configureGitLabRequestContext({
|
|
|
1006
1007
|
getDispatcherForUrl: apiUrl => clientPool.getDispatcherForUrl(apiUrl),
|
|
1007
1008
|
getOAuthAccessToken: () => OAUTH_ACCESS_TOKEN,
|
|
1008
1009
|
});
|
|
1009
|
-
// The wiki, milestone, label, tag, variable, and
|
|
1010
|
+
// The wiki, milestone, label, tag, variable, webhook, and todo handlers call back into the fetch, error
|
|
1010
1011
|
// handling, and project scope helpers below; fetch is read at call time because the cookie
|
|
1011
1012
|
// reload replaces it.
|
|
1012
1013
|
configureWikiTools({
|
|
@@ -1043,6 +1044,11 @@ configureWebhookTools({
|
|
|
1043
1044
|
getEffectiveProjectId,
|
|
1044
1045
|
rejectIfStrictProjectScope,
|
|
1045
1046
|
});
|
|
1047
|
+
configureTodoTools({
|
|
1048
|
+
getFetch: () => fetch,
|
|
1049
|
+
handleGitLabError,
|
|
1050
|
+
rejectIfStrictProjectScope,
|
|
1051
|
+
});
|
|
1046
1052
|
// Create cookie jar with clean Netscape file parsing
|
|
1047
1053
|
// Resolve cookie path once using os.homedir() for cross-platform support
|
|
1048
1054
|
const resolvedCookiePath = GITLAB_AUTH_COOKIE_PATH
|
|
@@ -1697,32 +1703,6 @@ async function listIssues(projectId, options = {}) {
|
|
|
1697
1703
|
const data = await response.json();
|
|
1698
1704
|
return z.array(GitLabIssueSchema).parse(data);
|
|
1699
1705
|
}
|
|
1700
|
-
async function listTodos(options = {}) {
|
|
1701
|
-
const url = new URL(`${getEffectiveApiUrl()}/todos`);
|
|
1702
|
-
appendFilterParams(url.searchParams, options);
|
|
1703
|
-
const response = await fetch(url.toString(), {
|
|
1704
|
-
...getFetchConfig(),
|
|
1705
|
-
});
|
|
1706
|
-
await handleGitLabError(response);
|
|
1707
|
-
const data = await response.json();
|
|
1708
|
-
return z.array(GitLabTodoSchema).parse(data);
|
|
1709
|
-
}
|
|
1710
|
-
async function markTodoDone(id) {
|
|
1711
|
-
const response = await fetch(`${getEffectiveApiUrl()}/todos/${id}/mark_as_done`, {
|
|
1712
|
-
...getFetchConfig(),
|
|
1713
|
-
method: "POST",
|
|
1714
|
-
});
|
|
1715
|
-
await handleGitLabError(response);
|
|
1716
|
-
const data = await response.json();
|
|
1717
|
-
return GitLabTodoSchema.parse(data);
|
|
1718
|
-
}
|
|
1719
|
-
async function markAllTodosDone() {
|
|
1720
|
-
const response = await fetch(`${getEffectiveApiUrl()}/todos/mark_as_done`, {
|
|
1721
|
-
...getFetchConfig(),
|
|
1722
|
-
method: "POST",
|
|
1723
|
-
});
|
|
1724
|
-
await handleGitLabError(response);
|
|
1725
|
-
}
|
|
1726
1706
|
/**
|
|
1727
1707
|
* Serialize merge request list filters onto a URL, honouring GitLab's per-parameter array forms
|
|
1728
1708
|
*/
|
|
@@ -8271,38 +8251,10 @@ async function handleToolCall(params) {
|
|
|
8271
8251
|
content: [{ type: "text", text: "Issue note emoji reaction deleted successfully" }],
|
|
8272
8252
|
};
|
|
8273
8253
|
}
|
|
8274
|
-
case "list_todos":
|
|
8275
|
-
|
|
8276
|
-
|
|
8277
|
-
|
|
8278
|
-
return {
|
|
8279
|
-
content: [{ type: "text", text: JSON.stringify(todos) }],
|
|
8280
|
-
};
|
|
8281
|
-
}
|
|
8282
|
-
case "mark_todo_done": {
|
|
8283
|
-
rejectIfStrictProjectScope("mark_todo_done");
|
|
8284
|
-
const args = MarkTodoDoneSchema.parse(params.arguments);
|
|
8285
|
-
const todo = await markTodoDone(args.id);
|
|
8286
|
-
return {
|
|
8287
|
-
content: [{ type: "text", text: JSON.stringify(todo) }],
|
|
8288
|
-
};
|
|
8289
|
-
}
|
|
8290
|
-
case "mark_all_todos_done": {
|
|
8291
|
-
rejectIfStrictProjectScope("mark_all_todos_done");
|
|
8292
|
-
MarkAllTodosDoneSchema.parse(params.arguments);
|
|
8293
|
-
await markAllTodosDone();
|
|
8294
|
-
return {
|
|
8295
|
-
content: [
|
|
8296
|
-
{
|
|
8297
|
-
type: "text",
|
|
8298
|
-
text: JSON.stringify({
|
|
8299
|
-
status: "success",
|
|
8300
|
-
message: "All pending to-do items marked as done",
|
|
8301
|
-
}),
|
|
8302
|
-
},
|
|
8303
|
-
],
|
|
8304
|
-
};
|
|
8305
|
-
}
|
|
8254
|
+
case "list_todos":
|
|
8255
|
+
case "mark_todo_done":
|
|
8256
|
+
case "mark_all_todos_done":
|
|
8257
|
+
return await handleTodoToolCall(params);
|
|
8306
8258
|
case "get_merge_request": {
|
|
8307
8259
|
const args = GetMergeRequestSchema.parse(params.arguments);
|
|
8308
8260
|
const mergeRequest = await getMergeRequest(args.project_id, args.merge_request_iid, args.source_branch);
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { GitLabTodoSchema, ListTodosSchema, MarkAllTodosDoneSchema, MarkTodoDoneSchema, } from "../schemas.js";
|
|
3
|
+
import { getEffectiveApiUrl, getFetchConfig } from "../server/gitlab-request-context.js";
|
|
4
|
+
import { appendFilterParams } from "../utils/tool-args.js";
|
|
5
|
+
let deps;
|
|
6
|
+
export function configureTodoTools(next) {
|
|
7
|
+
deps = next;
|
|
8
|
+
}
|
|
9
|
+
function requireDeps() {
|
|
10
|
+
if (!deps) {
|
|
11
|
+
throw new Error("Todo tools used before configureTodoTools()");
|
|
12
|
+
}
|
|
13
|
+
return deps;
|
|
14
|
+
}
|
|
15
|
+
const fetch = (input, init) => requireDeps().getFetch()(input, init);
|
|
16
|
+
function handleGitLabError(response) {
|
|
17
|
+
return requireDeps().handleGitLabError(response);
|
|
18
|
+
}
|
|
19
|
+
function rejectIfStrictProjectScope(toolName) {
|
|
20
|
+
requireDeps().rejectIfStrictProjectScope(toolName);
|
|
21
|
+
}
|
|
22
|
+
async function listTodos(options = {}) {
|
|
23
|
+
const url = new URL(`${getEffectiveApiUrl()}/todos`);
|
|
24
|
+
appendFilterParams(url.searchParams, options);
|
|
25
|
+
const response = await fetch(url.toString(), {
|
|
26
|
+
...getFetchConfig(),
|
|
27
|
+
});
|
|
28
|
+
await handleGitLabError(response);
|
|
29
|
+
const data = await response.json();
|
|
30
|
+
return z.array(GitLabTodoSchema).parse(data);
|
|
31
|
+
}
|
|
32
|
+
async function markTodoDone(id) {
|
|
33
|
+
const response = await fetch(`${getEffectiveApiUrl()}/todos/${id}/mark_as_done`, {
|
|
34
|
+
...getFetchConfig(),
|
|
35
|
+
method: "POST",
|
|
36
|
+
});
|
|
37
|
+
await handleGitLabError(response);
|
|
38
|
+
const data = await response.json();
|
|
39
|
+
return GitLabTodoSchema.parse(data);
|
|
40
|
+
}
|
|
41
|
+
async function markAllTodosDone() {
|
|
42
|
+
const response = await fetch(`${getEffectiveApiUrl()}/todos/mark_as_done`, {
|
|
43
|
+
...getFetchConfig(),
|
|
44
|
+
method: "POST",
|
|
45
|
+
});
|
|
46
|
+
await handleGitLabError(response);
|
|
47
|
+
}
|
|
48
|
+
export async function handleTodoToolCall(params) {
|
|
49
|
+
switch (params.name) {
|
|
50
|
+
case "list_todos": {
|
|
51
|
+
rejectIfStrictProjectScope("list_todos");
|
|
52
|
+
const args = ListTodosSchema.parse(params.arguments);
|
|
53
|
+
const todos = await listTodos(args);
|
|
54
|
+
return {
|
|
55
|
+
content: [{ type: "text", text: JSON.stringify(todos) }],
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
case "mark_todo_done": {
|
|
59
|
+
rejectIfStrictProjectScope("mark_todo_done");
|
|
60
|
+
const args = MarkTodoDoneSchema.parse(params.arguments);
|
|
61
|
+
const todo = await markTodoDone(args.id);
|
|
62
|
+
return {
|
|
63
|
+
content: [{ type: "text", text: JSON.stringify(todo) }],
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
case "mark_all_todos_done": {
|
|
67
|
+
rejectIfStrictProjectScope("mark_all_todos_done");
|
|
68
|
+
MarkAllTodosDoneSchema.parse(params.arguments);
|
|
69
|
+
await markAllTodosDone();
|
|
70
|
+
return {
|
|
71
|
+
content: [
|
|
72
|
+
{
|
|
73
|
+
type: "text",
|
|
74
|
+
text: JSON.stringify({
|
|
75
|
+
status: "success",
|
|
76
|
+
message: "All pending to-do items marked as done",
|
|
77
|
+
}),
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
default:
|
|
83
|
+
throw new Error(`Unknown tool: ${params.name}`);
|
|
84
|
+
}
|
|
85
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zereight/mcp-gitlab",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.31-next.257",
|
|
4
4
|
"mcpName": "io.github.zereight/gitlab-mcp",
|
|
5
5
|
"description": "GitLab MCP server for projects, merge requests, issues, pipelines, wiki, releases, and more",
|
|
6
6
|
"keywords": [
|