gitlab-api 25.24.1__tar.gz → 25.32.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.
Files changed (87) hide show
  1. gitlab_api-25.32.0/PKG-INFO +350 -0
  2. gitlab_api-25.32.0/README.md +318 -0
  3. {gitlab_api-25.24.1 → gitlab_api-25.32.0}/gitlab_api/agent_server.py +1 -1
  4. gitlab_api-25.32.0/gitlab_api/api/__init__.py +1 -0
  5. gitlab_api-25.32.0/gitlab_api/api/api_client_base.py +214 -0
  6. gitlab_api-25.32.0/gitlab_api/api/api_client_environments.py +725 -0
  7. gitlab_api-25.32.0/gitlab_api/api/api_client_issues.py +455 -0
  8. gitlab_api-25.32.0/gitlab_api/api/api_client_merge_requests.py +269 -0
  9. gitlab_api-25.32.0/gitlab_api/api/api_client_other.py +587 -0
  10. gitlab_api-25.32.0/gitlab_api/api/api_client_pipelines.py +783 -0
  11. gitlab_api-25.32.0/gitlab_api/api/api_client_projects.py +1213 -0
  12. gitlab_api-25.32.0/gitlab_api/api/api_client_repositories.py +984 -0
  13. gitlab_api-25.32.0/gitlab_api/api/api_client_system.py +69 -0
  14. gitlab_api-25.32.0/gitlab_api/api/api_client_users_groups.py +620 -0
  15. gitlab_api-25.32.0/gitlab_api/api_client.py +34 -0
  16. {gitlab_api-25.24.1 → gitlab_api-25.32.0}/gitlab_api/gitlab_gql.py +1 -0
  17. {gitlab_api-25.24.1 → gitlab_api-25.32.0}/gitlab_api/gitlab_input_models.py +190 -4
  18. {gitlab_api-25.24.1 → gitlab_api-25.32.0}/gitlab_api/gitlab_response_models.py +23 -0
  19. gitlab_api-25.32.0/gitlab_api/mcp/__init__.py +61 -0
  20. gitlab_api-25.32.0/gitlab_api/mcp/mcp_branches.py +49 -0
  21. gitlab_api-25.32.0/gitlab_api/mcp/mcp_commits.py +65 -0
  22. gitlab_api-25.32.0/gitlab_api/mcp/mcp_custom_api.py +44 -0
  23. gitlab_api-25.32.0/gitlab_api/mcp/mcp_deploy_tokens.py +59 -0
  24. gitlab_api-25.32.0/gitlab_api/mcp/mcp_environments.py +67 -0
  25. gitlab_api-25.32.0/gitlab_api/mcp/mcp_epics.py +51 -0
  26. gitlab_api-25.32.0/gitlab_api/mcp/mcp_graphql.py +80 -0
  27. gitlab_api-25.32.0/gitlab_api/mcp/mcp_groups.py +55 -0
  28. gitlab_api-25.32.0/gitlab_api/mcp/mcp_issues.py +51 -0
  29. gitlab_api-25.32.0/gitlab_api/mcp/mcp_jobs.py +55 -0
  30. gitlab_api-25.32.0/gitlab_api/mcp/mcp_labels.py +51 -0
  31. gitlab_api-25.32.0/gitlab_api/mcp/mcp_members.py +45 -0
  32. gitlab_api-25.32.0/gitlab_api/mcp/mcp_merge_requests.py +49 -0
  33. gitlab_api-25.32.0/gitlab_api/mcp/mcp_merge_rules.py +65 -0
  34. gitlab_api-25.32.0/gitlab_api/mcp/mcp_milestones.py +51 -0
  35. gitlab_api-25.32.0/gitlab_api/mcp/mcp_misc.py +10 -0
  36. gitlab_api-25.32.0/gitlab_api/mcp/mcp_notes.py +51 -0
  37. gitlab_api-25.32.0/gitlab_api/mcp/mcp_packages.py +47 -0
  38. gitlab_api-25.32.0/gitlab_api/mcp/mcp_pipeline_schedules.py +61 -0
  39. gitlab_api-25.32.0/gitlab_api/mcp/mcp_pipelines.py +47 -0
  40. gitlab_api-25.32.0/gitlab_api/mcp/mcp_projects.py +57 -0
  41. gitlab_api-25.32.0/gitlab_api/mcp/mcp_protected_branches.py +49 -0
  42. gitlab_api-25.32.0/gitlab_api/mcp/mcp_releases.py +65 -0
  43. gitlab_api-25.32.0/gitlab_api/mcp/mcp_runners.py +71 -0
  44. gitlab_api-25.32.0/gitlab_api/mcp/mcp_snippets.py +51 -0
  45. gitlab_api-25.32.0/gitlab_api/mcp/mcp_tags.py +57 -0
  46. {gitlab_api-25.24.1 → gitlab_api-25.32.0}/gitlab_api/mcp_server.py +479 -168
  47. gitlab_api-25.32.0/gitlab_api.egg-info/PKG-INFO +350 -0
  48. gitlab_api-25.32.0/gitlab_api.egg-info/SOURCES.txt +78 -0
  49. gitlab_api-25.32.0/gitlab_api.egg-info/requires.txt +21 -0
  50. {gitlab_api-25.24.1 → gitlab_api-25.32.0}/pyproject.toml +7 -6
  51. gitlab_api-25.32.0/tests/test_auth.py +105 -0
  52. {gitlab_api-25.24.1 → gitlab_api-25.32.0}/tests/test_gitlab_a2a_validation.py +1 -1
  53. gitlab_api-25.32.0/tests/test_gitlab_api_brute_force_coverage.py +411 -0
  54. gitlab_api-25.32.0/tests/test_gitlab_gql.py +317 -0
  55. {gitlab_api-25.24.1 → gitlab_api-25.32.0}/tests/test_gitlab_mcp_validation.py +1 -1
  56. gitlab_api-25.32.0/tests/test_init_dynamics.py +51 -0
  57. gitlab_api-25.32.0/tests/test_mock_coverage.py +372 -0
  58. {gitlab_api-25.24.1 → gitlab_api-25.32.0}/tests/test_verify_agent.py +1 -1
  59. gitlab_api-25.24.1/PKG-INFO +0 -997
  60. gitlab_api-25.24.1/README.md +0 -967
  61. gitlab_api-25.24.1/gitlab_api/api_client.py +0 -5109
  62. gitlab_api-25.24.1/gitlab_api.egg-info/PKG-INFO +0 -997
  63. gitlab_api-25.24.1/gitlab_api.egg-info/SOURCES.txt +0 -36
  64. gitlab_api-25.24.1/gitlab_api.egg-info/requires.txt +0 -19
  65. gitlab_api-25.24.1/tests/test_gitlab_api_brute_force_coverage.py +0 -164
  66. {gitlab_api-25.24.1 → gitlab_api-25.32.0}/LICENSE +0 -0
  67. {gitlab_api-25.24.1 → gitlab_api-25.32.0}/MANIFEST.in +0 -0
  68. {gitlab_api-25.24.1 → gitlab_api-25.32.0}/gitlab_api/__init__.py +0 -0
  69. {gitlab_api-25.24.1 → gitlab_api-25.32.0}/gitlab_api/__main__.py +0 -0
  70. {gitlab_api-25.24.1 → gitlab_api-25.32.0}/gitlab_api/auth.py +0 -0
  71. {gitlab_api-25.24.1 → gitlab_api-25.32.0}/gitlab_api/mcp_config.json +0 -0
  72. {gitlab_api-25.24.1 → gitlab_api-25.32.0}/gitlab_api.egg-info/dependency_links.txt +0 -0
  73. {gitlab_api-25.24.1 → gitlab_api-25.32.0}/gitlab_api.egg-info/entry_points.txt +0 -0
  74. {gitlab_api-25.24.1 → gitlab_api-25.32.0}/gitlab_api.egg-info/top_level.txt +0 -0
  75. {gitlab_api-25.24.1 → gitlab_api-25.32.0}/requirements.txt +0 -0
  76. {gitlab_api-25.24.1 → gitlab_api-25.32.0}/scripts/validate_a2a_agent.py +0 -0
  77. {gitlab_api-25.24.1 → gitlab_api-25.32.0}/scripts/validate_agent.py +0 -0
  78. {gitlab_api-25.24.1 → gitlab_api-25.32.0}/scripts/verify_api_integration.py +0 -0
  79. {gitlab_api-25.24.1 → gitlab_api-25.32.0}/setup.cfg +0 -0
  80. {gitlab_api-25.24.1 → gitlab_api-25.32.0}/test_setup.py +0 -0
  81. {gitlab_api-25.24.1 → gitlab_api-25.32.0}/tests/__init__.py +0 -0
  82. {gitlab_api-25.24.1 → gitlab_api-25.32.0}/tests/conftest.py +0 -0
  83. {gitlab_api-25.24.1 → gitlab_api-25.32.0}/tests/test_api_wrapper.py +0 -0
  84. {gitlab_api-25.24.1 → gitlab_api-25.32.0}/tests/test_concept_parity.py +0 -0
  85. {gitlab_api-25.24.1 → gitlab_api-25.32.0}/tests/test_gitlab_models.py +0 -0
  86. {gitlab_api-25.24.1 → gitlab_api-25.32.0}/tests/test_startup.py +0 -0
  87. {gitlab_api-25.24.1 → gitlab_api-25.32.0}/tests/verify_a2a_queries.py +0 -0
