# CICD AIops [Health: Active]

**Category:** 🔄 Version Control  
**Repository:** https://github.com/AIops-tools/CICD-AIops  
**GitHub Stars:** 0  
**Views:** 3  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/cicd-aiops

## Description
Governed self-managed GitLab + Gitea CI/CD ops: pipelines, runners, artifacts, RCA. 26 tools.

## Tools
Capabilities this server exposes over MCP:

- **pipeline_failure_rca** — [READ] Classify recent failed pipelines: cause + action per pipeline.

    The flagship pipeline RCA: pulls the project's recent failed pipelines with
    their failed jobs and trace tails, classifies each failed job (test-failure /
    dependency-network / runner-timeout / oom / script-error) from its
    failure_reason and trace markers, and attaches a cause and a recommended
    action. Every classification names its matched evidence, not a black-box
    verdict. Pass 'failed_pipelines' for pure analysis, or a project to pull live.

    Args:
        project: Project id or full path (required unless failed_pipelines given).
        limit: How many recent failed pipelines to pull (default 10).
        tail_lines: Trace-tail lines pulled per failed job (default 60).
        failed_pipelines: Injected rows {id, ref, jobs:[{name, stage, status,
            failureReason, traceTail}]}; skips the live pull.
        target: Server target name from config; omit for the default.

    Returns dict: {pipelinesEvaluated, classCounts, pipelines:[{pipeline, ref,
        headlineClass, cause, action, failedJobs:[{job, stage, class, cause,
        action, evidence}]}], note}.
    
- **runner_health_rca** — [READ] Flag offline/stale/paused runners, long-queued jobs, tag saturation.

    The flagship capacity RCA: pulls the runner fleet, flags each runner that is
    offline, stale (no contact for stale_contact_min minutes) or paused, lists
    jobs queued past queue_sec, and computes per-tag saturation (queued jobs vs
    online unpaused runners). Every flag carries its numbers. Pass 'runners' /
    'queued_jobs' for pure analysis, or a target to pull the fleet live.

    Args:
        stale_contact_min: Minutes since last contact at which a runner is stale.
        queue_sec: Seconds a job may wait before being flagged (default 300).
        saturation_ratio: Flagged queued jobs per online runner at which a tag
            is saturated (default 2.0).
        runners: Injected rows {id, description, status, paused, online, tags,
            contactedAt}; skips the live pull.
        queued_jobs: Injected rows {id, name, queuedDurationSec, createdAt, tags}.
        target: Server target name from config; omit for the default.

    Returns dict: {runnersEvaluated, flaggedRunners, longQueuedJobs,
        saturatedTags, thresholds, note}.
    
- **artifact_storage_bloat_analysis** — [READ] Rank projects by storage; estimate reclaimable artifact bytes.

    The flagship storage RCA: pulls project storage statistics, ranks projects
    by repo + artifact bytes, counts expired-but-kept artifacts and artifacts
    older than old_artifact_days, and estimates the reclaimable bytes per
    project. Every ranking carries its byte numbers. Pass 'projects' (and
    optionally 'artifacts_by_project') for pure analysis, or a target to pull
    live.

    Args:
        old_artifact_days: Age in days past which a kept artifact counts as
            reclaimable (default 30).
        limit: How many projects to pull when live (default 100).
        projects: Injected rows {path, repoBytes, artifactsBytes}; skips the
            live pull.
        artifacts_by_project: Injected map {project: [{file, sizeBytes,
            createdAt, expireAt}]}.
        target: Server target name from config; omit for the default.

    Returns dict: {projectsEvaluated, totalReclaimableBytes, thresholds,
        projects:[{project, repoBytes, artifactsBytes, totalBytes,
        expiredButKept, reclaimableBytes, action}], note}.
    
- **stale_work_audit** — [READ] Long-open MRs/PRs, inactive branches, protection config gaps.

    The flagship hygiene audit: flags open merge/pull requests idle past
    stale_mr_days, non-default branches with no commit for stale_branch_days,
    a default branch without protection, and protection rules that allow
    force-push. Every flag carries its numbers. Pass injected rows for pure
    analysis, or a project to pull live.

    Args:
        project: Project id or full path (required unless rows are injected).
        stale_mr_days: Days an open MR may idle before flagging (default 14).
        stale_branch_days: Days a branch may idle before flagging (default 90).
        merge_requests: Injected rows {id, title, state, updatedAt, draft}.
        branches: Injected rows {name, default, protected, lastCommitAt}.
        protections: Injected rows {branch, allowForcePush}.
        default_branch: Default-branch name (pulled live when omitted).
        target: Server target name from config; omit for the default.

    Returns dict: {staleMergeRequests, staleBranches, protectionGaps, counts,
        thresholds, note}.
    
