Skip to main content
Glama
harbor-registry-mcp

harbor-registry-mcp

harbor-registry-mcp

PyPI Python License: MIT

MCP-Server für die Harbor Registry. Ermöglicht einem LLM-Agenten (Claude Code, Cursor, OpenCode usw.) das Auflisten von Projekten, Repositories und Artefakten, das Ausführen von Speicherberichten, das Finden von Bereinigungskandidaten sowie das Löschen von nicht getaggten oder alten Artefakten — alles mit Sicherheitsvorkehrungen (standardmäßig Trockenlauf/Dry-Run bei Massenlöschungen).

Python, FastMCP, stdio-Transport.

Funktioniert mit jeder Harbor 2.x-Instanz — SaaS oder selbst gehostet / On-Premise.

Warum ein weiteres Harbor MCP?

Es gibt bereits einige Harbor-MCPs aus der Community (nomagicln/mcp-harbor, bupd/harbor-mcp-server), aber diese bieten nur grundlegende Listen-/Abruf-Endpunkte. Dieses hier fügt Speicherberichte, Bereinigungskandidaten, das Löschen von nicht getaggten Artefakten und das Löschen alter Artefakte mit Trockenlauf-Option hinzu — genau die Operationen, die DevOps-Ingenieure benötigen, um Speicherplatz freizugeben.

Related MCP server: Harbor MCP Server

Design-Highlights

  • Tool-Annotationen — Schreibgeschützte Tools erhalten readOnlyHint: True; destruktive Tools (harbor_delete_*) tragen destructiveHint: True, damit MCP-Clients eine Bestätigung anfordern.

  • Standardmäßiger Trockenlauf (Dry-Run) bei Massenbereinigungen (harbor_delete_old_artifacts(dry_run=True)) — der Agent muss dies explizit ändern, um den Vorgang auszuführen.

  • Strukturierte Ausgabe — jedes Tool gibt ein typisiertes Payload (TypedDict) + eine Markdown-Zusammenfassung zurück.

  • Strukturierte Fehler — 401 / 403 / 404 / 429 / 5xx Fehler werden auf umsetzbare Hinweise abgebildet.

  • Pydantic-Eingabevalidierung für jedes Argument.

  • Schwachstellen-Snapshot — harbor_list_artifacts zeigt den Scan-Status und die Anzahl an, wenn with_scan_overview aktiviert ist.

Funktionen (8 Tools)

Erkennung & Inspektion

  • harbor_list_projects — Projekte mit Repository-Anzahl und Sichtbarkeit

  • harbor_list_repos — Repositories in einem Projekt

  • harbor_list_artifacts — Artefakte in einem Repository mit Tags/Größe/Scan-Status

  • harbor_storage_report — Vollständige Speicheraufschlüsselung des Projekts (alle Repos × alle Artefakte)

Bereinigungsplanung

  • harbor_cleanup_candidates — Vorschläge für zu löschende Elemente (nicht getaggt, nie abgerufen, alte Versionen)

Bereinigungsausführung (destruktiv)

  • harbor_delete_artifact — Löschen eines einzelnen Artefakts per Tag oder Digest

  • harbor_delete_untagged — Löschen aller nicht getaggten Artefakte in einem Projekt/Repo

  • harbor_delete_old_artifacts — Behalten der N neuesten pro Repo, Löschen des Rests (standardmäßig Trockenlauf)

Installation

Erfordert Python 3.10+.

# via uvx (recommended)
uvx --from harbor-registry-mcp harbor-registry-mcp

# or via pipx
pipx install harbor-registry-mcp

Konfiguration

claude mcp add harbor -s project \
  --env HARBOR_URL=https://harbor.example.com \
  --env HARBOR_USERNAME='robot$your-robot' \
  --env HARBOR_PASSWORD=your-robot-token \
  --env HARBOR_SSL_VERIFY=true \
  -- uvx --from harbor-registry-mcp harbor-registry-mcp

