This project lets you use an AI assistant to scan your Harbor private registry for security vulnerabilities. It acts as a bridge, allowing any AI that "speaks" the Model-Context Protocol (MCP) to find security issues in your container images.
Think of it like asking a smart assistant: "Hey, are there any critical vulnerabilities in my production/api-server:v1.2 image?" This server gives the AI the tools it needs to answer that question.
This project runs a simple web server that listens for requests on the /mpv-spr endpoint. When an AI assistant sends a request, the server translates it into actions for your Harbor registry, like starting a vulnerability scan or checking for patched images.
The server relies on command-line flags for its configuration, including Harbor's URL and credentials.
- Go: Version 1.18 or newer.
- cURL: Used for testing and interacting with the MCP server from the command line.
- Crane: A command-line tool for interacting with container registries. It's useful for managing images outside the MCP server.
The required Go packages will be downloaded automatically when you build or run the application for the first time.
To run the server, you need to provide the Private Registry based on Harbor instance details via command-line flags.
# Example of running the server
go run main.go \
--private-registry-url "https://your-private-registry-instance.com" \
--private-registry-username "your-user" \
--private-registry-password "your-password"The server will start on localhost:8080 by default. The MCP endpoint will be available at http://localhost:8080/mpv-spr.
Analyze the same image with a better image in the private-registry

The server exposes several tools that can be called via the MCP protocol:
- What it does: Scans a single container image for security vulnerabilities.
- Process:
- Triggers a scan for the specified image (
project/repository:tag) using the Harbor API. - Polls the API until the vulnerability report is available.
- Returns a list of vulnerabilities found.
- Triggers a scan for the specified image (
- Parameters:
project,repository,tag.
- What it does: Scans every container image in an entire Harbor project.
- Process:
- Lists all repositories in the project.
- For each repository, it iterates through all image artifacts.
- It triggers a scan for each image and polls for the results.
- Returns a summary for each image, including counts of critical, high, medium, and low severity vulnerabilities.
- Parameters:
project.
- What it does: Finds a newer, patched version of an image that fixes a specific vulnerability (CVE).
- Process:
- Lists all artifacts (images) in the specified repository.
- Identifies images that are newer than the given tag based on their push time.
- For each newer image, it fetches its vulnerability report.
- It checks if the specified
cve_idis present in the report. - Returns the first newer image found that doesn't have the CVE.
- Parameters:
project,repository,tag,cve_id.

