gitlab-api 25.24.0__tar.gz → 25.27.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.
- gitlab_api-25.27.0/PKG-INFO +322 -0
- gitlab_api-25.27.0/README.md +291 -0
- gitlab_api-25.27.0/gitlab_api/__init__.py +80 -0
- {gitlab_api-25.24.0 → gitlab_api-25.27.0}/gitlab_api/agent_server.py +29 -24
- {gitlab_api-25.24.0 → gitlab_api-25.27.0}/gitlab_api/auth.py +55 -1
- {gitlab_api-25.24.0 → gitlab_api-25.27.0}/gitlab_api/gitlab_gql.py +3 -3
- gitlab_api-25.27.0/gitlab_api/mcp_server.py +1021 -0
- gitlab_api-25.27.0/gitlab_api.egg-info/PKG-INFO +322 -0
- {gitlab_api-25.24.0 → gitlab_api-25.27.0}/gitlab_api.egg-info/SOURCES.txt +1 -0
- gitlab_api-25.27.0/gitlab_api.egg-info/requires.txt +20 -0
- {gitlab_api-25.24.0 → gitlab_api-25.27.0}/pyproject.toml +6 -5
- gitlab_api-25.27.0/scripts/verify_api_integration.py +279 -0
- {gitlab_api-25.24.0 → gitlab_api-25.27.0}/tests/conftest.py +3 -1
- {gitlab_api-25.24.0 → gitlab_api-25.27.0}/tests/test_api_wrapper.py +1 -1
- {gitlab_api-25.24.0 → gitlab_api-25.27.0}/tests/test_concept_parity.py +27 -19
- {gitlab_api-25.24.0 → gitlab_api-25.27.0}/tests/test_gitlab_a2a_validation.py +1 -0
- {gitlab_api-25.24.0 → gitlab_api-25.27.0}/tests/test_gitlab_api_brute_force_coverage.py +2 -2
- {gitlab_api-25.24.0 → gitlab_api-25.27.0}/tests/test_gitlab_models.py +183 -354
- {gitlab_api-25.24.0 → gitlab_api-25.27.0}/tests/test_startup.py +4 -5
- gitlab_api-25.24.0/PKG-INFO +0 -1035
- gitlab_api-25.24.0/README.md +0 -1006
- gitlab_api-25.24.0/gitlab_api/__init__.py +0 -66
- gitlab_api-25.24.0/gitlab_api/mcp_server.py +0 -2336
- gitlab_api-25.24.0/gitlab_api.egg-info/PKG-INFO +0 -1035
- gitlab_api-25.24.0/gitlab_api.egg-info/requires.txt +0 -18
- {gitlab_api-25.24.0 → gitlab_api-25.27.0}/LICENSE +0 -0
- {gitlab_api-25.24.0 → gitlab_api-25.27.0}/MANIFEST.in +0 -0
- {gitlab_api-25.24.0 → gitlab_api-25.27.0}/gitlab_api/__main__.py +0 -0
- {gitlab_api-25.24.0 → gitlab_api-25.27.0}/gitlab_api/api_client.py +0 -0
- {gitlab_api-25.24.0 → gitlab_api-25.27.0}/gitlab_api/gitlab_input_models.py +0 -0
- {gitlab_api-25.24.0 → gitlab_api-25.27.0}/gitlab_api/gitlab_response_models.py +0 -0
- {gitlab_api-25.24.0 → gitlab_api-25.27.0}/gitlab_api/mcp_config.json +0 -0
- {gitlab_api-25.24.0 → gitlab_api-25.27.0}/gitlab_api.egg-info/dependency_links.txt +0 -0
- {gitlab_api-25.24.0 → gitlab_api-25.27.0}/gitlab_api.egg-info/entry_points.txt +0 -0
- {gitlab_api-25.24.0 → gitlab_api-25.27.0}/gitlab_api.egg-info/top_level.txt +0 -0
- {gitlab_api-25.24.0 → gitlab_api-25.27.0}/requirements.txt +0 -0
- {gitlab_api-25.24.0 → gitlab_api-25.27.0}/scripts/validate_a2a_agent.py +0 -0
- {gitlab_api-25.24.0 → gitlab_api-25.27.0}/scripts/validate_agent.py +0 -0
- {gitlab_api-25.24.0 → gitlab_api-25.27.0}/setup.cfg +0 -0
- {gitlab_api-25.24.0 → gitlab_api-25.27.0}/test_setup.py +0 -0
- {gitlab_api-25.24.0 → gitlab_api-25.27.0}/tests/__init__.py +0 -0
- {gitlab_api-25.24.0 → gitlab_api-25.27.0}/tests/test_gitlab_mcp_validation.py +0 -0
- {gitlab_api-25.24.0 → gitlab_api-25.27.0}/tests/test_verify_agent.py +0 -0
- {gitlab_api-25.24.0 → gitlab_api-25.27.0}/tests/verify_a2a_queries.py +0 -0
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gitlab-api
|
|
3
|
+
Version: 25.27.0
|
|
4
|
+
Summary: GitLab API + MCP Server + A2A Server
|
|
5
|
+
Author-email: Audel Rouhi <knucklessg1@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
8
|
+
Classifier: License :: Public Domain
|
|
9
|
+
Classifier: Environment :: Console
|
|
10
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Requires-Python: <3.14,>=3.11
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: agent-utilities>=0.16.0
|
|
16
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
17
|
+
Provides-Extra: mcp
|
|
18
|
+
Requires-Dist: agent-utilities[mcp]>=0.16.0; extra == "mcp"
|
|
19
|
+
Provides-Extra: agent
|
|
20
|
+
Requires-Dist: agent-utilities[agent,logfire]>=0.16.0; extra == "agent"
|
|
21
|
+
Provides-Extra: gql
|
|
22
|
+
Requires-Dist: gql>=4.0.0; extra == "gql"
|
|
23
|
+
Provides-Extra: all
|
|
24
|
+
Requires-Dist: gitlab-api[agent,gql,logfire,mcp]>=25.15.56; extra == "all"
|
|
25
|
+
Provides-Extra: test
|
|
26
|
+
Requires-Dist: pytest-xdist>=3.6.0; extra == "test"
|
|
27
|
+
Requires-Dist: pytest; extra == "test"
|
|
28
|
+
Requires-Dist: pytest-asyncio; extra == "test"
|
|
29
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
|
|
32
|
+
# Gitlab Api
|
|
33
|
+
## CLI or API | MCP | Agent
|
|
34
|
+
|
|
35
|
+