- **list_artifacts** — [READ] A project's artifact inventory: files, sizes, expiry.

    Also reports how many artifacts are past their expiry date but still kept
    (the delete_artifacts candidates). 'totalBytes' / 'expiredButKept' /
    'artifactsFound' count EVERY artifact found, so they stay correct when the
    row list is cut; 'truncated' then says the rows are a subset. On GitLab the
    inventory is assembled from a bounded scan of recent jobs — when
    'jobScanTruncated' is true, older jobs' artifacts are NOT in this result,
    so treat the totals as a lower bound.

    Args:
        project: Project id or full path ('group/project' / 'owner/repo').
        limit: Max artifact rows to return (default 500).
        target: Server target name from config; omit for the default.
    
- **list_pipelines** — [READ] Recent pipelines/runs for a project, newest first.

    Returns {project, pipelines:[...], returned, limit, truncated}. When
    'truncated' is true the server had MORE pipelines than were returned —
    re-run with a higher limit rather than treating the list as complete.
    Truncation is measured (one extra row is fetched), never guessed.

    Args:
        project: Project id or full path ('group/project' / 'owner/repo').
        status: Optional status filter (e.g. failed, success, running, pending).
        limit: Max rows to return (default 20, max 99).
        target: Server target name from config; omit for the default.
    
- **pipeline_detail** — [READ] One pipeline/run's full detail.

    Args:
        project: Project id or full path.
        pipeline: Pipeline/run id (from list_pipelines).
        target: Server target name from config; omit for the default.
    
- **pipeline_jobs** — [READ] Jobs of one pipeline/run with status + failure reason.

    Returns {project, pipeline, jobs:[...], returned, limit, truncated}. When
    'truncated' is true this pipeline had more jobs than were returned.

    Args:
        project: Project id or full path.
        pipeline: Pipeline/run id (from list_pipelines).
        limit: Max job rows to return (default 100).
        target: Server target name from config; omit for the default.
    
- **job_trace_tail** — [READ] The tail of one job's log/trace — where the failure explains itself.

    Returns {project, job, trace, totalLines, tailLines, returned, limit,
    truncated, charsTruncated}. 'truncated' true means earlier lines were
    dropped (the trace is only the tail — the FIRST error may be above the
    window, so raise tail_lines before concluding a root cause);
    'charsTruncated' true means the tail itself hit the byte ceiling.

    Args:
        project: Project id or full path.
        job: Job id (from pipeline_jobs).
        tail_lines: How many trailing lines to return (default 60).
        target: Server target name from config; omit for the default.
    
- **list_projects** — [READ] Projects/repositories the token can see, with storage numbers.

    Returns {projects:[...], returned, limit, truncated}; 'truncated' true means
    the server had more projects than were returned (measured, not guessed).

    Args:
        search: Optional name filter.
        limit: Max rows to return (default 50, max 99).
        target: Server target name from config; omit for the default.
    
- **project_detail** — [READ] One project's detail incl. repo/artifact byte counts.

    Args:
        project: Project id or full path ('group/project' / 'owner/repo').
        target: Server target name from config; omit for the default.
    
- **list_merge_requests** — [READ] Merge/pull requests for a project (default: open ones).

    Args:
        project: Project id or full path ('group/project' / 'owner/repo').
        state: opened/open, merged, closed, all (platform word is translated).
        limit: Max rows to return (default 50, max 99); the result carries
            'truncated' when the server had more.
        target: Server target name from config; omit for the default.
    
- **list_branches** — [READ] Branches with last-commit date and protected flag.

    Args:
        project: Project id or full path.
        limit: Max rows to return (default 100, capped at 99); the result
            carries 'truncated' when the server had more.
        target: Server target name from config; omit for the default.
    
- **list_protected_branches** — [READ] Branch-protection rules for a project (incl. force-push flags).

    Returns {project, protections:[...], returned, limit, truncated}.

    Args:
        project: Project id or full path.
        limit: Max rows to return (default 100).
        target: Server target name from config; omit for the default.
    
- **list_releases** — [READ] Releases for a project, newest first.

    Args:
        project: Project id or full path.
        limit: Max rows to return (default 20, max 99); the result carries
            'truncated' when the server had more.
        target: Server target name from config; omit for the default.
    
