gitlab-api 27.2.0__py3-none-any.whl → 27.3.0__py3-none-any.whl

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.
@@ -846,16 +846,27 @@ class GitLabApiProjects(GitLabApiBase):
846
846
  except ValidationError as e:
847
847
  raise ParameterError(f"Invalid parameters: {e.errors()}") from e
848
848
 
849
- def create_project(self, **kwargs) -> Response:
849
+ def create_project(
850
+ self,
851
+ name: str | None = None,
852
+ path: str | None = None,
853
+ namespace_id: int | None = None,
854
+ visibility: str | None = None,
855
+ description: str | None = None,
856
+ initialize_with_readme: bool | None = None,
857
+ **kwargs,
858
+ ) -> Response:
850
859
  """
851
860
  Create a new project.
852
861
 
853
862
  Args:
854
- **kwargs: GitLab POST /projects body fields. Common: name (required
855
- unless path given), path, namespace_id (group/user namespace),
856
- visibility ('private'|'internal'|'public'), description,
857
- initialize_with_readme. A flexible body is sent so any documented
858
- create field is accepted (ProjectModel does not cover namespace_id).
863
+ name: Project name (required unless path is given).
864
+ path: Repository path.
865
+ namespace_id: Group or user namespace id.
866
+ visibility: 'private', 'internal' or 'public'.
867
+ description: Project description.
868
+ initialize_with_readme: Create an initial README.
869
+ **kwargs: Any other documented GitLab POST /projects body field.
859
870
 
860
871
  Returns:
861
872
  Response: A wrapper containing the original response and a Project model.
@@ -864,8 +875,16 @@ class GitLabApiProjects(GitLabApiBase):
864
875
  MissingParameterError: If neither name nor path is provided.
865
876
  ParameterError: If invalid parameters are provided.
866
877
  """
867
- if not kwargs.get("name") and not kwargs.get("path"):
878
+ if not name and not path:
868
879
  raise MissingParameterError
880
+ kwargs.update(
881
+ name=name,
882
+ path=path,
883
+ namespace_id=namespace_id,
884
+ visibility=visibility,
885
+ description=description,
886
+ initialize_with_readme=initialize_with_readme,
887
+ )
869
888
  body = {k: v for k, v in kwargs.items() if v is not None}
870
889
  try:
871
890
  response = self._session.post(
@@ -2,17 +2,17 @@
2
2
  "_comment": "Tier-1 mcp_tool source presets for gitlab-api (AU-KG.ingest.mcp-tool-connector). Syncs GitLab projects into the KG as repository documents via the gitlab-api MCP server. Contributed presets win over the central MCP_TOOL_PRESETS. Extend with merge-request / pipeline presets as needed.",
3
3
  "gitlab-projects": {
4
4
  "server": "gitlab-mcp",
5
- "tool": "gitlab_projects",
6
- "action": "get",
5
+ "tool": "gitlab_get_projects",
7
6
  "records_path": "data",
8
7
  "id_field": "id",
9
8
  "title_field": "path_with_namespace",
10
9
  "text_field": "description",
11
10
  "updated_field": "last_activity_at",
12
11
  "pagination": "page",
13
- "page_kind": "page",
12
+ "page_kind": "number",
14
13
  "page_param": "page",
15
14
  "page_size_param": "per_page",
16
- "doc_type": "repository"
15
+ "doc_type": "repository",
16
+ "params_style": "args"
17
17
  }
18
18
  }
@@ -3,6 +3,6 @@
3
3
  "connector": "gitlab-api",
4
4
  "schema_version": "1",
5
5
  "tools": {
6
- "gitlab_projects": "dc3f211d87b545429087ffd95b83a35a3f2ed269a4cd8ff927c9d72fc08d5c81"
6
+ "gitlab_get_projects": "18b7c440b1165616ba8455535985becf3c14d643a22f40c34d4f321c736c9e06"
7
7
  }
8
8
  }
gitlab_api/mcp_server.py CHANGED
@@ -35,7 +35,7 @@ from agent_connector_sdk.mcp.tool_surface import register_tool_surface
35
35
  from gitlab_api.api_client import Api