Oder in .mcp.json:

{
  "mcpServers": {
    "harbor": {
      "type": "stdio",
      "command": "uvx",
      "args": ["--from", "harbor-registry-mcp", "harbor-registry-mcp"],
      "env": {
        "HARBOR_URL": "https://harbor.example.com",
        "HARBOR_USERNAME": "robot$your-robot",
        "HARBOR_PASSWORD": "${HARBOR_PASSWORD}",
        "HARBOR_SSL_VERIFY": "true"
      }
    }
  }
}

Überprüfung:

claude mcp list
# harbor: uvx --from harbor-registry-mcp harbor-registry-mcp - ✓ Connected

Umgebungsvariablen

Variable

Erforderlich

Beschreibung

HARBOR_URL

ja

Harbor-URL (ohne abschließenden Schrägstrich)

HARBOR_USERNAME

ja

Harbor-Benutzername — Robot-Account empfohlen

HARBOR_PASSWORD

ja

Passwort oder Robot-Token

HARBOR_SSL_VERIFY

nein

true/false. Standard: true.

Beispielanwendung

  • "Speicherbericht für Projekt einvy-pub"

  • "Finde Bereinigungskandidaten in qa-assistant — behalte die neuesten 3"

  • "Lösche alle nicht getaggten Artefakte in qa-assistant"

  • "Trockenlauf zum Löschen alter Artefakte in qa-assistant/pgvector-rag, behalte das neueste"

  • "Was befindet sich in einvy-pub/my-image?"

Sicherheit

  • Lese-Tools verwenden readOnlyHint: True — keine Bestätigung erforderlich.

  • Lösch-Tools verwenden destructiveHint: True — Clients sollten eine Bestätigung anfordern.

  • harbor_delete_old_artifacts ist standardmäßig auf dry_run=True gesetzt; der Agent muss explizit dry_run=False setzen, um den Löschvorgang tatsächlich auszuführen.

  • harbor_cleanup_candidates ist schreibgeschützt — es schlägt nur Kandidaten vor und löscht niemals etwas.

Entwicklung

git clone https://github.com/mshegolev/harbor-registry-mcp.git
cd harbor-registry-mcp
pip install -e '.[dev]'
pytest

Lizenz

MIT © Mikhail Shchegolev

Available Tools

8 tools
harbor_cleanup_candidatesA
Read-onlyIdempotent

Suggest which artifacts could be deleted to reclaim space.

READ-ONLY — never deletes anything; just produces a list with reasons. Use harbor_delete_artifact / harbor_delete_untagged / harbor_delete_old_artifacts to act on the results.

Reasons emitted: - untagged — artifact has no tags (orphaned layer) - never_pulled — artifact has never been pulled (and is past the keep_latest_per_repo cutoff) - old_version — artifact is older than the keep_latest_per_repo newest tagged artifacts

Inputs: project_name (required), include_untagged, include_zero_pulls, keep_latest_per_repo. Returns: project, candidates_count, total_reclaimable, total_reclaimable_bytes, +2 more

harbor_delete_artifactA
Destructive

Delete a single artifact by tag or digest.

DESTRUCTIVE & IRREVERSIBLE — Harbor immediately removes the manifest from its catalogue; the underlying blobs are reclaimed by the next GC sweep. There is no soft-delete or undo.

Returns the freed space and tag list for confirmation.

Inputs: project_name (required), repository_name (required), reference (required). Returns: success, project, repository, reference, +4 more

harbor_delete_old_artifactsA
Destructive

Keep the N newest artifacts in a repository, delete the rest.

DESTRUCTIVE. dry_run=True is the default — the agent must explicitly set dry_run=False to actually delete. Each entry in to_delete carries a deleted field (True/False after real run, None in dry-run).

Inputs: project_name (required), repository_name (required), keep_count, dry_run. Returns: project, repository, dry_run, keeping, +6 more

