@zereight/mcp-gitlab 2.1.27 → 2.1.28
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 +28 -23
- package/README.md +34 -29
- package/README.zh-CN.md +24 -19
- package/build/utils/schema.js +42 -11
- package/package.json +4 -3
package/README.ko.md
CHANGED
|
@@ -20,7 +20,7 @@ PAT, OAuth, 읽기 전용 모드, 동적 API URL, 원격 인증을 지원하며
|
|
|
20
20
|
- 클라이언트 친화적 설정: Claude Code, Codex, Antigravity, OpenCode, Copilot, Cline, Roo Code, Cursor, Kilo Code, Amp Code 예시 제공
|
|
21
21
|
- 셀프 호스팅 대응: 커스텀 GitLab 인스턴스, 프록시 설정, 동적 API URL 라우팅 지원
|
|
22
22
|
|
|
23
|
-
빠른 시작: 아래에서 Personal Access Token 또는 OAuth2 설정 중 하나를 선택하고 MCP 클라이언트 설정에서
|
|
23
|
+
빠른 시작: 아래에서 Personal Access Token 또는 OAuth2 설정 중 하나를 선택하고 `@zereight/mcp-gitlab`을 설치한 뒤 MCP 클라이언트 설정에서 `zereight-mcp-gitlab`을 사용하세요.
|
|
24
24
|
|
|
25
25
|
### 클라이언트 설정 가이드
|
|
26
26
|
|
|
@@ -63,6 +63,16 @@ PAT, OAuth, 읽기 전용 모드, 동적 API URL, 원격 인증을 지원하며
|
|
|
63
63
|
|
|
64
64
|
가장 단순한 로컬 설정은 Personal Access Token으로 시작하세요. 브라우저 기반 로컬 인증은 OAuth2를 사용하세요. 원격 또는 멀티 유저 배포는 아래 MCP OAuth 및 원격 인증 섹션을 참고하세요.
|
|
65
65
|
|
|
66
|
+
서버를 한 번 전역 설치하세요.
|
|
67
|
+
|
|
68
|
+
```shell
|
|
69
|
+
npm install -g @zereight/mcp-gitlab
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
예시는 기존 `mcp-gitlab`보다 충돌 가능성이 낮은 `zereight-mcp-gitlab` 별칭을 사용합니다. MCP 클라이언트가 찾지 못하면 `which zereight-mcp-gitlab`의 절대 경로를 사용하세요.
|
|
73
|
+
|
|
74
|
+
전역 설치를 쓰지 않으려면 `npx -y @zereight/mcp-gitlab@2.1.27`처럼 버전을 고정하세요.
|
|
75
|
+
|
|
66
76
|
#### CLI 인자 사용하기(환경 변수 문제가 있는 클라이언트용)
|
|
67
77
|
|
|
68
78
|
일부 MCP 클라이언트(예: GitHub Copilot CLI)는 환경 변수 처리에 문제가 있을 수 있습니다. 이 경우 CLI 인자를 사용하세요.
|
|
@@ -71,13 +81,8 @@ PAT, OAuth, 읽기 전용 모드, 동적 API URL, 원격 인증을 지원하며
|
|
|
71
81
|
{
|
|
72
82
|
"mcpServers": {
|
|
73
83
|
"gitlab": {
|
|
74
|
-
"command": "
|
|
75
|
-
"args": [
|
|
76
|
-
"-y",
|
|
77
|
-
"@zereight/mcp-gitlab",
|
|
78
|
-
"--token=YOUR_GITLAB_TOKEN",
|
|
79
|
-
"--api-url=https://gitlab.com/api/v4"
|
|
80
|
-
],
|
|
84
|
+
"command": "zereight-mcp-gitlab",
|
|
85
|
+
"args": ["--token=YOUR_GITLAB_TOKEN", "--api-url=https://gitlab.com/api/v4"],
|
|
81
86
|
"tools": ["*"]
|
|
82
87
|
}
|
|
83
88
|
}
|
|
@@ -178,15 +183,15 @@ MCP 서버가 직접 로컬 브라우저 callback을 받을 때만 `GITLAB_OAUTH
|
|
|
178
183
|
2. `api` 또는 `read_api` scope가 있는 사전 등록 GitLab OAuth 애플리케이션
|
|
179
184
|
— `Admin area` → `Applications`에서 Redirect URI를 `{MCP_SERVER_URL}/callback`으로 설정하세요.
|
|
180
185
|
|
|
181
|
-
| 환경 변수 | 필수 | 설명
|
|
182
|
-
| ----------------------------- | ---- |
|
|
183
|
-
| `GITLAB_MCP_OAUTH` | 예 | 활성화하려면 `true`
|
|
184
|
-
| `GITLAB_API_URL` | 예 | GitLab API base URL
|
|
185
|
-
| `GITLAB_OAUTH_APP_ID` | 예 | GitLab OAuth Application ID
|
|
186
|
-
| `MCP_SERVER_URL` | 예 | 이 MCP 서버의 공개 HTTPS URL
|
|
187
|
-
| `STREAMABLE_HTTP` | 예 | 반드시 `true`
|
|
188
|
-
| `GITLAB_OAUTH_CALLBACK_PROXY` | 선택 | MCP 서버의 고정 `/callback` URL을 사용하려면 `true`
|
|
189
|
-
| `GITLAB_OAUTH_SCOPES` | 선택 | 쉼표로 구분된 scope 목록(기본값: `api,read_api,read_user`)
|
|
186
|
+
| 환경 변수 | 필수 | 설명 |
|
|
187
|
+
| ----------------------------- | ---- | ------------------------------------------------------------------------------------------------------------------------------- |
|
|
188
|
+
| `GITLAB_MCP_OAUTH` | 예 | 활성화하려면 `true` |
|
|
189
|
+
| `GITLAB_API_URL` | 예 | GitLab API base URL |
|
|
190
|
+
| `GITLAB_OAUTH_APP_ID` | 예 | GitLab OAuth Application ID |
|
|
191
|
+
| `MCP_SERVER_URL` | 예 | 이 MCP 서버의 공개 HTTPS URL |
|
|
192
|
+
| `STREAMABLE_HTTP` | 예 | 반드시 `true` |
|
|
193
|
+
| `GITLAB_OAUTH_CALLBACK_PROXY` | 선택 | MCP 서버의 고정 `/callback` URL을 사용하려면 `true` |
|
|
194
|
+
| `GITLAB_OAUTH_SCOPES` | 선택 | 쉼표로 구분된 scope 목록(기본값: `api,read_api,read_user`) |
|
|
190
195
|
| `GITLAB_OAUTH_ALLOWED_GROUPS` | 선택 | 쉼표로 구분된 GitLab 그룹 전체 경로 — 해당 그룹 및 하위 그룹 멤버만 토큰을 발급받을 수 있음 (기존 `GITLAB_ALLOWED_GROUPS` 대체) |
|
|
191
196
|
|
|
192
197
|
> **`Unregistered redirect_uri` 문제 해결**
|
|
@@ -233,12 +238,12 @@ MCP 클라이언트 설정:
|
|
|
233
238
|
|
|
234
239
|
**헤더 우선순위**: `Private-Token` > `JOB-TOKEN` > `Authorization: Bearer`
|
|
235
240
|
|
|
236
|
-
| 환경 변수 | 필수 | 설명
|
|
237
|
-
| ------------------------ | ---- |
|
|
238
|
-
| `REMOTE_AUTHORIZATION` | 예 | 활성화하려면 `true`
|
|
239
|
-
| `STREAMABLE_HTTP` | 예 | 반드시 `true`
|
|
240
|
-
| `ENABLE_DYNAMIC_API_URL` | 선택 | 요청별 `X-GitLab-API-URL` 헤더 허용
|
|
241
|
-
| `GITLAB_ALLOWED_HOSTS`
|
|
241
|
+
| 환경 변수 | 필수 | 설명 |
|
|
242
|
+
| ------------------------ | ---- | ------------------------------------------------------------------- |
|
|
243
|
+
| `REMOTE_AUTHORIZATION` | 예 | 활성화하려면 `true` |
|
|
244
|
+
| `STREAMABLE_HTTP` | 예 | 반드시 `true` |
|
|
245
|
+
| `ENABLE_DYNAMIC_API_URL` | 선택 | 요청별 `X-GitLab-API-URL` 헤더 허용 |
|
|
246
|
+
| `GITLAB_ALLOWED_HOSTS` | 선택 | 허용할 호스트의 쉼표 구분 목록; `GITLAB_API_URL` 호스트는 항상 허용 |
|
|
242
247
|
|
|
243
248
|
**예시 요청 헤더:**
|
|
244
249
|
|
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ Supports PAT, OAuth, read-only mode, dynamic API URLs, and remote authorization
|
|
|
22
22
|
- Client-friendly setup — examples for Claude Code, Codex, Antigravity, OpenCode, Copilot, Cline, Roo Code, Cursor, Kilo Code, and Amp Code
|
|
23
23
|
- Self-hosted ready — works with custom GitLab instances, proxy settings, and dynamic API URL routing
|
|
24
24
|
|
|
25
|
-
Quick start: choose either Personal Access Token or OAuth2 setup below and use
|
|
25
|
+
Quick start: choose either Personal Access Token or OAuth2 setup below, install `@zereight/mcp-gitlab`, and use `zereight-mcp-gitlab` in your MCP client configuration.
|
|
26
26
|
|
|
27
27
|
### Client Setup Guides
|
|
28
28
|
|
|
@@ -67,6 +67,16 @@ The server supports four authentication methods:
|
|
|
67
67
|
|
|
68
68
|
For the simplest local setup, start with a Personal Access Token. For browser-based local auth, use OAuth2. For remote or multi-user deployments, continue to the MCP OAuth and Remote Authorization sections later in this README.
|
|
69
69
|
|
|
70
|
+
Install the server globally once:
|
|
71
|
+
|
|
72
|
+
```shell
|
|
73
|
+
npm install -g @zereight/mcp-gitlab
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
The examples use `zereight-mcp-gitlab`, a less collision-prone alias for the legacy `mcp-gitlab` binary. If your MCP client cannot find it, use the absolute path from `which zereight-mcp-gitlab`.
|
|
77
|
+
|
|
78
|
+
No global install? Pin `npx` to a known version, for example `npx -y @zereight/mcp-gitlab@2.1.27`.
|
|
79
|
+
|
|
70
80
|
#### Using CLI Arguments (for clients with env var issues)
|
|
71
81
|
|
|
72
82
|
Some MCP clients (like GitHub Copilot CLI) have issues with environment variables. Use CLI arguments instead:
|
|
@@ -75,13 +85,8 @@ Some MCP clients (like GitHub Copilot CLI) have issues with environment variable
|
|
|
75
85
|
{
|
|
76
86
|
"mcpServers": {
|
|
77
87
|
"gitlab": {
|
|
78
|
-
"command": "
|
|
79
|
-
"args": [
|
|
80
|
-
"-y",
|
|
81
|
-
"@zereight/mcp-gitlab",
|
|
82
|
-
"--token=YOUR_GITLAB_TOKEN",
|
|
83
|
-
"--api-url=https://gitlab.com/api/v4"
|
|
84
|
-
],
|
|
88
|
+
"command": "zereight-mcp-gitlab",
|
|
89
|
+
"args": ["--token=YOUR_GITLAB_TOKEN", "--api-url=https://gitlab.com/api/v4"],
|
|
85
90
|
"tools": ["*"]
|
|
86
91
|
}
|
|
87
92
|
}
|
|
@@ -186,10 +191,10 @@ Remote MCP OAuth is different. In `GITLAB_MCP_OAUTH=true` mode, the MCP client
|
|
|
186
191
|
provides its own callback URL during `/authorize`. `GITLAB_OAUTH_REDIRECT_URI`
|
|
187
192
|
does not replace that client-provided URL.
|
|
188
193
|
|
|
189
|
-
| Mode
|
|
190
|
-
|
|
|
191
|
-
| Local OAuth
|
|
192
|
-
| Remote MCP OAuth | `GITLAB_MCP_OAUTH=true` | `GITLAB_OAUTH_CALLBACK_PROXY=true` | `{MCP_SERVER_URL}/callback`
|
|
194
|
+
| Mode | Enable with | Callback variable | GitLab redirect URI |
|
|
195
|
+
| ---------------- | ----------------------- | ---------------------------------- | ------------------------------------------------------- |
|
|
196
|
+
| Local OAuth | `GITLAB_USE_OAUTH=true` | `GITLAB_OAUTH_REDIRECT_URI` | `http://127.0.0.1:8888/callback` or your local callback |
|
|
197
|
+
| Remote MCP OAuth | `GITLAB_MCP_OAUTH=true` | `GITLAB_OAUTH_CALLBACK_PROXY=true` | `{MCP_SERVER_URL}/callback` |
|
|
193
198
|
|
|
194
199
|
Use `GITLAB_OAUTH_REDIRECT_URI` only when the MCP server itself owns the local
|
|
195
200
|
browser callback. Use `GITLAB_OAUTH_CALLBACK_PROXY=true` when a remote MCP client
|
|
@@ -205,15 +210,15 @@ exchanging credentials with GitLab on behalf of the client.
|
|
|
205
210
|
2. A pre-registered GitLab OAuth application with `api` (or `read_api`) scopes
|
|
206
211
|
— Go to `Admin area` → `Applications`, set Redirect URI to `{MCP_SERVER_URL}/callback`
|
|
207
212
|
|
|
208
|
-
| Environment Variable
|
|
209
|
-
|
|
|
210
|
-
| `GITLAB_MCP_OAUTH`
|
|
211
|
-
| `GITLAB_API_URL`
|
|
212
|
-
| `GITLAB_OAUTH_APP_ID`
|
|
213
|
-
| `MCP_SERVER_URL`
|
|
214
|
-
| `STREAMABLE_HTTP`
|
|
215
|
-
| `GITLAB_OAUTH_CALLBACK_PROXY` | optional | Set to `true` to use the MCP server's fixed `/callback` URL
|
|
216
|
-
| `GITLAB_OAUTH_SCOPES`
|
|
213
|
+
| Environment Variable | Required | Description |
|
|
214
|
+
| ----------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------- |
|
|
215
|
+
| `GITLAB_MCP_OAUTH` | ✅ | Set to `true` to enable |
|
|
216
|
+
| `GITLAB_API_URL` | ✅ | GitLab API base URL |
|
|
217
|
+
| `GITLAB_OAUTH_APP_ID` | ✅ | GitLab OAuth Application ID |
|
|
218
|
+
| `MCP_SERVER_URL` | ✅ | Public HTTPS URL of this MCP server |
|
|
219
|
+
| `STREAMABLE_HTTP` | ✅ | Must be `true` |
|
|
220
|
+
| `GITLAB_OAUTH_CALLBACK_PROXY` | optional | Set to `true` to use the MCP server's fixed `/callback` URL |
|
|
221
|
+
| `GITLAB_OAUTH_SCOPES` | optional | Comma-separated scopes (default: `api,read_api,read_user`) |
|
|
217
222
|
| `GITLAB_OAUTH_ALLOWED_GROUPS` | optional | Comma-separated group full paths — only members (and subgroup members) may obtain a token (replaces deprecated `GITLAB_ALLOWED_GROUPS`) |
|
|
218
223
|
|
|
219
224
|
When `STREAMABLE_HTTP=true`, server-side `GITLAB_PERSONAL_ACCESS_TOKEN` or `GITLAB_JOB_TOKEN` require `REMOTE_AUTHORIZATION=true` or `GITLAB_MCP_OAUTH=true`.
|
|
@@ -266,14 +271,14 @@ the token to GitLab on behalf of the caller.
|
|
|
266
271
|
|
|
267
272
|
**Header priority**: `Private-Token` > `JOB-TOKEN` > `Authorization: Bearer`
|
|
268
273
|
|
|
269
|
-
| Environment Variable
|
|
270
|
-
|
|
|
271
|
-
| `REMOTE_AUTHORIZATION`
|
|
272
|
-
| `STREAMABLE_HTTP`
|
|
273
|
-
| `ENABLE_DYNAMIC_API_URL`
|
|
274
|
-
| `GITLAB_ALLOWED_HOSTS`
|
|
275
|
-
| `GITLAB_ALLOW_UNAUTHENTICATED_TOOL_DISCOVERY` | optional | Allow unauthenticated `initialize`, `notifications/initialized`, and `tools/list` only (tool calls still require auth)
|
|
276
|
-
| `MCP_TRUST_PROXY`
|
|
274
|
+
| Environment Variable | Required | Description |
|
|
275
|
+
| --------------------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------- |
|
|
276
|
+
| `REMOTE_AUTHORIZATION` | ✅ | Set to `true` to enable |
|
|
277
|
+
| `STREAMABLE_HTTP` | ✅ | Must be `true` |
|
|
278
|
+
| `ENABLE_DYNAMIC_API_URL` | optional | Allow per-request GitLab URL via `X-GitLab-API-URL` header |
|
|
279
|
+
| `GITLAB_ALLOWED_HOSTS` | optional | Comma-separated allowed `X-GitLab-API-URL` hosts; `GITLAB_API_URL` hosts are always allowed |
|
|
280
|
+
| `GITLAB_ALLOW_UNAUTHENTICATED_TOOL_DISCOVERY` | optional | Allow unauthenticated `initialize`, `notifications/initialized`, and `tools/list` only (tool calls still require auth) |
|
|
281
|
+
| `MCP_TRUST_PROXY` | optional | Trust `Forwarded` / `X-Forwarded-*` headers behind a reverse proxy (download URLs, Express `req.ip`, OAuth rate limits) |
|
|
277
282
|
|
|
278
283
|
`GITLAB_ALLOW_UNAUTHENTICATED_TOOL_DISCOVERY=true` is intended for MCP gateways
|
|
279
284
|
or admin UIs that need to inspect tool metadata before a user provides a GitLab
|
package/README.zh-CN.md
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
- 客户端设置友好:提供 Claude Code、Codex、Antigravity、OpenCode、Copilot、Cline、Roo Code、Cursor、Kilo Code 和 Amp Code 示例
|
|
21
21
|
- 适合自托管:支持自定义 GitLab 实例、代理设置和动态 API URL 路由
|
|
22
22
|
|
|
23
|
-
快速开始:在下面选择 Personal Access Token 或 OAuth2
|
|
23
|
+
快速开始:在下面选择 Personal Access Token 或 OAuth2 设置,安装 `@zereight/mcp-gitlab`,并在 MCP 客户端配置中使用 `zereight-mcp-gitlab`。
|
|
24
24
|
|
|
25
25
|
### 客户端设置指南
|
|
26
26
|
|
|
@@ -63,6 +63,16 @@
|
|
|
63
63
|
|
|
64
64
|
最简单的本地设置可以从 Personal Access Token 开始。基于浏览器的本地认证使用 OAuth2。远程或多用户部署请继续查看下面的 MCP OAuth 和远程授权部分。
|
|
65
65
|
|
|
66
|
+
先全局安装一次服务器:
|
|
67
|
+
|
|
68
|
+
```shell
|
|
69
|
+
npm install -g @zereight/mcp-gitlab
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
示例使用 `zereight-mcp-gitlab`,这是比旧的 `mcp-gitlab` 更不容易冲突的别名。如果 MCP 客户端找不到它,请使用 `which zereight-mcp-gitlab` 输出的绝对路径。
|
|
73
|
+
|
|
74
|
+
如果不想全局安装,请固定 `npx` 版本,例如 `npx -y @zereight/mcp-gitlab@2.1.27`。
|
|
75
|
+
|
|
66
76
|
#### 使用 CLI 参数(适用于环境变量有问题的客户端)
|
|
67
77
|
|
|
68
78
|
部分 MCP 客户端(例如 GitHub Copilot CLI)可能难以处理环境变量。可以改用 CLI 参数。
|
|
@@ -71,13 +81,8 @@
|
|
|
71
81
|
{
|
|
72
82
|
"mcpServers": {
|
|
73
83
|
"gitlab": {
|
|
74
|
-
"command": "
|
|
75
|
-
"args": [
|
|
76
|
-
"-y",
|
|
77
|
-
"@zereight/mcp-gitlab",
|
|
78
|
-
"--token=YOUR_GITLAB_TOKEN",
|
|
79
|
-
"--api-url=https://gitlab.com/api/v4"
|
|
80
|
-
],
|
|
84
|
+
"command": "zereight-mcp-gitlab",
|
|
85
|
+
"args": ["--token=YOUR_GITLAB_TOKEN", "--api-url=https://gitlab.com/api/v4"],
|
|
81
86
|
"tools": ["*"]
|
|
82
87
|
}
|
|
83
88
|
}
|
|
@@ -178,16 +183,16 @@ OpenCode、MCPJam、Claude.ai 等远程 MCP 客户端可能会在授权时发送
|
|
|
178
183
|
2. 预先注册的 GitLab OAuth 应用,包含 `api` 或 `read_api` scopes
|
|
179
184
|
— 前往 `Admin area` → `Applications`,将 Redirect URI 设置为 `{MCP_SERVER_URL}/callback`
|
|
180
185
|
|
|
181
|
-
| 环境变量 | 必需 | 说明
|
|
182
|
-
| ----------------------------- | ---- |
|
|
183
|
-
| `GITLAB_MCP_OAUTH` | 是 | 设置为 `true` 以启用
|
|
184
|
-
| `GITLAB_API_URL` | 是 | GitLab API base URL
|
|
185
|
-
| `GITLAB_OAUTH_APP_ID` | 是 | GitLab OAuth Application ID
|
|
186
|
-
| `MCP_SERVER_URL` | 是 | 此 MCP 服务器的公开 HTTPS URL
|
|
187
|
-
| `STREAMABLE_HTTP` | 是 | 必须为 `true`
|
|
188
|
-
| `GITLAB_OAUTH_CALLBACK_PROXY` | 可选 | 设置为 `true` 时使用 MCP 服务器固定的 `/callback` URL
|
|
189
|
-
| `GITLAB_OAUTH_SCOPES` | 可选 | 逗号分隔的 scope(默认:`api,read_api,read_user`)
|
|
190
|
-
| `GITLAB_OAUTH_ALLOWED_GROUPS` | 可选 | 逗号分隔的 GitLab 群组完整路径 — 仅该群组及其子群组的成员可获取令牌(替代已废弃的 `GITLAB_ALLOWED_GROUPS
|
|
186
|
+
| 环境变量 | 必需 | 说明 |
|
|
187
|
+
| ----------------------------- | ---- | ----------------------------------------------------------------------------------------------------------- |
|
|
188
|
+
| `GITLAB_MCP_OAUTH` | 是 | 设置为 `true` 以启用 |
|
|
189
|
+
| `GITLAB_API_URL` | 是 | GitLab API base URL |
|
|
190
|
+
| `GITLAB_OAUTH_APP_ID` | 是 | GitLab OAuth Application ID |
|
|
191
|
+
| `MCP_SERVER_URL` | 是 | 此 MCP 服务器的公开 HTTPS URL |
|
|
192
|
+
| `STREAMABLE_HTTP` | 是 | 必须为 `true` |
|
|
193
|
+
| `GITLAB_OAUTH_CALLBACK_PROXY` | 可选 | 设置为 `true` 时使用 MCP 服务器固定的 `/callback` URL |
|
|
194
|
+
| `GITLAB_OAUTH_SCOPES` | 可选 | 逗号分隔的 scope(默认:`api,read_api,read_user`) |
|
|
195
|
+
| `GITLAB_OAUTH_ALLOWED_GROUPS` | 可选 | 逗号分隔的 GitLab 群组完整路径 — 仅该群组及其子群组的成员可获取令牌(替代已废弃的 `GITLAB_ALLOWED_GROUPS`) |
|
|
191
196
|
|
|
192
197
|
> **排查 `Unregistered redirect_uri`**
|
|
193
198
|
>
|
|
@@ -238,7 +243,7 @@ MCP 客户端配置:
|
|
|
238
243
|
| `REMOTE_AUTHORIZATION` | 是 | 设置为 `true` 以启用 |
|
|
239
244
|
| `STREAMABLE_HTTP` | 是 | 必须为 `true` |
|
|
240
245
|
| `ENABLE_DYNAMIC_API_URL` | 可选 | 允许按请求通过 `X-GitLab-API-URL` 请求头指定 GitLab URL |
|
|
241
|
-
| `GITLAB_ALLOWED_HOSTS`
|
|
246
|
+
| `GITLAB_ALLOWED_HOSTS` | 可选 | 逗号分隔的允许主机;`GITLAB_API_URL` 中的主机始终允许 |
|
|
242
247
|
|
|
243
248
|
**示例请求头:**
|
|
244
249
|
|
package/build/utils/schema.js
CHANGED
|
@@ -87,17 +87,48 @@ export const toJSONSchema = (schema) => {
|
|
|
87
87
|
return obj;
|
|
88
88
|
}
|
|
89
89
|
const fixedSchema = fixNullableOptional(jsonSchema, true);
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
90
|
+
// Flatten top-level anyOf/oneOf into a single object schema for Anthropic API compatibility.
|
|
91
|
+
// The Anthropic API rejects tool input_schema with top-level oneOf/allOf/anyOf.
|
|
92
|
+
for (const combiner of ["anyOf", "oneOf", "allOf"]) {
|
|
93
|
+
if (Array.isArray(fixedSchema[combiner])) {
|
|
94
|
+
const variants = fixedSchema[combiner].filter((item) => item?.type === "object" && item.properties);
|
|
95
|
+
if (variants.length > 0 && variants.length === fixedSchema[combiner].length) {
|
|
96
|
+
fixedSchema.type = "object";
|
|
97
|
+
fixedSchema.properties = fixedSchema.properties || {};
|
|
98
|
+
for (const variant of variants) {
|
|
99
|
+
for (const [key, value] of Object.entries(variant.properties)) {
|
|
100
|
+
if (!fixedSchema.properties[key]) {
|
|
101
|
+
fixedSchema.properties[key] = value;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// Compute required fields based on combiner semantics:
|
|
106
|
+
// - allOf: union (all schemas apply, so all requirements apply)
|
|
107
|
+
// - anyOf/oneOf: intersection (only shared requirements are universal)
|
|
108
|
+
const requiredSets = variants.map((v) => new Set(Array.isArray(v.required) ? v.required : []));
|
|
109
|
+
let mergedRequired;
|
|
110
|
+
if (combiner === "allOf") {
|
|
111
|
+
// Union: any field required in any variant is required
|
|
112
|
+
const all = new Set();
|
|
113
|
+
for (const s of requiredSets) {
|
|
114
|
+
for (const field of s)
|
|
115
|
+
all.add(field);
|
|
116
|
+
}
|
|
117
|
+
mergedRequired = [...all];
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
// Intersection: only fields required in ALL variants
|
|
121
|
+
mergedRequired = [...requiredSets[0]].filter(field => requiredSets.every((s) => s.has(field)));
|
|
122
|
+
}
|
|
123
|
+
if (mergedRequired.length > 0) {
|
|
124
|
+
const existing = new Set(Array.isArray(fixedSchema.required) ? fixedSchema.required : []);
|
|
125
|
+
for (const field of mergedRequired) {
|
|
126
|
+
existing.add(field);
|
|
127
|
+
}
|
|
128
|
+
fixedSchema.required = [...existing];
|
|
129
|
+
}
|
|
130
|
+
delete fixedSchema[combiner];
|
|
131
|
+
}
|
|
101
132
|
}
|
|
102
133
|
}
|
|
103
134
|
return fixedSchema;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zereight/mcp-gitlab",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.28",
|
|
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": [
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
"author": "zereight",
|
|
27
27
|
"type": "module",
|
|
28
28
|
"bin": {
|
|
29
|
-
"mcp-gitlab": "build/index.js"
|
|
29
|
+
"mcp-gitlab": "build/index.js",
|
|
30
|
+
"zereight-mcp-gitlab": "build/index.js"
|
|
30
31
|
},
|
|
31
32
|
"files": [
|
|
32
33
|
"build"
|
|
@@ -70,7 +71,7 @@
|
|
|
70
71
|
"format:check": "prettier --check \"**/*.{js,ts,json,md}\""
|
|
71
72
|
},
|
|
72
73
|
"dependencies": {
|
|
73
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
74
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
74
75
|
"@types/node-fetch": "^2.6.12",
|
|
75
76
|
"diff": "^9.0.0",
|
|
76
77
|
"express": "^5.1.0",
|