36
36
  from gitlab_api.auth import get_client
37
37
 
38
- __version__ = "27.2.0"
38
+ __version__ = "27.3.0"
39
39
  print(f"Gitlab MCP v{__version__}", file=sys.stderr)
40
40
 
41
41
  logger = get_logger(name="mcp_server")
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "api_version": "arbora.io/v1",
3
3
  "artifacts": {
4
- "connector_manifest.yml": "a54aac9929e2f281fc34b5e87c3224b60bad4ef2e5d5556a868bf3dc8d2198af",
5
- "gitlab_api/connectors/mcp_source_presets.json": "e3d608244e0b66694fc82ab039613181a98e9e4c25a9bf2c8f0a2b09a0c23061",
6
- "gitlab_api/connectors/tool_schema_fingerprints.json": "74f3e6a172be003056bb74279281308a900b53c4d2d12de7fc2affee9fbcc6a3",
4
+ "connector_manifest.yml": "994ca982e951c529bbc3ae0206bbe94e0f5cc66d5ffb659c94e2d925a15af130",
5
+ "gitlab_api/connectors/mcp_source_presets.json": "08401d486ad760f128203a710577be5be0a7c892acd6f46685077d19294b641e",
6
+ "gitlab_api/connectors/tool_schema_fingerprints.json": "5e7928f836de01dc652c26eff3dbbdbde221f5cfe03b90b2d1479b83502c05ce",
7
7
  "gitlab_api/ontology/fixtures/records.json": "5f0417820053941933f15b3f459750753f4e8e34cf1e7853fd030c1143356b40",
8
8
  "gitlab_api/ontology/gitlab.ttl": "19fa64000d2e51c60c53074b1fae4ab98aed85318337b5a2199f4837ae9f3fc0",
9
9
  "gitlab_api/ontology/mappings/source.yaml": "167206b5387f7ca97ce02e0f15164f8fe41f06b413b591d0008c29e9f0a95e7f",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gitlab-api
3
- Version: 27.2.0
3
+ Version: 27.3.0
4
4
  Summary: GitLab API + MCP Server
5
5
  Author-email: Project Maintainers <maintainers@users.noreply.github.com>
6
6
  License: MIT
@@ -12,11 +12,11 @@ Classifier: Programming Language :: Python :: 3
12
12
  Requires-Python: >=3.12
13
13
  Description-Content-Type: text/markdown
14
14
  License-File: LICENSE
15
- Requires-Dist: agent-connector-sdk[mcp]<1.0.0,>=0.2.1
15
+ Requires-Dist: agent-connector-sdk[mcp]<1.0.0,>=0.3.0
16
16
  Requires-Dist: python-dotenv>=1.2.4
17
17
  Requires-Dist: gql[requests]>=4.4.0
18
18
  Provides-Extra: mcp
19
- Requires-Dist: agent-connector-sdk[mcp]<1.0.0,>=0.2.1; extra == "mcp"
19
+ Requires-Dist: agent-connector-sdk[mcp]<1.0.0,>=0.3.0; extra == "mcp"
20
20
  Provides-Extra: gql
21
21
  Requires-Dist: gql[requests]>=4.4.0; extra == "gql"
22
22
  Provides-Extra: all
@@ -50,7 +50,7 @@ Dynamic: license-file
50
50
  ![PyPI - Wheel](https://img.shields.io/pypi/wheel/gitlab-api)
51
51
  ![PyPI - Implementation](https://img.shields.io/pypi/implementation/gitlab-api)
52
52
 
53
- *Version: 27.2.0*
53
+ *Version: 27.3.0*
54
54
 
55
55
  > **Documentation** — Installation, deployment, usage across the API, CLI, and MCP
56
56
  > backing GitLab instance are maintained in the
@@ -9,7 +9,7 @@ gitlab_api/gitlab_response_models.py,sha256=m0jU8Xtwbq2y0AogCptVCslWlvi6SztLMDQZ
9
9
  gitlab_api/instances.py,sha256=RW7aKRvHWMQAQ5ZRRcjpKgpPgq_5YoncXt-_rC4ReXk,5423
10
10
  gitlab_api/kg_ingest.py,sha256=Verv5y0OtMYDXmzMoUD5EDUC8PZBiVfTddU5nND38b0,10750
11
11
  gitlab_api/mcp_config.json,sha256=2OOXrwO1sDLyHQqpZwhvDHizPIe3by6YmK4KFE333gI,23
12
- gitlab_api/mcp_server.py,sha256=T-EV1WuMiOXQLEwm3CLIpge6sgjuIwjcz2XbIvRknaY,51654
12
+ gitlab_api/mcp_server.py,sha256=aSVb3p2glE_Q4IbsDmLVbBKYuDNK4ggI10PapEJ_xzs,51654
13
13
  gitlab_api/api/__init__.py,sha256=MQblcZQoMdWyzpfnlAOEmyVlP7pbNcz_BQgAs5JINOI,27
14
14
  gitlab_api/api/api_client_base.py,sha256=0jdaCaV0tCxbNop6mdtq4nXgbrxEXu-ENoOxVmlaORE,8670
15
15
  gitlab_api/api/api_client_environments.py,sha256=2OQ88aStucaKO-VNc6NbXJxQdB761h0aJnPcVaHwBxo,26403
@@ -17,16 +17,16 @@ gitlab_api/api/api_client_issues.py,sha256=_N-fxDh2rOD1gjxCM7Hyhxy_TmEE-fkUNpjDL
17
17
  gitlab_api/api/api_client_merge_requests.py,sha256=qySeI94cy660E-RdUg6rRs0BN91-iY_evRHGcUHiIKs,13200
18
18
  gitlab_api/api/api_client_other.py,sha256=7uSrnMI3Qbfe-dqo83ucgAngA_0rwHSibPiszHdKq8g,20974
19
19
  gitlab_api/api/api_client_pipelines.py,sha256=-saQ_UwLJlSJepNRtIiRm_R9j_dyzMSy3TDYLgyS4TI,28485
20
- gitlab_api/api/api_client_projects.py,sha256=REkuvAs05KVEFKJR2JBDycbSSgzTM1cd3zlMYzEWaPY,46167
20
+ gitlab_api/api/api_client_projects.py,sha256=wYshJH7cMOObZnZJEt0PWgkF-WWmZwe8Wiog_SO1Q58,46647
21
21
  gitlab_api/api/api_client_repositories.py,sha256=nop0DRe6WR-UENSPZKtH-CYmHxDgEZ392U9zpQlI_kg,34819
22
22
  gitlab_api/api/api_client_system.py,sha256=upgTUlDoqSq6reLyOT9lK6IDUuhUAXWKbd7vPDyFhtM,2205
23
23
  gitlab_api/api/api_client_users_groups.py,sha256=0tpy-Bxx9mP2imeIQGJMmzlpxSKGaKuoPt5bwqJSaYI,22035
24
24
  gitlab_api/api/api_client_vulnerabilities.py,sha256=O2HNDopoaWlG0_wQNQvhZKNibFOOOzjXCOFzO8GzAZA,6168
25
25
  gitlab_api/connectors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
- gitlab_api/connectors/mcp_source_presets.json,sha256=49YIJE4LZmlPyCqwOWExgamOnkwlqb8sjworCaDCMGE,720
27
- gitlab_api/connectors/tool_schema_fingerprints.json,sha256=mP15QKfrsSBF6QNSDRVlYxZbqTAwrQ51tuYQP0o48vc,231
26
+ gitlab_api/connectors/mcp_source_presets.json,sha256=CEAdSGrXYPEoIDpxBXe-W-CnyJKs1vRmhQd9GSlLZB4,733
27
+ gitlab_api/connectors/tool_schema_fingerprints.json,sha256=Xnko-DbeAdxlLCbv89u9veIh9c_gO5Cy0Uebg1AsBc4,235
28
28
  gitlab_api/ontology/__init__.py,sha256=508Z6ZA4AHEfTFVfTLsenl0Lj_3sfI-MZG8icDzlOSo,568
29
- gitlab_api/ontology/certification.json,sha256=snBcuMl9AZi0oYW3I9y7AYBtnwA1LnhIWaqQqwhg3ps,1650
29
+ gitlab_api/ontology/certification.json,sha256=1Gfxi5Nu-EdYhtsHJYaHW2dqblLhclfVCzaWgM5Cs4w,1650
30
30
  gitlab_api/ontology/gitlab.ttl,sha256=qJvCWigVMhMF80HpMwegHGC3cG5pAtC8jBESD4BchXU,8028
31
31
  gitlab_api/ontology/fixtures/records.json,sha256=XwQXggBTlBkz8Vs_RZdQdT9OjjTPHnhT_QMMEUM1a0A,553
32
32
  gitlab_api/ontology/mappings/source.yaml,sha256=FnIGtTh_fKl84C4PFRZPj-QfBrQTtZHQAIwp6fCpXn8,545
@@ -48,14 +48,13 @@ gitlab_api/skills/gitlab-pipelines/SKILL.md,sha256=OuEk9sRMjJQQzCE2eZtRq9-wgtWRO
48
48
  gitlab_api/skills/gitlab-pipelines/WORKFLOW.md,sha256=6C61qo-byMs-7bvry3NKCtyzdRWOEjhC-mOG0ZJvsL0,4314
49
49
  gitlab_api/skills/gitlab-vulnerabilities/SKILL.md,sha256=acBODboYBGccTtuCAv5fv5cY_gEXedMSmepur3q9f9Q,5212
50
50
  gitlab_api/skills/gitlab-vulnerabilities/WORKFLOW.md,sha256=OKnEKILIrhsnnNQTu0MLSQAWR6jL2w6PuX6ztu0Nhdk,5041
51
- gitlab_api-27.2.0.dist-info/licenses/LICENSE,sha256=9eAPQLU4cIYQNvAIt6PNoiVQozaVoPRhMV_N7_UHG7A,1068
51
+ gitlab_api-27.3.0.dist-info/licenses/LICENSE,sha256=9eAPQLU4cIYQNvAIt6PNoiVQozaVoPRhMV_N7_UHG7A,1068
52
52
  scripts/check_import_safety.py,sha256=IjaMe7nWwK261tNPO8vmLdDy-skX1mpMACQKJhvp0ik,13503
53
53
  scripts/security_contract.py,sha256=3517zbvFsLEaWhZOiBwjb9lQiNvH8C-8HzlK4i4SBF8,25137
54
54
  scripts/security_sanitizer.py,sha256=gE65xtYMGx43oYUnK0kozBm73Hx97mCdrQUM7GGzIbk,9449
55
55
  scripts/verify_api_integration.py,sha256=3AK8HKW52o1yxCDaEUtXngnh7CjYw6NiG9Eb3EIoXNE,10256
56
56
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
57
57
  tests/conftest.py,sha256=srq80Qcj_VFRxMFCYZ6pXtEDfXO1PzVY-HEI4kmm29s,2090
58
- tests/test_action_discovery.py,sha256=me7KaADxSR4sjxeZJnC3sfqALJY5hd6LL56mKO-CJn0,2001
59
58
  tests/test_api_wrapper.py,sha256=jUXDVR4lKOZLTvE3vAS8Xjkc4q57smd6MJr7u_eBU9U,5717
60
59
  tests/test_auth.py,sha256=4Fn0JFvGW5wxUu3-gJQEZO0agLrtOw8LEQ6HH5uYKLk,4420
61
60
  tests/test_connector_prep.py,sha256=m4cGbZlfmZLcai7ShUiiip5a-QvNVy8WQ-P9jaVcAFM,10714
@@ -68,13 +67,13 @@ tests/test_identity_context_scoping.py,sha256=wY_xb37E7qd91F5NNhf0g2Hv1uRyrM0wnC
68
67
  tests/test_init_dynamics.py,sha256=fsfRhuT6yCY91JXoHd7gbHfuPjZfLW0A7aJgyXptL6E,1693
69
68
  tests/test_instances.py,sha256=C8csQIJPv1Wdbh4Le2JBg1pM7iFo5rYfL-vp_aGwOtA,4167
70
69
  tests/test_kg_ingest.py,sha256=sgo6KNYKs7xbvbmKZDOXpHDhb3YkXvxjWsIELpxcAGI,7633
71
- tests/test_mock_coverage.py,sha256=WE8erM8Er4Vkq-nA_nvN9NxvvCAHqhnwRfE9YUv-fRU,12162
70
+ tests/test_mock_coverage.py,sha256=yO5A8ZP3UxTx1fO-T15p2Dy74EZaXRHgUyBXfhqN96k,11053
72
71
  tests/test_startup.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
73
- tests/test_tool_modes.py,sha256=zxgrbC-zu5MEXD1-TXt3-URGJ_VAjeckgkPg_EKc1iA,737
72
+ tests/test_tool_modes.py,sha256=aiAaQE0yXp9SKGz9BVgik4HIjE5kar8FBD9uVOK5pwA,721
74
73
  tests/test_verify_agent.py,sha256=XdW2NtR5643rgjDYLu6RajWu-4wqrZjCUsRehfsKCqQ,6465
75
74
  tests/verify_a2a_queries.py,sha256=JMKBexwzo6c59NpVrBfYgW4HnmSG8-qqfdeku5YFtwc,3613
76
- gitlab_api-27.2.0.dist-info/METADATA,sha256=KOQvhY39v333lk2O5_DA4KtnrX2Of6upAiNltu_8xLU,40527
77
- gitlab_api-27.2.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
78
- gitlab_api-27.2.0.dist-info/entry_points.txt,sha256=-FUZqPa8FPHty3mGFhNlFRajrMh6fgSgV8fcxAI1KTA,366
79
- gitlab_api-27.2.0.dist-info/top_level.txt,sha256=fJ-T_zkuttbq8Kn1dq0mBvyjtKqPdMic01oCdbzxh_k,48
80
- gitlab_api-27.2.0.dist-info/RECORD,,
75
+ gitlab_api-27.3.0.dist-info/METADATA,sha256=3i4OzlUaSNYLDO6R_3mdL5fAMCbRiCLj5uUrodvjAew,40527
76
+ gitlab_api-27.3.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
77
+ gitlab_api-27.3.0.dist-info/entry_points.txt,sha256=-FUZqPa8FPHty3mGFhNlFRajrMh6fgSgV8fcxAI1KTA,366
78
+ gitlab_api-27.3.0.dist-info/top_level.txt,sha256=fJ-T_zkuttbq8Kn1dq0mBvyjtKqPdMic01oCdbzxh_k,48
79
+ gitlab_api-27.3.0.dist-info/RECORD,,
@@ -296,48 +296,8 @@ async def test_archive_unarchive_methods_and_mcp():
296
296
  )
297
297
  assert mock_post.call_args.kwargs["headers"] == client.headers
298
298
 
299
- # 2. Test the FastMCP tool for gitlab_projects archive/unarchive actions
299
+ # 2. The MCP surface serves one tool per operation.
300
300
  mcp, _, _, _ = get_mcp_instance()
301
- tool_objs = (
302
- await mcp.list_tools()
303
- if inspect.iscoroutinefunction(mcp.list_tools)
304
- else mcp.list_tools()
305
- )
306
-
307
- projects_tool = None
308
- for tool in tool_objs:
309
- if tool.name == "gitlab_projects":
310
- projects_tool = tool
311
- break
312
-
313
- assert projects_tool is not None
314
-
315
- mock_client = MagicMock()
316
- mock_client.archive_project.return_value = {
317
- "status": "success",
318
- "action": "archive",
319
- }
320
- mock_client.unarchive_project.return_value = {
321
- "status": "success",
322
- "action": "unarchive",
323
- }
324
-
325
- # Test action="archive"
326
- res_archive = await projects_tool.fn(
327
- action="archive",
328
- params_json='{"project_id": 123}',
329
- client=mock_client,
330
- ctx=None,
331
- )
332
- assert res_archive == {"status": "success", "action": "archive"}
333
- mock_client.archive_project.assert_called_once_with(project_id=123)
334
-
335
- # Test action="unarchive"
336
- res_unarchive = await projects_tool.fn(
337
- action="unarchive",
338
- params_json='{"project_id": 123}',
339
- client=mock_client,
340
- ctx=None,
341
- )
342
- assert res_unarchive == {"status": "success", "action": "unarchive"}
343
- mock_client.unarchive_project.assert_called_once_with(project_id=123)
301
+ names = {tool.name for tool in await mcp.list_tools()}
302
+ assert {"gitlab_archive_project", "gitlab_unarchive_project"} <= names
303
+ assert "gitlab_projects" not in names
tests/test_tool_modes.py CHANGED
@@ -1,4 +1,4 @@
1
- """MCP_TOOL_MODE: condensed (default) / verbose / both surfaces (ECO-4.82)."""
1
+ """MCP_TOOL_MODE: condensed surface (ECO-4.82)."""
2
2
 
3
3
  from unittest.mock import patch
4
4
 
@@ -20,9 +20,5 @@ async def _names(monkeypatch, mode):
20
20
  @pytest.mark.asyncio
21
21
  async def test_condensed_default(monkeypatch):
22
22
  names = await _names(monkeypatch, None)
23
- assert "gitlab_branches" in names # action-routed tool
24
- assert "gitlab_get_branches" not in names # verbose absent
25
-
26
-
27
-
28
-
23
+ assert "gitlab_get_branches" in names # one tool per operation
24
+ assert "gitlab_branches" not in names # action-routed tool retired
@@ -1,70 +0,0 @@
1
- """Action-discovery standardization tests.
2
-
3
- Verifies that action-routed tools expose `list_actions` discovery and raise a
4
- rich did-you-mean error on unknown actions, via the shared agent-connector-sdk
5
- `resolve_action` helper wired into `mcp_server.py`.
6
- """
7
-
8
- import inspect
9
- from unittest.mock import MagicMock
10
-
11
- import pytest
12
-
13
- from gitlab_api.mcp_server import get_mcp_instance
14
-
15
-
16
- async def _get_tool(name: str):
17
- mcp, _args, _mw, _tags = get_mcp_instance()
18
- tool_objs = (
19
- await mcp.list_tools()
20
- if inspect.iscoroutinefunction(mcp.list_tools)
21
- else mcp.list_tools()
22
- )
23
- for tool in tool_objs:
24
- if tool.name == name:
25
- return tool
26
- raise AssertionError(f"tool {name} not registered")
27
-
28
-
29
- @pytest.mark.asyncio
30
- async def test_list_actions_returns_names():
31
- tool = await _get_tool("gitlab_branches")
32
- result = await tool.fn(
33
- action="list_actions",
34
- params_json="{}",
35
- client=MagicMock(),
36
- ctx=None,
37
- )
38
- assert isinstance(result, dict)
39
- assert result["service"] == "gitlab-api"
40
- assert set(result["actions"]) == {"get", "create", "delete", "delete_merged"}
41
-
42
-
43
- @pytest.mark.asyncio
44
- async def test_unknown_action_raises_with_list_actions_hint():
45
- tool = await _get_tool("gitlab_branches")
46
- with pytest.raises(ValueError) as excinfo:
47
- await tool.fn(
48
- action="creat",
49
- params_json="{}",
50
- client=MagicMock(),
51
- ctx=None,
52
- )
53
- message = str(excinfo.value)
54
- assert "list_actions" in message
55
- assert "create" in message # did-you-mean suggestion
56
-
57
-
58
- @pytest.mark.asyncio
59
- async def test_canonical_action_still_dispatches():
60
- tool = await _get_tool("gitlab_branches")
61
- client = MagicMock()
62
- client.get_branches.return_value = {"ok": True}
63
- result = await tool.fn(
64
- action="get",
65
- params_json="{}",
66
- client=client,
67
- ctx=None,
68
- )
69
- assert result == {"ok": True}
70
- client.get_branches.assert_called_once()