Purpose
ocireg-mcp is an MCP (Model Context Protocol) server used to query OCI registries and image references. It implements an SSE-based MCP server, enabling LLM-driven applications to interact with OCI registries.
Main Capabilities
The server provides the following MCP tools:
- Get OCI image information: parameter image_ref (image reference, such as docker.io/library/alpine:latest), returns information such as the image's digest, size, architecture, operating system, creation date, and number of layers.
- List repository tags: parameter repository (repository name, such as docker.io/library/alpine), returns the list of tags for that repository.
- get_image_manifest: get the manifest of an OCI image.
- get_image_config: get the configuration of an OCI image.
Usage
It is recommended to run it with ToolHive, which provides a secure containerized deployment method for MCP servers. After the server starts, it can be used by MCP-compatible clients and query OCI registries to obtain image information.
To access a private registry, authentication credentials can be provided through ToolHive's secret management.
Authentication methods for accessing private OCI registries (in order of priority)
- HTTP Authorization header (highest priority): include a bearer token in the Authorization header of the HTTP request:
Authorization: Bearer <your-token>. This method takes precedence over all other authentication methods; when present, environment variables and Docker configuration are ignored. - Bearer Token environment variable: set
OCI_TOKEN: bearer token for registry authentication. - Username and password: set
OCI_USERNAME(registry authentication username) andOCI_PASSWORD(registry authentication password). - Docker configuration (lowest priority): if no other authentication is provided, the server will use the default Docker keychain to read credentials from ~/.docker/config.json.
Port configuration
The server listening port can be configured in the following ways:
- Environment variable
MCP_PORT: the port number to listen on (must be between 0 and 65535). If not set or invalid, the default is port 8080. - Command-line flag
-port: overrides the environment variable setting (must be between 0 and 65535). If an invalid port is provided, the default is port 8080. Example:./ocireg-mcp -port 9090.
Use Cases
Suitable for scenarios that require LLM-driven applications to interact with OCI registries, such as obtaining container image information, querying repository tags, and inspecting image manifests and configurations.
Limitations and Requirements
- Requires Go 1.21 or later.
- Requires access to an OCI registry.
Other Information
Code contributions are welcome; before contributing, please review the CONTRIBUTING guide. If you encounter a bug or have a feature request, you can submit an issue in the repository or join the #mcp-servers channel on the community Discord server. The project is licensed under the Apache v2 license; see the LICENSE file for details.