Coverage for gco_mcp / tools / gitops.py: 100.00%

11 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-10-28 16:19 +0000

1"""Self-managed Argo CD MCP tool (read-only wrapper over `gco gitops status`). 

2 

3There is intentionally no ``gitops open`` / ``screenshot`` tool — those are 

4interactive, long-running port-forwards — and no ``gitops password`` tool: the 

5generated Argo CD admin password never leaves the operator's terminal. 

6""" 

7 

8import asyncio 

9 

10import cli_runner 

11from audit import audit_logged 

12from server import mcp 

13 

14 

15@mcp.tool(tags={"safe", "gitops"}) 

16@audit_logged 

17async def gitops_status(region: str | None = None) -> str: 

18 """`gco gitops status` — the configured self-managed Argo CD (cdk.json helm.argocd). 

19 

20 Reports whether Argo CD is enabled, the pinned argo-cd chart, the 

21 gco-tenants fence (destinations and source repositories) and the GitOps 

22 hand-off with its path rendered per Region, plus how to reach the UI. 

23 Reads cdk.json and charts.yaml only. 

24 

25 Args: 

26 region: Render the GitOps path for this Region only. Omit for every 

27 regional deployment Region. 

28 """ 

29 args = ["gitops", "status"] 

30 if region: 

31 args += ["-r", region] 

32 return await asyncio.to_thread(cli_runner._run_cli, *args)