- **list_runners** — [READ] All runners visible to the token, offline/paused first.

    GITLAB ONLY. Gitea has no runner-administration API, so a Gitea target
    raises a teaching error naming the resources that DO exist there. That is
    a platform-capability answer, not a broken tool: do not retry it, and do
    not report the server as unreachable — answer from the pipeline/job
    surface instead.

    Returns {runners:[...], returned, limit, truncated}; rows are sorted
    offline/paused first BEFORE the cut, so the most urgent runners survive.

    Args:
        status: Optional status filter (online, offline, paused, stale).
        limit: Max rows to return (default 100, capped at 99).
        target: Server target name from config; omit for the default.
    
- **runner_detail** — [READ] One runner's full detail (contacted_at, tags, paused, version).

    GITLAB ONLY — a Gitea target raises the same teaching error as list_runners.

    Args:
        runner: Runner id (from list_runners).
        target: Server target name from config; omit for the default.
    
- **server_version** — [READ] CI/CD server version and revision.

    Args:
        target: Server target name from config; omit for the default.
    
- **current_user** — [READ] The token's identity — who the API sees you as (scope probe).

    Args:
        target: Server target name from config; omit for the default.
    
- **cicd_overview** — [READ] One-shot summary: version, token identity, projects, runners.

    Resilient — a failing sub-call degrades to a partial summary with an
    'errors' list instead of crashing.

    Args:
        target: Server target name from config; omit for the default.
    
- **undo_list** — [READ] List recorded, not-yet-applied undo tokens (most recent first).

    Each entry names the original tool, the inverse tool that ``undo_apply``
    would run, and a human note. Use the ``undoId`` with ``undo_apply``.

    Returns {undos:[...], returned, limit, truncated}. One extra row is asked
    for, so 'truncated' is measured — a full page is not assumed to be the end.

    Each entry carries ``effectVerified``. False means the original write
    lost its response, so the change it reverses is PROBABLE, not confirmed —
    check the live state before applying, and do not report the result as a
    restore of a state that may never have been reached.

    Args:
        limit: Max rows to return (default 50, max 500).
        target: Unused (undo state is host-local); accepted for CLI uniformity.
    
- **undo_apply** — [WRITE][risk=medium] Apply a recorded undo by dispatching its inverse tool.

    The inverse runs through its own governed tool, so its real risk tier is
    recorded there. Pass dry_run=True to preview the inverse call without
    executing it. A token can only be applied once.

    Args:
        undo_id: The undoId from undo_list (or an ``_undo_id`` in a write result).
        dry_run: If True, preview the inverse tool + params without running it.
        target: Passed through to the inverse tool when it accepts a target.
    
- **retry_pipeline** — [WRITE][risk=medium] Retry a failed/canceled pipeline.

    Reads the pipeline first so priorState records the status it had before the
    retry. Irreversible (a retry is a new run) — no undo. Pass dry_run=True to
    preview.

    Args:
        project: Project id or full path ('group/project' / 'owner/repo').
        pipeline: Pipeline id (from list_pipelines).
        dry_run: If True, preview without retrying.
        target: Server target name from config; omit for the default.
    
- **cancel_pipeline** — [WRITE][risk=medium] Cancel a running pipeline.

    Reads the pipeline first so priorState records the status it had before the
    cancel. Irreversible (the stopped run cannot be resumed) — no undo. Pass
    dry_run=True to preview.

    Args:
        project: Project id or full path.
        pipeline: Pipeline id (from list_pipelines).
        dry_run: If True, preview without canceling.
        target: Server target name from config; omit for the default.
    
- **pause_runner** — [WRITE][risk=medium] Pause a runner; reversible (undo resumes it).

    Reads the runner first so the harness records its prior paused state.
    A paused runner stops picking up new jobs; running jobs finish. Pass
    dry_run=True to preview.

    Args:
        runner: Runner id (from list_runners).
        dry_run: If True, preview without pausing.
        target: Server target name from config; omit for the default.
    
- **resume_runner** — [WRITE][risk=medium] Resume a paused runner; reversible (undo pauses it).

    Reads the runner first so the harness records its prior paused state. Pass
    dry_run=True to preview.

    Args:
        runner: Runner id (from list_runners).
        dry_run: If True, preview without resuming.
        target: Server target name from config; omit for the default.
    
- **delete_artifacts** — [WRITE][risk=high] Delete a project's artifacts (all, or older than N days).

    IRREVERSIBLE — reads the artifact inventory first so priorState records the
    file count and bytes being destroyed; no undo. Pass dry_run=True to preview
    (reports what would be reclaimed without deleting).

    Args:
        project: Project id or full path.
        older_than_days: Only delete artifacts created before this many days
            ago; 0 = the server's bulk delete of all eligible artifacts.
        dry_run: If True, preview without deleting.
        acknowledge_unknown_inventory: Allow the bulk delete when the artifact
            inventory cannot be read (it is refused otherwise, because nothing
            would record what was destroyed). Never applies to older_than_days.
        target: Server target name from config; omit for the default.
    
