mcp-gitlab 0.23.0__tar.gz → 0.24.0__tar.gz
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.
- mcp_gitlab-0.24.0/.claude-plugin/plugin.json +35 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/.copier-answers.yml +1 -1
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/.github/workflows/link-check.yml +1 -1
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/.github/workflows/lint.yml +1 -1
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/.github/workflows/publish.yml +2 -2
- mcp_gitlab-0.24.0/.github/workflows/reconcile.yml +15 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/.github/workflows/release.yml +1 -1
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/.github/workflows/tests.yml +1 -1
- mcp_gitlab-0.24.0/.mcp.json +15 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/AGENTS.md +44 -6
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/CHANGELOG.md +13 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/PKG-INFO +70 -1
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/README.md +69 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/gemini-extension.json +8 -2
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/llms-full.txt +1 -1
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/llms.txt +1 -1
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/pyproject.toml +1 -1
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/server.json +9 -2
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/src/mcp_gitlab/__init__.py +13 -1
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/src/mcp_gitlab/servers/gitlab.py +75 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/tests/conftest.py +5 -3
- mcp_gitlab-0.24.0/tests/unit/test_health.py +30 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/tests/unit/test_read_only_lock.py +19 -3
- mcp_gitlab-0.24.0/tests/unit/test_toolsets.py +192 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/uv.lock +1 -1
- mcp_gitlab-0.23.0/.github/workflows/reconcile.yml +0 -15
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/.dockerignore +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/.env.example +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/.github/dependabot.yml +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/.gitignore +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/Dockerfile +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/LICENSE +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/assets/icon.svg +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/docs/oauth.md +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/docs/specs/2026-09-21-test-confidence-and-error-contract.md +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/evaluations/eval.xml +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/glama.json +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/ruff.toml +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/src/mcp_gitlab/__main__.py +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/src/mcp_gitlab/client.py +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/src/mcp_gitlab/config.py +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/src/mcp_gitlab/exceptions.py +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/src/mcp_gitlab/local_auth.py +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/src/mcp_gitlab/oauth.py +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/src/mcp_gitlab/py.typed +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/src/mcp_gitlab/resources/approval-workflow.md +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/src/mcp_gitlab/resources/code-review.md +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/src/mcp_gitlab/resources/codeowners.md +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/src/mcp_gitlab/resources/conventional-commits.md +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/src/mcp_gitlab/resources/git-workflow.md +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/src/mcp_gitlab/resources/gitlab-ci.md +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/src/mcp_gitlab/resources/mr-hygiene.md +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/src/mcp_gitlab/resources/prompts/approve-mr.md +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/src/mcp_gitlab/resources/prompts/diagnose-pipeline.md +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/src/mcp_gitlab/resources/prompts/prepare-release.md +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/src/mcp_gitlab/resources/prompts/review-mr.md +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/src/mcp_gitlab/resources/prompts/setup-branch-protection.md +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/src/mcp_gitlab/resources/prompts/triage-issues.md +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/src/mcp_gitlab/servers/__init__.py +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/src/mcp_gitlab/servers/_helpers.py +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/src/mcp_gitlab/servers/prompts.py +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/src/mcp_gitlab/servers/resources.py +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/tests/__init__.py +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/tests/test_links.py +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/tests/unit/__init__.py +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/tests/unit/test_cli.py +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/tests/unit/test_client.py +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/tests/unit/test_config.py +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/tests/unit/test_exceptions.py +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/tests/unit/test_local_auth.py +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/tests/unit/test_oauth.py +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/tests/unit/test_oauth_http.py +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/tests/unit/test_prompts.py +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/tests/unit/test_resources.py +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/tests/unit/test_server_assembly.py +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/tests/unit/test_tool_contract.py +0 -0
- {mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/tests/unit/test_tools.py +0 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mcp-gitlab",
|
|
3
|
+
"displayName": "GitLab",
|
|
4
|
+
"version": "0.24.0",
|
|
5
|
+
"description": "GitLab MCP server (MCP 2026-07-28): projects, MRs, pipelines, CI/CD, issues; writes or read-only",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "vish288"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://vish288.github.io/mcp-install?server=mcp-gitlab",
|
|
10
|
+
"repository": "https://github.com/vish288/mcp-gitlab",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"userConfig": {
|
|
13
|
+
"gitlab_token": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"title": "GITLAB_TOKEN",
|
|
16
|
+
"description": "GitLab personal access token (token mode). Optional after `mcp-gitlab auth login`; also accepts GITLAB_PAT, GITLAB_PERSONAL_ACCESS_TOKEN, GITLAB_API_TOKEN",
|
|
17
|
+
"required": false,
|
|
18
|
+
"sensitive": true
|
|
19
|
+
},
|
|
20
|
+
"gitlab_url": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"title": "GITLAB_URL",
|
|
23
|
+
"description": "GitLab instance URL (e.g. https://gitlab.com)",
|
|
24
|
+
"required": true,
|
|
25
|
+
"sensitive": false
|
|
26
|
+
},
|
|
27
|
+
"mcp_read_only": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"title": "MCP_READ_ONLY",
|
|
30
|
+
"description": "Locks the server read-only: write tools and write-workflow prompts are not listed and nothing lifts the lock at runtime. Shared name across the mcp-* servers; set it in the deployer's env",
|
|
31
|
+
"required": false,
|
|
32
|
+
"sensitive": false
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -30,7 +30,7 @@ permissions: {}
|
|
|
30
30
|
|
|
31
31
|
jobs:
|
|
32
32
|
prepare:
|
|
33
|
-
uses: vish288/.github/.github/workflows/publish-prepare.yml@
|
|
33
|
+
uses: vish288/.github/.github/workflows/publish-prepare.yml@32162d0f696f22bb25ba61c0d9f74ea4d5c5b8a7 # v1.5.0
|
|
34
34
|
with:
|
|
35
35
|
dry_run: ${{ inputs.dry_run }}
|
|
36
36
|
permissions:
|
|
@@ -68,7 +68,7 @@ jobs:
|
|
|
68
68
|
finish:
|
|
69
69
|
needs: [prepare, pypi]
|
|
70
70
|
if: ${{ !cancelled() && !inputs.dry_run && (needs.prepare.outputs.pypi == 'done' || needs.pypi.result == 'success') }}
|
|
71
|
-
uses: vish288/.github/.github/workflows/publish-finish.yml@
|
|
71
|
+
uses: vish288/.github/.github/workflows/publish-finish.yml@32162d0f696f22bb25ba61c0d9f74ea4d5c5b8a7 # v1.5.0
|
|
72
72
|
with:
|
|
73
73
|
dry_run: ${{ inputs.dry_run }}
|
|
74
74
|
fail_at: ${{ inputs.fail_at }}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
name: Reconcile releases
|
|
2
|
+
# Stub -> vish288/.github.
|
|
3
|
+
on:
|
|
4
|
+
schedule:
|
|
5
|
+
- cron: "23 */6 * * *"
|
|
6
|
+
workflow_run: # zizmor: ignore[dangerous-triggers] only retries this repo's own failed Publish run; never checks out PR head or untrusted code
|
|
7
|
+
workflows: [Publish]
|
|
8
|
+
types: [completed]
|
|
9
|
+
workflow_dispatch:
|
|
10
|
+
jobs:
|
|
11
|
+
reconcile:
|
|
12
|
+
uses: vish288/.github/.github/workflows/reconcile.yml@32162d0f696f22bb25ba61c0d9f74ea4d5c5b8a7 # v1.5.0
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
actions: write
|
|
@@ -27,7 +27,7 @@ on:
|
|
|
27
27
|
default: none
|
|
28
28
|
jobs:
|
|
29
29
|
release:
|
|
30
|
-
uses: vish288/.github/.github/workflows/release.yml@
|
|
30
|
+
uses: vish288/.github/.github/workflows/release.yml@32162d0f696f22bb25ba61c0d9f74ea4d5c5b8a7 # v1.5.0
|
|
31
31
|
with:
|
|
32
32
|
bump: ${{ inputs.bump }}
|
|
33
33
|
version: ${{ inputs.version }}
|
|
@@ -5,6 +5,6 @@ permissions:
|
|
|
5
5
|
contents: read
|
|
6
6
|
jobs:
|
|
7
7
|
test:
|
|
8
|
-
uses: vish288/.github/.github/workflows/tests.yml@
|
|
8
|
+
uses: vish288/.github/.github/workflows/tests.yml@32162d0f696f22bb25ba61c0d9f74ea4d5c5b8a7 # v1.5.0
|
|
9
9
|
with:
|
|
10
10
|
coverage_min: 98
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mcpServers": {
|
|
3
|
+
"gitlab": {
|
|
4
|
+
"command": "uvx",
|
|
5
|
+
"args": [
|
|
6
|
+
"mcp-gitlab@0.24.0"
|
|
7
|
+
],
|
|
8
|
+
"env": {
|
|
9
|
+
"GITLAB_TOKEN": "${user_config.gitlab_token}",
|
|
10
|
+
"GITLAB_URL": "${user_config.gitlab_url}",
|
|
11
|
+
"MCP_READ_ONLY": "${user_config.mcp_read_only}"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -21,6 +21,15 @@ GitLab tokens). The auth MUSTs are covered by in-process HTTP tests in `tests/un
|
|
|
21
21
|
not by a CI conformance job: the MCP conformance suite has no server-side auth scenarios (`auth/*`
|
|
22
22
|
are client scenarios), so a conformance job cannot prove them.
|
|
23
23
|
|
|
24
|
+
## Observability
|
|
25
|
+
|
|
26
|
+
HTTP transports expose `GET /health` (a `@mcp.custom_route` in `servers/gitlab.py`): an
|
|
27
|
+
unauthenticated liveness probe returning `{"status", "name", "version"}` and nothing else —
|
|
28
|
+
FastMCP's auth guards `/mcp`, not custom routes, so it carries no config or secrets. FastMCP 4
|
|
29
|
+
emits OpenTelemetry spans for `tools/call` and propagates trace context by default;
|
|
30
|
+
`OTEL_EXPORTER_OTLP_ENDPOINT` with `opentelemetry-instrument` exports them, and
|
|
31
|
+
`FASTMCP_TELEMETRY_MODE=off` disables it. Tested via `httpx.ASGITransport(mcp.http_app())`.
|
|
32
|
+
|
|
24
33
|
## Architecture
|
|
25
34
|
|
|
26
35
|
- **Entry point**: `src/mcp_gitlab/__init__.py` — click CLI, loads `.env` via python-dotenv, runs the FastMCP server
|
|
@@ -60,7 +69,7 @@ pushed to a registry.
|
|
|
60
69
|
- Errors: expected failures are `isError: true` results whose text content is the `{"error", "status_code"?, "body"?, "hint"?}` object and which set no `structuredContent` (a strict client — the TS MCP SDK — validates `structuredContent` against the tool's output schema even on an error, and the schema rejects the error body); bugs are `isError: true` with `TypeName: message` text and no `structuredContent`, logged with a traceback
|
|
61
70
|
- `_slim_pipeline` / `_slim_job` trim pipeline and job payloads; tools expose `slim=True` by default
|
|
62
71
|
- Write access control: a truthy `MCP_READ_ONLY` / `GITLAB_READ_ONLY` locks the server read-only — `_lock_read_only` hides the write tools from `tools/list`, and `_check_write(ctx)` (via `@tool_result(write=True)`, or inline in `gitlab_merge_mr_sequence`) raises `GitLabWriteDisabledError` as defence in depth (see Read-only mode)
|
|
63
|
-
- Tags: every tool tagged
|
|
72
|
+
- Tags: every tool tagged `{"gitlab", "<category>", "read"|"write"}`; five MR tools also carry a second domain tag (`list_mr_pipelines`, `list_mr_commits`, `approve_mr`, `unapprove_mr`, `get_mr_approvals`), which is why they are listed in two toolset groups
|
|
64
73
|
- Parameters use `Annotated[type, Field(description=...)]`
|
|
65
74
|
- Client auth is a per-request header: `PRIVATE-TOKEN` in token mode, `Bearer` from `get_access_token()` in oauth mode. `GitLabClient.with_bearer(token)` returns a shallow copy that shares the connection pool but swaps the auth header. The shared `httpx.AsyncClient` uses a cookie jar that rejects every cookie (empty-`allowed_domains` policy) so a `Set-Cookie` from GitLab is never stored on the shared client and replayed on another user's request
|
|
66
75
|
- `GitLabClient._send` is the one send path for every verb. With stored local-sign-in credentials it sets a `Bearer` header from `LocalCredentials.bearer()` (proactive refresh within a 300 s margin) and, on a 401, refreshes once and retries; refresh failure raises `GitLabAuthError` rather than looping
|
|
@@ -101,10 +110,12 @@ sources (any locking one wins; a falsy value never unlocks and logs a WARNING; a
|
|
|
101
110
|
value fails closed), and the lifespan calls `_lock_read_only(server)`, which
|
|
102
111
|
`server.disable(tags={"write"})` so write tools and write-workflow prompts drop out of
|
|
103
112
|
`tools/list`/`prompts/list` and `tools/call` on them returns "Unknown tool". The lock is
|
|
104
|
-
computed once and never cleared; `
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
113
|
+
computed once and never cleared; the only `enable` call in `src/` is the `MCP_TOOLSETS`
|
|
114
|
+
allowlist (`_apply_toolsets`), which runs before the lock and never names the `write` tag, so
|
|
115
|
+
the lock stays the last word. The lock is unconditional on auth mode (oauth also hides by
|
|
116
|
+
tag); the per-user `read_api` scope refusal in `_check_write` stays call-time. Every write
|
|
117
|
+
tool MUST still call `_check_write(ctx)` (via `@tool_result(write=True)`, or inline as
|
|
118
|
+
`gitlab_merge_mr_sequence` does) as defence in depth.
|
|
108
119
|
|
|
109
120
|
### Naming convention
|
|
110
121
|
- Pattern: `gitlab_{verb}_{resource}` (snake_case)
|
|
@@ -135,6 +146,32 @@ unconditional on auth mode (oauth also hides by tag); the per-user `read_api` sc
|
|
|
135
146
|
The table counts the share/unshare tools under Groups, not Projects. There is no `gitlab_list_jobs` —
|
|
136
147
|
get job IDs from `gitlab_get_pipeline(..., include_jobs=True)`.
|
|
137
148
|
|
|
149
|
+
### Tool surface (MCP_TOOLSETS)
|
|
150
|
+
|
|
151
|
+
`MCP_TOOLSETS` (or `--toolsets`) switches `tools/list` to an allowlist of coarse groups — named
|
|
152
|
+
sets of the raw domain tags the tools already carry — so a client with a tool budget sees fewer.
|
|
153
|
+
Resources and prompts stay listed regardless (fastmcp `enable(components=...)` re-lists them after
|
|
154
|
+
the `enable(tags=..., only=True)` allowlist), and the read-only lock runs after the allowlist so it
|
|
155
|
+
only ever removes more tools. Unset or `all` lists every tool; an unknown name exits 2.
|
|
156
|
+
|
|
157
|
+
| Group | Raw tags | Tools | Read-only |
|
|
158
|
+
|---|---|---|---|
|
|
159
|
+
| `code` | files, branches, commits | 12 | 9 |
|
|
160
|
+
| `review` | merge_requests, notes, discussions, review | 29 | 9 |
|
|
161
|
+
| `ci` | pipelines, jobs, variables | 18 | 6 |
|
|
162
|
+
| `issues` | issues | 5 | 2 |
|
|
163
|
+
| `release` | tags, releases | 9 | 4 |
|
|
164
|
+
| `admin` | projects, groups, approvals | 23 | 7 |
|
|
165
|
+
| `all` (default) | every tag | 91 | 34 |
|
|
166
|
+
|
|
167
|
+
The map is `TOOLSET_GROUPS` in `servers/gitlab.py`; `_apply_toolsets` runs in the lifespan before
|
|
168
|
+
`_lock_read_only`. Five tools carry two domain tags and are listed in both groups:
|
|
169
|
+
`gitlab_list_mr_commits` (code, review), `gitlab_list_mr_pipelines` (review, ci), and
|
|
170
|
+
`gitlab_approve_mr` / `gitlab_unapprove_mr` / `gitlab_get_mr_approvals` (review, admin). A test
|
|
171
|
+
asserts every raw domain tag belongs to exactly one group and only those five tools carry two.
|
|
172
|
+
`review,ci` (46) and `code,review` (40) reach or pass Cursor's 40-tool warning; every single group
|
|
173
|
+
stays under it.
|
|
174
|
+
|
|
138
175
|
## Common Workflows
|
|
139
176
|
|
|
140
177
|
- **Code review**: `gitlab_list_mrs` → `gitlab_mr_changes` → `gitlab_list_mr_discussions` → `gitlab_add_mr_note` or `gitlab_create_mr_discussion` → `gitlab_resolve_discussion`
|
|
@@ -168,6 +205,7 @@ plus an assistant acknowledgment.
|
|
|
168
205
|
| token (see below) | yes, unless signed in via `mcp-gitlab auth login` | — | Personal access token, OAuth2 token, or `$CI_JOB_TOKEN` |
|
|
169
206
|
| `GITLAB_READ_ONLY` | no | `false` | Truthy (or unrecognised) locks the server read-only: the write tools are not listed and are refused before any API call |
|
|
170
207
|
| `MCP_READ_ONLY` | no | `false` | Same as `GITLAB_READ_ONLY`; shared name across the mcp-* servers. Either being truthy locks read-only, and nothing turns it off at runtime |
|
|
208
|
+
| `MCP_TOOLSETS` | no | all | Comma list of tool groups (`code`, `review`, `ci`, `issues`, `release`, `admin`); unset or `all` lists every tool. Validated at startup (unknown name exits 2); `MCP_READ_ONLY` applies after the selection |
|
|
171
209
|
| `GITLAB_TIMEOUT` | no | `30` | Request timeout in seconds |
|
|
172
210
|
| `GITLAB_SSL_VERIFY` | no | `true` | `false`/`0`/`no` skips verification — self-signed certs only |
|
|
173
211
|
| `GITLAB_AUTH` | no | `token` | `token` (PAT from env) or `oauth` (OAuth 2.1 proxy to GitLab; `streamable-http` only) |
|
|
@@ -184,7 +222,7 @@ The server reads the token from the first of `GITLAB_TOKEN`, `GITLAB_PAT`,
|
|
|
184
222
|
`read_api` for read-only deployments. The server never persists an env token. Stored OAuth
|
|
185
223
|
credentials live in `~/.config/mcp-gitlab/credentials.json`.
|
|
186
224
|
|
|
187
|
-
CLI flags override env: `--gitlab-url`, `--read-only`, plus
|
|
225
|
+
CLI flags override env: `--gitlab-url`, `--read-only`, `--toolsets`, plus
|
|
188
226
|
`--transport {stdio,sse,streamable-http}` with `--host` (default `127.0.0.1`) and `--port`
|
|
189
227
|
(default `8000`); host/port apply only to non-stdio transports (`--gitlab-token` is deprecated
|
|
190
228
|
and hidden from `--help`; it still works and warns on stderr — set `GITLAB_TOKEN` instead). The
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.24.0] - 2026-11-10
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
- feat(http): /health route (1d684d3)
|
|
7
|
+
- feat(config): MCP_TOOLSETS (9dc1fb0)
|
|
8
|
+
|
|
9
|
+
### Documentation
|
|
10
|
+
- docs: Claude Code plugin install (509128a)
|
|
11
|
+
|
|
12
|
+
### Chores
|
|
13
|
+
- chore(fleet): template v1.5.0 (991a28c)
|
|
14
|
+
|
|
15
|
+
|
|
3
16
|
## [0.23.0] - 2026-11-09
|
|
4
17
|
|
|
5
18
|
### Features
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: mcp-gitlab
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.24.0
|
|
4
4
|
Summary: GitLab MCP server for the MCP 2026-07-28 specification (MCP 2.0): projects, MRs, pipelines, CI/CD, approvals and issues for AI assistants. Runs with writes, or locked read-only via MCP_READ_ONLY
|
|
5
5
|
Project-URL: Homepage, https://github.com/vish288/mcp-gitlab
|
|
6
6
|
Project-URL: Repository, https://github.com/vish288/mcp-gitlab
|
|
@@ -61,6 +61,13 @@ MCP_READ_ONLY=true uvx mcp-gitlab # locked read-only: write tools are not
|
|
|
61
61
|
|
|
62
62
|
## 1-Click Installation
|
|
63
63
|
|
|
64
|
+
**Claude Code plugin** — one command adds the fleet marketplace, the next installs the server, prompts for `GITLAB_URL`/`GITLAB_TOKEN` (the token is stored in the credential store, never written to a config file) with an optional `MCP_READ_ONLY` toggle, and keeps it updated:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
claude plugin marketplace add vish288/.github
|
|
68
|
+
claude plugin install mcp-gitlab@vish288-mcp
|
|
69
|
+
```
|
|
70
|
+
|
|
64
71
|
[](https://vish288.github.io/mcp-install?server=mcp-gitlab&install=cursor)
|
|
65
72
|
|
|
66
73
|
[](https://vish288.github.io/mcp-install?server=mcp-gitlab&install=vscode) [](https://vish288.github.io/mcp-install?server=mcp-gitlab&install=vscode-insiders)
|
|
@@ -162,11 +169,48 @@ Drop `MCP_READ_ONLY` to allow writes. On a shared or hosted server put it in the
|
|
|
162
169
|
| `GITLAB_TOKEN` | Yes, unless signed in with `mcp-gitlab auth login` | - | Authentication token (see below) |
|
|
163
170
|
| `MCP_READ_ONLY` | No | `false` | Shared name across the mcp-* servers. Any value other than `false`/`0`/`no`/`off`/empty locks the server read-only: the 57 write tools and write-workflow prompts are not listed, and nothing can turn it back off at runtime |
|
|
164
171
|
| `GITLAB_READ_ONLY` | No | `false` | Per-server alias for `MCP_READ_ONLY`; either one locks the server read-only. `--read-only` can only raise the lock |
|
|
172
|
+
| `MCP_TOOLSETS` | No | all | Comma list of tool groups to expose (see Toolsets); unset or `all` lists every tool. `MCP_READ_ONLY` still applies after the selection |
|
|
165
173
|
| `GITLAB_HTTP_BEARER_TOKEN` | No | - | Bearer token (min 16 chars) required to bind an HTTP transport to a non-loopback host; clients send `Authorization: Bearer <token>`; token mode only |
|
|
166
174
|
| `GITLAB_TIMEOUT` | No | `30` | Request timeout in seconds |
|
|
167
175
|
| `GITLAB_SSL_VERIFY` | No | `true` | Set to `false` to skip SSL verification |
|
|
168
176
|
| `GITLAB_AUTH` | No | `token` | `token` (PAT from env) or `oauth` (OAuth 2.1 proxy; see below) |
|
|
169
177
|
|
|
178
|
+
### Toolsets
|
|
179
|
+
|
|
180
|
+
Clients cap how many tools they forward: Cursor warns past **40 tools across all enabled
|
|
181
|
+
servers**. `MCP_TOOLSETS` (or `--toolsets`) shrinks `tools/list` to one or more named groups —
|
|
182
|
+
sets of the raw domain tags the tools already carry — so a single-job selection is cheap.
|
|
183
|
+
Unset or `all` lists every tool. Names are lowercase and comma-separated; an unknown name
|
|
184
|
+
exits 2 with the valid list. `MCP_READ_ONLY` still applies afterward and only ever removes
|
|
185
|
+
more tools (the read-only column).
|
|
186
|
+
|
|
187
|
+
| Group | Raw tags | Tools | Read-only |
|
|
188
|
+
|-------|----------|-------|-----------|
|
|
189
|
+
| `code` | files, branches, commits | 12 | 9 |
|
|
190
|
+
| `review` | merge_requests, notes, discussions, review | 29 | 9 |
|
|
191
|
+
| `ci` | pipelines, jobs, variables | 18 | 6 |
|
|
192
|
+
| `issues` | issues | 5 | 2 |
|
|
193
|
+
| `release` | tags, releases | 9 | 4 |
|
|
194
|
+
| `admin` | projects, groups, approvals | 23 | 7 |
|
|
195
|
+
| `all` (default) | every tag | 91 | 34 |
|
|
196
|
+
|
|
197
|
+
Five tools carry two domain tags, so they are listed in both of their groups:
|
|
198
|
+
`gitlab_list_mr_commits` (`code`, `review`), `gitlab_list_mr_pipelines` (`review`, `ci`), and
|
|
199
|
+
`gitlab_approve_mr` / `gitlab_unapprove_mr` / `gitlab_get_mr_approvals` (`review`, `admin`).
|
|
200
|
+
|
|
201
|
+
Every single group stays under 40, and so does `review,issues` (34). Two pairs do not, because
|
|
202
|
+
the shared tools are counted once each: **`review,ci` lists 46 tools** and **`code,review` lists
|
|
203
|
+
40**, so both reach or pass Cursor's 40-tool warning. Pick one group per job, or leave room for
|
|
204
|
+
your other servers.
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
MCP_TOOLSETS=review uvx mcp-gitlab # MR review: 29 tools
|
|
208
|
+
uvx mcp-gitlab --toolsets ci # pipelines, jobs, CI/CD variables: 18 tools
|
|
209
|
+
MCP_TOOLSETS=issues,release uvx mcp-gitlab
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Resources and prompts are unaffected by the selection.
|
|
213
|
+
|
|
170
214
|
### Supported Token Types
|
|
171
215
|
|
|
172
216
|
The server checks these environment variables in order — first match wins:
|
|
@@ -615,6 +659,9 @@ mcp-gitlab auth login|status|logout
|
|
|
615
659
|
|
|
616
660
|
# CLI overrides for config
|
|
617
661
|
GITLAB_TOKEN=glpat-xxx uvx mcp-gitlab --gitlab-url https://gitlab.example.com --read-only
|
|
662
|
+
|
|
663
|
+
# Expose only one job's tools (same as MCP_TOOLSETS=review); see Toolsets above
|
|
664
|
+
uvx mcp-gitlab --toolsets review
|
|
618
665
|
```
|
|
619
666
|
|
|
620
667
|
`--gitlab-token` still works but is deprecated and hidden from `--help`: it exposes the token to
|
|
@@ -631,6 +678,28 @@ The default `127.0.0.1` bind needs neither.
|
|
|
631
678
|
|
|
632
679
|
The server loads `.env` files from the working directory automatically via `python-dotenv`.
|
|
633
680
|
|
|
681
|
+
### Observability
|
|
682
|
+
|
|
683
|
+
An HTTP transport exposes `GET /health`, an unauthenticated liveness probe that returns the
|
|
684
|
+
server name and version (no config, no secrets) for container and load-balancer checks:
|
|
685
|
+
|
|
686
|
+
```bash
|
|
687
|
+
curl -s http://127.0.0.1:8000/health
|
|
688
|
+
# {"status":"ok","name":"GitLab MCP Server","version":"0.23.0"}
|
|
689
|
+
```
|
|
690
|
+
|
|
691
|
+
FastMCP emits OpenTelemetry spans for `tools/call` and propagates trace context by default — no
|
|
692
|
+
opt-in needed. Point it at a collector with the standard OTel environment and launch under the
|
|
693
|
+
auto-instrumentation wrapper:
|
|
694
|
+
|
|
695
|
+
```bash
|
|
696
|
+
OTEL_EXPORTER_OTLP_ENDPOINT=http://collector:4317 \
|
|
697
|
+
opentelemetry-instrument uvx mcp-gitlab --transport streamable-http --port 8000
|
|
698
|
+
```
|
|
699
|
+
|
|
700
|
+
Set `FASTMCP_TELEMETRY_MODE=off` to disable tracing entirely (`propagation_only` keeps trace-context
|
|
701
|
+
propagation without emitting spans).
|
|
702
|
+
|
|
634
703
|
## Docker
|
|
635
704
|
|
|
636
705
|
A minimal non-root image builds straight from this repo (uv, the committed `uv.lock`). The image
|
|
@@ -26,6 +26,13 @@ MCP_READ_ONLY=true uvx mcp-gitlab # locked read-only: write tools are not
|
|
|
26
26
|
|
|
27
27
|
## 1-Click Installation
|
|
28
28
|
|
|
29
|
+
**Claude Code plugin** — one command adds the fleet marketplace, the next installs the server, prompts for `GITLAB_URL`/`GITLAB_TOKEN` (the token is stored in the credential store, never written to a config file) with an optional `MCP_READ_ONLY` toggle, and keeps it updated:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
claude plugin marketplace add vish288/.github
|
|
33
|
+
claude plugin install mcp-gitlab@vish288-mcp
|
|
34
|
+
```
|
|
35
|
+
|
|
29
36
|
[](https://vish288.github.io/mcp-install?server=mcp-gitlab&install=cursor)
|
|
30
37
|
|
|
31
38
|
[](https://vish288.github.io/mcp-install?server=mcp-gitlab&install=vscode) [](https://vish288.github.io/mcp-install?server=mcp-gitlab&install=vscode-insiders)
|
|
@@ -127,11 +134,48 @@ Drop `MCP_READ_ONLY` to allow writes. On a shared or hosted server put it in the
|
|
|
127
134
|
| `GITLAB_TOKEN` | Yes, unless signed in with `mcp-gitlab auth login` | - | Authentication token (see below) |
|
|
128
135
|
| `MCP_READ_ONLY` | No | `false` | Shared name across the mcp-* servers. Any value other than `false`/`0`/`no`/`off`/empty locks the server read-only: the 57 write tools and write-workflow prompts are not listed, and nothing can turn it back off at runtime |
|
|
129
136
|
| `GITLAB_READ_ONLY` | No | `false` | Per-server alias for `MCP_READ_ONLY`; either one locks the server read-only. `--read-only` can only raise the lock |
|
|
137
|
+
| `MCP_TOOLSETS` | No | all | Comma list of tool groups to expose (see Toolsets); unset or `all` lists every tool. `MCP_READ_ONLY` still applies after the selection |
|
|
130
138
|
| `GITLAB_HTTP_BEARER_TOKEN` | No | - | Bearer token (min 16 chars) required to bind an HTTP transport to a non-loopback host; clients send `Authorization: Bearer <token>`; token mode only |
|
|
131
139
|
| `GITLAB_TIMEOUT` | No | `30` | Request timeout in seconds |
|
|
132
140
|
| `GITLAB_SSL_VERIFY` | No | `true` | Set to `false` to skip SSL verification |
|
|
133
141
|
| `GITLAB_AUTH` | No | `token` | `token` (PAT from env) or `oauth` (OAuth 2.1 proxy; see below) |
|
|
134
142
|
|
|
143
|
+
### Toolsets
|
|
144
|
+
|
|
145
|
+
Clients cap how many tools they forward: Cursor warns past **40 tools across all enabled
|
|
146
|
+
servers**. `MCP_TOOLSETS` (or `--toolsets`) shrinks `tools/list` to one or more named groups —
|
|
147
|
+
sets of the raw domain tags the tools already carry — so a single-job selection is cheap.
|
|
148
|
+
Unset or `all` lists every tool. Names are lowercase and comma-separated; an unknown name
|
|
149
|
+
exits 2 with the valid list. `MCP_READ_ONLY` still applies afterward and only ever removes
|
|
150
|
+
more tools (the read-only column).
|
|
151
|
+
|
|
152
|
+
| Group | Raw tags | Tools | Read-only |
|
|
153
|
+
|-------|----------|-------|-----------|
|
|
154
|
+
| `code` | files, branches, commits | 12 | 9 |
|
|
155
|
+
| `review` | merge_requests, notes, discussions, review | 29 | 9 |
|
|
156
|
+
| `ci` | pipelines, jobs, variables | 18 | 6 |
|
|
157
|
+
| `issues` | issues | 5 | 2 |
|
|
158
|
+
| `release` | tags, releases | 9 | 4 |
|
|
159
|
+
| `admin` | projects, groups, approvals | 23 | 7 |
|
|
160
|
+
| `all` (default) | every tag | 91 | 34 |
|
|
161
|
+
|
|
162
|
+
Five tools carry two domain tags, so they are listed in both of their groups:
|
|
163
|
+
`gitlab_list_mr_commits` (`code`, `review`), `gitlab_list_mr_pipelines` (`review`, `ci`), and
|
|
164
|
+
`gitlab_approve_mr` / `gitlab_unapprove_mr` / `gitlab_get_mr_approvals` (`review`, `admin`).
|
|
165
|
+
|
|
166
|
+
Every single group stays under 40, and so does `review,issues` (34). Two pairs do not, because
|
|
167
|
+
the shared tools are counted once each: **`review,ci` lists 46 tools** and **`code,review` lists
|
|
168
|
+
40**, so both reach or pass Cursor's 40-tool warning. Pick one group per job, or leave room for
|
|
169
|
+
your other servers.
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
MCP_TOOLSETS=review uvx mcp-gitlab # MR review: 29 tools
|
|
173
|
+
uvx mcp-gitlab --toolsets ci # pipelines, jobs, CI/CD variables: 18 tools
|
|
174
|
+
MCP_TOOLSETS=issues,release uvx mcp-gitlab
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Resources and prompts are unaffected by the selection.
|
|
178
|
+
|
|
135
179
|
### Supported Token Types
|
|
136
180
|
|
|
137
181
|
The server checks these environment variables in order — first match wins:
|
|
@@ -580,6 +624,9 @@ mcp-gitlab auth login|status|logout
|
|
|
580
624
|
|
|
581
625
|
# CLI overrides for config
|
|
582
626
|
GITLAB_TOKEN=glpat-xxx uvx mcp-gitlab --gitlab-url https://gitlab.example.com --read-only
|
|
627
|
+
|
|
628
|
+
# Expose only one job's tools (same as MCP_TOOLSETS=review); see Toolsets above
|
|
629
|
+
uvx mcp-gitlab --toolsets review
|
|
583
630
|
```
|
|
584
631
|
|
|
585
632
|
`--gitlab-token` still works but is deprecated and hidden from `--help`: it exposes the token to
|
|
@@ -596,6 +643,28 @@ The default `127.0.0.1` bind needs neither.
|
|
|
596
643
|
|
|
597
644
|
The server loads `.env` files from the working directory automatically via `python-dotenv`.
|
|
598
645
|
|
|
646
|
+
### Observability
|
|
647
|
+
|
|
648
|
+
An HTTP transport exposes `GET /health`, an unauthenticated liveness probe that returns the
|
|
649
|
+
server name and version (no config, no secrets) for container and load-balancer checks:
|
|
650
|
+
|
|
651
|
+
```bash
|
|
652
|
+
curl -s http://127.0.0.1:8000/health
|
|
653
|
+
# {"status":"ok","name":"GitLab MCP Server","version":"0.23.0"}
|
|
654
|
+
```
|
|
655
|
+
|
|
656
|
+
FastMCP emits OpenTelemetry spans for `tools/call` and propagates trace context by default — no
|
|
657
|
+
opt-in needed. Point it at a collector with the standard OTel environment and launch under the
|
|
658
|
+
auto-instrumentation wrapper:
|
|
659
|
+
|
|
660
|
+
```bash
|
|
661
|
+
OTEL_EXPORTER_OTLP_ENDPOINT=http://collector:4317 \
|
|
662
|
+
opentelemetry-instrument uvx mcp-gitlab --transport streamable-http --port 8000
|
|
663
|
+
```
|
|
664
|
+
|
|
665
|
+
Set `FASTMCP_TELEMETRY_MODE=off` to disable tracing entirely (`propagation_only` keeps trace-context
|
|
666
|
+
propagation without emitting spans).
|
|
667
|
+
|
|
599
668
|
## Docker
|
|
600
669
|
|
|
601
670
|
A minimal non-root image builds straight from this repo (uv, the committed `uv.lock`). The image
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-gitlab",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"description": "GitLab MCP server (MCP 2026-07-28): projects, MRs, pipelines, CI/CD, issues; writes or read-only",
|
|
5
5
|
"mcpServers": {
|
|
6
6
|
"mcp-gitlab": {
|
|
7
7
|
"command": "uvx",
|
|
8
8
|
"args": [
|
|
9
|
-
"mcp-gitlab@0.
|
|
9
|
+
"mcp-gitlab@0.24.0"
|
|
10
10
|
]
|
|
11
11
|
}
|
|
12
12
|
},
|
|
@@ -35,6 +35,12 @@
|
|
|
35
35
|
"required": false,
|
|
36
36
|
"sensitive": false
|
|
37
37
|
},
|
|
38
|
+
{
|
|
39
|
+
"name": "MCP_TOOLSETS",
|
|
40
|
+
"description": "Comma list of tool groups to expose (code, review, ci, issues, release, admin); unset or 'all' lists every tool. Shrinks tools/list for clients with a tool budget; MCP_READ_ONLY still applies after the selection",
|
|
41
|
+
"required": false,
|
|
42
|
+
"sensitive": false
|
|
43
|
+
},
|
|
38
44
|
{
|
|
39
45
|
"name": "GITLAB_AUTH",
|
|
40
46
|
"description": "Authentication mode: token (default) or oauth (OAuth 2.1 proxy; streamable-http only)",
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
MCP server that wraps the GitLab REST API. Works with GitLab.com and self-hosted instances (CE/EE). No GitLab Duo or Premium required. Built with FastMCP, httpx, and Pydantic.
|
|
6
6
|
|
|
7
7
|
- **Install**: `uvx mcp-gitlab`
|
|
8
|
-
- **Version**: 0.
|
|
8
|
+
- **Version**: 0.24.0
|
|
9
9
|
- **Python**: >=3.11
|
|
10
10
|
- **License**: MIT
|
|
11
11
|
- **Protocol**: MCP 2026-07-28 (MCP 2.0); compatible with 2025-11-25 clients; built on FastMCP 4.x
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
MCP server that wraps the GitLab REST API. Works with GitLab.com and self-hosted instances (CE/EE). No GitLab Duo or Premium required. Built with FastMCP, httpx, and Pydantic.
|
|
6
6
|
|
|
7
7
|
- **Install**: `uvx mcp-gitlab`
|
|
8
|
-
- **Version**: 0.
|
|
8
|
+
- **Version**: 0.24.0
|
|
9
9
|
- **Python**: >=3.11
|
|
10
10
|
- **License**: MIT
|
|
11
11
|
- **Protocol**: MCP 2026-07-28 (MCP 2.0); compatible with 2025-11-25 clients; built on FastMCP 4.x
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "mcp-gitlab"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.24.0"
|
|
4
4
|
description = "GitLab MCP server for the MCP 2026-07-28 specification (MCP 2.0): projects, MRs, pipelines, CI/CD, approvals and issues for AI assistants. Runs with writes, or locked read-only via MCP_READ_ONLY"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = {text = "MIT"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"url": "https://github.com/vish288/mcp-gitlab",
|
|
8
8
|
"source": "github"
|
|
9
9
|
},
|
|
10
|
-
"version": "0.
|
|
10
|
+
"version": "0.24.0",
|
|
11
11
|
"websiteUrl": "https://vish288.github.io/mcp-install?server=mcp-gitlab",
|
|
12
12
|
"icons": [
|
|
13
13
|
{
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
{
|
|
23
23
|
"registryType": "pypi",
|
|
24
24
|
"identifier": "mcp-gitlab",
|
|
25
|
-
"version": "0.
|
|
25
|
+
"version": "0.24.0",
|
|
26
26
|
"runtimeHint": "uvx",
|
|
27
27
|
"transport": {
|
|
28
28
|
"type": "stdio"
|
|
@@ -56,6 +56,13 @@
|
|
|
56
56
|
"format": "string",
|
|
57
57
|
"isSecret": false
|
|
58
58
|
},
|
|
59
|
+
{
|
|
60
|
+
"name": "MCP_TOOLSETS",
|
|
61
|
+
"description": "Comma list of tool groups to expose (code, review, ci, issues, release, admin); unset or 'all' lists every tool. Shrinks tools/list for clients with a tool budget; MCP_READ_ONLY still applies after the selection",
|
|
62
|
+
"isRequired": false,
|
|
63
|
+
"format": "string",
|
|
64
|
+
"isSecret": false
|
|
65
|
+
},
|
|
59
66
|
{
|
|
60
67
|
"name": "GITLAB_AUTH",
|
|
61
68
|
"description": "Authentication mode: token (default) or oauth (OAuth 2.1 proxy; streamable-http only)",
|
|
@@ -101,6 +101,12 @@ def _apply_token_http_auth(mcp: Any, host: str) -> None:
|
|
|
101
101
|
@click.option("--gitlab-url", envvar="GITLAB_URL", help="GitLab instance URL")
|
|
102
102
|
@click.option("--gitlab-token", hidden=True, help="Deprecated: set GITLAB_TOKEN instead")
|
|
103
103
|
@click.option("--read-only", is_flag=True, help="Disable write operations")
|
|
104
|
+
@click.option(
|
|
105
|
+
"--toolsets",
|
|
106
|
+
envvar="MCP_TOOLSETS",
|
|
107
|
+
help="Comma list of tool groups to expose "
|
|
108
|
+
"(code, review, ci, issues, release, admin; default: all)",
|
|
109
|
+
)
|
|
104
110
|
@click.option(
|
|
105
111
|
"--auth",
|
|
106
112
|
type=click.Choice(["token", "oauth"]),
|
|
@@ -117,6 +123,7 @@ def main(
|
|
|
117
123
|
gitlab_url: str | None,
|
|
118
124
|
gitlab_token: str | None,
|
|
119
125
|
read_only: bool,
|
|
126
|
+
toolsets: str | None,
|
|
120
127
|
auth: str,
|
|
121
128
|
) -> None:
|
|
122
129
|
"""Run the GitLab MCP server. Subcommands: auth."""
|
|
@@ -136,6 +143,10 @@ def main(
|
|
|
136
143
|
os.environ["GITLAB_TOKEN"] = gitlab_token
|
|
137
144
|
if read_only:
|
|
138
145
|
os.environ["GITLAB_READ_ONLY"] = "true"
|
|
146
|
+
# --toolsets writes the env the lifespan reads; validation happens below with the rest
|
|
147
|
+
# of the startup config so an unknown group is one clear line and exit 2.
|
|
148
|
+
if toolsets:
|
|
149
|
+
os.environ["MCP_TOOLSETS"] = toolsets
|
|
139
150
|
os.environ["GITLAB_AUTH"] = auth
|
|
140
151
|
|
|
141
152
|
if auth == "oauth" and transport != "streamable-http":
|
|
@@ -159,7 +170,7 @@ def main(
|
|
|
159
170
|
|
|
160
171
|
from .config import GitLabConfig
|
|
161
172
|
from .servers import prompts, resources # noqa: F401 — registers decorators
|
|
162
|
-
from .servers.gitlab import mcp
|
|
173
|
+
from .servers.gitlab import mcp, parse_toolsets
|
|
163
174
|
|
|
164
175
|
# Validate configuration before run_async so a bad config is one clear
|
|
165
176
|
# `Error:` line + exit 2, not a traceback from inside the lifespan (D7).
|
|
@@ -186,6 +197,7 @@ def main(
|
|
|
186
197
|
if signed_in:
|
|
187
198
|
cfg.credentials = _SIGNED_IN
|
|
188
199
|
cfg.validate()
|
|
200
|
+
parse_toolsets(os.getenv("MCP_TOOLSETS"))
|
|
189
201
|
except ValueError as e:
|
|
190
202
|
click.echo(f"Error: {e}", err=True)
|
|
191
203
|
ctx.exit(2)
|
|
@@ -7,6 +7,7 @@ import base64
|
|
|
7
7
|
import functools
|
|
8
8
|
import json
|
|
9
9
|
import logging
|
|
10
|
+
import os
|
|
10
11
|
import re
|
|
11
12
|
from collections.abc import AsyncIterator, Awaitable, Callable
|
|
12
13
|
from contextlib import asynccontextmanager
|
|
@@ -21,6 +22,8 @@ from fastmcp.server.dependencies import get_access_token
|
|
|
21
22
|
from fastmcp.tools import ToolResult
|
|
22
23
|
from mcp.types import Icon, TextContent
|
|
23
24
|
from pydantic import Field
|
|
25
|
+
from starlette.requests import Request
|
|
26
|
+
from starlette.responses import JSONResponse
|
|
24
27
|
|
|
25
28
|
from ..client import GitLabClient
|
|
26
29
|
from ..config import GitLabConfig, read_only_sources
|
|
@@ -84,6 +87,66 @@ def _lock_read_only(server: FastMCP, *, sources: list[str] | None = None) -> Non
|
|
|
84
87
|
_log.info("read-only: LOCKED%s — write tools and prompts hidden", named)
|
|
85
88
|
|
|
86
89
|
|
|
90
|
+
# MCP_TOOLSETS: coarse tool groups (workbench-backlog#160). A group is a named set of
|
|
91
|
+
# the raw domain tags the tools already carry; selecting one or more (MCP_TOOLSETS, a
|
|
92
|
+
# comma list, or --toolsets) switches tools/list to an allowlist of just those tools.
|
|
93
|
+
# The five tools that carry two domain tags stay listed in both of their groups: an
|
|
94
|
+
# MR's pipelines under `ci`, an MR's commits under `code`, and MR approval state under
|
|
95
|
+
# `admin` (approve_mr, unapprove_mr, get_mr_approvals). Unset or `all` lists every
|
|
96
|
+
# tool; MCP_READ_ONLY still applies after the allowlist and only ever removes tools.
|
|
97
|
+
TOOLSET_GROUPS: dict[str, frozenset[str]] = {
|
|
98
|
+
"code": frozenset({"files", "branches", "commits"}),
|
|
99
|
+
"review": frozenset({"merge_requests", "notes", "discussions", "review"}),
|
|
100
|
+
"ci": frozenset({"pipelines", "jobs", "variables"}),
|
|
101
|
+
"issues": frozenset({"issues"}),
|
|
102
|
+
"release": frozenset({"tags", "releases"}),
|
|
103
|
+
"admin": frozenset({"projects", "groups", "approvals"}),
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
class UnknownToolsetError(ValueError):
|
|
108
|
+
"""MCP_TOOLSETS named a group this server does not define."""
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def parse_toolsets(raw: str | None) -> set[str] | None:
|
|
112
|
+
"""Resolve MCP_TOOLSETS / --toolsets to the set of raw tags to allowlist.
|
|
113
|
+
|
|
114
|
+
None, empty/whitespace, or a list containing ``all`` returns ``None`` — no filtering,
|
|
115
|
+
every tool listed (today's default). Names are lowercase, comma-separated, trimmed. An
|
|
116
|
+
unknown name raises ``UnknownToolsetError`` naming the offenders and every valid group.
|
|
117
|
+
"""
|
|
118
|
+
if not raw or not raw.strip():
|
|
119
|
+
return None
|
|
120
|
+
names = [n.strip().lower() for n in raw.split(",") if n.strip()]
|
|
121
|
+
if not names or "all" in names:
|
|
122
|
+
return None
|
|
123
|
+
unknown = [n for n in names if n not in TOOLSET_GROUPS]
|
|
124
|
+
if unknown:
|
|
125
|
+
valid = ", ".join([*TOOLSET_GROUPS, "all"])
|
|
126
|
+
msg = f"Unknown MCP_TOOLSETS group(s): {', '.join(unknown)}. Valid groups: {valid}"
|
|
127
|
+
raise UnknownToolsetError(msg)
|
|
128
|
+
tags: set[str] = set()
|
|
129
|
+
for name in names:
|
|
130
|
+
tags |= TOOLSET_GROUPS[name]
|
|
131
|
+
return tags
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def _apply_toolsets(server: FastMCP, raw: str | None) -> None:
|
|
135
|
+
"""Allowlist tools for the selected toolsets, keeping every resource and prompt.
|
|
136
|
+
|
|
137
|
+
fastmcp 4.1.6: ``enable(tags=..., only=True)`` switches to allowlist mode over *all*
|
|
138
|
+
component types, so resources and prompts would vanish; the chained
|
|
139
|
+
``enable(components=...)`` re-lists every resource/template/prompt. This runs before the
|
|
140
|
+
read-only ``disable(tags={"write"})`` so the lock stays the last word — an allowlisted
|
|
141
|
+
group still carries its write tools until the lock removes them. A no-op when no toolset
|
|
142
|
+
is selected, so the default server is untouched.
|
|
143
|
+
"""
|
|
144
|
+
tags = parse_toolsets(raw)
|
|
145
|
+
if tags is None:
|
|
146
|
+
return
|
|
147
|
+
server.enable(tags=tags, only=True).enable(components={"resource", "template", "prompt"})
|
|
148
|
+
|
|
149
|
+
|
|
87
150
|
@asynccontextmanager
|
|
88
151
|
async def lifespan(server: FastMCP) -> AsyncIterator[dict[str, Any]]:
|
|
89
152
|
config = GitLabConfig.from_env()
|
|
@@ -96,6 +159,7 @@ async def lifespan(server: FastMCP) -> AsyncIterator[dict[str, Any]]:
|
|
|
96
159
|
config.validate()
|
|
97
160
|
pkg_version = version("mcp-gitlab")
|
|
98
161
|
_log.info("mcp-gitlab %s starting", pkg_version)
|
|
162
|
+
_apply_toolsets(server, os.getenv("MCP_TOOLSETS"))
|
|
99
163
|
if config.read_only:
|
|
100
164
|
_log.info("GitLab: %s", config.url)
|
|
101
165
|
_lock_read_only(server, sources=read_only_sources("GITLAB_READ_ONLY"))
|
|
@@ -136,6 +200,17 @@ mcp = FastMCP(
|
|
|
136
200
|
)
|
|
137
201
|
|
|
138
202
|
|
|
203
|
+
@mcp.custom_route("/health", methods=["GET"])
|
|
204
|
+
async def health(_request: Request) -> JSONResponse:
|
|
205
|
+
"""Unauthenticated liveness probe for container and remote (HTTP transport) deployments.
|
|
206
|
+
|
|
207
|
+
FastMCP's auth guards ``/mcp``, not custom routes, so this stays reachable with no
|
|
208
|
+
credentials; it returns only the server name and package version — no config, no
|
|
209
|
+
secrets, no upstream call.
|
|
210
|
+
"""
|
|
211
|
+
return JSONResponse({"status": "ok", "name": mcp.name, "version": version("mcp-gitlab")})
|
|
212
|
+
|
|
213
|
+
|
|
139
214
|
def _get_client(ctx: Context) -> GitLabClient:
|
|
140
215
|
client: GitLabClient = ctx.lifespan_context["client"]
|
|
141
216
|
if _get_config(ctx).auth != "oauth":
|
|
@@ -27,11 +27,13 @@ OAUTH_BASE = "http://localhost"
|
|
|
27
27
|
|
|
28
28
|
@pytest.fixture(autouse=True)
|
|
29
29
|
def _no_ambient_read_only(monkeypatch: pytest.MonkeyPatch) -> None:
|
|
30
|
-
"""The locked read-only switch
|
|
31
|
-
runner's environment (the suite must stay green with
|
|
32
|
-
|
|
30
|
+
"""The locked read-only switch and the toolset selection are deployer-set; no test
|
|
31
|
+
should inherit them from the runner's environment (the suite must stay green with
|
|
32
|
+
``MCP_READ_ONLY=true`` or ``MCP_TOOLSETS=review`` exported). Tests that exercise
|
|
33
|
+
either set the vars explicitly, which overrides this."""
|
|
33
34
|
monkeypatch.delenv("MCP_READ_ONLY", raising=False)
|
|
34
35
|
monkeypatch.delenv("GITLAB_READ_ONLY", raising=False)
|
|
36
|
+
monkeypatch.delenv("MCP_TOOLSETS", raising=False)
|
|
35
37
|
|
|
36
38
|
|
|
37
39
|
@pytest.fixture
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""/health liveness route (workbench-backlog#167).
|
|
2
|
+
|
|
3
|
+
A container or remote (HTTP transport) deployment needs an unauthenticated liveness URL.
|
|
4
|
+
FastMCP's auth guards ``/mcp``, not custom routes, so ``GET /health`` answers with the
|
|
5
|
+
server name and package version and nothing else — no config, no secrets.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from importlib.metadata import version
|
|
11
|
+
|
|
12
|
+
import httpx
|
|
13
|
+
|
|
14
|
+
from mcp_gitlab.servers.gitlab import mcp
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
async def test_health_returns_ok_name_and_version():
|
|
18
|
+
transport = httpx.ASGITransport(app=mcp.http_app())
|
|
19
|
+
async with httpx.AsyncClient(transport=transport, base_url="http://health.test") as client:
|
|
20
|
+
response = await client.get("/health")
|
|
21
|
+
assert response.status_code == 200
|
|
22
|
+
body = response.json()
|
|
23
|
+
assert body == {"status": "ok", "name": mcp.name, "version": version("mcp-gitlab")}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
async def test_health_exposes_no_secrets():
|
|
27
|
+
transport = httpx.ASGITransport(app=mcp.http_app())
|
|
28
|
+
async with httpx.AsyncClient(transport=transport, base_url="http://health.test") as client:
|
|
29
|
+
response = await client.get("/health")
|
|
30
|
+
assert set(response.json()) == {"status", "name", "version"}
|
|
@@ -250,10 +250,18 @@ def test_locked_instructions_and_log(lock_mcp, caplog, source):
|
|
|
250
250
|
|
|
251
251
|
|
|
252
252
|
def test_src_never_re_enables_or_mutates_visibility():
|
|
253
|
-
"""``src/`` must not re-
|
|
254
|
-
|
|
253
|
+
"""``src/`` must not undo the read-only lock: no re-enabling of the ``write`` tag, no
|
|
254
|
+
component re-enable/disable helpers, no transform-list surgery, no flipping the config
|
|
255
|
+
flag off after config is final. The lock is one ``disable(tags={"write"})`` and nothing
|
|
256
|
+
reverses it.
|
|
257
|
+
|
|
258
|
+
``.enable(`` itself is allowed only for the MCP_TOOLSETS allowlist (``_apply_toolsets``),
|
|
259
|
+
which runs *before* the lock and never names the ``write`` tag, so the lock still wins;
|
|
260
|
+
a separate assertion pins that ordering. Any ``.enable(`` mentioning ``write`` would
|
|
261
|
+
re-list write tools and is banned.
|
|
262
|
+
"""
|
|
255
263
|
banned = (
|
|
256
|
-
r"\.enable\(",
|
|
264
|
+
r"\.enable\([^)]*['\"]write['\"]",
|
|
257
265
|
r"enable_components\(",
|
|
258
266
|
r"disable_components\(",
|
|
259
267
|
r"reset_visibility\(",
|
|
@@ -265,3 +273,11 @@ def test_src_never_re_enables_or_mutates_visibility():
|
|
|
265
273
|
text = path.read_text(encoding="utf-8")
|
|
266
274
|
for pattern in banned:
|
|
267
275
|
assert not re.search(pattern, text), f"{pattern} found in {path}"
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
def test_toolset_allowlist_applied_before_read_only_lock():
|
|
279
|
+
"""The MCP_TOOLSETS allowlist must run before the lock, so read-only still removes every
|
|
280
|
+
write tool from an allowlisted group (the lock is the last visibility transform)."""
|
|
281
|
+
body = _SERVER_SRC.read_text(encoding="utf-8").split("async def lifespan", 1)[1]
|
|
282
|
+
assert "_apply_toolsets(" in body
|
|
283
|
+
assert body.index("_apply_toolsets(") < body.index("_lock_read_only(")
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"""MCP_TOOLSETS: coarse tool groups (workbench-backlog#160).
|
|
2
|
+
|
|
3
|
+
``MCP_TOOLSETS`` (or ``--toolsets``) selects one or more named groups of the raw domain
|
|
4
|
+
tags the tools already carry, switching ``tools/list`` to an allowlist of just those
|
|
5
|
+
tools so a client with a tool budget (Cursor warns past 40, across all servers) sees
|
|
6
|
+
fewer. Resources and prompts stay listed regardless, and ``MCP_READ_ONLY`` still applies
|
|
7
|
+
after the selection and only ever removes tools. Unset or ``all`` lists every tool. An
|
|
8
|
+
unknown group name exits 2 with the valid list.
|
|
9
|
+
|
|
10
|
+
Each case boots a real ``Client(mcp)`` so the env → lifespan → ``_apply_toolsets`` wiring
|
|
11
|
+
is exercised, and restores the module-level server's visibility transforms afterwards.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
from unittest.mock import patch
|
|
17
|
+
|
|
18
|
+
import pytest
|
|
19
|
+
from click.testing import CliRunner
|
|
20
|
+
from fastmcp import Client
|
|
21
|
+
|
|
22
|
+
from mcp_gitlab import main
|
|
23
|
+
from mcp_gitlab.servers import prompts, resources # noqa: F401 — registers decorators
|
|
24
|
+
from mcp_gitlab.servers.gitlab import (
|
|
25
|
+
TOOLSET_GROUPS,
|
|
26
|
+
UnknownToolsetError,
|
|
27
|
+
mcp,
|
|
28
|
+
parse_toolsets,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
# Non-domain tags every tool carries; the remainder is its one or two domain tags.
|
|
32
|
+
_FRAME_TAGS = {"gitlab", "read", "write"}
|
|
33
|
+
|
|
34
|
+
# The five tools that legitimately carry two domain tags, so they are listed in two
|
|
35
|
+
# groups. Any other double-tagged tool would break the group map.
|
|
36
|
+
_DOUBLE_TAGGED = {
|
|
37
|
+
"gitlab_approve_mr",
|
|
38
|
+
"gitlab_unapprove_mr",
|
|
39
|
+
"gitlab_get_mr_approvals",
|
|
40
|
+
"gitlab_list_mr_pipelines",
|
|
41
|
+
"gitlab_list_mr_commits",
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
# Per group: (tools listed, tools listed under read-only). Verified against the server.
|
|
45
|
+
_EXPECTED = {
|
|
46
|
+
"code": (12, 9),
|
|
47
|
+
"review": (29, 9),
|
|
48
|
+
"ci": (18, 6),
|
|
49
|
+
"issues": (5, 2),
|
|
50
|
+
"release": (9, 4),
|
|
51
|
+
"admin": (23, 7),
|
|
52
|
+
}
|
|
53
|
+
_ALL_TOOLS = 91
|
|
54
|
+
_ALL_READ_ONLY = 34
|
|
55
|
+
_RESOURCES = 7
|
|
56
|
+
_PROMPTS = 6
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
async def _boot(
|
|
60
|
+
monkeypatch, toolsets: str | None, *, read_only: bool = False
|
|
61
|
+
) -> tuple[set[str], int, int]:
|
|
62
|
+
"""Boot ``mcp`` through a real client with the given MCP_TOOLSETS / MCP_READ_ONLY env and
|
|
63
|
+
return (tool names, resource count, prompt count), restoring visibility afterwards."""
|
|
64
|
+
monkeypatch.setenv("GITLAB_URL", "https://gitlab.example.com")
|
|
65
|
+
monkeypatch.setenv("GITLAB_TOKEN", "test-token")
|
|
66
|
+
monkeypatch.delenv("GITLAB_READ_ONLY", raising=False)
|
|
67
|
+
monkeypatch.delenv("MCP_READ_ONLY", raising=False)
|
|
68
|
+
monkeypatch.delenv("MCP_TOOLSETS", raising=False)
|
|
69
|
+
if toolsets is not None:
|
|
70
|
+
monkeypatch.setenv("MCP_TOOLSETS", toolsets)
|
|
71
|
+
if read_only:
|
|
72
|
+
monkeypatch.setenv("MCP_READ_ONLY", "true")
|
|
73
|
+
tx = len(mcp._transforms)
|
|
74
|
+
instructions = mcp.instructions
|
|
75
|
+
try:
|
|
76
|
+
async with Client(mcp) as client:
|
|
77
|
+
tools = {t.name for t in await client.list_tools()}
|
|
78
|
+
res = len(await client.list_resources())
|
|
79
|
+
prm = len(await client.list_prompts())
|
|
80
|
+
return tools, res, prm
|
|
81
|
+
finally:
|
|
82
|
+
del mcp._transforms[tx:]
|
|
83
|
+
mcp.instructions = instructions
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
# ── the group map ──────────────────────────────────────────────────────
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
async def test_every_domain_tag_belongs_to_exactly_one_group():
|
|
90
|
+
"""Every raw domain tag is covered by exactly one group, and no group names a tag no
|
|
91
|
+
tool carries — so the map and the decorators cannot drift apart. Only the five
|
|
92
|
+
known double-tagged tools carry two domain tags."""
|
|
93
|
+
all_tools = await mcp._list_tools()
|
|
94
|
+
domain_tags = {t for tool in all_tools for t in (set(tool.tags) - _FRAME_TAGS)}
|
|
95
|
+
for tool in all_tools:
|
|
96
|
+
extra = set(tool.tags) - _FRAME_TAGS
|
|
97
|
+
if len(extra) > 1:
|
|
98
|
+
assert tool.name in _DOUBLE_TAGGED, tool.name
|
|
99
|
+
assert len(extra) == 2, tool.name
|
|
100
|
+
group_tags = [tag for tags in TOOLSET_GROUPS.values() for tag in tags]
|
|
101
|
+
assert len(group_tags) == len(set(group_tags)), "a tag appears in two groups"
|
|
102
|
+
assert set(group_tags) == domain_tags
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
# ── selection ────────────────────────────────────────────────────────────
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
@pytest.mark.parametrize("group", sorted(_EXPECTED))
|
|
109
|
+
async def test_group_lists_expected_tools(monkeypatch, group):
|
|
110
|
+
tools, res, prm = await _boot(monkeypatch, group)
|
|
111
|
+
assert len(tools) == _EXPECTED[group][0]
|
|
112
|
+
assert (res, prm) == (_RESOURCES, _PROMPTS)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
async def test_review_group_is_under_cursor_tool_limit(monkeypatch):
|
|
116
|
+
"""T3.4: a single-job review selection must list fewer than Cursor's 40-tool warning."""
|
|
117
|
+
tools, _, _ = await _boot(monkeypatch, "review")
|
|
118
|
+
assert len(tools) == 29 < 40
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
@pytest.mark.parametrize(("raw", "expected"), [("code,review", 40), ("review,ci", 46)])
|
|
122
|
+
async def test_documented_pairs_reach_the_tool_limit(monkeypatch, raw, expected):
|
|
123
|
+
"""The two-group pairs the README warns about: shared double-tagged tools are counted
|
|
124
|
+
once, so these land exactly at/over 40."""
|
|
125
|
+
tools, _, _ = await _boot(monkeypatch, raw)
|
|
126
|
+
assert len(tools) == expected
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
@pytest.mark.parametrize("raw", [None, "", " ", "all", "code,all"])
|
|
130
|
+
async def test_unset_or_all_lists_everything(monkeypatch, raw):
|
|
131
|
+
tools, res, prm = await _boot(monkeypatch, raw)
|
|
132
|
+
assert len(tools) == _ALL_TOOLS
|
|
133
|
+
assert (res, prm) == (_RESOURCES, _PROMPTS)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
async def test_multiple_groups_union(monkeypatch):
|
|
137
|
+
tools, _, _ = await _boot(monkeypatch, "issues,release")
|
|
138
|
+
assert len(tools) == _EXPECTED["issues"][0] + _EXPECTED["release"][0]
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
# ── read-only still wins after the allowlist ──────────────────────────────
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
@pytest.mark.parametrize("group", sorted(_EXPECTED))
|
|
145
|
+
async def test_group_plus_read_only_drops_writes(monkeypatch, group):
|
|
146
|
+
all_tools = await mcp._list_tools()
|
|
147
|
+
write_names = {t.name for t in all_tools if "write" in t.tags}
|
|
148
|
+
tools, _, _ = await _boot(monkeypatch, group, read_only=True)
|
|
149
|
+
assert len(tools) == _EXPECTED[group][1]
|
|
150
|
+
assert not (tools & write_names)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
async def test_all_plus_read_only_lists_every_read_tool(monkeypatch):
|
|
154
|
+
tools, _, _ = await _boot(monkeypatch, "all", read_only=True)
|
|
155
|
+
assert len(tools) == _ALL_READ_ONLY
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
# ── parsing / validation ──────────────────────────────────────────────────
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
@pytest.mark.parametrize("raw", [None, "", " ", "all", "ALL", " code , all "])
|
|
162
|
+
def test_parse_none_means_no_filter(raw):
|
|
163
|
+
assert parse_toolsets(raw) is None
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
def test_parse_trims_and_lowercases():
|
|
167
|
+
assert parse_toolsets(" Code , REVIEW ") == set(TOOLSET_GROUPS["code"]) | set(
|
|
168
|
+
TOOLSET_GROUPS["review"]
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
def test_parse_unknown_raises_with_valid_list():
|
|
173
|
+
with pytest.raises(UnknownToolsetError) as exc:
|
|
174
|
+
parse_toolsets("code,bogus")
|
|
175
|
+
message = str(exc.value)
|
|
176
|
+
assert "bogus" in message
|
|
177
|
+
for name in [*TOOLSET_GROUPS, "all"]:
|
|
178
|
+
assert name in message
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
def test_cli_unknown_toolset_exits_2():
|
|
182
|
+
# main() writes MCP_TOOLSETS into os.environ; patch.dict restores it so the bad value
|
|
183
|
+
# does not leak into later tests (CliRunner's env= would not).
|
|
184
|
+
with patch.dict(
|
|
185
|
+
"os.environ",
|
|
186
|
+
{"GITLAB_URL": "https://gitlab.example.com", "GITLAB_TOKEN": "t"},
|
|
187
|
+
clear=False,
|
|
188
|
+
):
|
|
189
|
+
result = CliRunner().invoke(main, ["--toolsets", "bogus"])
|
|
190
|
+
assert result.exit_code == 2
|
|
191
|
+
assert "bogus" in result.output
|
|
192
|
+
assert "code" in result.output
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
name: Reconcile releases
|
|
2
|
-
# Stub -> vish288/.github.
|
|
3
|
-
on:
|
|
4
|
-
schedule:
|
|
5
|
-
- cron: "23 */6 * * *"
|
|
6
|
-
workflow_run:
|
|
7
|
-
workflows: [Publish]
|
|
8
|
-
types: [completed]
|
|
9
|
-
workflow_dispatch:
|
|
10
|
-
jobs:
|
|
11
|
-
reconcile:
|
|
12
|
-
uses: vish288/.github/.github/workflows/reconcile.yml@f59da4e8bae11ace9d2f69e43d8601ff9cb68c04 # v1.4.1
|
|
13
|
-
permissions:
|
|
14
|
-
contents: read
|
|
15
|
-
actions: write
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/docs/specs/2026-09-21-test-confidence-and-error-contract.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/src/mcp_gitlab/resources/prompts/diagnose-pipeline.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mcp_gitlab-0.23.0 → mcp_gitlab-0.24.0}/src/mcp_gitlab/resources/prompts/setup-branch-protection.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|