@@ -0,0 +1,350 @@
1
+ Metadata-Version: 2.4
2
+ Name: gitlab-api
3
+ Version: 25.32.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.26.0
16
+ Requires-Dist: python-dotenv>=1.0.0
17
+ Requires-Dist: gql>=4.0.0
18
+ Provides-Extra: mcp
19
+ Requires-Dist: agent-utilities[mcp]>=0.26.0; extra == "mcp"
20
+ Provides-Extra: agent
21
+ Requires-Dist: agent-utilities[agent,logfire]>=0.26.0; extra == "agent"
22
+ Provides-Extra: gql
23
+ Requires-Dist: gql>=4.0.0; extra == "gql"
24
+ Provides-Extra: all
25
+ Requires-Dist: gitlab-api[agent,gql,logfire,mcp]>=25.32.0; extra == "all"
26
+ Provides-Extra: test
27
+ Requires-Dist: pytest-xdist>=3.6.0; extra == "test"
28
+ Requires-Dist: pytest; extra == "test"
29
+ Requires-Dist: pytest-asyncio; extra == "test"
30
+ Requires-Dist: pytest-cov; extra == "test"
31
+ Dynamic: license-file
32
+
33
+ # Gitlab Api
34
+ ## CLI or API | MCP | Agent
35
+
36
+ ![PyPI - Version](https://img.shields.io/pypi/v/gitlab-api)
37
+ ![MCP Server](https://badge.mcpx.dev?type=server 'MCP Server')
38
+ ![PyPI - Downloads](https://img.shields.io/pypi/dd/gitlab-api)
39
+ ![GitHub Repo stars](https://img.shields.io/github/stars/Knuckles-Team/gitlab-api)
40
+ ![GitHub forks](https://img.shields.io/github/forks/Knuckles-Team/gitlab-api)
41
+ ![GitHub contributors](https://img.shields.io/github/contributors/Knuckles-Team/gitlab-api)
42
+ ![PyPI - License](https://img.shields.io/pypi/l/gitlab-api)
43
+ ![GitHub](https://img.shields.io/github/license/Knuckles-Team/gitlab-api)
44
+ ![GitHub last commit (by committer)](https://img.shields.io/github/last-commit/Knuckles-Team/gitlab-api)
45
+ ![GitHub pull requests](https://img.shields.io/github/issues-pr/Knuckles-Team/gitlab-api)
46
+ ![GitHub closed pull requests](https://img.shields.io/github/issues-pr-closed/Knuckles-Team/gitlab-api)
47
+ ![GitHub issues](https://img.shields.io/github/issues/Knuckles-Team/gitlab-api)
48
+ ![GitHub top language](https://img.shields.io/github/languages/top/Knuckles-Team/gitlab-api)
49
+ ![GitHub language count](https://img.shields.io/github/languages/count/Knuckles-Team/gitlab-api)
50
+ ![GitHub repo size](https://img.shields.io/github/repo-size/Knuckles-Team/gitlab-api)
51
+ ![GitHub repo file count (file type)](https://img.shields.io/github/directory-file-count/Knuckles-Team/gitlab-api)
52
+ ![PyPI - Wheel](https://img.shields.io/pypi/wheel/gitlab-api)
53
+ ![PyPI - Implementation](https://img.shields.io/pypi/implementation/gitlab-api)
54
+
55
+ *Version: 25.32.0*
56
+
57
+ ---
58
+
59
+ ## Overview
60
+
61
+ **Gitlab Api** is a production-grade Agent and Model Context Protocol (MCP) server designed to interface directly with GitLab API + MCP Server + A2A Server.
62
+
63
+ ---
64
+
65
+ ## Key Features
66
+
67
+ - **Consolidated Action-Routed MCP Tools:** Minimizes token overhead and eliminates tool bloat in LLM contexts by grouping methods into optimized, togglable tool modules.
68
+ - **Enterprise-Grade Security:** Comprehensive support for Eunomia policies, OIDC token delegation, and granular execution context tracking.
69
+ - **Integrated Graph Agent:** Built-in Pydantic AI agent supporting the Agent Control Protocol (ACP) and standard Web interfaces (AG-UI).
70
+ - **Native Telemetry & Tracing:** Out-of-the-box OpenTelemetry exports and native Langfuse tracing.
71
+
72
+ ---
73
+
74
+ ## CLI or API
75
+
76
+ This agent wraps the GitLab API + MCP Server + A2A Server API. You can interact with it programmatically or via its integrated execution entrypoints.
77
+
78
+ Detailed instructions on how to use the underlying API wrappers, extended schema bindings, and developer SDK references are maintained in [docs/index.md](docs/index.md).
79
+
80
+ ---
81
+
82
+ ## MCP
83
+
84
+ This server utilizes dynamic Action-Routed tools to optimize token overhead and maximize IDE compatibility.
85
+
86
+ ### Available MCP Tools
87
+ | Tool Module | Toggle Env Var | Enabled by Default | Description & Nested Methods |
88
+ |-------------|----------------|--------------------|------------------------------|
89
+ | **Misc** | `MISC_TOOL` | `True` | Manage gitlab api misc operations. |
90
+ | **Branches** | `BRANCHES_TOOL` | `True` | Manage gitlab branches operations. Action-routed methods: `create`, `delete`, `get`. |
91
+ | **Protected Branches** | `PROTECTED_BRANCHES_TOOL` | `True` | Manage gitlab protected branches operations. Action-routed methods: `get`, `protect`, `unprotect`. |
92
+ | **Commits** | `COMMITS_TOOL` | `True` | Manage gitlab commits operations. Action-routed methods: `create`, `create_comment`, `diff`, `get`, `get_comments`, `get_discussions`, `get_gpg_signature`, `get_merge_requests`, `get_statuses`, `post_status`, `revert`. |
93
+ | **Deploy Tokens** | `DEPLOY_TOKENS_TOOL` | `True` | Manage gitlab deploy tokens operations. Action-routed methods: `create_group`, `create_project`, `delete_group`, `delete_project`, `get`, `get_group`, `get_project`. |
94
+ | **Environments** | `ENVIRONMENTS_TOOL` | `True` | Manage gitlab environments operations. Action-routed methods: `create`, `delete`, `delete_stopped`, `get`, `get_protected`, `protect`, `stop`, `stop_stale`, `unprotect`, `update`, `update_protected`. |
95
+ | **Groups** | `GROUPS_TOOL` | `True` | Manage gitlab groups operations. Action-routed methods: `edit`, `get`, `get_descendants`, `get_merge_requests`, `get_projects`, `get_subgroups`. |
96
+ | **Jobs** | `JOBS_TOOL` | `True` | Manage gitlab jobs operations. Action-routed methods: `cancel`, `erase`, `get_log`, `get_pipeline_jobs`, `get_project_jobs`, `retry`, `run`. |
97
+ | **Members** | `MEMBERS_TOOL` | `True` | Manage gitlab members operations. Action-routed methods: `get_group`, `get_project`. |
98
+ | **Merge Requests** | `MERGE_REQUESTS_TOOL` | `True` | Manage gitlab merge requests operations. Action-routed methods: `create`, `get`, `get_project`. |
99
+ | **Merge Rules** | `MERGE_RULES_TOOL` | `True` | Manage gitlab merge rules operations. Action-routed methods: `approve_mr`, `create_project_level`, `delete_project_level`, `edit_group_level`, `edit_project_level`, `get_group_level`, `get_mr_approval_state`, `get_mr_approvals`, `get_mr_level`, `get_project_level`, `unapprove_mr`, `update_project_level`. |
100
+ | **Packages** | `PACKAGES_TOOL` | `True` | Manage gitlab packages operations. Action-routed methods: `download`, `get`, `publish`. |
101
+ | **Pipelines** | `PIPELINES_TOOL` | `True` | Manage gitlab pipelines operations. Action-routed methods: `get`, `run`. |
102
+ | **Pipeline Schedules** | `PIPELINE_SCHEDULES_TOOL` | `True` | Manage gitlab pipeline schedules operations. Action-routed methods: `create`, `create_variable`, `delete`, `delete_variable`, `edit`, `get`, `get_all`, `get_triggered`, `run`, `take_ownership`. |
103
+ | **Projects** | `PROJECTS_TOOL` | `True` | Manage gitlab projects operations. Action-routed methods: `edit`, `get`, `get_contributors`, `get_nested_by_group`, `get_statistics`, `share_with_group`, `unshare_with_group`. |
104
+ | **Releases** | `RELEASES_TOOL` | `True` | Manage gitlab releases operations. Action-routed methods: `create`, `create_evidence`, `delete`, `download_asset`, `get`, `get_by_tag`, `get_group_releases`, `get_latest`, `get_latest_asset`, `get_latest_evidence`, `update`. |
105
+ | **Runners** | `RUNNERS_TOOL` | `True` | Manage gitlab runners operations. Action-routed methods: `delete`, `delete_project`, `enable_project`, `get_all`, `get_group`, `get_jobs`, `get_project`, `pause`, `register`, `reset_gitlab_token`, `reset_group_token`, `reset_project_token`, `reset_token`, `update_details`, `verify_auth`. |
106
+ | **Tags** | `TAGS_TOOL` | `True` | Manage gitlab tags operations. Action-routed methods: `create`, `delete`, `get`, `get_protected`, `get_protected_tag`, `protect`, `unprotect`. |
107
+ | **Labels** | `LABELS_TOOL` | `True` | Manage GitLab labels. Action-routed methods: `create`, `delete`, `get`, `update`. |
108
+ | **Milestones** | `MILESTONES_TOOL` | `True` | Manage GitLab milestones. Action-routed methods: `create`, `delete`, `get`, `update`. |
109
+ | **Snippets** | `SNIPPETS_TOOL` | `True` | Manage GitLab snippets. Action-routed methods: `create`, `delete`, `get`, `update`. |
110
+ | **Notes** | `NOTES_TOOL` | `True` | Manage GitLab notes/comments on issues, merge requests, commits, and epics. Action-routed methods: `create`, `delete`, `get`, `update`. |
111
+ | **Epics** | `EPICS_TOOL` | `True` | Manage GitLab epics. Action-routed methods: `create`, `delete`, `get`, `update`. |
112
+ | **Issues** | `ISSUES_TOOL` | `True` | Manage GitLab issues. Action-routed methods: `create`, `delete`, `get`, `update`. |
113
+ | **Custom Api** | `CUSTOM_API_TOOL` | `True` | Execute arbitrary GitLab REST API requests directly. |
114
+ | **Graphql** | `GRAPHQL_TOOL` | `True` | Execute raw GraphQL queries and mutations natively on GitLab. |
115
+
116
+ Detailed tool schemas, parameter shapes, and validation constraints are preserved in [docs/mcp.md](docs/mcp.md).
117
+
118
+ ### Dynamic Tool Selection & Visibility
119
+
120
+ This MCP server supports dynamic toolset selection and visibility filtering at runtime. This allows you to restrict the set of exposed tools in order to prevent blowing up the LLM's context window.
121
+
122
+ You can configure tool filtering via multiple input channels:
123
+
124
+ - **CLI Arguments:** Pass `--tools` or `--toolsets` (or their disabled counterparts `--disabled-tools` and `--disabled-toolsets`) during startup.
125
+ - **Environment Variables:** Define standard environment variables:
126
+ - `MCP_ENABLED_TOOLS` / `MCP_DISABLED_TOOLS`
127
+ - `MCP_ENABLED_TAGS` / `MCP_DISABLED_TAGS`
128
+ - **HTTP SSE Request Headers:** Pass custom headers during transport initialization:
129
+ - `x-mcp-enabled-tools` / `x-mcp-disabled-tools`
130
+ - `x-mcp-enabled-tags` / `x-mcp-disabled-tags`
131
+ - **HTTP SSE Request Query Parameters:** Append query parameters directly to your transport connection URL:
132
+ - `?tools=tool1,tool2`
133
+ - `?tags=tag1`
134
+
135
+ When query strings or parameters are supplied, an LLM-free **Knowledge Graph resolution layer** (using `DynamicToolOrchestrator`) matches query intents against known tool tags, names, or descriptions, with safe fallback and automated 24-hour background cache refreshing.
136
+
137
+ ---
138
+
139
+ ### MCP Configuration Examples
140
+
141
+ #### stdio Transport (Recommended for local IDEs e.g., Cursor, Claude Desktop)
142
+ Configure your IDE's `mcp.json` to launch the MCP server via `uvx`:
143
+
144
+ ```json
145
+ {
146
+ "mcpServers": {
147
+ "gitlab-api": {
148
+ "command": "uvx",
149
+ "args": [
150
+ "--from",
151
+ "gitlab-api",
152
+ "gitlab-mcp"
153
+ ],
154
+ "env": {
155
+ "GITLAB_URL": "your_gitlab_url_here",
156
+ "GITLAB_TOKEN": "your_gitlab_token_here"
157
+ }
158
+ }
159
+ }
160
+ }
161
+ ```
162
+
163
+ #### Streamable-HTTP Transport (Recommended for production deployments)
164
+ Configure your client's `mcp.json` to launch the Streamable-HTTP server via `uvx` with explicit host and port definition:
165
+
166
+ ```json
167
+ {
168
+ "mcpServers": {
169
+ "gitlab-api": {
170
+ "command": "uvx",
171
+ "args": [
172
+ "--from",
173
+ "gitlab-api",
174
+ "gitlab-mcp"
175
+ ],
176
+ "env": {
177
+ "TRANSPORT": "streamable-http",
178
+ "HOST": "0.0.0.0",
179
+ "PORT": "8000",
180
+ "GITLAB_URL": "your_gitlab_url_here",
181
+ "GITLAB_TOKEN": "your_gitlab_token_here"
182
+ }
183
+ }
184
+ }
185
+ }
186
+ ```
187
+
188
+ Alternatively, connect to a pre-deployed remote or local Streamable-HTTP instance:
189
+
190
+ ```json
191
+ {
192
+ "mcpServers": {
193
+ "gitlab-api": {
194
+ "url": "http://localhost:8000/gitlab-api/mcp"
195
+ }
196
+ }
197
+ }
198
+ ```
199
+
200
+ Deploying the Streamable-HTTP server via Docker:
201
+
202
+ ```bash
203
+ docker run -d \
204
+ --name gitlab-api-mcp \
205
+ -p 8000:8000 \
206
+ -e TRANSPORT=streamable-http \
207
+ -e PORT=8000 \
208
+ -e GITLAB_URL="your_value" \
209
+ -e GITLAB_TOKEN="your_value" \
210
+ knucklessg1/gitlab-api:latest
211
+ ```
212
+
213
+ ---
214
+
215
+ ## Agent
216
+
217
+ 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.
218
+
219
+ ### Running the Agent CLI
220
+ To start the interactive command-line agent:
221
+
222
+ ```bash
223
+ # Set credentials
224
+ export GITLAB_URL="your_value"
225
+ export GITLAB_TOKEN="your_value"
226
+
227
+ # Run the agent server
228
+ gitlab-agent --provider openai --model-id gpt-4o
229
+ ```
230
+
231
+ ### Docker Compose Orchestration
232
+ The following `docker/agent.compose.yml` configures the Agent, Web UI, and Terminal Interface together:
233
+
234
+ ```yaml
235
+ version: '3.8'
236
+
237
+ services:
238
+ gitlab-api-mcp:
239
+ image: knucklessg1/gitlab-api:latest
240
+ container_name: gitlab-api-mcp
241
+ hostname: gitlab-api-mcp
242
+ restart: always
243
+ env_file:
244
+ - ../.env
245
+ environment:
246
+ - PYTHONUNBUFFERED=1
247
+ - HOST=0.0.0.0
248
+ - PORT=8000
249
+ - TRANSPORT=streamable-http
250
+ ports:
251
+ - "8000:8000"
252
+ healthcheck:
253
+ test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"]
254
+ interval: 30s
255
+ timeout: 10s
256
+ retries: 3
257
+ start_period: 10s
258
+ logging:
259
+ driver: json-file
260
+ options:
261
+ max-size: "10m"
262
+ max-file: "3"
263
+
264
+ gitlab-api-agent:
265
+ image: knucklessg1/gitlab-api:latest
266
+ container_name: gitlab-api-agent
267
+ hostname: gitlab-api-agent
268
+ restart: always
269
+ depends_on:
270
+ - gitlab-api-mcp
271
+ env_file:
272
+ - ../.env
273
+ command: [ "gitlab-agent" ]
274
+ environment:
275
+ - PYTHONUNBUFFERED=1
276
+ - HOST=0.0.0.0
277
+ - PORT=9017
278
+ - MCP_URL=http://gitlab-api-mcp:8000/mcp
279
+ - PROVIDER=${PROVIDER:-openai}
280
+ - MODEL_ID=${MODEL_ID:-gpt-4o}
281
+ - ENABLE_WEB_UI=True
282
+ - ENABLE_OTEL=True
283
+ ports:
284
+ - "9017:9017"
285
+ healthcheck:
286
+ test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:9017/health')"]
287
+ interval: 30s
288
+ timeout: 10s
289
+ retries: 3
290
+ start_period: 10s
291
+ logging:
292
+ driver: json-file
293
+ options:
294
+ max-size: "10m"
295
+ max-file: "3"
296
+
297
+ ```
298
+
299
+ Detailed graph node architecture explanations, custom skill configurations, and agentic trace guides are available in [docs/agent.md](docs/agent.md).
300
+
301
+ ---
302
+
303
+ ## Security & Governance
304
+
305
+ Built directly upon the enterprise-ready [`agent-utilities`](https://github.com/Knuckles-Team/agent-utilities) core, standard security parameters are fully supported:
306
+
307
+ ### Access Control & Policy Enforcement
308
+ - **Eunomia Policies:** Fine-grained, policy-driven tool authorization. Supports `none`, local `embedded` (`mcp_policies.json`), or centralized `remote` modes.
309
+ - **OIDC Token Delegation:** Compliant with RFC 8693 token exchange for flowing authenticating user credentials from Web UI / ACP → Agent → MCP.
310
+ - **Scoped Credentials:** Execution context runs restricted to the specific caller identity.
311
+
312
+ ### Runtime Security Grid
313
+ | Feature | Functionality | Enablement |
314
+ |---------|---------------|------------|
315
+ | **Tool Guard** | Sensitivity inspection with human-in-the-loop validation | Enabled by default |
316
+ | **Prompt Injection Defense** | Input scanning, repetition monitoring, and recursive loop blocks | Enabled by default |
317
+ | **Context Safety Guard** | Stuck-loop detectors and contextual overflow preemptive alerts | Enabled by default |
318
+
319
+ ---
320
+
321
+ ## Installation
322
+
323
+ Install the Python package locally:
324
+
325
+ ```bash
326
+ # Using uv (highly recommended)
327
+ uv pip install gitlab-api[all]
328
+
329
+ # Using standard pip
330
+ python -m pip install gitlab-api[all]
331
+ ```
332
+
333
+ ---
334
+
335
+ ## Repository Owners
336
+
337
+ <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" />
338
+
339
+ ![GitHub followers](https://img.shields.io/github/followers/Knucklessg1)
340
+ ![GitHub User's stars](https://img.shields.io/github/stars/Knucklessg1)
341
+
342
+ ---
343
+
344
+ ## Contribute
345
+
346
+ Contributions are welcome! Please ensure code quality by executing local checks before submitting pull requests:
347
+ - Format code using `ruff format .`
348
+ - Lint code using `ruff check .`
349
+ - Validate type-safety with `mypy .`
350
+ - Execute test suites using `pytest`
@@ -0,0 +1,318 @@
1
+ # Gitlab Api
2
+ ## CLI or API | MCP | Agent
3
+
4
+ ![PyPI - Version](https://img.shields.io/pypi/v/gitlab-api)
5
+ ![MCP Server](https://badge.mcpx.dev?type=server 'MCP Server')
6
+ ![PyPI - Downloads](https://img.shields.io/pypi/dd/gitlab-api)
7
+ ![GitHub Repo stars](https://img.shields.io/github/stars/Knuckles-Team/gitlab-api)
8
+ ![GitHub forks](https://img.shields.io/github/forks/Knuckles-Team/gitlab-api)
9
+ ![GitHub contributors](https://img.shields.io/github/contributors/Knuckles-Team/gitlab-api)
10
+ ![PyPI - License](https://img.shields.io/pypi/l/gitlab-api)
11
+ ![GitHub](https://img.shields.io/github/license/Knuckles-Team/gitlab-api)
12
+ ![GitHub last commit (by committer)](https://img.shields.io/github/last-commit/Knuckles-Team/gitlab-api)
13
+ ![GitHub pull requests](https://img.shields.io/github/issues-pr/Knuckles-Team/gitlab-api)
14
+ ![GitHub closed pull requests](https://img.shields.io/github/issues-pr-closed/Knuckles-Team/gitlab-api)
15
+ ![GitHub issues](https://img.shields.io/github/issues/Knuckles-Team/gitlab-api)
16
+ ![GitHub top language](https://img.shields.io/github/languages/top/Knuckles-Team/gitlab-api)
17
+ ![GitHub language count](https://img.shields.io/github/languages/count/Knuckles-Team/gitlab-api)
18
+ ![GitHub repo size](https://img.shields.io/github/repo-size/Knuckles-Team/gitlab-api)
19
+ ![GitHub repo file count (file type)](https://img.shields.io/github/directory-file-count/Knuckles-Team/gitlab-api)
20
+ ![PyPI - Wheel](https://img.shields.io/pypi/wheel/gitlab-api)
21
+ ![PyPI - Implementation](https://img.shields.io/pypi/implementation/gitlab-api)
22
+
23
+ *Version: 25.32.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](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** | `MISC_TOOL` | `True` | Manage gitlab api misc operations. |
58
+ | **Branches** | `BRANCHES_TOOL` | `True` | Manage gitlab branches operations. Action-routed methods: `create`, `delete`, `get`. |
59
+ | **Protected Branches** | `PROTECTED_BRANCHES_TOOL` | `True` | Manage gitlab protected branches operations. Action-routed methods: `get`, `protect`, `unprotect`. |
60
+ | **Commits** | `COMMITS_TOOL` | `True` | Manage gitlab commits operations. Action-routed methods: `create`, `create_comment`, `diff`, `get`, `get_comments`, `get_discussions`, `get_gpg_signature`, `get_merge_requests`, `get_statuses`, `post_status`, `revert`. |
61
+ | **Deploy Tokens** | `DEPLOY_TOKENS_TOOL` | `True` | Manage gitlab deploy tokens operations. Action-routed methods: `create_group`, `create_project`, `delete_group`, `delete_project`, `get`, `get_group`, `get_project`. |
62
+ | **Environments** | `ENVIRONMENTS_TOOL` | `True` | Manage gitlab environments operations. Action-routed methods: `create`, `delete`, `delete_stopped`, `get`, `get_protected`, `protect`, `stop`, `stop_stale`, `unprotect`, `update`, `update_protected`. |
63
+ | **Groups** | `GROUPS_TOOL` | `True` | Manage gitlab groups operations. Action-routed methods: `edit`, `get`, `get_descendants`, `get_merge_requests`, `get_projects`, `get_subgroups`. |
64
+ | **Jobs** | `JOBS_TOOL` | `True` | Manage gitlab jobs operations. Action-routed methods: `cancel`, `erase`, `get_log`, `get_pipeline_jobs`, `get_project_jobs`, `retry`, `run`. |
65
+ | **Members** | `MEMBERS_TOOL` | `True` | Manage gitlab members operations. Action-routed methods: `get_group`, `get_project`. |
66
+ | **Merge Requests** | `MERGE_REQUESTS_TOOL` | `True` | Manage gitlab merge requests operations. Action-routed methods: `create`, `get`, `get_project`. |
67
+ | **Merge Rules** | `MERGE_RULES_TOOL` | `True` | Manage gitlab merge rules operations. Action-routed methods: `approve_mr`, `create_project_level`, `delete_project_level`, `edit_group_level`, `edit_project_level`, `get_group_level`, `get_mr_approval_state`, `get_mr_approvals`, `get_mr_level`, `get_project_level`, `unapprove_mr`, `update_project_level`. |
68
+ | **Packages** | `PACKAGES_TOOL` | `True` | Manage gitlab packages operations. Action-routed methods: `download`, `get`, `publish`. |
69
+ | **Pipelines** | `PIPELINES_TOOL` | `True` | Manage gitlab pipelines operations. Action-routed methods: `get`, `run`. |
70
+ | **Pipeline Schedules** | `PIPELINE_SCHEDULES_TOOL` | `True` | Manage gitlab pipeline schedules operations. Action-routed methods: `create`, `create_variable`, `delete`, `delete_variable`, `edit`, `get`, `get_all`, `get_triggered`, `run`, `take_ownership`. |
71
+ | **Projects** | `PROJECTS_TOOL` | `True` | Manage gitlab projects operations. Action-routed methods: `edit`, `get`, `get_contributors`, `get_nested_by_group`, `get_statistics`, `share_with_group`, `unshare_with_group`. |
72
+ | **Releases** | `RELEASES_TOOL` | `True` | Manage gitlab releases operations. Action-routed methods: `create`, `create_evidence`, `delete`, `download_asset`, `get`, `get_by_tag`, `get_group_releases`, `get_latest`, `get_latest_asset`, `get_latest_evidence`, `update`. |
73
+ | **Runners** | `RUNNERS_TOOL` | `True` | Manage gitlab runners operations. Action-routed methods: `delete`, `delete_project`, `enable_project`, `get_all`, `get_group`, `get_jobs`, `get_project`, `pause`, `register`, `reset_gitlab_token`, `reset_group_token`, `reset_project_token`, `reset_token`, `update_details`, `verify_auth`. |
74
+ | **Tags** | `TAGS_TOOL` | `True` | Manage gitlab tags operations. Action-routed methods: `create`, `delete`, `get`, `get_protected`, `get_protected_tag`, `protect`, `unprotect`. |
75
+ | **Labels** | `LABELS_TOOL` | `True` | Manage GitLab labels. Action-routed methods: `create`, `delete`, `get`, `update`. |
76
+ | **Milestones** | `MILESTONES_TOOL` | `True` | Manage GitLab milestones. Action-routed methods: `create`, `delete`, `get`, `update`. |
77
+ | **Snippets** | `SNIPPETS_TOOL` | `True` | Manage GitLab snippets. Action-routed methods: `create`, `delete`, `get`, `update`. |
78
+ | **Notes** | `NOTES_TOOL` | `True` | Manage GitLab notes/comments on issues, merge requests, commits, and epics. Action-routed methods: `create`, `delete`, `get`, `update`. |
79
+ | **Epics** | `EPICS_TOOL` | `True` | Manage GitLab epics. Action-routed methods: `create`, `delete`, `get`, `update`. |
80
+ | **Issues** | `ISSUES_TOOL` | `True` | Manage GitLab issues. Action-routed methods: `create`, `delete`, `get`, `update`. |
81
+ | **Custom Api** | `CUSTOM_API_TOOL` | `True` | Execute arbitrary GitLab REST API requests directly. |
82
+ | **Graphql** | `GRAPHQL_TOOL` | `True` | Execute raw GraphQL queries and mutations natively on GitLab. |
83
+
84
+ Detailed tool schemas, parameter shapes, and validation constraints are preserved in [docs/mcp.md](docs/mcp.md).
85
+
86
+ ### Dynamic Tool Selection & Visibility
87
+
88
+ This MCP server supports dynamic toolset selection and visibility filtering at runtime. This allows you to restrict the set of exposed tools in order to prevent blowing up the LLM's context window.
89
+
90
+ You can configure tool filtering via multiple input channels:
91
+
92
+ - **CLI Arguments:** Pass `--tools` or `--toolsets` (or their disabled counterparts `--disabled-tools` and `--disabled-toolsets`) during startup.
93
+ - **Environment Variables:** Define standard environment variables:
94
+ - `MCP_ENABLED_TOOLS` / `MCP_DISABLED_TOOLS`
95
+ - `MCP_ENABLED_TAGS` / `MCP_DISABLED_TAGS`
96
+ - **HTTP SSE Request Headers:** Pass custom headers during transport initialization:
97
+ - `x-mcp-enabled-tools` / `x-mcp-disabled-tools`
98
+ - `x-mcp-enabled-tags` / `x-mcp-disabled-tags`
99
+ - **HTTP SSE Request Query Parameters:** Append query parameters directly to your transport connection URL:
100
+ - `?tools=tool1,tool2`
101
+ - `?tags=tag1`
102
+
103
+ When query strings or parameters are supplied, an LLM-free **Knowledge Graph resolution layer** (using `DynamicToolOrchestrator`) matches query intents against known tool tags, names, or descriptions, with safe fallback and automated 24-hour background cache refreshing.
104
+
105
+ ---
106
+
107
+ ### MCP Configuration Examples
108
+
109
+ #### stdio Transport (Recommended for local IDEs e.g., Cursor, Claude Desktop)
110
+ Configure your IDE's `mcp.json` to launch the MCP server via `uvx`:
111
+
112
+ ```json
113
+ {
114
+ "mcpServers": {
115
+ "gitlab-api": {
116
+ "command": "uvx",
117
+ "args": [
118
+ "--from",
119
+ "gitlab-api",
120
+ "gitlab-mcp"
121
+ ],
122
+ "env": {
123
+ "GITLAB_URL": "your_gitlab_url_here",
124
+ "GITLAB_TOKEN": "your_gitlab_token_here"
125
+ }
126
+ }
127
+ }
128
+ }
129
+ ```
130
+
131
+ #### Streamable-HTTP Transport (Recommended for production deployments)
132
+ Configure your client's `mcp.json` to launch the Streamable-HTTP server via `uvx` with explicit host and port definition:
133
+
134
+ ```json
135
+ {
136
+ "mcpServers": {
137
+ "gitlab-api": {
138
+ "command": "uvx",
139
+ "args": [
140
+ "--from",
141
+ "gitlab-api",
142
+ "gitlab-mcp"
143
+ ],
144
+ "env": {
145
+ "TRANSPORT": "streamable-http",
146
+ "HOST": "0.0.0.0",
147
+ "PORT": "8000",
148
+ "GITLAB_URL": "your_gitlab_url_here",
149
+ "GITLAB_TOKEN": "your_gitlab_token_here"
150
+ }
151
+ }
152
+ }
153
+ }
154
+ ```
155
+
156
+ Alternatively, connect to a pre-deployed remote or local Streamable-HTTP instance:
157
+
158
+ ```json
159
+ {
160
+ "mcpServers": {
161
+ "gitlab-api": {
162
+ "url": "http://localhost:8000/gitlab-api/mcp"
163
+ }
164
+ }
165
+ }
166
+ ```
167
+
168
+ Deploying the Streamable-HTTP server via Docker:
169
+
170
+ ```bash
171
+ docker run -d \
172
+ --name gitlab-api-mcp \
173
+ -p 8000:8000 \
174
+ -e TRANSPORT=streamable-http \
175
+ -e PORT=8000 \
176
+ -e GITLAB_URL="your_value" \
177
+ -e GITLAB_TOKEN="your_value" \
178
+ knucklessg1/gitlab-api:latest
179
+ ```
180
+
181
+ ---
182
+
183
+ ## Agent
184
+
185
+ 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.
186
+
187
+ ### Running the Agent CLI
188
+ To start the interactive command-line agent:
189
+
190
+ ```bash
191
+ # Set credentials
192
+ export GITLAB_URL="your_value"
193
+ export GITLAB_TOKEN="your_value"
194
+
195
+ # Run the agent server
196
+ gitlab-agent --provider openai --model-id gpt-4o
197
+ ```
198
+
199
+ ### Docker Compose Orchestration
200
+ The following `docker/agent.compose.yml` configures the Agent, Web UI, and Terminal Interface together:
201
+
202
+ ```yaml
203
+ version: '3.8'
204
+
205
+ services:
206
+ gitlab-api-mcp:
207
+ image: knucklessg1/gitlab-api:latest
208
+ container_name: gitlab-api-mcp
209
+ hostname: gitlab-api-mcp
210
+ restart: always
211
+ env_file:
212
+ - ../.env
213
+ environment:
214
+ - PYTHONUNBUFFERED=1
215
+ - HOST=0.0.0.0
216
+ - PORT=8000
217
+ - TRANSPORT=streamable-http
218
+ ports:
219
+ - "8000:8000"
220
+ healthcheck:
221
+ test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"]
222
+ interval: 30s
223
+ timeout: 10s
224
+ retries: 3
225
+ start_period: 10s
226
+ logging:
227
+ driver: json-file
228
+ options:
229
+ max-size: "10m"
230
+ max-file: "3"
231
+
232
+ gitlab-api-agent:
233
+ image: knucklessg1/gitlab-api:latest
234
+ container_name: gitlab-api-agent
235
+ hostname: gitlab-api-agent
236
+ restart: always
237
+ depends_on:
238
+ - gitlab-api-mcp
239
+ env_file:
240
+ - ../.env
241
+ command: [ "gitlab-agent" ]
242
+ environment:
243
+ - PYTHONUNBUFFERED=1
244
+ - HOST=0.0.0.0
245
+ - PORT=9017
246
+ - MCP_URL=http://gitlab-api-mcp:8000/mcp
247
+ - PROVIDER=${PROVIDER:-openai}
248
+ - MODEL_ID=${MODEL_ID:-gpt-4o}
249
+ - ENABLE_WEB_UI=True
250
+ - ENABLE_OTEL=True
251
+ ports:
252
+ - "9017:9017"
253
+ healthcheck:
254
+ test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:9017/health')"]
255
+ interval: 30s
256
+ timeout: 10s
257
+ retries: 3
258
+ start_period: 10s
259
+ logging:
260
+ driver: json-file
261
+ options:
262
+ max-size: "10m"
263
+ max-file: "3"
264
+
265
+ ```
266
+
267
+ Detailed graph node architecture explanations, custom skill configurations, and agentic trace guides are available in [docs/agent.md](docs/agent.md).
268
+
269
+ ---
270
+
271
+ ## Security & Governance
272
+
273
+ Built directly upon the enterprise-ready [`agent-utilities`](https://github.com/Knuckles-Team/agent-utilities) core, standard security parameters are fully supported:
274
+
275
+ ### Access Control & Policy Enforcement
276
+ - **Eunomia Policies:** Fine-grained, policy-driven tool authorization. Supports `none`, local `embedded` (`mcp_policies.json`), or centralized `remote` modes.
277
+ - **OIDC Token Delegation:** Compliant with RFC 8693 token exchange for flowing authenticating user credentials from Web UI / ACP → Agent → MCP.
278
+ - **Scoped Credentials:** Execution context runs restricted to the specific caller identity.
279
+
280
+ ### Runtime Security Grid
281
+ | Feature | Functionality | Enablement |
282
+ |---------|---------------|------------|
283
+ | **Tool Guard** | Sensitivity inspection with human-in-the-loop validation | Enabled by default |
284
+ | **Prompt Injection Defense** | Input scanning, repetition monitoring, and recursive loop blocks | Enabled by default |
285
+ | **Context Safety Guard** | Stuck-loop detectors and contextual overflow preemptive alerts | Enabled by default |
286
+
287
+ ---
288
+
289
+ ## Installation
290
+
291
+ Install the Python package locally:
292
+
293
+ ```bash
294
+ # Using uv (highly recommended)
295
+ uv pip install gitlab-api[all]
296
+
297
+ # Using standard pip
298
+ python -m pip install gitlab-api[all]
299
+ ```
300
+
301
+ ---
302
+
303
+ ## Repository Owners
304
+
305
+ <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" />
306
+
307
+ ![GitHub followers](https://img.shields.io/github/followers/Knucklessg1)
308
+ ![GitHub User's stars](https://img.shields.io/github/stars/Knucklessg1)
309
+
310
+ ---
311
+
312
+ ## Contribute
313
+
314
+ Contributions are welcome! Please ensure code quality by executing local checks before submitting pull requests:
315
+ - Format code using `ruff format .`
316
+ - Lint code using `ruff check .`
317
+ - Validate type-safety with `mypy .`
318
+ - Execute test suites using `pytest`
@@ -4,7 +4,7 @@ import os
4
4
  import sys
5
5
  import warnings
6
6
 
7
- __version__ = "25.24.1"
7
+ __version__ = "25.32.0"
8
8
 
9
9
  logging.basicConfig(
10
10
  level=logging.INFO,
@@ -0,0 +1 @@
1
+ # GitLab Agent API Package