- **update_branch_protection** — [WRITE][risk=medium] Protect/unprotect a branch; reversible.

    Reads the branch's current protection first so the harness records an undo
    that replays this same tool with the prior settings. Pass dry_run=True to
    preview.

    Args:
        project: Project id or full path.
        branch: Branch name (from list_branches).
        protect: True to protect the branch, False to remove protection.
        allow_force_push: Whether the protection permits force-push (default
            False — the safe setting).
        dry_run: If True, preview without changing.
        target: Server target name from config; omit for the default.
    

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `uvx` (confidence: high):

```json
"mcpServers": {
  "cicd-aiops": {
    "command": "uvx",
    "args": ["--from","cicd-aiops","cicd-aiops-mcp"]
  }
}
```

## Documentation

## What CICD AIops does

CICD AIops gives an agent an MCP interface to self-managed GitLab and self-hosted Gitea installations. It covers pipelines or Actions runs, jobs and trace or log tails, projects and repositories, merge or pull requests, branches, protections, releases, runners where the platform supports them, and artifact or storage information.

Its four main analyses focus on common operational questions:

- Pipeline failure RCA classifies failed jobs using trace-tail evidence, including test failures, dependency or network problems, runner timeouts, out-of-memory failures, and script errors.
- Runner health analysis identifies offline or stale runners, delayed jobs, and tag saturation.
- Storage analysis ranks repository and artifact usage, estimates reclaimable bytes, and identifies expired artifacts that remain stored.
- Stale-work audits find inactive merge or pull requests, old branches, and branch-protection gaps.

The package also exposes selected mutations such as retrying or cancelling pipelines, pausing or resuming GitLab runners, deleting artifacts, and updating branch protection.

## How it works

The server calls the GitLab REST API v4 or Gitea API v1 directly against the configured host. Platform-specific capability checks produce a teaching error when a requested surface is unavailable; for example, Gitea does not provide the runner and several mutation operations supported by GitLab through this tool.

All calls pass through a governance harness. Each call creates an audit row containing parameters, an outcome summary, status, duration, and a descriptive risk tier. Mutating operations fetch and preserve prior state when possible, allowing reversible actions such as runner pause or branch-protection changes to record a replayable inverse. Retry, cancel, and artifact deletion retain prior-state information instead.

Analyses use named thresholds and report the values behind their findings. Returned server text is normalized before reaching the agent, and path parameters are percent-encoded.

## Setup and configuration

Install the package with `uv tool install cicd-aiops` or `pip install cicd-aiops`. Run `cicd-aiops init` to configure a base URL, token, and TLS verification behavior, then use `cicd-aiops doctor` to test connectivity and token scopes. `cicd-aiops overview` provides a quick view of the configured identity, projects, runners, and version.

Credentials are stored in an encrypted secrets file at `~/.cicd-aiops/secrets.enc`, with the encryption key derived from a master password using scrypt. Set `CICD_AIOPS_MASTER_PASSWORD` for non-interactive or MCP use. `CICD_AIOPS_HOME` relocates the audit and undo databases and related application data. TLS verification is enabled by default.

As a standalone MCP server, the package can be launched through `uvx` with a stdio configuration using `--from cicd-aiops`. Claude Code and OpenClaw also have plugin installation paths that bundle the skill with the MCP server.

## Tools and capabilities

The package provides 26 governed tools: 20 read or analysis tools and 6 write tools. CLI commands use the same governed path as MCP calls, so command-line mutations are audited as well. Every write accepts a dry-run option and requires double confirmation when executed.

The runaway guard can trip a circuit breaker when the same call is repeated rapidly. `CICD_RUNAWAY_MAX=0` disables that safeguard, while `CICD_MAX_TOOL_CALLS` and `CICD_MAX_TOOL_SECONDS` can impose additional ceilings. These controls are safety backstops, not authorization mechanisms.

## Limitations and notes

CICD AIops targets self-managed GitLab and Gitea deployments, not their SaaS offerings. It stops at the CI/CD platform API and should not be used to inspect Kubernetes deployment state. Governance records and labels activity but does not decide whether a write is permitted; the connected token and platform permissions still control authorization. A read-only mode, policy file, or approval gate is not part of the configuration model.

Support is modelled from public API documentation and exercised against mocked HTTP responses. Use `cicd-aiops doctor` as the live connectivity and scope check for a target installation.

_Full upstream README: https://allmcps.com/mcp/cicd-aiops/readme_

