harbor-registry-mcp
harbor-registry-mcp
Harbor Registry用MCPサーバー。LLMエージェント(Claude Code、Cursor、OpenCodeなど)を使用して、プロジェクト、リポジトリ、アーティファクトの一覧表示、ストレージレポートの実行、クリーンアップ候補の検索、タグなしまたは古いアーティファクトの削除が可能です。すべて安全策(一括削除はデフォルトでドライラン)が講じられています。
Python、FastMCP、stdioトランスポートを使用。
SaaSまたはセルフホスト/オンプレミスのあらゆるHarbor 2.xインスタンスで動作します。
なぜ別のHarbor MCPが必要なのか?
既存のコミュニティ製Harbor MCP(nomagicln/mcp-harbor、bupd/harbor-mcp-server)は、基本的な一覧表示/取得エンドポイントのみを公開しています。本サーバーは、ストレージレポート、クリーンアップ候補の特定、タグなしアーティファクトの削除、ドライラン付きの古いアーティファクト削除といった、DevOpsエンジニアがディスク容量を解放するために実際に必要とする操作を追加しています。
Related MCP server: Harbor MCP Server
設計のハイライト
ツールアノテーション — 読み取り専用ツールには
readOnlyHint: Trueが設定され、破壊的なツール(harbor_delete_*)にはdestructiveHint: Trueが設定されているため、MCPクライアントは確認を求めます。デフォルトでドライラン — 一括クリーンアップ(
harbor_delete_old_artifacts(dry_run=True))はデフォルトでドライランとなり、エージェントが実行するには設定を切り替える必要があります。構造化出力 — すべてのツールは型付きペイロード(TypedDict)とMarkdown形式の要約を返します。
構造化エラー — 401 / 403 / 404 / 429 / 5xx エラーは、対処可能なヒントにマッピングされます。
Pydanticによる入力検証 — すべての引数に対して検証を行います。
脆弱性スナップショット —
with_scan_overviewが有効な場合、harbor_list_artifactsはスキャンステータスと件数を表示します。
機能(8つのツール)
探索と調査
harbor_list_projects— リポジトリ数と可視性を含むプロジェクト一覧harbor_list_repos— プロジェクト内のリポジトリ一覧harbor_list_artifacts— タグ/サイズ/スキャンステータスを含むリポジトリ内のアーティファクト一覧harbor_storage_report— プロジェクト全体のストレージ内訳(全リポジトリ × 全アーティファクト)
クリーンアップ計画
harbor_cleanup_candidates— 削除候補の提案(タグなし、プルされていない、古いバージョン)
クリーンアップ実行(破壊的)
harbor_delete_artifact— タグまたはダイジェストによる単一アーティファクトの削除harbor_delete_untagged— プロジェクト/リポジトリ内のすべてのタグなしアーティファクトを削除harbor_delete_old_artifacts— リポジトリごとに最新のN個を残し、残りを削除(デフォルトはドライラン)
インストール
Python 3.10以上が必要です。
# via uvx (recommended)
uvx --from harbor-registry-mcp harbor-registry-mcp
# or via pipx
pipx install harbor-registry-mcp設定
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または .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"
}
}
}
}確認:
claude mcp list
# harbor: uvx --from harbor-registry-mcp harbor-registry-mcp - ✓ Connected環境変数
変数 | 必須 | 説明 |
| はい | Harbor URL(末尾のスラッシュなし) |
| はい | Harborユーザー名 — ロボットアカウントを推奨 |
| はい | パスワードまたはロボットトークン |
| いいえ |
|
使用例
「プロジェクト
einvy-pubのストレージレポートを表示して」「
qa-assistant内のクリーンアップ候補を探して。最新3つは残して」「
qa-assistant内のタグなしアーティファクトをすべて削除して」「
qa-assistant/pgvector-rag内の古いアーティファクトをドライランで削除して。最新1つは残して」「
einvy-pub/my-imageには何が入っている?」
安全性
読み取りツールは
readOnlyHint: Trueを使用するため、確認は不要です。削除ツールは
destructiveHint: Trueを使用するため、クライアントは確認を行うべきです。harbor_delete_old_artifactsはデフォルトでdry_run=Trueです。実際に削除するには、エージェントが明示的にdry_run=Falseを設定する必要があります。harbor_cleanup_candidatesは読み取り専用であり、候補を提案するだけで、削除は行いません。
開発
git clone https://github.com/mshegolev/harbor-registry-mcp.git
cd harbor-registry-mcp
pip install -e '.[dev]'
pytestライセンス
MIT © Mikhail Shchegolev
Available Tools
8 toolsharbor_cleanup_candidatesARead-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_artifactADestructive
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_artifactsADestructive
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_untaggedADestructiveIdempotent
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_artifactsARead-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_projectsARead-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_reposARead-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_reportARead-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
Scored across 8 tools
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.
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.
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.
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
Related MCP Connectors
Unofficial Docker Hub MCP — wraps the Docker Hub v2 API (free, no auth required for public data)
Go MCP server for GitLab: 2 dynamic tools reach 1000+ REST/GraphQL actions. Free/CE, no paid tier.
Toggl 2.0 MCP server for tasks, projects, time entries, and workspace operations.
MCP server for LingoHub — localization projects, resources, exports and repository pushes.
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceA 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 npm7MIT
- AlicenseNot gradedqualityDmaintenanceEnables 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.6MIT
- AlicenseNot gradedqualityDmaintenanceMCP Harbor is a Node.js application that provides a Model Context Protocol (MCP) server for interacting with Harbor container registry.MIT
- AlicenseNot gradedqualityCmaintenanceEnables interacting with a Harbor container registry through the Model Context Protocol, supporting operations for projects, repositories, tags, and Helm charts.1MIT