|
|
36
|
+

|
|
37
|
+

|
|
38
|
+

|
|
39
|
+

|
|
40
|
+

|
|
41
|
+

|
|
42
|
+

|
|
43
|
+

|
|
44
|
+

|
|
45
|
+

|
|
46
|
+

|
|
47
|
+

|
|
48
|
+

|
|
49
|
+

|
|
50
|
+

|
|
51
|
+

|
|
52
|
+

|
|
53
|
+
|
|
54
|
+
*Version: 25.27.0*
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Overview
|
|
59
|
+
|
|
60
|
+
**Gitlab Api** is a production-grade Agent and Model Context Protocol (MCP) server designed to interface directly with GitLab API + MCP Server + A2A Server.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Key Features
|
|
65
|
+
|
|
66
|
+
- **Consolidated Action-Routed MCP Tools:** Minimizes token overhead and eliminates tool bloat in LLM contexts by grouping methods into optimized, togglable tool modules.
|
|
67
|
+
- **Enterprise-Grade Security:** Comprehensive support for Eunomia policies, OIDC token delegation, and granular execution context tracking.
|
|
68
|
+
- **Integrated Graph Agent:** Built-in Pydantic AI agent supporting the Agent Control Protocol (ACP) and standard Web interfaces (AG-UI).
|
|
69
|
+
- **Native Telemetry & Tracing:** Out-of-the-box OpenTelemetry exports and native Langfuse tracing.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## CLI or API
|
|
74
|
+
|
|
75
|
+
This agent wraps the GitLab API + MCP Server + A2A Server API. You can interact with it programmatically or via its integrated execution entrypoints.
|
|
76
|
+
|
|
77
|
+
Detailed instructions on how to use the underlying API wrappers, extended schema bindings, and developer SDK references are maintained in [docs/index.md](file:///home/apps/workspace/agent-packages/agents/gitlab-api/docs/index.md).
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## MCP
|
|
82
|
+
|
|
83
|
+
This server utilizes dynamic Action-Routed tools to optimize token overhead and maximize IDE compatibility.
|
|
84
|
+
|
|
85
|
+
### Available MCP Tools
|
|
86
|
+
| Tool Module | Toggle Env Var | Enabled by Default | Description & Nested Methods |
|
|
87
|
+
|-------------|----------------|--------------------|------------------------------|
|
|
88
|
+
| **Misc** | `MISCTOOL` | `True` | Manage misc operations. |
|
|
89
|
+
| **Branches** | `BRANCHESTOOL` | `True` | Manage gitlab branches operations. Action-routed methods: `get`, `create`, `delete`. |
|
|
90
|
+
| **Protected Branches** | `PROTECTED_BRANCHESTOOL` | `True` | Manage gitlab protected branches operations. Action-routed methods: `get`, `protect`, `unprotect`. |
|
|
91
|
+
| **Commits** | `COMMITSTOOL` | `True` | Manage gitlab commits operations. Action-routed methods: `get`, `create`, `diff`, `revert`, `get_comments`, `create_comment`, `get_discussions`, `get_statuses`, `post_status`, `get_merge_requests`, `get_gpg_signature`. |
|
|
92
|
+
| **Deploy Tokens** | `DEPLOY_TOKENSTOOL` | `True` | Manage gitlab deploy tokens operations. Action-routed methods: `get`, `get_project`, `create_project`, `delete_project`, `get_group`, `create_group`, `delete_group`. |
|
|
93
|
+
| **Environments** | `ENVIRONMENTSTOOL` | `True` | Manage gitlab environments operations. Action-routed methods: `get`, `create`, `update`, `delete`, `stop`, `stop_stale`, `delete_stopped`, `get_protected`, `protect`, `update_protected`, `unprotect`. |
|
|
94
|
+
| **Groups** | `GROUPSTOOL` | `True` | Manage gitlab groups operations. Action-routed methods: `get`, `edit`, `get_subgroups`, `get_descendants`, `get_projects`, `get_merge_requests`. |
|
|
95
|
+
| **Jobs** | `JOBSTOOL` | `True` | Manage gitlab jobs operations. Action-routed methods: `get_project_jobs`, `get_log`, `cancel`, `retry`, `erase`, `run`, `get_pipeline_jobs`. |
|
|
96
|
+
| **Members** | `MEMBERSTOOL` | `True` | Manage gitlab members operations. Action-routed methods: `get_group`, `get_project`. |
|
|
97
|
+
| **Merge Requests** | `MERGE_REQUESTSTOOL` | `True` | Manage gitlab merge requests operations. Action-routed methods: `create`, `get`, `get_project`. |
|
|
98
|
+
| **Merge Rules** | `MERGE_RULESTOOL` | `True` | Manage gitlab merge rules operations. Action-routed methods: `get_project_level`, `create_project_level`, `update_project_level`, `delete_project_level`, `get_mr_approvals`, `get_mr_approval_state`, `get_mr_level`, `approve_mr`, `unapprove_mr`, `get_group_level`, `edit_group_level`, `edit_project_level`. |
|
|
99
|
+
| **Packages** | `PACKAGESTOOL` | `True` | Manage gitlab packages operations. Action-routed methods: `get`, `publish`, `download`. |
|
|
100
|
+
| **Pipelines** | `PIPELINESTOOL` | `True` | Manage gitlab pipelines operations. Action-routed methods: `get`, `run`. |
|
|
101
|
+
| **Pipeline Schedules** | `PIPELINE_SCHEDULESTOOL` | `True` | Manage gitlab pipeline schedules operations. Action-routed methods: `get_all`, `get`, `get_triggered`, `create`, `edit`, `take_ownership`, `delete`, `run`, `create_variable`, `delete_variable`. |
|
|
102
|
+
| **Projects** | `PROJECTSTOOL` | `True` | Manage gitlab projects operations. Action-routed methods: `get`, `get_nested_by_group`, `get_contributors`, `get_statistics`, `edit`, `share_with_group`, `unshare_with_group`. |
|
|
103
|
+
| **Releases** | `RELEASESTOOL` | `True` | Manage gitlab releases operations. Action-routed methods: `get`, `get_latest`, `get_latest_evidence`, `get_latest_asset`, `get_group_releases`, `download_asset`, `get_by_tag`, `create`, `create_evidence`, `update`, `delete`. |
|
|
104
|
+
| **Runners** | `RUNNERSTOOL` | `True` | Manage gitlab runners operations. Action-routed methods: `get_all`, `update_details`, `pause`, `get_jobs`, `get_project`, `enable_project`, `delete_project`, `get_group`, `register`, `delete`, `verify_auth`, `reset_gitlab_token`, `reset_project_token`, `reset_group_token`, `reset_token`. |
|
|
105
|
+
| **Tags** | `TAGSTOOL` | `True` | Manage gitlab tags operations. Action-routed methods: `get`, `create`, `delete`, `get_protected`, `get_protected_tag`, `protect`, `unprotect`. |
|
|
106
|
+
| **Custom Api** | `CUSTOM_APITOOL` | `True` | Manage api request operations. |
|
|
107
|
+
| **Graphql** | `GRAPHQLTOOL` | `True` | Execute raw GraphQL queries and mutations natively on GitLab. |
|
|
108
|
+
|
|
109
|
+
Detailed tool schemas, parameter shapes, and validation constraints are preserved in [docs/mcp.md](file:///home/apps/workspace/agent-packages/agents/gitlab-api/docs/mcp.md).
|
|
110
|
+
|
|
111
|
+
### MCP Configuration Examples
|
|
112
|
+
|
|
113
|
+
#### stdio Transport (Recommended for local IDEs e.g., Cursor, Claude Desktop)
|
|
114
|
+
Configure your IDE's `mcp.json` to launch the MCP server via `uvx`:
|
|
115
|
+
|
|
116
|
+
```json
|
|
117
|
+
{
|
|
118
|
+
"mcpServers": {
|
|
119
|
+
"gitlab-api": {
|
|
120
|
+
"command": "uvx",
|
|
121
|
+
"args": [
|
|
122
|
+
"--from",
|
|
123
|
+
"gitlab-api",
|
|
124
|
+
"gitlab-mcp"
|
|
125
|
+
],
|
|
126
|
+
"env": {
|
|
127
|
+
"GITLAB_URL": "your_gitlab_url_here",
|
|
128
|
+
"GITLAB_TOKEN": "your_gitlab_token_here"
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
#### Streamable-HTTP Transport (Recommended for production deployments)
|
|
136
|
+
Configure your client's `mcp.json` to launch the Streamable-HTTP server via `uvx` with explicit host and port definition:
|
|
137
|
+
|
|
138
|
+
```json
|
|
139
|
+
{
|
|
140
|
+
"mcpServers": {
|
|
141
|
+
"gitlab-api": {
|
|
142
|
+
"command": "uvx",
|
|
143
|
+
"args": [
|
|
144
|
+
"--from",
|
|
145
|
+
"gitlab-api",
|
|
146
|
+
"gitlab-mcp"
|
|
147
|
+
],
|
|
148
|
+
"env": {
|
|
149
|
+
"TRANSPORT": "streamable-http",
|
|
150
|
+
"HOST": "0.0.0.0",
|
|
151
|
+
"PORT": "8000",
|
|
152
|
+
"GITLAB_URL": "your_gitlab_url_here",
|
|
153
|
+
"GITLAB_TOKEN": "your_gitlab_token_here"
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Alternatively, connect to a pre-deployed remote or local Streamable-HTTP instance:
|
|
161
|
+
|
|
162
|
+
```json
|
|
163
|
+
{
|
|
164
|
+
"mcpServers": {
|
|
165
|
+
"gitlab-api": {
|
|
166
|
+
"url": "http://localhost:8000/gitlab-api/mcp"
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Deploying the Streamable-HTTP server via Docker:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
docker run -d \
|
|
176
|
+
--name gitlab-api-mcp \
|
|
177
|
+
-p 8000:8000 \
|
|
178
|
+
-e TRANSPORT=streamable-http \
|
|
179
|
+
-e PORT=8000 \
|
|
180
|
+
-e GITLAB_URL="your_value" \
|
|
181
|
+
-e GITLAB_TOKEN="your_value" \
|
|
182
|
+
knucklessg1/gitlab-api:latest
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## Agent
|
|
188
|
+
|
|
189
|
+
This repository features a fully integrated Pydantic AI Graph Agent. It communicates over the **Agent Control Protocol (ACP)** and interacts seamlessly with the **Agent Web UI (AG-UI)** and Terminal interface.
|
|
190
|
+
|
|
191
|
+
### Running the Agent CLI
|
|
192
|
+
To start the interactive command-line agent:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
# Set credentials
|
|
196
|
+
export GITLAB_URL="your_value"
|
|
197
|
+
export GITLAB_TOKEN="your_value"
|
|
198
|
+
|
|
199
|
+
# Run the agent server
|
|
200
|
+
gitlab-agent --provider openai --model-id gpt-4o
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Docker Compose Orchestration
|
|
204
|
+
The following `docker/agent.compose.yml` configures the Agent, Web UI, and Terminal Interface together:
|
|
205
|
+
|
|
206
|
+
```yaml
|
|
207
|
+
version: '3.8'
|
|
208
|
+
|
|
209
|
+
services:
|
|
210
|
+
gitlab-api-mcp:
|
|
211
|
+
image: knucklessg1/gitlab-api:latest
|
|
212
|
+
container_name: gitlab-api-mcp
|
|
213
|
+
hostname: gitlab-api-mcp
|
|
214
|
+
restart: always
|
|
215
|
+
env_file:
|
|
216
|
+
- ../.env
|
|
217
|
+
environment:
|
|
218
|
+
- PYTHONUNBUFFERED=1
|
|
219
|
+
- HOST=0.0.0.0
|
|
220
|
+
- PORT=8000
|
|
221
|
+
- TRANSPORT=streamable-http
|
|
222
|
+
ports:
|
|
223
|
+
- "8000:8000"
|
|
224
|
+
healthcheck:
|
|
225
|
+
test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"]
|
|
226
|
+
interval: 30s
|
|
227
|
+
timeout: 10s
|
|
228
|
+
retries: 3
|
|
229
|
+
start_period: 10s
|
|
230
|
+
logging:
|
|
231
|
+
driver: json-file
|
|
232
|
+
options:
|
|
233
|
+
max-size: "10m"
|
|
234
|
+
max-file: "3"
|
|
235
|
+
|
|
236
|
+
gitlab-api-agent:
|
|
237
|
+
image: knucklessg1/gitlab-api:latest
|
|
238
|
+
container_name: gitlab-api-agent
|
|
239
|
+
hostname: gitlab-api-agent
|
|
240
|
+
restart: always
|
|
241
|
+
depends_on:
|
|
242
|
+
- gitlab-api-mcp
|
|
243
|
+
env_file:
|
|
244
|
+
- ../.env
|
|
245
|
+
command: [ "gitlab-agent" ]
|
|
246
|
+
environment:
|
|
247
|
+
- PYTHONUNBUFFERED=1
|
|
248
|
+
- HOST=0.0.0.0
|
|
249
|
+
- PORT=9017
|
|
250
|
+
- MCP_URL=http://gitlab-api-mcp:8000/mcp
|
|
251
|
+
- PROVIDER=${PROVIDER:-openai}
|
|
252
|
+
- MODEL_ID=${MODEL_ID:-gpt-4o}
|
|
253
|
+
- ENABLE_WEB_UI=True
|
|
254
|
+
- ENABLE_OTEL=True
|
|
255
|
+
ports:
|
|
256
|
+
- "9017:9017"
|
|
257
|
+
healthcheck:
|
|
258
|
+
test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:9017/health')"]
|
|
259
|
+
interval: 30s
|
|
260
|
+
timeout: 10s
|
|
261
|
+
retries: 3
|
|
262
|
+
start_period: 10s
|
|
263
|
+
logging:
|
|
264
|
+
driver: json-file
|
|
265
|
+
options:
|
|
266
|
+
max-size: "10m"
|
|
267
|
+
max-file: "3"
|
|
268
|
+
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
Detailed graph node architecture explanations, custom skill configurations, and agentic trace guides are available in [docs/agent.md](file:///home/apps/workspace/agent-packages/agents/gitlab-api/docs/agent.md).
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
## Security & Governance
|
|
276
|
+
|
|
277
|
+
Built directly upon the enterprise-ready [`agent-utilities`](https://github.com/Knuckles-Team/agent-utilities) core, standard security parameters are fully supported:
|
|
278
|
+
|
|
279
|
+
### Access Control & Policy Enforcement
|
|
280
|
+
- **Eunomia Policies:** Fine-grained, policy-driven tool authorization. Supports `none`, local `embedded` (`mcp_policies.json`), or centralized `remote` modes.
|
|
281
|
+
- **OIDC Token Delegation:** Compliant with RFC 8693 token exchange for flowing authenticating user credentials from Web UI / ACP → Agent → MCP.
|
|
282
|
+
- **Scoped Credentials:** Execution context runs restricted to the specific caller identity.
|
|
283
|
+
|
|
284
|
+
### Runtime Security Grid
|
|
285
|
+
| Feature | Functionality | Enablement |
|
|
286
|
+
|---------|---------------|------------|
|
|
287
|
+
| **Tool Guard** | Sensitivity inspection with human-in-the-loop validation | Enabled by default |
|
|
288
|
+
| **Prompt Injection Defense** | Input scanning, repetition monitoring, and recursive loop blocks | Enabled by default |
|
|
289
|
+
| **Context Safety Guard** | Stuck-loop detectors and contextual overflow preemptive alerts | Enabled by default |
|
|
290
|
+
|
|
291
|
+
---
|
|
292
|
+
|
|
293
|
+
## Installation
|
|
294
|
+
|
|
295
|
+
Install the Python package locally:
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
# Using uv (highly recommended)
|
|
299
|
+
uv pip install gitlab-api[all]
|
|
300
|
+
|
|
301
|
+
# Using standard pip
|
|
302
|
+
python -m pip install gitlab-api[all]
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
---
|
|
306
|
+
|
|
307
|
+
## Repository Owners
|
|
308
|
+
|
|
309
|
+
<img width="100%" height="180em" src="https://github-readme-stats.vercel.app/api?username=Knucklessg1&show_icons=true&hide_border=true&&count_private=true&include_all_commits=true" />
|
|
310
|
+
|
|
311
|
+

|
|
312
|
+

|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
## Contribute
|
|
317
|
+
|
|
318
|
+
Contributions are welcome! Please ensure code quality by executing local checks before submitting pull requests:
|
|
319
|
+
- Format code using `ruff format .`
|
|
320
|
+
- Lint code using `ruff check .`
|
|
321
|
+
- Validate type-safety with `mypy .`
|
|
322
|
+
- Execute test suites using `pytest`
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
# Gitlab Api
|
|
2
|
+
## CLI or API | MCP | Agent
|
|
3
|
+
|
|
4
|
+

|
|
5
|
+

|
|
6
|
+

|
|
7
|
+

|
|
8
|
+

|
|
9
|
+

|
|
10
|
+

|
|
11
|
+

|
|
12
|
+

|
|
13
|
+

|
|
14
|
+

|
|
15
|
+

|
|
16
|
+

|
|
17
|
+

|
|
18
|
+

|
|
19
|
+

|
|
20
|
+

|
|
21
|
+

|
|
22
|
+
|
|
23
|
+
*Version: 25.27.0*
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Overview
|
|
28
|
+
|
|
29
|
+
**Gitlab Api** is a production-grade Agent and Model Context Protocol (MCP) server designed to interface directly with GitLab API + MCP Server + A2A Server.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Key Features
|
|
34
|
+
|
|
35
|
+
- **Consolidated Action-Routed MCP Tools:** Minimizes token overhead and eliminates tool bloat in LLM contexts by grouping methods into optimized, togglable tool modules.
|
|
36
|
+
- **Enterprise-Grade Security:** Comprehensive support for Eunomia policies, OIDC token delegation, and granular execution context tracking.
|
|
37
|
+
- **Integrated Graph Agent:** Built-in Pydantic AI agent supporting the Agent Control Protocol (ACP) and standard Web interfaces (AG-UI).
|
|
38
|
+
- **Native Telemetry & Tracing:** Out-of-the-box OpenTelemetry exports and native Langfuse tracing.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## CLI or API
|
|
43
|
+
|
|
44
|
+
This agent wraps the GitLab API + MCP Server + A2A Server API. You can interact with it programmatically or via its integrated execution entrypoints.
|
|
45
|
+
|
|
46
|
+
Detailed instructions on how to use the underlying API wrappers, extended schema bindings, and developer SDK references are maintained in [docs/index.md](file:///home/apps/workspace/agent-packages/agents/gitlab-api/docs/index.md).
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## MCP
|
|
51
|
+
|
|
52
|
+
This server utilizes dynamic Action-Routed tools to optimize token overhead and maximize IDE compatibility.
|
|
53
|
+
|
|
54
|
+
### Available MCP Tools
|
|
55
|
+
| Tool Module | Toggle Env Var | Enabled by Default | Description & Nested Methods |
|
|
56
|
+
|-------------|----------------|--------------------|------------------------------|
|
|
57
|
+
| **Misc** | `MISCTOOL` | `True` | Manage misc operations. |
|
|
58
|
+
| **Branches** | `BRANCHESTOOL` | `True` | Manage gitlab branches operations. Action-routed methods: `get`, `create`, `delete`. |
|
|
59
|
+
| **Protected Branches** | `PROTECTED_BRANCHESTOOL` | `True` | Manage gitlab protected branches operations. Action-routed methods: `get`, `protect`, `unprotect`. |
|
|
60
|
+
| **Commits** | `COMMITSTOOL` | `True` | Manage gitlab commits operations. Action-routed methods: `get`, `create`, `diff`, `revert`, `get_comments`, `create_comment`, `get_discussions`, `get_statuses`, `post_status`, `get_merge_requests`, `get_gpg_signature`. |
|
|
61
|
+
| **Deploy Tokens** | `DEPLOY_TOKENSTOOL` | `True` | Manage gitlab deploy tokens operations. Action-routed methods: `get`, `get_project`, `create_project`, `delete_project`, `get_group`, `create_group`, `delete_group`. |
|
|
62
|
+
| **Environments** | `ENVIRONMENTSTOOL` | `True` | Manage gitlab environments operations. Action-routed methods: `get`, `create`, `update`, `delete`, `stop`, `stop_stale`, `delete_stopped`, `get_protected`, `protect`, `update_protected`, `unprotect`. |
|
|
63
|
+
| **Groups** | `GROUPSTOOL` | `True` | Manage gitlab groups operations. Action-routed methods: `get`, `edit`, `get_subgroups`, `get_descendants`, `get_projects`, `get_merge_requests`. |
|
|
64
|
+
| **Jobs** | `JOBSTOOL` | `True` | Manage gitlab jobs operations. Action-routed methods: `get_project_jobs`, `get_log`, `cancel`, `retry`, `erase`, `run`, `get_pipeline_jobs`. |
|
|
65
|
+
| **Members** | `MEMBERSTOOL` | `True` | Manage gitlab members operations. Action-routed methods: `get_group`, `get_project`. |
|
|
66
|
+
| **Merge Requests** | `MERGE_REQUESTSTOOL` | `True` | Manage gitlab merge requests operations. Action-routed methods: `create`, `get`, `get_project`. |
|
|
67
|
+
| **Merge Rules** | `MERGE_RULESTOOL` | `True` | Manage gitlab merge rules operations. Action-routed methods: `get_project_level`, `create_project_level`, `update_project_level`, `delete_project_level`, `get_mr_approvals`, `get_mr_approval_state`, `get_mr_level`, `approve_mr`, `unapprove_mr`, `get_group_level`, `edit_group_level`, `edit_project_level`. |
|
|
68
|
+
| **Packages** | `PACKAGESTOOL` | `True` | Manage gitlab packages operations. Action-routed methods: `get`, `publish`, `download`. |
|
|
69
|
+
| **Pipelines** | `PIPELINESTOOL` | `True` | Manage gitlab pipelines operations. Action-routed methods: `get`, `run`. |
|
|
70
|
+
| **Pipeline Schedules** | `PIPELINE_SCHEDULESTOOL` | `True` | Manage gitlab pipeline schedules operations. Action-routed methods: `get_all`, `get`, `get_triggered`, `create`, `edit`, `take_ownership`, `delete`, `run`, `create_variable`, `delete_variable`. |
|
|
71
|
+
| **Projects** | `PROJECTSTOOL` | `True` | Manage gitlab projects operations. Action-routed methods: `get`, `get_nested_by_group`, `get_contributors`, `get_statistics`, `edit`, `share_with_group`, `unshare_with_group`. |
|
|
72
|
+
| **Releases** | `RELEASESTOOL` | `True` | Manage gitlab releases operations. Action-routed methods: `get`, `get_latest`, `get_latest_evidence`, `get_latest_asset`, `get_group_releases`, `download_asset`, `get_by_tag`, `create`, `create_evidence`, `update`, `delete`. |
|
|
73
|
+
| **Runners** | `RUNNERSTOOL` | `True` | Manage gitlab runners operations. Action-routed methods: `get_all`, `update_details`, `pause`, `get_jobs`, `get_project`, `enable_project`, `delete_project`, `get_group`, `register`, `delete`, `verify_auth`, `reset_gitlab_token`, `reset_project_token`, `reset_group_token`, `reset_token`. |
|
|
74
|
+
| **Tags** | `TAGSTOOL` | `True` | Manage gitlab tags operations. Action-routed methods: `get`, `create`, `delete`, `get_protected`, `get_protected_tag`, `protect`, `unprotect`. |
|
|
75
|
+
| **Custom Api** | `CUSTOM_APITOOL` | `True` | Manage api request operations. |
|
|
76
|
+
| **Graphql** | `GRAPHQLTOOL` | `True` | Execute raw GraphQL queries and mutations natively on GitLab. |
|
|
77
|
+
|
|
78
|
+
Detailed tool schemas, parameter shapes, and validation constraints are preserved in [docs/mcp.md](file:///home/apps/workspace/agent-packages/agents/gitlab-api/docs/mcp.md).
|
|
79
|
+
|
|
80
|
+
### MCP Configuration Examples
|
|
81
|
+
|
|
82
|
+
#### stdio Transport (Recommended for local IDEs e.g., Cursor, Claude Desktop)
|
|
83
|
+
Configure your IDE's `mcp.json` to launch the MCP server via `uvx`:
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"mcpServers": {
|
|
88
|
+
"gitlab-api": {
|
|
89
|
+
"command": "uvx",
|
|
90
|
+
"args": [
|
|
91
|
+
"--from",
|
|
92
|
+
"gitlab-api",
|
|
93
|
+
"gitlab-mcp"
|
|
94
|
+
],
|
|
95
|
+
"env": {
|
|
96
|
+
"GITLAB_URL": "your_gitlab_url_here",
|
|
97
|
+
"GITLAB_TOKEN": "your_gitlab_token_here"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
#### Streamable-HTTP Transport (Recommended for production deployments)
|
|
105
|
+
Configure your client's `mcp.json` to launch the Streamable-HTTP server via `uvx` with explicit host and port definition:
|
|
106
|
+
|
|
107
|
+
```json
|
|
108
|
+
{
|
|
109
|
+
"mcpServers": {
|
|
110
|
+
"gitlab-api": {
|
|
111
|
+
"command": "uvx",
|
|
112
|
+
"args": [
|
|
113
|
+
"--from",
|
|
114
|
+
"gitlab-api",
|
|
115
|
+
"gitlab-mcp"
|
|
116
|
+
],
|
|
117
|
+
"env": {
|
|
118
|
+
"TRANSPORT": "streamable-http",
|
|
119
|
+
"HOST": "0.0.0.0",
|
|
120
|
+
"PORT": "8000",
|
|
121
|
+
"GITLAB_URL": "your_gitlab_url_here",
|
|
122
|
+
"GITLAB_TOKEN": "your_gitlab_token_here"
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Alternatively, connect to a pre-deployed remote or local Streamable-HTTP instance:
|
|
130
|
+
|
|
131
|
+
```json
|
|
132
|
+
{
|
|
133
|
+
"mcpServers": {
|
|
134
|
+
"gitlab-api": {
|
|
135
|
+
"url": "http://localhost:8000/gitlab-api/mcp"
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Deploying the Streamable-HTTP server via Docker:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
docker run -d \
|
|
145
|
+
--name gitlab-api-mcp \
|
|
146
|
+
-p 8000:8000 \
|
|
147
|
+
-e TRANSPORT=streamable-http \
|
|
148
|
+
-e PORT=8000 \
|
|
149
|
+
-e GITLAB_URL="your_value" \
|
|
150
|
+
-e GITLAB_TOKEN="your_value" \
|
|
151
|
+
knucklessg1/gitlab-api:latest
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Agent
|
|
157
|
+
|
|
158
|
+
This repository features a fully integrated Pydantic AI Graph Agent. It communicates over the **Agent Control Protocol (ACP)** and interacts seamlessly with the **Agent Web UI (AG-UI)** and Terminal interface.
|
|
159
|
+
|
|
160
|
+
### Running the Agent CLI
|
|
161
|
+
To start the interactive command-line agent:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
# Set credentials
|
|
165
|
+
export GITLAB_URL="your_value"
|
|
166
|
+
export GITLAB_TOKEN="your_value"
|
|
167
|
+
|
|
168
|
+
# Run the agent server
|
|
169
|
+
gitlab-agent --provider openai --model-id gpt-4o
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Docker Compose Orchestration
|
|
173
|
+
The following `docker/agent.compose.yml` configures the Agent, Web UI, and Terminal Interface together:
|
|
174
|
+
|
|
175
|
+
```yaml
|
|
176
|
+
version: '3.8'
|
|
177
|
+
|
|
178
|
+
services:
|
|
179
|
+
gitlab-api-mcp:
|
|
180
|
+
image: knucklessg1/gitlab-api:latest
|
|
181
|
+
container_name: gitlab-api-mcp
|
|
182
|
+
hostname: gitlab-api-mcp
|
|
183
|
+
restart: always
|
|
184
|
+
env_file:
|
|
185
|
+
- ../.env
|
|
186
|
+
environment:
|
|
187
|
+
- PYTHONUNBUFFERED=1
|
|
188
|
+
- HOST=0.0.0.0
|
|
189
|
+
- PORT=8000
|
|
190
|
+
- TRANSPORT=streamable-http
|
|
191
|
+
ports:
|
|
192
|
+
- "8000:8000"
|
|
193
|
+
healthcheck:
|
|
194
|
+
test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"]
|
|
195
|
+
interval: 30s
|
|
196
|
+
timeout: 10s
|
|
197
|
+
retries: 3
|
|
198
|
+
start_period: 10s
|
|
199
|
+
logging:
|
|
200
|
+
driver: json-file
|
|
201
|
+
options:
|
|
202
|
+
max-size: "10m"
|
|
203
|
+
max-file: "3"
|
|
204
|
+
|
|
205
|
+
gitlab-api-agent:
|
|
206
|
+
image: knucklessg1/gitlab-api:latest
|
|
207
|
+
container_name: gitlab-api-agent
|
|
208
|
+
hostname: gitlab-api-agent
|
|
209
|
+
restart: always
|
|
210
|
+
depends_on:
|
|
211
|
+
- gitlab-api-mcp
|
|
212
|
+
env_file:
|
|
213
|
+
- ../.env
|
|
214
|
+
command: [ "gitlab-agent" ]
|
|
215
|
+
environment:
|
|
216
|
+
- PYTHONUNBUFFERED=1
|
|
217
|
+
- HOST=0.0.0.0
|
|
218
|
+
- PORT=9017
|
|
219
|
+
- MCP_URL=http://gitlab-api-mcp:8000/mcp
|
|
220
|
+
- PROVIDER=${PROVIDER:-openai}
|
|
221
|
+
- MODEL_ID=${MODEL_ID:-gpt-4o}
|
|
222
|
+
- ENABLE_WEB_UI=True
|
|
223
|
+
- ENABLE_OTEL=True
|
|
224
|
+
ports:
|
|
225
|
+
- "9017:9017"
|
|
226
|
+
healthcheck:
|
|
227
|
+
test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:9017/health')"]
|
|
228
|
+
interval: 30s
|
|
229
|
+
timeout: 10s
|
|
230
|
+
retries: 3
|
|
231
|
+
start_period: 10s
|
|
232
|
+
logging:
|
|
233
|
+
driver: json-file
|
|
234
|
+
options:
|
|
235
|
+
max-size: "10m"
|
|
236
|
+
max-file: "3"
|
|
237
|
+
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
Detailed graph node architecture explanations, custom skill configurations, and agentic trace guides are available in [docs/agent.md](file:///home/apps/workspace/agent-packages/agents/gitlab-api/docs/agent.md).
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## Security & Governance
|
|
245
|
+
|
|
246
|
+
Built directly upon the enterprise-ready [`agent-utilities`](https://github.com/Knuckles-Team/agent-utilities) core, standard security parameters are fully supported:
|
|
247
|
+
|
|
248
|
+
### Access Control & Policy Enforcement
|
|
249
|
+
- **Eunomia Policies:** Fine-grained, policy-driven tool authorization. Supports `none`, local `embedded` (`mcp_policies.json`), or centralized `remote` modes.
|
|
250
|
+
- **OIDC Token Delegation:** Compliant with RFC 8693 token exchange for flowing authenticating user credentials from Web UI / ACP → Agent → MCP.
|
|
251
|
+
- **Scoped Credentials:** Execution context runs restricted to the specific caller identity.
|
|
252
|
+
|
|
253
|
+
### Runtime Security Grid
|
|
254
|
+
| Feature | Functionality | Enablement |
|
|
255
|
+
|---------|---------------|------------|
|
|
256
|
+
| **Tool Guard** | Sensitivity inspection with human-in-the-loop validation | Enabled by default |
|
|
257
|
+
| **Prompt Injection Defense** | Input scanning, repetition monitoring, and recursive loop blocks | Enabled by default |
|
|
258
|
+
| **Context Safety Guard** | Stuck-loop detectors and contextual overflow preemptive alerts | Enabled by default |
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
## Installation
|
|
263
|
+
|
|
264
|
+
Install the Python package locally:
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
# Using uv (highly recommended)
|
|
268
|
+
uv pip install gitlab-api[all]
|
|
269
|
+
|
|
270
|
+
# Using standard pip
|
|
271
|
+
python -m pip install gitlab-api[all]
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
## Repository Owners
|
|
277
|
+
|
|
278
|
+
<img width="100%" height="180em" src="https://github-readme-stats.vercel.app/api?username=Knucklessg1&show_icons=true&hide_border=true&&count_private=true&include_all_commits=true" />
|
|
279
|
+
|
|
280
|
+

|
|
281
|
+

|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
## Contribute
|
|
286
|
+
|
|
287
|
+
Contributions are welcome! Please ensure code quality by executing local checks before submitting pull requests:
|
|
288
|
+
- Format code using `ruff format .`
|
|
289
|
+
- Lint code using `ruff check .`
|
|
290
|
+
- Validate type-safety with `mypy .`
|
|
291
|
+
- Execute test suites using `pytest`
|