@zereight/mcp-gitlab 2.3.30 → 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/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, GitLabTodoSchema, 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, ListTodosSchema, ListMergeRequestDiffsSchema, // Added
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, MarkAllTodosDoneSchema, MarkTodoDoneSchema, 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";
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 webhook handlers call back into the fetch, error
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
- rejectIfStrictProjectScope("list_todos");
8276
- const args = ListTodosSchema.parse(params.arguments);
8277
- const todos = await listTodos(args);
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.30",
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": [