harbor_delete_untaggedA
DestructiveIdempotent

Delete all untagged artifacts in a project (or single repository).

DESTRUCTIVE. Untagged artifacts are typically orphaned layers left behind after pushing a new tag of the same image — generally safe to delete. The full project sweep is opaque, so the response includes repos_scanned for visibility.

Inputs: project_name (required), repository_name. Returns: project, repos_scanned, deleted_count, freed_size, +3 more

harbor_list_artifactsA
Read-onlyIdempotent

List artifacts (tags) in a repository, newest first.

Each artifact carries digest, size, push/pull timestamps, scan status and vulnerability counts (if scanned).

Pagination: if has_more is True, call again with page + 1. For repositories with hundreds of artifacts prefer harbor_storage_report or harbor_cleanup_candidates which paginate internally.

Inputs: project_name (required), repository_name (required), page, page_size. Returns: project, repository, total_size, total_size_bytes, +6 more

harbor_list_projectsA
Read-onlyIdempotent

List Harbor projects, sorted by repository count (descending within the page).

Use this first to discover which Harbor projects exist before drilling in with harbor_list_repos / harbor_list_artifacts.

Pagination: if has_more is True, call again with page + 1. Note that sorting is per-page — agents that need a global ranking should aggregate across pages.

Returns: dict with keys projects_count / page / page_size / has_more / next_page / projects (list).

Inputs: page, page_size. Returns: projects_count, page, page_size, has_more, +2 more

harbor_list_reposA
Read-onlyIdempotent

List repositories in a Harbor project.

Each repository is reported with artifact count and total pull count (useful for spotting unused repos before cleanup).

Pagination: if has_more is True, call again with page + 1.

Inputs: project_name (required), page, page_size. Returns: project, repositories_count, page, page_size, +3 more

harbor_storage_reportA
Read-onlyIdempotent

Full storage breakdown for a Harbor project.

Iterates every repository × every artifact and returns a sorted-by-size report — the canonical view for "what's eating up our quota?". Performs O(repos × artifacts) API calls; emits progress events through MCP Context.

Inputs: project_name (required). Returns: project, total_repositories, total_size, total_size_bytes, +1 more

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.4/5.0

    Scored across 8 tools

    Disambiguation5/5

    Each tool targets a distinct operation: listing, reporting, or deleting. The cleanup candidate tool is clearly separate from the delete tools, and deletion tools are differentiated by scope (single, old, untagged). No overlapping purposes.

    Naming Consistency4/5

    Most tools follow the harbor_verb_noun pattern (e.g., harbor_delete_artifact, harbor_list_projects), but harbor_storage_report uses a noun_noun pattern, breaking consistency. The prefix and general style are otherwise uniform.

    Tool Count5/5

    Eight tools cover the essential operations for a Harbor registry: discovery (list projects, repos, artifacts), cleanup (candidates, delete single, delete old, delete untagged), and reporting (storage report). The count is well-scoped without being excessive.

    Completeness5/5

    The tool set provides comprehensive coverage for registry management: full lifecycle for artifacts (list, delete individual/bulk/untagged), project and repository exploration, storage analysis, and a cleanup candidate suggestion tool. No major gaps in functionality for the intended domain.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      F
      maintenance
      A Node.js application that provides a Model Context Protocol server for interacting with Harbor container registry, supporting operations for projects, repositories, tags, and Helm charts.
      21 npm
      7
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI models to interact with Harbor container registries to manage projects, repositories, and system configurations in real time. It provides a suite of tools for monitoring health, retrieving statistics, and performing searches across registry data.
      6
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      MCP Harbor is a Node.js application that provides a Model Context Protocol (MCP) server for interacting with Harbor container registry.
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables interacting with a Harbor container registry through the Model Context Protocol, supporting operations for projects, repositories, tags, and Helm charts.
      1
      MIT