Harbor Registry Mcp

io.github.mshegolev由 GitHub 账号 mshegolev 发布v0.1.0更新于 Oct 27, 2026

Harbor Registry MCP — projects, repos, artifacts, storage reports, cleanup (with dry-run).

发布方自己的服务:Harbor Notes

概览

AI 生成的概览

面向 Harbor 容器镜像仓库的 MCP 服务器,让助手列出项目、仓库与制品,生成存储报告、规划清理并删除制品。

可以做什么
  • 列出项目、仓库与制品,含标签、大小与扫描状态
  • 生成项目级完整存储占用明细(覆盖所有仓库与制品)
  • 给出清理候选建议,如无标签、从未拉取或旧版本
  • 按标签或摘要删除单个制品
  • 批量删除无标签制品或仅保留每个仓库最新的 N 个,默认试运行
适用场景
适合在 Harbor 2.x 仓库上做运维工作,尤其是回收磁盘空间:盘点现有镜像、查看存储占用分布,并在试运行确认后清理无标签或过期制品。
运行要求
以 Python 包形式通过 stdio 在本机运行(需 Python 3.10+,可用 uvx 或 pipx)。需要能访问 Harbor 2.x 实例的网络,并设置环境变量 HARBOR_URL、HARBOR_USERNAME 和 HARBOR_PASSWORD;HARBOR_SSL_VERIFY 可选,默认 true。
安装前请注意
HARBOR_PASSWORD 存放密码或机器人令牌,建议使用权限受限的机器人账号而非个人管理员登录。删除类工具具有破坏性,可批量移除制品;批量删除默认试运行,需显式设置 dry_run=False 才会执行,请先核对计划。将 HARBOR_SSL_VERIFY 设为 false 会关闭证书校验。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Harbor Registry Mcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

harbor-registry-mcp

[PyPI] [Python] [License: MIT]

MCP server for Harbor Registry. Lets an LLM agent (Claude Code, Cursor, OpenCode, etc.) list projects, repositories and artifacts, run storage reports, find cleanup candidates, and delete untagged or old artifacts — all with safety rails (dry-run by default for bulk delete).

Python, FastMCP, stdio transport.

Works with any Harbor 2.x instance — SaaS or self-hosted / on-prem.

Why another Harbor MCP?

A couple of community Harbor MCPs exist (nomagicln/mcp-harbor, bupd/harbor-mcp-server) but they expose only the basic list/get endpoints. This one adds storage reports, cleanup candidates, delete untagged, and delete old artifacts with dry-run — the operations DevOps engineers actually need to reclaim disk space.

Design highlights

  • Tool annotations — read-only tools get readOnlyHint: True; destructive ones (harbor_delete_*) carry destructiveHint: True so MCP clients ask for confirmation.
  • Dry-run by default on both bulk cleanups (harbor_delete_untagged, harbor_delete_old_artifacts) — the agent must pass dry_run=False to execute.
  • Structured output — every tool returns a typed payload (TypedDict) + a markdown summary.
  • Structured errors — 401 / 403 / 404 / 429 / 5xx mapped to actionable hints.
  • Pydantic input validation for every argument.
  • Vulnerability snapshot — harbor_list_artifacts surfaces scan status and counts if with_scan_overview is enabled.

Features (8 tools)

Discovery & inspection

  • harbor_list_projects — projects with repo counts and visibility
  • harbor_list_repos — repositories in a project
  • harbor_list_artifacts — artifacts in a repository with tags/size/scan status
  • harbor_storage_report — full project storage breakdown (all repos × all artifacts)

Cleanup planning

  • harbor_cleanup_candidates — suggest what to delete (untagged, never-pulled, old versions)

Cleanup execution (destructive)

  • harbor_delete_artifact — delete a single artifact by tag or digest
  • harbor_delete_untagged — delete all untagged artifacts in a project/repo (dry-run default)
  • harbor_delete_old_artifacts — keep N latest per repo, delete the rest (dry-run default)

Installation

Requires Python 3.10+.

bash
# via uvx (recommended)uvx --from harbor-registry-mcp harbor-registry-mcp
# or via pipxpipx install harbor-registry-mcp

Configuration

bash
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

Or in .mcp.json:

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"      }    }  }}

Check:

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

Environment variables

VariableRequiredDescription
HARBOR_URLyesHarbor URL (no trailing slash)
HARBOR_USERNAMEyesHarbor username — robot account recommended
HARBOR_PASSWORDyesPassword or robot token
HARBOR_SSL_VERIFYnotrue/false. Default: true.

Example usage

  • "Storage report for project einvy-pub"
  • "Find cleanup candidates in qa-assistant — keep latest 3"
  • "Delete all untagged artifacts in qa-assistant"
  • "Dry-run delete of old artifacts in qa-assistant/pgvector-rag, keep 1 latest"
  • "What's in einvy-pub/my-image?"

Safety

  • Read tools use readOnlyHint: True — no confirmation needed.
  • Delete tools use destructiveHint: True — clients should confirm.
  • harbor_delete_untagged and harbor_delete_old_artifacts both default to dry_run=True; the agent must explicitly set dry_run=False to actually delete.
  • harbor_cleanup_candidates is read-only — it only suggests candidates, never deletes.

Development

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

License

MIT © Mikhail Shchegolev

来源:README.md,提交 446fd5d

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.1.0最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

其他 Harbor 集成