@structured-world/gitlab-mcp 4.0.0
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/LICENSE +21 -0
- package/README.md +486 -0
- package/dist/config.d.ts +31 -0
- package/dist/config.js +115 -0
- package/dist/config.js.map +1 -0
- package/dist/entities/core/index.d.ts +7 -0
- package/dist/entities/core/index.js +31 -0
- package/dist/entities/core/index.js.map +1 -0
- package/dist/entities/core/registry.d.ts +5 -0
- package/dist/entities/core/registry.js +584 -0
- package/dist/entities/core/registry.js.map +1 -0
- package/dist/entities/core/schema-readonly.d.ts +302 -0
- package/dist/entities/core/schema-readonly.js +364 -0
- package/dist/entities/core/schema-readonly.js.map +1 -0
- package/dist/entities/core/schema.d.ts +87 -0
- package/dist/entities/core/schema.js +143 -0
- package/dist/entities/core/schema.js.map +1 -0
- package/dist/entities/files/index.d.ts +7 -0
- package/dist/entities/files/index.js +31 -0
- package/dist/entities/files/index.js.map +1 -0
- package/dist/entities/files/registry.d.ts +5 -0
- package/dist/entities/files/registry.js +199 -0
- package/dist/entities/files/registry.js.map +1 -0
- package/dist/entities/files/schema-readonly.d.ts +78 -0
- package/dist/entities/files/schema-readonly.js +50 -0
- package/dist/entities/files/schema-readonly.js.map +1 -0
- package/dist/entities/files/schema.d.ts +42 -0
- package/dist/entities/files/schema.js +38 -0
- package/dist/entities/files/schema.js.map +1 -0
- package/dist/entities/index.d.ts +10 -0
- package/dist/entities/index.js +27 -0
- package/dist/entities/index.js.map +1 -0
- package/dist/entities/labels/index.d.ts +7 -0
- package/dist/entities/labels/index.js +31 -0
- package/dist/entities/labels/index.js.map +1 -0
- package/dist/entities/labels/registry.d.ts +5 -0
- package/dist/entities/labels/registry.js +186 -0
- package/dist/entities/labels/registry.js.map +1 -0
- package/dist/entities/labels/schema-readonly.d.ts +16 -0
- package/dist/entities/labels/schema-readonly.js +29 -0
- package/dist/entities/labels/schema-readonly.js.map +1 -0
- package/dist/entities/labels/schema.d.ts +26 -0
- package/dist/entities/labels/schema.js +50 -0
- package/dist/entities/labels/schema.js.map +1 -0
- package/dist/entities/milestones/index.d.ts +7 -0
- package/dist/entities/milestones/index.js +31 -0
- package/dist/entities/milestones/index.js.map +1 -0
- package/dist/entities/milestones/registry.d.ts +5 -0
- package/dist/entities/milestones/registry.js +316 -0
- package/dist/entities/milestones/registry.js.map +1 -0
- package/dist/entities/milestones/schema-readonly.d.ts +63 -0
- package/dist/entities/milestones/schema-readonly.js +68 -0
- package/dist/entities/milestones/schema-readonly.js.map +1 -0
- package/dist/entities/milestones/schema.d.ts +36 -0
- package/dist/entities/milestones/schema.js +52 -0
- package/dist/entities/milestones/schema.js.map +1 -0
- package/dist/entities/mrs/index.d.ts +7 -0
- package/dist/entities/mrs/index.js +31 -0
- package/dist/entities/mrs/index.js.map +1 -0
- package/dist/entities/mrs/registry.d.ts +5 -0
- package/dist/entities/mrs/registry.js +629 -0
- package/dist/entities/mrs/registry.js.map +1 -0
- package/dist/entities/mrs/schema-readonly.d.ts +127 -0
- package/dist/entities/mrs/schema-readonly.js +213 -0
- package/dist/entities/mrs/schema-readonly.js.map +1 -0
- package/dist/entities/mrs/schema.d.ts +285 -0
- package/dist/entities/mrs/schema.js +161 -0
- package/dist/entities/mrs/schema.js.map +1 -0
- package/dist/entities/pipelines/index.d.ts +7 -0
- package/dist/entities/pipelines/index.js +31 -0
- package/dist/entities/pipelines/index.js.map +1 -0
- package/dist/entities/pipelines/registry.d.ts +5 -0
- package/dist/entities/pipelines/registry.js +369 -0
- package/dist/entities/pipelines/registry.js.map +1 -0
- package/dist/entities/pipelines/schema-readonly.d.ts +238 -0
- package/dist/entities/pipelines/schema-readonly.js +257 -0
- package/dist/entities/pipelines/schema-readonly.js.map +1 -0
- package/dist/entities/pipelines/schema.d.ts +49 -0
- package/dist/entities/pipelines/schema.js +44 -0
- package/dist/entities/pipelines/schema.js.map +1 -0
- package/dist/entities/shared.d.ts +291 -0
- package/dist/entities/shared.js +277 -0
- package/dist/entities/shared.js.map +1 -0
- package/dist/entities/utils.d.ts +3 -0
- package/dist/entities/utils.js +22 -0
- package/dist/entities/utils.js.map +1 -0
- package/dist/entities/variables/index.d.ts +7 -0
- package/dist/entities/variables/index.js +31 -0
- package/dist/entities/variables/index.js.map +1 -0
- package/dist/entities/variables/registry.d.ts +5 -0
- package/dist/entities/variables/registry.js +192 -0
- package/dist/entities/variables/registry.js.map +1 -0
- package/dist/entities/variables/schema-readonly.d.ts +17 -0
- package/dist/entities/variables/schema-readonly.js +35 -0
- package/dist/entities/variables/schema-readonly.js.map +1 -0
- package/dist/entities/variables/schema.d.ts +45 -0
- package/dist/entities/variables/schema.js +127 -0
- package/dist/entities/variables/schema.js.map +1 -0
- package/dist/entities/wiki/index.d.ts +7 -0
- package/dist/entities/wiki/index.js +31 -0
- package/dist/entities/wiki/index.js.map +1 -0
- package/dist/entities/wiki/registry.d.ts +5 -0
- package/dist/entities/wiki/registry.js +195 -0
- package/dist/entities/wiki/registry.js.map +1 -0
- package/dist/entities/wiki/schema-readonly.d.ts +24 -0
- package/dist/entities/wiki/schema-readonly.js +34 -0
- package/dist/entities/wiki/schema-readonly.js.map +1 -0
- package/dist/entities/wiki/schema.d.ts +24 -0
- package/dist/entities/wiki/schema.js +37 -0
- package/dist/entities/wiki/schema.js.map +1 -0
- package/dist/entities/workitems/index.d.ts +7 -0
- package/dist/entities/workitems/index.js +31 -0
- package/dist/entities/workitems/index.js.map +1 -0
- package/dist/entities/workitems/registry.d.ts +5 -0
- package/dist/entities/workitems/registry.js +183 -0
- package/dist/entities/workitems/registry.js.map +1 -0
- package/dist/entities/workitems/schema-readonly.d.ts +46 -0
- package/dist/entities/workitems/schema-readonly.js +38 -0
- package/dist/entities/workitems/schema-readonly.js.map +1 -0
- package/dist/entities/workitems/schema.d.ts +37 -0
- package/dist/entities/workitems/schema.js +29 -0
- package/dist/entities/workitems/schema.js.map +1 -0
- package/dist/graphql/DynamicWorkItemsQuery.d.ts +56 -0
- package/dist/graphql/DynamicWorkItemsQuery.js +190 -0
- package/dist/graphql/DynamicWorkItemsQuery.js.map +1 -0
- package/dist/graphql/client.d.ts +15 -0
- package/dist/graphql/client.js +50 -0
- package/dist/graphql/client.js.map +1 -0
- package/dist/graphql/index.d.ts +2 -0
- package/dist/graphql/index.js +21 -0
- package/dist/graphql/index.js.map +1 -0
- package/dist/graphql/workItems.d.ts +430 -0
- package/dist/graphql/workItems.js +559 -0
- package/dist/graphql/workItems.js.map +1 -0
- package/dist/handlers.d.ts +2 -0
- package/dist/handlers.js +132 -0
- package/dist/handlers.js.map +1 -0
- package/dist/http-client.d.ts +1 -0
- package/dist/http-client.js +13 -0
- package/dist/http-client.js.map +1 -0
- package/dist/logger.d.ts +2 -0
- package/dist/logger.js +21 -0
- package/dist/logger.js.map +1 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.js +10 -0
- package/dist/main.js.map +1 -0
- package/dist/registry-manager.d.ts +25 -0
- package/dist/registry-manager.js +176 -0
- package/dist/registry-manager.js.map +1 -0
- package/dist/server.d.ts +25 -0
- package/dist/server.js +129 -0
- package/dist/server.js.map +1 -0
- package/dist/services/ConnectionManager.d.ts +27 -0
- package/dist/services/ConnectionManager.js +144 -0
- package/dist/services/ConnectionManager.js.map +1 -0
- package/dist/services/GitLabVersionDetector.d.ts +53 -0
- package/dist/services/GitLabVersionDetector.js +216 -0
- package/dist/services/GitLabVersionDetector.js.map +1 -0
- package/dist/services/SchemaIntrospector.d.ts +39 -0
- package/dist/services/SchemaIntrospector.js +188 -0
- package/dist/services/SchemaIntrospector.js.map +1 -0
- package/dist/services/ToolAvailability.d.ts +18 -0
- package/dist/services/ToolAvailability.js +373 -0
- package/dist/services/ToolAvailability.js.map +1 -0
- package/dist/services/WidgetAvailability.d.ts +14 -0
- package/dist/services/WidgetAvailability.js +84 -0
- package/dist/services/WidgetAvailability.js.map +1 -0
- package/dist/structured-world-gitlab-mcp-4.0.0.tgz +0 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/types.d.ts +21 -0
- package/dist/types.js +10 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/fetch.d.ts +9 -0
- package/dist/utils/fetch.js +164 -0
- package/dist/utils/fetch.js.map +1 -0
- package/package.json +90 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Roo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,486 @@
|
|
|
1
|
+
# GitLab MCP Server
|
|
2
|
+
|
|
3
|
+
**Maintained by:** [Dmitry Prudnikov](https://github.com/polaz) | **Original Author:** [zereight](https://github.com/zereight)
|
|
4
|
+
|
|
5
|
+
## @structured-world/gitlab-mcp
|
|
6
|
+
|
|
7
|
+
A fork of the original [zereight/gitlab-mcp](https://github.com/zereight/gitlab-mcp)
|
|
8
|
+
|
|
9
|
+
    [](https://structured-world.github.io/gitlab-mcp/coverage/)
|
|
10
|
+
|
|
11
|
+
GitLab MCP(Model Context Protocol) Server. **Includes bug fixes and improvements over the original GitLab MCP server.**
|
|
12
|
+
|
|
13
|
+
This fork is actively maintained and enhanced with strict TypeScript standards, Yarn 4 support, and improved development workflows.
|
|
14
|
+
|
|
15
|
+
## Requirements
|
|
16
|
+
|
|
17
|
+
- **Node.js**: >=18.0.0 (required for native fetch API support)
|
|
18
|
+
- **GitLab**: Compatible with GitLab.com and self-hosted instances
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
### Using with Claude App, Cline, Roo Code, Cursor, Kilo Code
|
|
23
|
+
|
|
24
|
+
When using with the Claude App, you need to set up your API key and URLs directly.
|
|
25
|
+
|
|
26
|
+
#### npx
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"mcpServers": {
|
|
31
|
+
"gitlab": {
|
|
32
|
+
"command": "npx",
|
|
33
|
+
"args": ["-y", "@structured-world/gitlab-mcp"],
|
|
34
|
+
"env": {
|
|
35
|
+
"GITLAB_TOKEN": "your_gitlab_token",
|
|
36
|
+
"GITLAB_API_URL": "your_gitlab_api_url",
|
|
37
|
+
"GITLAB_PROJECT_ID": "your_project_id", // Optional: default project
|
|
38
|
+
"GITLAB_ALLOWED_PROJECT_IDS": "", // Optional: comma-separated list of allowed project IDs
|
|
39
|
+
"GITLAB_READ_ONLY_MODE": "false",
|
|
40
|
+
"USE_GITLAB_WIKI": "false", // use wiki api?
|
|
41
|
+
"USE_MILESTONE": "false", // use milestone api?
|
|
42
|
+
"USE_PIPELINE": "false", // use pipeline api?
|
|
43
|
+
"USE_VARIABLES": "true", // use variables api?
|
|
44
|
+
"SKIP_TLS_VERIFY": "false" // skip SSL cert verification (dev only)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
#### vscode .vscode/mcp.json
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"inputs": [
|
|
56
|
+
{
|
|
57
|
+
"type": "promptString",
|
|
58
|
+
"id": "gitlab-token",
|
|
59
|
+
"description": "Gitlab Token to read API",
|
|
60
|
+
"password": true
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
"servers": {
|
|
64
|
+
"GitLab-MCP": {
|
|
65
|
+
"type": "stdio",
|
|
66
|
+
"command": "npx",
|
|
67
|
+
"args": ["-y", "@structured-world/gitlab-mcp"],
|
|
68
|
+
"env": {
|
|
69
|
+
"GITLAB_TOKEN": "${input:gitlab-token}",
|
|
70
|
+
"GITLAB_API_URL": "your-fancy-gitlab-url",
|
|
71
|
+
"GITLAB_READ_ONLY_MODE": "true",
|
|
72
|
+
...
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
#### Docker
|
|
80
|
+
|
|
81
|
+
- stdio mcp.json
|
|
82
|
+
|
|
83
|
+
```json
|
|
84
|
+
{
|
|
85
|
+
"mcpServers": {
|
|
86
|
+
"gitlab": {
|
|
87
|
+
"command": "docker",
|
|
88
|
+
"args": [
|
|
89
|
+
"run",
|
|
90
|
+
"-i",
|
|
91
|
+
"--rm",
|
|
92
|
+
"-e",
|
|
93
|
+
"GITLAB_TOKEN",
|
|
94
|
+
"-e",
|
|
95
|
+
"GITLAB_API_URL",
|
|
96
|
+
"-e",
|
|
97
|
+
"GITLAB_READ_ONLY_MODE",
|
|
98
|
+
"-e",
|
|
99
|
+
"USE_GITLAB_WIKI",
|
|
100
|
+
"-e",
|
|
101
|
+
"USE_MILESTONE",
|
|
102
|
+
"-e",
|
|
103
|
+
"USE_PIPELINE",
|
|
104
|
+
"-e",
|
|
105
|
+
"USE_VARIABLES",
|
|
106
|
+
"ghcr.io/structured-world/gitlab-mcp:latest"
|
|
107
|
+
],
|
|
108
|
+
"env": {
|
|
109
|
+
"GITLAB_TOKEN": "your_gitlab_token",
|
|
110
|
+
"GITLAB_API_URL": "https://gitlab.com", // Optional, for self-hosted GitLab
|
|
111
|
+
"GITLAB_READ_ONLY_MODE": "false",
|
|
112
|
+
"USE_GITLAB_WIKI": "true",
|
|
113
|
+
"USE_MILESTONE": "true",
|
|
114
|
+
"USE_PIPELINE": "true",
|
|
115
|
+
"USE_VARIABLES": "true"
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
- sse
|
|
123
|
+
|
|
124
|
+
```shell
|
|
125
|
+
docker run -i --rm \
|
|
126
|
+
-e GITLAB_TOKEN=your_gitlab_token \
|
|
127
|
+
-e GITLAB_API_URL="https://gitlab.com" \
|
|
128
|
+
-e GITLAB_READ_ONLY_MODE=true \
|
|
129
|
+
-e USE_GITLAB_WIKI=true \
|
|
130
|
+
-e USE_MILESTONE=true \
|
|
131
|
+
-e USE_PIPELINE=true \
|
|
132
|
+
-e SSE=true \
|
|
133
|
+
-p 3333:3002 \
|
|
134
|
+
ghcr.io/structured-world/gitlab-mcp:latest
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
```json
|
|
138
|
+
{
|
|
139
|
+
"mcpServers": {
|
|
140
|
+
"gitlab": {
|
|
141
|
+
"type": "sse",
|
|
142
|
+
"url": "http://localhost:3333/sse"
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
- streamable-http
|
|
149
|
+
|
|
150
|
+
```shell
|
|
151
|
+
docker run -i --rm \
|
|
152
|
+
-e GITLAB_TOKEN=your_gitlab_token \
|
|
153
|
+
-e GITLAB_API_URL="https://gitlab.com" \
|
|
154
|
+
-e GITLAB_READ_ONLY_MODE=true \
|
|
155
|
+
-e USE_GITLAB_WIKI=true \
|
|
156
|
+
-e USE_MILESTONE=true \
|
|
157
|
+
-e USE_PIPELINE=true \
|
|
158
|
+
-e STREAMABLE_HTTP=true \
|
|
159
|
+
-p 3333:3002 \
|
|
160
|
+
ghcr.io/structured-world/gitlab-mcp:latest
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
```json
|
|
164
|
+
{
|
|
165
|
+
"mcpServers": {
|
|
166
|
+
"gitlab": {
|
|
167
|
+
"type": "streamable-http",
|
|
168
|
+
"url": "http://localhost:3333/mcp"
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Environment Variables
|
|
175
|
+
|
|
176
|
+
- `GITLAB_TOKEN`: Your GitLab personal access token.
|
|
177
|
+
- `GITLAB_API_URL`: Your GitLab API URL. (Default: `https://gitlab.com`)
|
|
178
|
+
- `GITLAB_PROJECT_ID`: Default project ID. If set, Overwrite this value when making an API request.
|
|
179
|
+
- `GITLAB_ALLOWED_PROJECT_IDS`: Optional comma-separated list of allowed project IDs. When set with a single value, acts as a default project (like the old "lock" mode). When set with multiple values, restricts access to only those projects. Examples:
|
|
180
|
+
- Single value `123`: MCP server can only access project 123 and uses it as default
|
|
181
|
+
- Multiple values `123,456,789`: MCP server can access projects 123, 456, and 789 but requires explicit project ID in requests
|
|
182
|
+
- `GITLAB_READ_ONLY_MODE`: When set to 'true', restricts the server to only expose read-only operations. Useful for enhanced security or when write access is not needed. Also useful for using with Cursor and it's 40 tool limit.
|
|
183
|
+
- `GITLAB_DENIED_TOOLS_REGEX`: When set as a regular expression, it excludes the matching tools.
|
|
184
|
+
- `USE_GITLAB_WIKI`: When set to 'true', enables the wiki-related tools (list_wiki_pages, get_wiki_page, create_wiki_page, update_wiki_page, delete_wiki_page). Supports both project-level and group-level wikis. By default, wiki features are disabled.
|
|
185
|
+
- `USE_MILESTONE`: When set to 'true', enables the milestone-related tools (list_milestones, get_milestone, create_milestone, edit_milestone, delete_milestone, get_milestone_issue, get_milestone_merge_requests, promote_milestone, get_milestone_burndown_events). By default, milestone features are disabled.
|
|
186
|
+
- `USE_PIPELINE`: When set to 'true', enables the pipeline-related tools (list_pipelines, get_pipeline, list_pipeline_jobs, list_pipeline_trigger_jobs, get_pipeline_job, get_pipeline_job_output, create_pipeline, retry_pipeline, cancel_pipeline, play_pipeline_job, retry_pipeline_job, cancel_pipeline_job). By default, pipeline features are disabled.
|
|
187
|
+
- `USE_LABELS`: When set to 'true', enables the label-related tools (list_labels, get_label, create_label, update_label, delete_label). By default, label features are enabled.
|
|
188
|
+
- `USE_MRS`: When set to 'true', enables the merge request-related tools (list_merge_requests, get_merge_request, create_merge_request, update_merge_request, merge_merge_request, get_merge_request_diffs, list_merge_request_diffs, mr_discussions, create_merge_request_thread, create_merge_request_note, update_merge_request_note, create_draft_note, update_draft_note, delete_draft_note, publish_draft_note, bulk_publish_draft_notes, get_draft_note, list_draft_notes). By default, merge request features are enabled.
|
|
189
|
+
- `USE_FILES`: When set to 'true', enables the file-related tools (get_file_contents, get_repository_tree, create_or_update_file, push_files, upload_markdown). By default, file operation features are enabled.
|
|
190
|
+
- `USE_VARIABLES`: When set to 'true', enables the CI/CD variables-related tools (list_variables, get_variable, create_variable, update_variable, delete_variable). Supports both project-level and group-level variables. By default, variables features are enabled.
|
|
191
|
+
- `GITLAB_AUTH_COOKIE_PATH`: Path to an authentication cookie file for GitLab instances that require cookie-based authentication. When provided, the cookie will be included in all GitLab API requests.
|
|
192
|
+
- `SKIP_TLS_VERIFY`: When set to 'true', skips TLS certificate verification for all GitLab API requests (both REST and GraphQL). **WARNING**: This bypasses SSL certificate validation and should only be used for testing with self-signed certificates or trusted internal GitLab instances. Never use this in production environments.
|
|
193
|
+
- `SSE`: When set to 'true', enables the Server-Sent Events transport.
|
|
194
|
+
- `STREAMABLE_HTTP`: When set to 'true', enables the Streamable HTTP transport. If both **SSE** and **STREAMABLE_HTTP** are set to 'true', the server will prioritize Streamable HTTP over SSE transport.
|
|
195
|
+
|
|
196
|
+
### Dynamic Tool Description Customization
|
|
197
|
+
|
|
198
|
+
You can customize tool descriptions at runtime using environment variables following the pattern `GITLAB_TOOL_{TOOL_NAME}`. This is useful for:
|
|
199
|
+
|
|
200
|
+
- Providing context-specific descriptions for your team
|
|
201
|
+
- Translating tool descriptions to different languages
|
|
202
|
+
- Adding organization-specific documentation or warnings
|
|
203
|
+
- Simplifying descriptions for non-technical users
|
|
204
|
+
|
|
205
|
+
#### Format
|
|
206
|
+
```bash
|
|
207
|
+
GITLAB_TOOL_{TOOL_NAME}="Your custom description"
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Where `{TOOL_NAME}` is the uppercase version of the tool name with underscores preserved.
|
|
211
|
+
|
|
212
|
+
#### Examples
|
|
213
|
+
```bash
|
|
214
|
+
# Customize the list_projects tool description
|
|
215
|
+
export GITLAB_TOOL_LIST_PROJECTS="Show all available GitLab projects in our organization"
|
|
216
|
+
|
|
217
|
+
# Customize the create_merge_request tool description
|
|
218
|
+
export GITLAB_TOOL_CREATE_MERGE_REQUEST="Create a new MR following our team's review process"
|
|
219
|
+
|
|
220
|
+
# Customize the get_file_contents tool description
|
|
221
|
+
export GITLAB_TOOL_GET_FILE_CONTENTS="Read source code files from the repository"
|
|
222
|
+
|
|
223
|
+
# Multiple customizations
|
|
224
|
+
export GITLAB_TOOL_LIST_PROJECTS="List user projects"
|
|
225
|
+
export GITLAB_TOOL_GET_PROJECT="Get project details including settings"
|
|
226
|
+
export GITLAB_TOOL_CREATE_WORK_ITEM="Create tickets for our sprint planning"
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
#### Usage in Configuration Files
|
|
230
|
+
```json
|
|
231
|
+
{
|
|
232
|
+
"mcpServers": {
|
|
233
|
+
"gitlab": {
|
|
234
|
+
"command": "npx",
|
|
235
|
+
"args": ["-y", "@structured-world/gitlab-mcp"],
|
|
236
|
+
"env": {
|
|
237
|
+
"GITLAB_TOKEN": "your_token",
|
|
238
|
+
"GITLAB_API_URL": "https://gitlab.com",
|
|
239
|
+
|
|
240
|
+
"GITLAB_TOOL_LIST_PROJECTS": "Show our team's GitLab projects",
|
|
241
|
+
"GITLAB_TOOL_CREATE_MERGE_REQUEST": "Create MR with our review standards",
|
|
242
|
+
"GITLAB_TOOL_GET_FILE_CONTENTS": "Read code from repo"
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
#### Important Notes
|
|
250
|
+
|
|
251
|
+
- **Description Override Only**: Only the tool description is overridden - the tool name and functionality remain unchanged
|
|
252
|
+
- **Schema Preservation**: Schema field descriptions are NOT affected - they remain hardcoded for consistency
|
|
253
|
+
- **Case Sensitivity**: Tool names in environment variables must be UPPERCASE (e.g., `LIST_PROJECTS` not `list_projects`)
|
|
254
|
+
- **Invalid Names**: Invalid tool names in environment variables are ignored with a warning in debug logs
|
|
255
|
+
- **Content Guidelines**: Descriptions can be any valid string but should be kept concise for better UX
|
|
256
|
+
- **Scope**: Works with all 86 available tools across all entities (Core, Work Items, Merge Requests, Files, etc.)
|
|
257
|
+
|
|
258
|
+
## Tools 🛠️
|
|
259
|
+
|
|
260
|
+
**86 Tools Available** - Organized by entity and functionality below.
|
|
261
|
+
|
|
262
|
+
### Key Features:
|
|
263
|
+
- **Modular Entity Architecture** - Separate entities for Labels, Merge Requests, Files, Pipelines, etc.
|
|
264
|
+
- **Environment-Gated Features** - Enable/disable tool groups with USE_* environment variables
|
|
265
|
+
- **Work Items Management** - Modern GraphQL API for Issues, Epics, Tasks, and more
|
|
266
|
+
- **Complete GitLab API Coverage** - Repository, Merge Requests, Pipelines, Wiki, and more
|
|
267
|
+
- **Tier-based Feature Detection** - Automatically enables features based on your GitLab tier
|
|
268
|
+
- **Read-only Mode Support** - Safe operation mode for production environments
|
|
269
|
+
|
|
270
|
+
### Migration from v2.0:
|
|
271
|
+
All issue management has been migrated to the Work Items GraphQL API. The legacy REST API issue tools (`create_issue`, `update_issue`, etc.) have been removed. Use the Work Items tools (`create_work_item`, `update_work_item`, etc.) instead for better performance and more features.
|
|
272
|
+
|
|
273
|
+
<details>
|
|
274
|
+
<summary>Removed/Migrated Tools from v2.0</summary>
|
|
275
|
+
|
|
276
|
+
The following issue-related tools have been removed and replaced by Work Items GraphQL API:
|
|
277
|
+
|
|
278
|
+
- `create_issue` → Use `create_work_item` instead
|
|
279
|
+
- `update_issue` → Use `update_work_item` instead
|
|
280
|
+
- `delete_issue` → Use `delete_work_item` instead
|
|
281
|
+
- `list_issues` → Use `list_work_items` instead
|
|
282
|
+
- `my_issues` → Use `list_work_items` with assignee filter
|
|
283
|
+
- `get_issue` → Use `get_work_item` instead
|
|
284
|
+
- `create_issue_link` → Use `update_work_item` with LINKED_ITEMS widget
|
|
285
|
+
- `delete_issue_link` → Use `update_work_item` with LINKED_ITEMS widget
|
|
286
|
+
- `update_issue_note` → Use `update_work_item` with NOTES widget
|
|
287
|
+
- `create_issue_note` → Use `update_work_item` with NOTES widget
|
|
288
|
+
- `list_issue_links` → Use Work Items GraphQL API
|
|
289
|
+
- `list_issue_discussions` → Use Work Items GraphQL API
|
|
290
|
+
- `get_issue_link` → Use Work Items GraphQL API
|
|
291
|
+
|
|
292
|
+
</details>
|
|
293
|
+
|
|
294
|
+
## Complete Tool Reference
|
|
295
|
+
|
|
296
|
+
### Legend
|
|
297
|
+
- 📖 = Read-only tool (available in GITLAB_READ_ONLY_MODE)
|
|
298
|
+
- ✏️ = Read/Write tool (disabled in GITLAB_READ_ONLY_MODE)
|
|
299
|
+
|
|
300
|
+
### Core Tools (22 tools)
|
|
301
|
+
Core GitLab functionality always available.
|
|
302
|
+
|
|
303
|
+
#### Repository & Project Management
|
|
304
|
+
- ✏️ **`create_repository`**: Create a new GitLab project
|
|
305
|
+
- 📖 **`get_project`**: Get details of a specific project
|
|
306
|
+
- 📖 **`list_projects`**: List projects accessible by the current user
|
|
307
|
+
- 📖 **`search_repositories`**: Search for GitLab projects
|
|
308
|
+
- 📖 **`list_group_projects`**: List projects in a GitLab group with filtering options
|
|
309
|
+
- 📖 **`list_project_members`**: List members of a GitLab project
|
|
310
|
+
|
|
311
|
+
#### Branch Management
|
|
312
|
+
- ✏️ **`create_branch`**: Create a new branch in a GitLab project
|
|
313
|
+
- 📖 **`get_branch_diffs`**: Get the changes/diffs between two branches or commits in a GitLab project
|
|
314
|
+
- ✏️ **`fork_repository`**: Fork a GitLab project to your account or specified namespace
|
|
315
|
+
|
|
316
|
+
#### Comments & General Notes
|
|
317
|
+
- ✏️ **`create_note`**: Create a new note (comment) to an issue or merge request
|
|
318
|
+
- 📖 **`download_attachment`**: Download an uploaded file from a GitLab project by secret and filename
|
|
319
|
+
|
|
320
|
+
#### Commits & History
|
|
321
|
+
- 📖 **`get_commit`**: Get details of a specific commit
|
|
322
|
+
- 📖 **`get_commit_diff`**: Get changes/diffs of a specific commit
|
|
323
|
+
- 📖 **`list_commits`**: List repository commits with filtering options
|
|
324
|
+
|
|
325
|
+
#### Namespaces & Users
|
|
326
|
+
- 📖 **`get_namespace`**: Get details of a namespace by ID or path
|
|
327
|
+
- 📖 **`list_namespaces`**: List all namespaces available to the current user
|
|
328
|
+
- 📖 **`verify_namespace`**: Verify if a namespace path exists
|
|
329
|
+
- 📖 **`get_users`**: Get GitLab user details by usernames
|
|
330
|
+
|
|
331
|
+
#### Events & Activity
|
|
332
|
+
- 📖 **`get_project_events`**: List all visible events for a specified project. Note: before/after parameters accept date format YYYY-MM-DD only
|
|
333
|
+
- 📖 **`list_events`**: List all events for the currently authenticated user. Note: before/after parameters accept date format YYYY-MM-DD only
|
|
334
|
+
- 📖 **`list_group_iterations`**: List group iterations with filtering options
|
|
335
|
+
|
|
336
|
+
### Labels Management (5 tools)
|
|
337
|
+
Requires USE_LABELS=true environment variable (enabled by default). Supports both project and group labels.
|
|
338
|
+
|
|
339
|
+
- ✏️ **`create_label`**: Create a new label in a project or group
|
|
340
|
+
- ✏️ **`update_label`**: Update an existing label in a project or group
|
|
341
|
+
- ✏️ **`delete_label`**: Delete a label from a project or group
|
|
342
|
+
- 📖 **`get_label`**: Get a single label from a project or group
|
|
343
|
+
- 📖 **`list_labels`**: List labels for a project or group
|
|
344
|
+
|
|
345
|
+
### Merge Requests Management (17 tools)
|
|
346
|
+
Requires USE_MRS=true environment variable (enabled by default).
|
|
347
|
+
|
|
348
|
+
#### Merge Request Operations
|
|
349
|
+
- ✏️ **`create_merge_request`**: Create a new merge request in a GitLab project
|
|
350
|
+
- ✏️ **`update_merge_request`**: Update a merge request (Either mergeRequestIid or branchName must be provided)
|
|
351
|
+
- ✏️ **`merge_merge_request`**: Merge a merge request in a GitLab project
|
|
352
|
+
- 📖 **`get_merge_request`**: Get details of a merge request (Either mergeRequestIid or branchName must be provided)
|
|
353
|
+
- 📖 **`get_merge_request_diffs`**: Get the changes/diffs of a merge request (Either mergeRequestIid or branchName must be provided)
|
|
354
|
+
- 📖 **`list_merge_request_diffs`**: List merge request diffs with pagination support (Either mergeRequestIid or branchName must be provided)
|
|
355
|
+
- 📖 **`list_merge_requests`**: List merge requests in a GitLab project with filtering options
|
|
356
|
+
- 📖 **`mr_discussions`**: List discussion items for a merge request
|
|
357
|
+
|
|
358
|
+
#### MR Comments & Discussions
|
|
359
|
+
- ✏️ **`create_merge_request_thread`**: Create a new thread on a merge request
|
|
360
|
+
- ✏️ **`create_merge_request_note`**: Add a new note to an existing merge request thread
|
|
361
|
+
- ✏️ **`update_merge_request_note`**: Modify an existing merge request thread note
|
|
362
|
+
|
|
363
|
+
#### MR Draft Notes
|
|
364
|
+
- ✏️ **`create_draft_note`**: Create a draft note for a merge request
|
|
365
|
+
- ✏️ **`update_draft_note`**: Update an existing draft note
|
|
366
|
+
- ✏️ **`delete_draft_note`**: Delete a draft note
|
|
367
|
+
- ✏️ **`publish_draft_note`**: Publish a single draft note
|
|
368
|
+
- ✏️ **`bulk_publish_draft_notes`**: Publish all draft notes for a merge request
|
|
369
|
+
- 📖 **`get_draft_note`**: Get a single draft note from a merge request
|
|
370
|
+
- 📖 **`list_draft_notes`**: List draft notes for a merge request
|
|
371
|
+
|
|
372
|
+
### File Operations (5 tools)
|
|
373
|
+
Requires USE_FILES=true environment variable (enabled by default).
|
|
374
|
+
|
|
375
|
+
- ✏️ **`create_or_update_file`**: Create or update a single file in a GitLab project
|
|
376
|
+
- ✏️ **`push_files`**: Push multiple files to a GitLab project in a single commit
|
|
377
|
+
- 📖 **`get_file_contents`**: Get the contents of a file or directory from a GitLab project
|
|
378
|
+
- 📖 **`get_repository_tree`**: Get the repository tree for a GitLab project (list files and directories)
|
|
379
|
+
- ✏️ **`upload_markdown`**: Upload a file to a GitLab project for use in markdown content
|
|
380
|
+
|
|
381
|
+
### CI/CD Variables (5 tools)
|
|
382
|
+
Requires USE_VARIABLES=true environment variable (enabled by default). Supports both project-level and group-level variables.
|
|
383
|
+
|
|
384
|
+
- 📖 **`list_variables`**: List all CI/CD variables for a project or group with their configuration and security settings
|
|
385
|
+
- 📖 **`get_variable`**: Get a specific CI/CD variable by key from a project or group, optionally filtered by environment scope
|
|
386
|
+
- ✏️ **`create_variable`**: Create a new CI/CD variable for automated deployments and pipeline configuration in a project or group
|
|
387
|
+
- ✏️ **`update_variable`**: Update an existing CI/CD variable's value, security settings, or configuration in a project or group
|
|
388
|
+
- ✏️ **`delete_variable`**: Remove a CI/CD variable from a project or group
|
|
389
|
+
|
|
390
|
+
### Work Items (6 tools)
|
|
391
|
+
Modern GraphQL API for issues, epics, tasks, and more. Requires USE_WORKITEMS=true (enabled by default).
|
|
392
|
+
|
|
393
|
+
- ✏️ **`create_work_item`**: Create a new work item (epic, issue, task, etc.) in a GitLab group
|
|
394
|
+
- ✏️ **`update_work_item`**: Update an existing work item
|
|
395
|
+
- ✏️ **`delete_work_item`**: Delete a work item
|
|
396
|
+
- 📖 **`get_work_item`**: Get details of a specific work item by ID
|
|
397
|
+
- 📖 **`get_work_item_types`**: Get available work item types for a group
|
|
398
|
+
- 📖 **`list_work_items`**: List work items from a GitLab group with optional filtering by type
|
|
399
|
+
|
|
400
|
+
### Wiki Management (5 tools)
|
|
401
|
+
Requires USE_GITLAB_WIKI=true environment variable. Supports both project-level and group-level wikis.
|
|
402
|
+
|
|
403
|
+
- ✏️ **`create_wiki_page`**: Create a new wiki page in a GitLab project or group
|
|
404
|
+
- ✏️ **`update_wiki_page`**: Update an existing wiki page in a GitLab project or group
|
|
405
|
+
- ✏️ **`delete_wiki_page`**: Delete a wiki page from a GitLab project or group
|
|
406
|
+
- 📖 **`get_wiki_page`**: Get details of a specific wiki page from a project or group
|
|
407
|
+
- 📖 **`list_wiki_pages`**: List wiki pages in a GitLab project or group
|
|
408
|
+
|
|
409
|
+
### Milestones (9 tools)
|
|
410
|
+
Requires USE_MILESTONE=true environment variable. Supports both project and group milestones.
|
|
411
|
+
|
|
412
|
+
- ✏️ **`create_milestone`**: Create a new milestone in a GitLab project or group
|
|
413
|
+
- ✏️ **`edit_milestone`**: Edit an existing milestone in a GitLab project or group
|
|
414
|
+
- ✏️ **`delete_milestone`**: Delete a milestone from a GitLab project or group
|
|
415
|
+
- ✏️ **`promote_milestone`**: Promote a project milestone to a group milestone
|
|
416
|
+
- 📖 **`get_milestone`**: Get details of a specific project or group milestone
|
|
417
|
+
- 📖 **`get_milestone_issue`**: Get issues associated with a specific project or group milestone
|
|
418
|
+
- 📖 **`get_milestone_merge_requests`**: Get merge requests associated with a specific project or group milestone
|
|
419
|
+
- 📖 **`get_milestone_burndown_events`**: Get burndown events for a specific project or group milestone
|
|
420
|
+
- 📖 **`list_milestones`**: List milestones in a GitLab project or group with filtering options
|
|
421
|
+
|
|
422
|
+
### Pipelines & CI/CD (12 tools)
|
|
423
|
+
Requires USE_PIPELINE=true environment variable.
|
|
424
|
+
|
|
425
|
+
- ✏️ **`create_pipeline`**: Create a new pipeline for a branch or tag
|
|
426
|
+
- ✏️ **`retry_pipeline`**: Retry a failed or canceled pipeline
|
|
427
|
+
- ✏️ **`cancel_pipeline`**: Cancel a running pipeline
|
|
428
|
+
- ✏️ **`play_pipeline_job`**: Run a manual pipeline job
|
|
429
|
+
- ✏️ **`retry_pipeline_job`**: Retry a failed or canceled pipeline job
|
|
430
|
+
- ✏️ **`cancel_pipeline_job`**: Cancel a running pipeline job
|
|
431
|
+
- 📖 **`get_pipeline`**: Get details of a specific pipeline in a GitLab project
|
|
432
|
+
- 📖 **`get_pipeline_job`**: Get details of a GitLab pipeline job number
|
|
433
|
+
- 📖 **`get_pipeline_job_output`**: Get the output/trace of a GitLab pipeline job with optional pagination to limit context window usage
|
|
434
|
+
- 📖 **`list_pipelines`**: List pipelines in a GitLab project with filtering options
|
|
435
|
+
- 📖 **`list_pipeline_jobs`**: List all jobs in a specific pipeline
|
|
436
|
+
- 📖 **`list_pipeline_trigger_jobs`**: List all trigger jobs (bridges) in a specific pipeline that trigger downstream pipelines
|
|
437
|
+
|
|
438
|
+
## Testing
|
|
439
|
+
|
|
440
|
+
This project includes comprehensive integration tests that verify functionality against a real GitLab instance.
|
|
441
|
+
|
|
442
|
+
### Running Tests
|
|
443
|
+
|
|
444
|
+
```bash
|
|
445
|
+
# Run all tests (requires .env.test configuration)
|
|
446
|
+
yarn test
|
|
447
|
+
|
|
448
|
+
# Run with verbose output
|
|
449
|
+
yarn test --verbose
|
|
450
|
+
|
|
451
|
+
# Run specific test suites
|
|
452
|
+
yarn test tests/integration/data-lifecycle.test.ts
|
|
453
|
+
yarn test tests/integration/schemas/workitems.test.ts
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
### Test Architecture
|
|
457
|
+
|
|
458
|
+
- **200+ integration tests** running against real GitLab 18.3 Ultimate instance
|
|
459
|
+
- **Data lifecycle pattern** - Creates test infrastructure once, shared across dependent tests
|
|
460
|
+
- **Work Items CRUD testing** - Complete Create/Read/Update/Delete for both Issues and Epics
|
|
461
|
+
- **Schema validation** - All 50+ schemas validated against real API responses
|
|
462
|
+
- **Dependency chain** - Tests run in proper order using `--runInBand` for reliable results
|
|
463
|
+
|
|
464
|
+
For detailed testing documentation, see [TESTING.md](TESTING.md).
|
|
465
|
+
|
|
466
|
+
## 💖 Support the Project
|
|
467
|
+
|
|
468
|
+
This GitLab MCP Server is developed and maintained with care for the community. If it saves you time or helps your workflow, consider supporting its continued development!
|
|
469
|
+
|
|
470
|
+
<div align="center">
|
|
471
|
+
|
|
472
|
+

|
|
473
|
+
|
|
474
|
+
☕ **Buy me a coffee with USDT (TRC-20)**
|
|
475
|
+
`TFDsezHa1cBkoeZT5q2T49Wp66K8t2DmdA`
|
|
476
|
+
|
|
477
|
+
📱 *Scan QR code with your wallet (TronLink, Trust Wallet, Exodus, etc.)*
|
|
478
|
+
|
|
479
|
+
**Every contribution helps keep this project alive and growing! 🚀**
|
|
480
|
+
|
|
481
|
+
</div>
|
|
482
|
+
|
|
483
|
+
---
|
|
484
|
+
|
|
485
|
+
**Maintained with ❤️ by [Dmitry Prudnikov](https://github.com/polaz)**
|
|
486
|
+
**Original work by [zereight](https://github.com/zereight) - Thank you for the foundation!**
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare const GITLAB_TOKEN: string | undefined;
|
|
2
|
+
export declare const GITLAB_AUTH_COOKIE_PATH: string | undefined;
|
|
3
|
+
export declare const IS_OLD: boolean;
|
|
4
|
+
export declare const GITLAB_READ_ONLY_MODE: boolean;
|
|
5
|
+
export declare const GITLAB_DENIED_TOOLS_REGEX: RegExp | undefined;
|
|
6
|
+
export declare const USE_GITLAB_WIKI: boolean;
|
|
7
|
+
export declare const USE_MILESTONE: boolean;
|
|
8
|
+
export declare const USE_PIPELINE: boolean;
|
|
9
|
+
export declare const USE_WORKITEMS: boolean;
|
|
10
|
+
export declare const USE_LABELS: boolean;
|
|
11
|
+
export declare const USE_MRS: boolean;
|
|
12
|
+
export declare const USE_FILES: boolean;
|
|
13
|
+
export declare const USE_VARIABLES: boolean;
|
|
14
|
+
export declare const SSE: boolean;
|
|
15
|
+
export declare const STREAMABLE_HTTP: boolean;
|
|
16
|
+
export declare const HOST: string;
|
|
17
|
+
export declare const PORT: string | number;
|
|
18
|
+
export declare const SKIP_TLS_VERIFY: boolean;
|
|
19
|
+
export declare const HTTP_PROXY: string | undefined;
|
|
20
|
+
export declare const HTTPS_PROXY: string | undefined;
|
|
21
|
+
export declare const NODE_TLS_REJECT_UNAUTHORIZED: string | undefined;
|
|
22
|
+
export declare const GITLAB_CA_CERT_PATH: string | undefined;
|
|
23
|
+
export declare const GITLAB_BASE_URL: string;
|
|
24
|
+
export declare const GITLAB_API_URL: string;
|
|
25
|
+
export declare const GITLAB_PROJECT_ID: string | undefined;
|
|
26
|
+
export declare const GITLAB_ALLOWED_PROJECT_IDS: string[];
|
|
27
|
+
export declare function getEffectiveProjectId(projectId: string): string;
|
|
28
|
+
declare let packageName: string;
|
|
29
|
+
declare let packageVersion: string;
|
|
30
|
+
export { packageName, packageVersion };
|
|
31
|
+
export declare function getToolDescriptionOverrides(): Map<string, string>;
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.packageVersion = exports.packageName = exports.GITLAB_ALLOWED_PROJECT_IDS = exports.GITLAB_PROJECT_ID = exports.GITLAB_API_URL = exports.GITLAB_BASE_URL = exports.GITLAB_CA_CERT_PATH = exports.NODE_TLS_REJECT_UNAUTHORIZED = exports.HTTPS_PROXY = exports.HTTP_PROXY = exports.SKIP_TLS_VERIFY = exports.PORT = exports.HOST = exports.STREAMABLE_HTTP = exports.SSE = exports.USE_VARIABLES = exports.USE_FILES = exports.USE_MRS = exports.USE_LABELS = exports.USE_WORKITEMS = exports.USE_PIPELINE = exports.USE_MILESTONE = exports.USE_GITLAB_WIKI = exports.GITLAB_DENIED_TOOLS_REGEX = exports.GITLAB_READ_ONLY_MODE = exports.IS_OLD = exports.GITLAB_AUTH_COOKIE_PATH = exports.GITLAB_TOKEN = void 0;
|
|
37
|
+
exports.getEffectiveProjectId = getEffectiveProjectId;
|
|
38
|
+
exports.getToolDescriptionOverrides = getToolDescriptionOverrides;
|
|
39
|
+
const path = __importStar(require("path"));
|
|
40
|
+
const fs = __importStar(require("fs"));
|
|
41
|
+
const packageJsonPath = path.resolve(process.cwd(), 'package.json');
|
|
42
|
+
exports.GITLAB_TOKEN = process.env.GITLAB_TOKEN;
|
|
43
|
+
exports.GITLAB_AUTH_COOKIE_PATH = process.env.GITLAB_AUTH_COOKIE_PATH;
|
|
44
|
+
exports.IS_OLD = process.env.GITLAB_IS_OLD === 'true';
|
|
45
|
+
exports.GITLAB_READ_ONLY_MODE = process.env.GITLAB_READ_ONLY_MODE === 'true';
|
|
46
|
+
exports.GITLAB_DENIED_TOOLS_REGEX = process.env.GITLAB_DENIED_TOOLS_REGEX
|
|
47
|
+
? new RegExp(process.env.GITLAB_DENIED_TOOLS_REGEX)
|
|
48
|
+
: undefined;
|
|
49
|
+
exports.USE_GITLAB_WIKI = process.env.USE_GITLAB_WIKI !== 'false';
|
|
50
|
+
exports.USE_MILESTONE = process.env.USE_MILESTONE !== 'false';
|
|
51
|
+
exports.USE_PIPELINE = process.env.USE_PIPELINE !== 'false';
|
|
52
|
+
exports.USE_WORKITEMS = process.env.USE_WORKITEMS !== 'false';
|
|
53
|
+
exports.USE_LABELS = process.env.USE_LABELS !== 'false';
|
|
54
|
+
exports.USE_MRS = process.env.USE_MRS !== 'false';
|
|
55
|
+
exports.USE_FILES = process.env.USE_FILES !== 'false';
|
|
56
|
+
exports.USE_VARIABLES = process.env.USE_VARIABLES !== 'false';
|
|
57
|
+
exports.SSE = process.env.SSE === 'true';
|
|
58
|
+
exports.STREAMABLE_HTTP = process.env.STREAMABLE_HTTP === 'true';
|
|
59
|
+
exports.HOST = process.env.HOST ?? '0.0.0.0';
|
|
60
|
+
exports.PORT = process.env.PORT ?? 3002;
|
|
61
|
+
exports.SKIP_TLS_VERIFY = process.env.SKIP_TLS_VERIFY === 'true';
|
|
62
|
+
exports.HTTP_PROXY = process.env.HTTP_PROXY;
|
|
63
|
+
exports.HTTPS_PROXY = process.env.HTTPS_PROXY;
|
|
64
|
+
exports.NODE_TLS_REJECT_UNAUTHORIZED = process.env.NODE_TLS_REJECT_UNAUTHORIZED;
|
|
65
|
+
exports.GITLAB_CA_CERT_PATH = process.env.GITLAB_CA_CERT_PATH;
|
|
66
|
+
function normalizeGitLabBaseUrl(url) {
|
|
67
|
+
if (!url) {
|
|
68
|
+
return 'https://gitlab.com';
|
|
69
|
+
}
|
|
70
|
+
if (url.endsWith('/')) {
|
|
71
|
+
url = url.slice(0, -1);
|
|
72
|
+
}
|
|
73
|
+
if (url.endsWith('/api/v4')) {
|
|
74
|
+
url = url.slice(0, -7);
|
|
75
|
+
}
|
|
76
|
+
return url;
|
|
77
|
+
}
|
|
78
|
+
exports.GITLAB_BASE_URL = normalizeGitLabBaseUrl(process.env.GITLAB_API_URL ?? '');
|
|
79
|
+
exports.GITLAB_API_URL = `${exports.GITLAB_BASE_URL}/api/v4`;
|
|
80
|
+
exports.GITLAB_PROJECT_ID = process.env.GITLAB_PROJECT_ID;
|
|
81
|
+
exports.GITLAB_ALLOWED_PROJECT_IDS = process.env.GITLAB_ALLOWED_PROJECT_IDS?.split(',').map((id) => id.trim()) ?? [];
|
|
82
|
+
function getEffectiveProjectId(projectId) {
|
|
83
|
+
if (exports.GITLAB_PROJECT_ID) {
|
|
84
|
+
return exports.GITLAB_PROJECT_ID;
|
|
85
|
+
}
|
|
86
|
+
if (exports.GITLAB_ALLOWED_PROJECT_IDS.length > 0) {
|
|
87
|
+
if (!exports.GITLAB_ALLOWED_PROJECT_IDS.includes(projectId)) {
|
|
88
|
+
throw new Error(`Project ID ${projectId} is not allowed. Allowed project IDs: ${exports.GITLAB_ALLOWED_PROJECT_IDS.join(', ')}`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return projectId;
|
|
92
|
+
}
|
|
93
|
+
let packageName = 'gitlab-mcp';
|
|
94
|
+
exports.packageName = packageName;
|
|
95
|
+
let packageVersion = 'unknown';
|
|
96
|
+
exports.packageVersion = packageVersion;
|
|
97
|
+
try {
|
|
98
|
+
const packageInfo = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
99
|
+
exports.packageName = packageName = packageInfo.name ?? packageName;
|
|
100
|
+
exports.packageVersion = packageVersion = packageInfo.version ?? packageVersion;
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
}
|
|
104
|
+
function getToolDescriptionOverrides() {
|
|
105
|
+
const overrides = new Map();
|
|
106
|
+
const prefix = 'GITLAB_TOOL_';
|
|
107
|
+
for (const [key, value] of Object.entries(process.env)) {
|
|
108
|
+
if (key.startsWith(prefix) && value) {
|
|
109
|
+
const toolName = key.substring(prefix.length).toLowerCase();
|
|
110
|
+
overrides.set(toolName, value);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return overrides;
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DA,sDAcC;AAwBD,kEAgBC;AAjHD,2CAA6B;AAC7B,uCAAyB;AAEzB,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC,CAAC;AAGvD,QAAA,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;AACxC,QAAA,uBAAuB,GAAG,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC;AAC9D,QAAA,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,KAAK,MAAM,CAAC;AAC9C,QAAA,qBAAqB,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,KAAK,MAAM,CAAC;AACrE,QAAA,yBAAyB,GAAG,OAAO,CAAC,GAAG,CAAC,yBAAyB;IAC5E,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC;IACnD,CAAC,CAAC,SAAS,CAAC;AACD,QAAA,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,KAAK,OAAO,CAAC;AAC1D,QAAA,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,KAAK,OAAO,CAAC;AACtD,QAAA,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,KAAK,OAAO,CAAC;AACpD,QAAA,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,KAAK,OAAO,CAAC;AACtD,QAAA,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,KAAK,OAAO,CAAC;AAChD,QAAA,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,OAAO,CAAC;AAC1C,QAAA,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,KAAK,OAAO,CAAC;AAC9C,QAAA,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,KAAK,OAAO,CAAC;AACtD,QAAA,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,MAAM,CAAC;AACjC,QAAA,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,KAAK,MAAM,CAAC;AACzD,QAAA,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,SAAS,CAAC;AACrC,QAAA,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC;AAGhC,QAAA,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,KAAK,MAAM,CAAC;AAGzD,QAAA,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC;AACpC,QAAA,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;AACtC,QAAA,4BAA4B,GAAG,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC;AACxE,QAAA,mBAAmB,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC;AAGnE,SAAS,sBAAsB,CAAC,GAAY;IAC1C,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,oBAAoB,CAAC;IAC9B,CAAC;IAED,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACtB,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACzB,CAAC;IAGD,IAAI,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QAC5B,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACzB,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAEY,QAAA,eAAe,GAAG,sBAAsB,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC;AAC3E,QAAA,cAAc,GAAG,GAAG,uBAAe,SAAS,CAAC;AAC7C,QAAA,iBAAiB,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;AAClD,QAAA,0BAA0B,GACrC,OAAO,CAAC,GAAG,CAAC,0BAA0B,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC;AAElF,SAAgB,qBAAqB,CAAC,SAAiB;IACrD,IAAI,yBAAiB,EAAE,CAAC;QACtB,OAAO,yBAAiB,CAAC;IAC3B,CAAC;IAED,IAAI,kCAA0B,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1C,IAAI,CAAC,kCAA0B,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;YACpD,MAAM,IAAI,KAAK,CACb,cAAc,SAAS,yCAAyC,kCAA0B,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACxG,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAGD,IAAI,WAAW,GAAG,YAAY,CAAC;AActB,kCAAW;AAbpB,IAAI,cAAc,GAAG,SAAS,CAAC;AAaT,wCAAc;AAXpC,IAAI,CAAC;IACH,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,CAGtE,CAAC;IACF,sBAAA,WAAW,GAAG,WAAW,CAAC,IAAI,IAAI,WAAW,CAAC;IAC9C,yBAAA,cAAc,GAAG,WAAW,CAAC,OAAO,IAAI,cAAc,CAAC;AACzD,CAAC;AAAC,MAAM,CAAC;AAET,CAAC;AASD,SAAgB,2BAA2B;IACzC,MAAM,SAAS,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC5C,MAAM,MAAM,GAAG,cAAc,CAAC;IAG9B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACvD,IAAI,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;YAGpC,MAAM,QAAQ,GAAG,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC;YAE5D,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from '../shared';
|
|
2
|
+
export * from './schema-readonly';
|
|
3
|
+
export * from './schema';
|
|
4
|
+
export * from './registry';
|
|
5
|
+
import type { ToolDefinition } from '../../types';
|
|
6
|
+
export declare const coreTools: ToolDefinition[];
|
|
7
|
+
export declare const coreReadOnlyTools: string[];
|