@zereight/mcp-gitlab 2.3.23-next.208 → 2.3.23-next.210
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 +4 -0
- package/README.md +4 -0
- package/README.pt-BR.md +4 -0
- package/README.zh-CN.md +4 -0
- package/build/index.js +16 -153
- package/build/tools/labels.js +175 -0
- package/package.json +1 -1
package/README.ko.md
CHANGED
|
@@ -764,3 +764,7 @@ npm run test:integration
|
|
|
764
764
|
```
|
|
765
765
|
|
|
766
766
|
모든 원격 인증 테스트는 mock GitLab 서버를 사용하므로 실제 GitLab 자격 증명이 필요하지 않습니다.
|
|
767
|
+
|
|
768
|
+
## 후원 💖
|
|
769
|
+
|
|
770
|
+
[GitHub Sponsors](https://github.com/sponsors/zereight) 후원금은 GitLab E2E 테스트 비용에 쓰입니다. 무료 테스트 인스턴스로는 확인할 수 없는 Premium/Ultimate 기능(milestone burndown 차트, iteration 등)을 테스트하기 위한 유료 GitLab 플랜과 live API 테스트 인프라 비용입니다.
|
package/README.md
CHANGED
|
@@ -1111,3 +1111,7 @@ npm run test:integration
|
|
|
1111
1111
|
```
|
|
1112
1112
|
|
|
1113
1113
|
All remote authorization tests use a mock GitLab server and do not require actual GitLab credentials.
|
|
1114
|
+
|
|
1115
|
+
## Sponsor 💖
|
|
1116
|
+
|
|
1117
|
+
Sponsorships through [GitHub Sponsors](https://github.com/sponsors/zereight) help cover GitLab E2E testing costs: a paid GitLab tier to test Premium/Ultimate features (such as milestone burndown charts and iterations) that the free test instance cannot reach, and the infrastructure for live API tests.
|
package/README.pt-BR.md
CHANGED
|
@@ -764,3 +764,7 @@ npm run test:integration
|
|
|
764
764
|
```
|
|
765
765
|
|
|
766
766
|
Todos os testes de autorização remota usam um servidor GitLab mockado e não exigem credenciais reais do GitLab.
|
|
767
|
+
|
|
768
|
+
## Patrocínio 💖
|
|
769
|
+
|
|
770
|
+
Os patrocínios pelo [GitHub Sponsors](https://github.com/sponsors/zereight) ajudam a cobrir os custos dos testes E2E com o GitLab: um plano pago do GitLab para testar recursos Premium/Ultimate (como gráficos de burndown de milestones e iterations) que a instância de teste gratuita não alcança, e a infraestrutura dos testes de API ao vivo.
|
package/README.zh-CN.md
CHANGED
|
@@ -763,3 +763,7 @@ npm run test:integration
|
|
|
763
763
|
```
|
|
764
764
|
|
|
765
765
|
所有远程授权测试都使用 mock GitLab 服务器,不需要真实 GitLab 凭据。
|
|
766
|
+
|
|
767
|
+
## 赞助 💖
|
|
768
|
+
|
|
769
|
+
通过 [GitHub Sponsors](https://github.com/sponsors/zereight) 的赞助将用于 GitLab E2E 测试费用:用于测试免费测试实例无法覆盖的 Premium/Ultimate 功能(如 milestone burndown 图表和 iterations)的付费 GitLab 方案,以及 live API 测试基础设施。
|
package/build/index.js
CHANGED
|
@@ -134,19 +134,19 @@ import { advertisesReadOnly, allTools, readOnlyTools, destructiveTools, deleteTo
|
|
|
134
134
|
import { executeGitLabApiRequestAsync, GitLabApiRequestHttpError, GitLabApiRequestInputError, } from "./tools/gitlab-api-request.js";
|
|
135
135
|
import { configureWikiTools, handleWikiToolCall } from "./tools/wiki.js";
|
|
136
136
|
import { configureMilestoneTools, handleMilestoneToolCall } from "./tools/milestones.js";
|
|
137
|
+
import { configureLabelTools, handleLabelToolCall } from "./tools/labels.js";
|
|
137
138
|
import { buildUnavailableToolMessage, isSkippedByDiscoverActivation, } from "./tools/discover-activation.js";
|
|
138
139
|
import { selectCallableHiddenToolNames, selectExposedTools } from "./tools/exposed-tools.js";
|
|
139
140
|
import { createListedToolsCache, decorateToolsForList, } from "./tools/listed-tools.js";
|
|
140
141
|
import { isExcludedBySlimProfile, shouldApplySlimToolProfile } from "./tools/tool-profile.js";
|
|
141
142
|
import { shouldCompactToolResult } from "./utils/compact-tool-allowlist.js";
|
|
142
|
-
import { BulkPublishDraftNotesSchema, CancelPipelineJobSchema, ErasePipelineJobSchema, CancelPipelineSchema, CreateBranchSchema, CreateDraftNoteSchema, CreateIssueLinkSchema, CreateIssueNoteSchema, CreateIssueSchema, CreateIssueEmojiReactionSchema, CreateIssueNoteEmojiReactionSchema, ListIssueEmojiReactionsSchema, ListIssueNoteEmojiReactionsSchema,
|
|
143
|
-
CreateMergeRequestNoteSchema, CreateMergeRequestDiscussionNoteSchema, CreateMergeRequestEmojiReactionSchema, CreateMergeRequestNoteEmojiReactionSchema, ListMergeRequestEmojiReactionsSchema, ListMergeRequestNoteEmojiReactionsSchema, CreateMergeRequestSchema, CreateMergeRequestThreadSchema, CreateNoteSchema, CreateCommitStatusSchema, CreateOrUpdateFileSchema, CreatePipelineSchema, CreateRepositorySchema, CreateGroupSchema, DeleteBranchSchema, GetProtectedBranchSchema, ListProtectedBranchesSchema, ProtectBranchSchema, UpdateProtectedBranchSchema, UnprotectBranchSchema, UpdateDefaultBranchSchema, DeleteDraftNoteSchema, DeleteIssueLinkSchema, DeleteIssueSchema, DeleteIssueEmojiReactionSchema, DeleteIssueNoteEmojiReactionSchema, DeleteLabelSchema, DeleteMergeRequestNoteSchema, DeleteMergeRequestEmojiReactionSchema, DeleteMergeRequestNoteEmojiReactionSchema, ForkRepositorySchema, GetBranchDiffsSchema, GetBranchSchema, GetCommitDiffSchema, GetCommitSchema, GetFileBlameSchema, GitLabBlameEntrySchema, GetDraftNoteSchema, GetFileContentsSchema, GetIssueLinkSchema, GetIssueSchema, GetLabelSchema, GetMergeRequestDiffsSchema, GetMergeRequestSchema, GetDeploymentSchema, CreateDeploymentSchema, UpdateDeploymentSchema, DeploymentApprovalSchema, ListDeploymentMergeRequestsSchema, GetEnvironmentSchema, UpdateEnvironmentSchema, StopEnvironmentSchema, StopStaleEnvironmentsSchema, DeleteReviewAppEnvironmentsSchema, PipelineTriggerIdSchema, ListPipelineTriggersSchema, CreatePipelineTriggerSchema, UpdatePipelineTriggerSchema, TriggerPipelineSchema, GetNamespaceSchema, GitLabCiLintResultSchema, GetPipelineJobOutputSchema, PipelineJobControlSchema, GetPipelineSchema, GetPipelineVariablesSchema, UpdatePipelineMetadataSchema, DeletePipelineSchema, PipelineReportSchema, WaitForPipelineSchema, WaitForPipelineJobSchema, PlayPipelineJobsSchema, GetProjectSchema, GetRepositoryTreeSchema, GetUsersSchema, GetUserSchema, GitLabUserFullSchema, WhoAmISchema, GitLabCurrentUserSchema, GitLabCommitSchema, GitLabCommitStatusSchema, GitLabCompareResultSchema, GitLabContentSchema, GitLabCreateUpdateFileResponseSchema, GitLabDiffSchema,
|
|
143
|
+
import { BulkPublishDraftNotesSchema, CancelPipelineJobSchema, ErasePipelineJobSchema, CancelPipelineSchema, CreateBranchSchema, CreateDraftNoteSchema, CreateIssueLinkSchema, CreateIssueNoteSchema, CreateIssueSchema, CreateIssueEmojiReactionSchema, CreateIssueNoteEmojiReactionSchema, ListIssueEmojiReactionsSchema, ListIssueNoteEmojiReactionsSchema, CreateMergeRequestNoteSchema, CreateMergeRequestDiscussionNoteSchema, CreateMergeRequestEmojiReactionSchema, CreateMergeRequestNoteEmojiReactionSchema, ListMergeRequestEmojiReactionsSchema, ListMergeRequestNoteEmojiReactionsSchema, CreateMergeRequestSchema, CreateMergeRequestThreadSchema, CreateNoteSchema, CreateCommitStatusSchema, CreateOrUpdateFileSchema, CreatePipelineSchema, CreateRepositorySchema, CreateGroupSchema, DeleteBranchSchema, GetProtectedBranchSchema, ListProtectedBranchesSchema, ProtectBranchSchema, UpdateProtectedBranchSchema, UnprotectBranchSchema, UpdateDefaultBranchSchema, DeleteDraftNoteSchema, DeleteIssueLinkSchema, DeleteIssueSchema, DeleteIssueEmojiReactionSchema, DeleteIssueNoteEmojiReactionSchema, DeleteMergeRequestNoteSchema, DeleteMergeRequestEmojiReactionSchema, DeleteMergeRequestNoteEmojiReactionSchema, ForkRepositorySchema, GetBranchDiffsSchema, GetBranchSchema, GetCommitDiffSchema, GetCommitSchema, GetFileBlameSchema, GitLabBlameEntrySchema, GetDraftNoteSchema, GetFileContentsSchema, GetIssueLinkSchema, GetIssueSchema, GetMergeRequestDiffsSchema, GetMergeRequestSchema, GetDeploymentSchema, CreateDeploymentSchema, UpdateDeploymentSchema, DeploymentApprovalSchema, ListDeploymentMergeRequestsSchema, GetEnvironmentSchema, UpdateEnvironmentSchema, StopEnvironmentSchema, StopStaleEnvironmentsSchema, DeleteReviewAppEnvironmentsSchema, PipelineTriggerIdSchema, ListPipelineTriggersSchema, CreatePipelineTriggerSchema, UpdatePipelineTriggerSchema, TriggerPipelineSchema, GetNamespaceSchema, GitLabCiLintResultSchema, GetPipelineJobOutputSchema, PipelineJobControlSchema, GetPipelineSchema, GetPipelineVariablesSchema, UpdatePipelineMetadataSchema, DeletePipelineSchema, PipelineReportSchema, WaitForPipelineSchema, WaitForPipelineJobSchema, PlayPipelineJobsSchema, GetProjectSchema, GetRepositoryTreeSchema, GetUsersSchema, GetUserSchema, GitLabUserFullSchema, WhoAmISchema, GitLabCurrentUserSchema, GitLabCommitSchema, GitLabCommitStatusSchema, GitLabCompareResultSchema, GitLabContentSchema, GitLabCreateUpdateFileResponseSchema, GitLabDiffSchema,
|
|
144
144
|
// Discussion Schemas
|
|
145
145
|
GitLabDiscussionNoteSchema, // Added
|
|
146
146
|
GitLabDiscussionSchema,
|
|
147
147
|
// Draft Notes Schemas
|
|
148
|
-
GitLabDraftNoteSchema, GitLabForkSchema, GitLabBranchSchema, GitLabProtectedBranchSchema, GitLabProtectedTagSchema, GitLabGroupSchema, GitLabIssueLinkSchema, GitLabIssueSchema, GitLabIssueWithLinkDetailsSchema, 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, GitLabCiVariableSchema, ListProjectVariablesSchema, GetProjectVariableSchema, CreateProjectVariableSchema, UpdateProjectVariableSchema, DeleteProjectVariableSchema, ListGroupVariablesSchema, GetGroupVariableSchema, CreateGroupVariableSchema, UpdateGroupVariableSchema, DeleteGroupVariableSchema, GitLabDependencyProxySchema, GitLabDependencyProxyBlobSchema, GetDependencyProxySettingsSchema, UpdateDependencyProxySettingsSchema, ListDependencyProxyBlobsSchema, PurgeDependencyProxyCacheSchema, ListProjectVulnerabilitiesSchema, GetVulnerabilitySchema, DismissVulnerabilitySchema, ConfirmVulnerabilitySchema, ListIssueDiscussionsSchema, ListIssueLinksSchema, ListIssuesSchema, ListTodosSchema,
|
|
149
|
-
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,
|
|
148
|
+
GitLabDraftNoteSchema, GitLabForkSchema, GitLabBranchSchema, GitLabProtectedBranchSchema, GitLabProtectedTagSchema, GitLabGroupSchema, GitLabIssueLinkSchema, GitLabIssueSchema, GitLabIssueWithLinkDetailsSchema, 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, GitLabCiVariableSchema, ListProjectVariablesSchema, GetProjectVariableSchema, CreateProjectVariableSchema, UpdateProjectVariableSchema, DeleteProjectVariableSchema, ListGroupVariablesSchema, GetGroupVariableSchema, CreateGroupVariableSchema, UpdateGroupVariableSchema, DeleteGroupVariableSchema, GitLabDependencyProxySchema, GitLabDependencyProxyBlobSchema, GetDependencyProxySettingsSchema, UpdateDependencyProxySettingsSchema, ListDependencyProxyBlobsSchema, PurgeDependencyProxyCacheSchema, ListProjectVulnerabilitiesSchema, GetVulnerabilitySchema, DismissVulnerabilitySchema, ConfirmVulnerabilitySchema, ListIssueDiscussionsSchema, ListIssueLinksSchema, ListIssuesSchema, ListTodosSchema, ListMergeRequestDiffsSchema, // Added
|
|
149
|
+
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, ListTagsSchema, GetTagSchema, CreateTagSchema, DeleteTagSchema, GetTagSignatureSchema, ListProtectedTagsSchema, GetProtectedTagSchema, ProtectTagSchema, UnprotectTagSchema, GitLabTagSchema, GitLabTagSignatureSchema, 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, ListWebhooksSchema, CreateWebhookSchema, UpdateWebhookSchema, DeleteWebhookSchema, ListWebhookEventsSchema, GetWebhookEventSchema, HealthCheckSchema, } from "./schemas.js";
|
|
150
150
|
import { createHash, randomUUID, timingSafeEqual } from "node:crypto";
|
|
151
151
|
import { createLogger, flushBufferedLogs, flushStartupLogs } from "./utils/logger.js";
|
|
152
152
|
const logger = createLogger();
|
|
@@ -989,7 +989,7 @@ configureGitLabRequestContext({
|
|
|
989
989
|
getDispatcherForUrl: apiUrl => clientPool.getDispatcherForUrl(apiUrl),
|
|
990
990
|
getOAuthAccessToken: () => OAUTH_ACCESS_TOKEN,
|
|
991
991
|
});
|
|
992
|
-
// The wiki and
|
|
992
|
+
// The wiki, milestone, and label handlers call back into the fetch, error handling, and project
|
|
993
993
|
// scope helpers below; fetch is read at call time because the cookie reload replaces it.
|
|
994
994
|
configureWikiTools({
|
|
995
995
|
getFetch: () => fetch,
|
|
@@ -1003,6 +1003,11 @@ configureMilestoneTools({
|
|
|
1003
1003
|
getEffectiveProjectId,
|
|
1004
1004
|
rejectIfStrictProjectScope,
|
|
1005
1005
|
});
|
|
1006
|
+
configureLabelTools({
|
|
1007
|
+
getFetch: () => fetch,
|
|
1008
|
+
handleGitLabError,
|
|
1009
|
+
getEffectiveProjectId,
|
|
1010
|
+
});
|
|
1006
1011
|
// Create cookie jar with clean Netscape file parsing
|
|
1007
1012
|
// Resolve cookie path once using os.homedir() for cross-platform support
|
|
1008
1013
|
const resolvedCookiePath = GITLAB_AUTH_COOKIE_PATH
|
|
@@ -4946,113 +4951,6 @@ async function listProjects(options = {}) {
|
|
|
4946
4951
|
const data = await response.json();
|
|
4947
4952
|
return filterProjectsByAllowlist(z.array(GitLabProjectSchema).parse(data));
|
|
4948
4953
|
}
|
|
4949
|
-
/**
|
|
4950
|
-
* List labels for a project
|
|
4951
|
-
*
|
|
4952
|
-
* @param projectId The ID or URL-encoded path of the project
|
|
4953
|
-
* @param options Optional parameters for listing labels
|
|
4954
|
-
* @returns Array of GitLab labels
|
|
4955
|
-
*/
|
|
4956
|
-
async function listLabels(projectId, options = {}) {
|
|
4957
|
-
projectId = decodeURIComponent(projectId); // Decode project ID
|
|
4958
|
-
// Construct the URL with project path
|
|
4959
|
-
const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/labels`);
|
|
4960
|
-
// Add query parameters
|
|
4961
|
-
appendFilterParams(url.searchParams, options);
|
|
4962
|
-
// Make the API request
|
|
4963
|
-
const response = await fetch(url.toString(), {
|
|
4964
|
-
...getFetchConfig(),
|
|
4965
|
-
});
|
|
4966
|
-
// Handle errors
|
|
4967
|
-
await handleGitLabError(response);
|
|
4968
|
-
// Parse and return the data
|
|
4969
|
-
const data = await response.json();
|
|
4970
|
-
return data;
|
|
4971
|
-
}
|
|
4972
|
-
/**
|
|
4973
|
-
* Get a single label from a project
|
|
4974
|
-
*
|
|
4975
|
-
* @param projectId The ID or URL-encoded path of the project
|
|
4976
|
-
* @param labelId The ID or name of the label
|
|
4977
|
-
* @param includeAncestorGroups Whether to include ancestor groups
|
|
4978
|
-
* @returns GitLab label
|
|
4979
|
-
*/
|
|
4980
|
-
async function getLabel(projectId, labelId, includeAncestorGroups) {
|
|
4981
|
-
projectId = decodeURIComponent(projectId); // Decode project ID
|
|
4982
|
-
const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/labels/${encodeGitLabPathSegment(String(labelId))}`);
|
|
4983
|
-
// Add query parameters
|
|
4984
|
-
if (includeAncestorGroups !== undefined) {
|
|
4985
|
-
url.searchParams.append("include_ancestor_groups", includeAncestorGroups ? "true" : "false");
|
|
4986
|
-
}
|
|
4987
|
-
// Make the API request
|
|
4988
|
-
const response = await fetch(url.toString(), {
|
|
4989
|
-
...getFetchConfig(),
|
|
4990
|
-
});
|
|
4991
|
-
// Handle errors
|
|
4992
|
-
await handleGitLabError(response);
|
|
4993
|
-
// Parse and return the data
|
|
4994
|
-
const data = await response.json();
|
|
4995
|
-
return data;
|
|
4996
|
-
}
|
|
4997
|
-
/**
|
|
4998
|
-
* Create a new label in a project
|
|
4999
|
-
*
|
|
5000
|
-
* @param projectId The ID or URL-encoded path of the project
|
|
5001
|
-
* @param options Options for creating the label
|
|
5002
|
-
* @returns Created GitLab label
|
|
5003
|
-
*/
|
|
5004
|
-
async function createLabel(projectId, options) {
|
|
5005
|
-
projectId = decodeURIComponent(projectId); // Decode project ID
|
|
5006
|
-
// Make the API request
|
|
5007
|
-
const response = await fetch(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/labels`, {
|
|
5008
|
-
...getFetchConfig(),
|
|
5009
|
-
method: "POST",
|
|
5010
|
-
body: JSON.stringify(options),
|
|
5011
|
-
});
|
|
5012
|
-
// Handle errors
|
|
5013
|
-
await handleGitLabError(response);
|
|
5014
|
-
// Parse and return the data
|
|
5015
|
-
const data = await response.json();
|
|
5016
|
-
return data;
|
|
5017
|
-
}
|
|
5018
|
-
/**
|
|
5019
|
-
* Update an existing label in a project
|
|
5020
|
-
*
|
|
5021
|
-
* @param projectId The ID or URL-encoded path of the project
|
|
5022
|
-
* @param labelId The ID or name of the label to update
|
|
5023
|
-
* @param options Options for updating the label
|
|
5024
|
-
* @returns Updated GitLab label
|
|
5025
|
-
*/
|
|
5026
|
-
async function updateLabel(projectId, labelId, options) {
|
|
5027
|
-
projectId = decodeURIComponent(projectId); // Decode project ID
|
|
5028
|
-
// Make the API request
|
|
5029
|
-
const response = await fetch(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/labels/${encodeGitLabPathSegment(String(labelId))}`, {
|
|
5030
|
-
...getFetchConfig(),
|
|
5031
|
-
method: "PUT",
|
|
5032
|
-
body: JSON.stringify(options),
|
|
5033
|
-
});
|
|
5034
|
-
// Handle errors
|
|
5035
|
-
await handleGitLabError(response);
|
|
5036
|
-
// Parse and return the data
|
|
5037
|
-
const data = await response.json();
|
|
5038
|
-
return data;
|
|
5039
|
-
}
|
|
5040
|
-
/**
|
|
5041
|
-
* Delete a label from a project
|
|
5042
|
-
*
|
|
5043
|
-
* @param projectId The ID or URL-encoded path of the project
|
|
5044
|
-
* @param labelId The ID or name of the label to delete
|
|
5045
|
-
*/
|
|
5046
|
-
async function deleteLabel(projectId, labelId) {
|
|
5047
|
-
projectId = decodeURIComponent(projectId); // Decode project ID
|
|
5048
|
-
// Make the API request
|
|
5049
|
-
const response = await fetch(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/labels/${encodeGitLabPathSegment(String(labelId))}`, {
|
|
5050
|
-
...getFetchConfig(),
|
|
5051
|
-
method: "DELETE",
|
|
5052
|
-
});
|
|
5053
|
-
// Handle errors
|
|
5054
|
-
await handleGitLabError(response);
|
|
5055
|
-
}
|
|
5056
4954
|
/**
|
|
5057
4955
|
* List all projects in a GitLab group
|
|
5058
4956
|
*
|
|
@@ -9232,47 +9130,12 @@ async function handleToolCall(params) {
|
|
|
9232
9130
|
content: [{ type: "text", text: JSON.stringify(result) }],
|
|
9233
9131
|
};
|
|
9234
9132
|
}
|
|
9235
|
-
case "list_labels":
|
|
9236
|
-
|
|
9237
|
-
|
|
9238
|
-
|
|
9239
|
-
|
|
9240
|
-
|
|
9241
|
-
}
|
|
9242
|
-
case "get_label": {
|
|
9243
|
-
const args = GetLabelSchema.parse(params.arguments);
|
|
9244
|
-
const label = await getLabel(args.project_id, args.label_id, args.include_ancestor_groups);
|
|
9245
|
-
return {
|
|
9246
|
-
content: [{ type: "text", text: JSON.stringify(label) }],
|
|
9247
|
-
};
|
|
9248
|
-
}
|
|
9249
|
-
case "create_label": {
|
|
9250
|
-
const args = CreateLabelSchema.parse(params.arguments);
|
|
9251
|
-
const label = await createLabel(args.project_id, args);
|
|
9252
|
-
return {
|
|
9253
|
-
content: [{ type: "text", text: JSON.stringify(label) }],
|
|
9254
|
-
};
|
|
9255
|
-
}
|
|
9256
|
-
case "update_label": {
|
|
9257
|
-
const args = UpdateLabelSchema.parse(params.arguments);
|
|
9258
|
-
const { project_id, label_id, ...options } = args;
|
|
9259
|
-
const label = await updateLabel(project_id, label_id, options);
|
|
9260
|
-
return {
|
|
9261
|
-
content: [{ type: "text", text: JSON.stringify(label) }],
|
|
9262
|
-
};
|
|
9263
|
-
}
|
|
9264
|
-
case "delete_label": {
|
|
9265
|
-
const args = DeleteLabelSchema.parse(params.arguments);
|
|
9266
|
-
await deleteLabel(args.project_id, args.label_id);
|
|
9267
|
-
return {
|
|
9268
|
-
content: [
|
|
9269
|
-
{
|
|
9270
|
-
type: "text",
|
|
9271
|
-
text: JSON.stringify({ status: "success", message: "Label deleted successfully" }),
|
|
9272
|
-
},
|
|
9273
|
-
],
|
|
9274
|
-
};
|
|
9275
|
-
}
|
|
9133
|
+
case "list_labels":
|
|
9134
|
+
case "get_label":
|
|
9135
|
+
case "create_label":
|
|
9136
|
+
case "update_label":
|
|
9137
|
+
case "delete_label":
|
|
9138
|
+
return await handleLabelToolCall(params);
|
|
9276
9139
|
case "list_group_projects": {
|
|
9277
9140
|
const args = ListGroupProjectsSchema.parse(params.arguments);
|
|
9278
9141
|
const projects = await listGroupProjects(args);
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { CreateLabelSchema, DeleteLabelSchema, GetLabelSchema, ListLabelsSchema, UpdateLabelSchema, } from "../schemas.js";
|
|
2
|
+
import { getEffectiveApiUrl, getFetchConfig } from "../server/gitlab-request-context.js";
|
|
3
|
+
import { appendFilterParams } from "../utils/tool-args.js";
|
|
4
|
+
import { encodeGitLabPathSegment } from "../utils/url.js";
|
|
5
|
+
let deps;
|
|
6
|
+
export function configureLabelTools(next) {
|
|
7
|
+
deps = next;
|
|
8
|
+
}
|
|
9
|
+
function requireDeps() {
|
|
10
|
+
if (!deps) {
|
|
11
|
+
throw new Error("Label tools used before configureLabelTools()");
|
|
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 getEffectiveProjectId(projectId) {
|
|
20
|
+
return requireDeps().getEffectiveProjectId(projectId);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* List labels for a project
|
|
24
|
+
*
|
|
25
|
+
* @param projectId The ID or URL-encoded path of the project
|
|
26
|
+
* @param options Optional parameters for listing labels
|
|
27
|
+
* @returns Array of GitLab labels
|
|
28
|
+
*/
|
|
29
|
+
async function listLabels(projectId, options = {}) {
|
|
30
|
+
projectId = decodeURIComponent(projectId); // Decode project ID
|
|
31
|
+
// Construct the URL with project path
|
|
32
|
+
const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/labels`);
|
|
33
|
+
// Add query parameters
|
|
34
|
+
appendFilterParams(url.searchParams, options);
|
|
35
|
+
// Make the API request
|
|
36
|
+
const response = await fetch(url.toString(), {
|
|
37
|
+
...getFetchConfig(),
|
|
38
|
+
});
|
|
39
|
+
// Handle errors
|
|
40
|
+
await handleGitLabError(response);
|
|
41
|
+
// Parse and return the data
|
|
42
|
+
const data = await response.json();
|
|
43
|
+
return data;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Get a single label from a project
|
|
47
|
+
*
|
|
48
|
+
* @param projectId The ID or URL-encoded path of the project
|
|
49
|
+
* @param labelId The ID or name of the label
|
|
50
|
+
* @param includeAncestorGroups Whether to include ancestor groups
|
|
51
|
+
* @returns GitLab label
|
|
52
|
+
*/
|
|
53
|
+
async function getLabel(projectId, labelId, includeAncestorGroups) {
|
|
54
|
+
projectId = decodeURIComponent(projectId); // Decode project ID
|
|
55
|
+
const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/labels/${encodeGitLabPathSegment(String(labelId))}`);
|
|
56
|
+
// Add query parameters
|
|
57
|
+
if (includeAncestorGroups !== undefined) {
|
|
58
|
+
url.searchParams.append("include_ancestor_groups", includeAncestorGroups ? "true" : "false");
|
|
59
|
+
}
|
|
60
|
+
// Make the API request
|
|
61
|
+
const response = await fetch(url.toString(), {
|
|
62
|
+
...getFetchConfig(),
|
|
63
|
+
});
|
|
64
|
+
// Handle errors
|
|
65
|
+
await handleGitLabError(response);
|
|
66
|
+
// Parse and return the data
|
|
67
|
+
const data = await response.json();
|
|
68
|
+
return data;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Create a new label in a project
|
|
72
|
+
*
|
|
73
|
+
* @param projectId The ID or URL-encoded path of the project
|
|
74
|
+
* @param options Options for creating the label
|
|
75
|
+
* @returns Created GitLab label
|
|
76
|
+
*/
|
|
77
|
+
async function createLabel(projectId, options) {
|
|
78
|
+
projectId = decodeURIComponent(projectId); // Decode project ID
|
|
79
|
+
// Make the API request
|
|
80
|
+
const response = await fetch(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/labels`, {
|
|
81
|
+
...getFetchConfig(),
|
|
82
|
+
method: "POST",
|
|
83
|
+
body: JSON.stringify(options),
|
|
84
|
+
});
|
|
85
|
+
// Handle errors
|
|
86
|
+
await handleGitLabError(response);
|
|
87
|
+
// Parse and return the data
|
|
88
|
+
const data = await response.json();
|
|
89
|
+
return data;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Update an existing label in a project
|
|
93
|
+
*
|
|
94
|
+
* @param projectId The ID or URL-encoded path of the project
|
|
95
|
+
* @param labelId The ID or name of the label to update
|
|
96
|
+
* @param options Options for updating the label
|
|
97
|
+
* @returns Updated GitLab label
|
|
98
|
+
*/
|
|
99
|
+
async function updateLabel(projectId, labelId, options) {
|
|
100
|
+
projectId = decodeURIComponent(projectId); // Decode project ID
|
|
101
|
+
// Make the API request
|
|
102
|
+
const response = await fetch(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/labels/${encodeGitLabPathSegment(String(labelId))}`, {
|
|
103
|
+
...getFetchConfig(),
|
|
104
|
+
method: "PUT",
|
|
105
|
+
body: JSON.stringify(options),
|
|
106
|
+
});
|
|
107
|
+
// Handle errors
|
|
108
|
+
await handleGitLabError(response);
|
|
109
|
+
// Parse and return the data
|
|
110
|
+
const data = await response.json();
|
|
111
|
+
return data;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Delete a label from a project
|
|
115
|
+
*
|
|
116
|
+
* @param projectId The ID or URL-encoded path of the project
|
|
117
|
+
* @param labelId The ID or name of the label to delete
|
|
118
|
+
*/
|
|
119
|
+
async function deleteLabel(projectId, labelId) {
|
|
120
|
+
projectId = decodeURIComponent(projectId); // Decode project ID
|
|
121
|
+
// Make the API request
|
|
122
|
+
const response = await fetch(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/labels/${encodeGitLabPathSegment(String(labelId))}`, {
|
|
123
|
+
...getFetchConfig(),
|
|
124
|
+
method: "DELETE",
|
|
125
|
+
});
|
|
126
|
+
// Handle errors
|
|
127
|
+
await handleGitLabError(response);
|
|
128
|
+
}
|
|
129
|
+
export async function handleLabelToolCall(params) {
|
|
130
|
+
switch (params.name) {
|
|
131
|
+
case "list_labels": {
|
|
132
|
+
const { project_id, ...options } = ListLabelsSchema.parse(params.arguments);
|
|
133
|
+
const labels = await listLabels(project_id, options);
|
|
134
|
+
return {
|
|
135
|
+
content: [{ type: "text", text: JSON.stringify(labels) }],
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
case "get_label": {
|
|
139
|
+
const args = GetLabelSchema.parse(params.arguments);
|
|
140
|
+
const label = await getLabel(args.project_id, args.label_id, args.include_ancestor_groups);
|
|
141
|
+
return {
|
|
142
|
+
content: [{ type: "text", text: JSON.stringify(label) }],
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
case "create_label": {
|
|
146
|
+
const args = CreateLabelSchema.parse(params.arguments);
|
|
147
|
+
const label = await createLabel(args.project_id, args);
|
|
148
|
+
return {
|
|
149
|
+
content: [{ type: "text", text: JSON.stringify(label) }],
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
case "update_label": {
|
|
153
|
+
const args = UpdateLabelSchema.parse(params.arguments);
|
|
154
|
+
const { project_id, label_id, ...options } = args;
|
|
155
|
+
const label = await updateLabel(project_id, label_id, options);
|
|
156
|
+
return {
|
|
157
|
+
content: [{ type: "text", text: JSON.stringify(label) }],
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
case "delete_label": {
|
|
161
|
+
const args = DeleteLabelSchema.parse(params.arguments);
|
|
162
|
+
await deleteLabel(args.project_id, args.label_id);
|
|
163
|
+
return {
|
|
164
|
+
content: [
|
|
165
|
+
{
|
|
166
|
+
type: "text",
|
|
167
|
+
text: JSON.stringify({ status: "success", message: "Label deleted successfully" }),
|
|
168
|
+
},
|
|
169
|
+
],
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
default:
|
|
173
|
+
throw new Error(`Unknown tool: ${params.name}`);
|
|
174
|
+
}
|
|
175
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zereight/mcp-gitlab",
|
|
3
|
-
"version": "2.3.23-next.
|
|
3
|
+
"version": "2.3.23-next.210",
|
|
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": [
|