Dockerhub Api
CLI or API | MCP
Version: 1.3.1
Documentation — Installation, deployment, usage across the API, CLI, and MCP Docker Hub platform are maintained in docs/.
Table of Contents
- Overview
- Key Features
- Installation
- Usage
- Environment Variables
- Deployment
- Safety Model
- Concepts
- License
Overview
Dockerhub Api is a production-grade Agent and Model Context Protocol (MCP) server
that wraps the official Docker Hub API v2 (https://hub.docker.com): repositories
and tags, immutable tags, personal and organization access tokens, organization
members/settings/invites, teams, audit logs, and SCIM 2.0 provisioning — plus the
Registry HTTP API v2 (registry-1.docker.io: manifests, blobs, digests,
multi-arch inspection, OCI referrers, and gated push/remove) and Docker Scout
(api.scout.docker.com: CVE/SBOM/policy intelligence).
Key Features
- Consolidated Action-Routed MCP Tools: Nine togglable tool modules
(
hub_auth,hub_repos,hub_org,hub_teams,hub_audit,hub_scim,hub_admin,hub_registry,hub_scout) minimize token overhead in LLM contexts. - Three API surfaces, one package: the Hub management API, the Registry v2 image API (its own host + per-repository scoped-token auth), and Docker Scout — each with the same uniform envelope, redaction, and gating.
- JWT Auth Lifecycle: Short-lived bearer minted from
POST /v2/auth/token(password, PATdckr_pat_*, or org access token), cached and refreshed before expiry, with one transparent re-mint on 401. - Rate-Limit Telemetry:
X-RateLimit-*headers surfaced in every result; HTTP 429 retried with boundedRetry-Afterbackoff. - Safety by Default: Removes and org-settings writes are gated behind
DOCKERHUB_ALLOW_DESTRUCTIVE(defaultFalse); secrets are redacted from tool results (plaintext tokens appear exactly once — on creation). Repository creation stays enabled: it is the primary release-provisioning use case. - Integrated Graph Agent: Built-in Pydantic AI agent (
dockerhub-agent) with A2A and AG-UI web interfaces. - Native Telemetry & Tracing: Out-of-the-box OpenTelemetry exports and Langfuse tracing via agent-connector-sdk.
Installation
pip install dockerhub-api # API client only
pip install "dockerhub-api[mcp]" # + MCP server
pip install "dockerhub-api[all]" # everything
| Extra | Adds |
|---|---|
mcp |
FastMCP server (dockerhub-mcp) via agent-connector-sdk |
agent |
Pydantic-AI A2A agent (dockerhub-agent) + Logfire via agent-connector-sdk |
all |
mcp + agent |
test |
pytest toolchain for development |
# Connector-focused MCP server (includes the shared graph engine)
uv pip install "dockerhub-api[mcp]"
# Agent runtime (adds model orchestration to the shared graph engine)
# Everything (development)
uv pip install "dockerhub-api[all]" # or: python -m pip install "dockerhub-api[all]"
Container images (:mcp)
One multi-stage docker/Dockerfile builds the MCP-only image (--target mcp):
| Image tag | Build target | Contents | Entrypoint |
|---|---|---|---|
example/dockerhub-api:mcp |
--target mcp |
dockerhub-api[mcp] — connector-focused, includes epistemic-graph[full]; no model-orchestration stack |
dockerhub-mcp |
docker build --target mcp -t example/dockerhub-api:mcp docker/ # connector-focused MCP server
agent (immutable agent digest) with a co-located :mcp sidecar.
Knowledge-graph database (epistemic-graph)
Agent Connector SDK core dependency (epistemic-graph[full]). The [mcp] extra keeps
deployments can use the bundled engine. For production or shared state, run
epistemic-graph as a dedicated database service and configure the runtime to use it.
Deployment recipes (single-node + Raft HA), connection configuration, and architecture
diagrams are documented in the
epistemic-graph deployment guide.
Usage
Python API / CLI
from dockerhub_api.auth import get_client
api = get_client() # reads DOCKERHUB_URL / DOCKER_HUB_USER / DOCKER_HUB_TOKEN
repos = api.get_repositories(namespace="acme", ordering="-last_updated")
api.create_repository(namespace="acme", name="release-images", is_private=True)
tags = api.get_repository_tags(namespace="acme", repository="release-images")
print(api.rate_limit) # latest X-RateLimit-* snapshot
Every client method returns a uniform envelope:
{"status_code": int, "data": ..., "rate_limit": {"limit", "remaining", "reset"}}.
MCP
Available MCP Tools
Auto-generated — do not edit (synced by the mcp-readme-table pre-commit hook).
Condensed action-routed tools (default — MCP_TOOL_MODE=condensed)
| MCP Tool | Toggle Env Var | Description |
|---|---|---|
hub_admin |
ADMINTOOL |
Client diagnostics: 'rate_limit' returns the latest |
hub_audit |
AUDITTOOL |
Read a Docker Hub account's audit trail: 'logs' lists events |
hub_auth |
AUTHTOOL |
Manage Docker Hub authentication, personal access tokens (PATs), |
dockerhub_ingest_repositories |
KGTOOL |
Natively ingest repositories into the epistemic-graph as typed :Repository/:ContainerImage nodes. |
hub_org |
ORGTOOL |
Manage a Docker Hub organization: settings (restricted images), |
hub_registry |
REGISTRYTOOL |
Docker Registry v2 image operations (registry-1.docker.io): |
hub_repos |
REPOSTOOL |
Manage Docker Hub repositories: list/create/inspect repositories, |
hub_scim |
SCIMTOOL |
Docker Hub SCIM 2.0: service discovery (ServiceProviderConfig, |
hub_scout |
SCOUTTOOL |
Docker Scout image intelligence (api.scout.docker.com): |
hub_teams |
TEAMSTOOL |
Manage Docker Hub organization groups (teams) and their members. |
Verbose 1:1 API-mapped tools (MCP_TOOL_MODE=verbose or both)
54 per-operation tools — one per public API method (click to expand)
| MCP Tool | Toggle Env Var | Description |
|---|---|---|
dockerhub_add_group_member |
GROUPSTOOL |
Add a username to a group. |
dockerhub_assign_repository_group |
REPOSITORIESTOOL |
Grant a team (group) read/write/admin on a repository. |
dockerhub_bulk_invite |
ORGSTOOL |
Invite many users/emails at once (POST /v2/invites/bulk). |
dockerhub_check_repository |
REPOSITORIESTOOL |
HEAD existence check for a repository. |
dockerhub_check_repository_tag |
REPOSITORIESTOOL |
HEAD existence check for one tag. |
dockerhub_check_repository_tags |
REPOSITORIESTOOL |
HEAD check: does the repository have any tags? |
dockerhub_create_access_token |
ACCESS_TOKENSTOOL |
Create a personal access token. |
dockerhub_create_auth_token |
AUTHTOOL |
Mint a short-lived JWT bearer from an identifier + secret. |
dockerhub_create_group |
GROUPSTOOL |
Create a group (team) in an organization. |
dockerhub_create_org_access_token |
ORG_ACCESS_TOKENSTOOL |
Create an organization access token. |
dockerhub_create_repository |
REPOSITORIESTOOL |
Create an image repository in a namespace. |
dockerhub_create_scim_user |
SCIMTOOL |
Provision a SCIM user. |
dockerhub_delete_access_token |
ACCESS_TOKENSTOOL |
Delete a personal access token. Destructive — gated. |
dockerhub_delete_group |
GROUPSTOOL |
Delete a group. Destructive — gated. |
dockerhub_delete_invite |
ORGSTOOL |
Cancel an invite. Destructive — gated. |
dockerhub_delete_org_access_token |
ORG_ACCESS_TOKENSTOOL |
Delete an organization access token. Destructive — gated. |
dockerhub_export_org_members |
ORGSTOOL |
Export the member list as CSV (GET /members/export). |
dockerhub_get_access_token |
ACCESS_TOKENSTOOL |
Get one personal access token by UUID. |
dockerhub_get_access_tokens |
ACCESS_TOKENSTOOL |
List the personal access tokens of the authenticated user. |
dockerhub_get_audit_log_actions |
AUDIT_LOGSTOOL |
List the audit-log action names available for a namespace. |
dockerhub_get_audit_logs |
AUDIT_LOGSTOOL |
List audit-log events for a namespace. |
dockerhub_get_group |
GROUPSTOOL |
Get one group. |
dockerhub_get_group_members |
GROUPSTOOL |
List a group's members. |
dockerhub_get_groups |
GROUPSTOOL |
List an organization's groups (teams). |
dockerhub_get_org_access_token |
ORG_ACCESS_TOKENSTOOL |
Get one organization access token by id. |
dockerhub_get_org_access_tokens |
ORG_ACCESS_TOKENSTOOL |
List an organization's access tokens. |
dockerhub_get_org_invites |
ORGSTOOL |
List an organization's pending invites. |
dockerhub_get_org_members |
ORGSTOOL |
List organization members (filter by search/type/role; paginated). |
dockerhub_get_org_settings |
ORGSTOOL |
Get an organization's settings (restricted images policy). |
dockerhub_get_repositories |
REPOSITORIESTOOL |
List a namespace's repositories (name filter + ordering enum). |
dockerhub_get_repository |
REPOSITORIESTOOL |
Get one repository. |
dockerhub_get_repository_tag |
REPOSITORIESTOOL |
Get one tag. |
dockerhub_get_repository_tags |
REPOSITORIESTOOL |
List a repository's tags (paginated). |
dockerhub_get_scim_resource_type |
SCIMTOOL |
Get one SCIM ResourceType by name. |
dockerhub_get_scim_resource_types |
SCIMTOOL |
List the SCIM ResourceTypes. |
dockerhub_get_scim_schema |
SCIMTOOL |
Get one SCIM Schema by id (URN). |
dockerhub_get_scim_schemas |
SCIMTOOL |
List the SCIM Schemas. |
dockerhub_get_scim_service_provider_config |
SCIMTOOL |
Get the SCIM ServiceProviderConfig. |
dockerhub_get_scim_user |
SCIMTOOL |
Get one SCIM user by id. |
dockerhub_get_scim_users |
SCIMTOOL |
List SCIM users (startIndex/count/filter/sortBy/sortOrder). |
dockerhub_login |
AUTHTOOL |
Authenticate via the legacy login endpoint. |
dockerhub_patch_group |
GROUPSTOOL |
Partially update a group (PATCH). |
dockerhub_remove_group_member |
GROUPSTOOL |
Remove a username from a group. Destructive — gated. |
dockerhub_remove_org_member |
ORGSTOOL |
Remove a member from the organization. Destructive — gated. |
dockerhub_replace_scim_user |
SCIMTOOL |
Replace a SCIM user resource (PUT). |
dockerhub_resend_invite |
ORGSTOOL |
Resend an invite (PATCH /v2/invites/{id}/resend). |
dockerhub_two_factor_login |
AUTHTOOL |
Complete a 2FA login with the TOTP code (POST /v2/users/2fa-login). |
dockerhub_update_access_token |
ACCESS_TOKENSTOOL |
Patch a personal access token's label and/or active state. |
dockerhub_update_group |
GROUPSTOOL |
Replace a group's details (PUT). |
dockerhub_update_immutable_tags |
REPOSITORIESTOOL |
Patch a repository's immutable-tags settings. |
dockerhub_update_org_access_token |
ORG_ACCESS_TOKENSTOOL |
Patch an organization access token. |
dockerhub_update_org_member |
ORGSTOOL |
Set a member's org role (owner, editor, or member). |
dockerhub_update_org_settings |
ORGSTOOL |
Replace an organization's settings. Destructive — gated. |
dockerhub_verify_immutable_tags |
REPOSITORIESTOOL |
Verify immutable-tag rules without applying them. |
9 action-routed tool(s) (default) · 54 verbose 1:1 tool(s). Each is enabled unless its <DOMAIN>TOOL toggle is set false; MCP_TOOL_MODE selects the surface (condensed default · verbose 1:1 · both). Auto-generated — do not edit.
MCP Configuration Examples
Install the connector-focused
[mcp]extra. Examples usedockerhub-api[mcp]to add FastMCP / FastAPI throughagent-connector-sdk; the required Agent Connector SDK core still carriesepistemic-graph[full]. The[agent-runtime]extra additionally enables model orchestration.
stdio Transport (local IDEs — Cursor, Claude Desktop, VS Code)
{
"mcpServers": {
"dockerhub-mcp": {
"command": "uvx",
"args": [
"--from",
"dockerhub-api[mcp]",
"dockerhub-mcp"
],
"env": {
"MCP_TOOL_MODE": "intent",
"ADMINTOOL": "True",
"AUDITTOOL": "True",
"AUTHTOOL": "True",
"DOCKERHUB_ALLOW_DESTRUCTIVE": "False",
"DOCKERHUB_TLS_PROFILE": "system",
"DOCKERHUB_TOKEN": "dckr_pat_your_personal_access_token",
"DOCKERHUB_URL": "https://hub.docker.com",
"DOCKERHUB_USERNAME": "your_dockerhub_username",
"DOCKER_REGISTRY_AUTH_URL": "https://auth.docker.io/token",
"DOCKER_REGISTRY_URL": "https://registry-1.docker.io",
"DOCKER_SCOUT_URL": "https://api.scout.docker.com",
"KGTOOL": "True",
"ORGTOOL": "True",
"REGISTRYTOOL": "True",
"REPOSTOOL": "True",
"SCIMTOOL": "True",
"SCOUTTOOL": "True",
"TEAMSTOOL": "True"
}
}
}
}
Runtime references require an alias-aware launcher such as Arbora. Other launchers must omit those entries and inject the resolved values through their own runtime secret boundary.
Streamable-HTTP Transport (networked / production)
{
"mcpServers": {
"dockerhub-mcp": {
"command": "uvx",
"args": [
"--from",
"dockerhub-api[mcp]",
"dockerhub-mcp",
"--transport",
"streamable-http",
"--port",
"8000"
],
"env": {
"TRANSPORT": "streamable-http",
"HOST": "127.0.0.1",
"PORT": "8000",
"MCP_TOOL_MODE": "intent",
"ADMINTOOL": "True",
"AUDITTOOL": "True",
"AUTHTOOL": "True",
"DOCKERHUB_ALLOW_DESTRUCTIVE": "False",
"DOCKERHUB_TLS_PROFILE": "system",
"DOCKERHUB_TOKEN": "dckr_pat_your_personal_access_token",
"DOCKERHUB_URL": "https://hub.docker.com",
"DOCKERHUB_USERNAME": "your_dockerhub_username",
"DOCKER_REGISTRY_AUTH_URL": "https://auth.docker.io/token",
"DOCKER_REGISTRY_URL": "https://registry-1.docker.io",
"DOCKER_SCOUT_URL": "https://api.scout.docker.com",
"KGTOOL": "True",
"ORGTOOL": "True",
"REGISTRYTOOL": "True",
"REPOSTOOL": "True",
"SCIMTOOL": "True",
"SCOUTTOOL": "True",
"TEAMSTOOL": "True"
}
}
}
}
Alternatively, connect to a pre-deployed Streamable-HTTP instance by url:
{
"mcpServers": {
"dockerhub-mcp": {
"url": "http://localhost:8000/dockerhub-mcp/mcp"
}
}
}
Run a reviewed container image as a least-privilege stdio child (no listener or published port):
docker run -i --rm \
--read-only \
--cap-drop=ALL \
--security-opt=no-new-privileges \
--pids-limit=256 \
--tmpfs /tmp:rw,noexec,nosuid,nodev,size=64m \
-e TRANSPORT=stdio \
-e MCP_TOOL_MODE=intent \
-e ADMINTOOL=True \
-e AUDITTOOL=True \
-e AUTHTOOL=True \
-e DOCKERHUB_ALLOW_DESTRUCTIVE=False \
-e DOCKERHUB_TLS_PROFILE=system \
-e DOCKERHUB_TOKEN=dckr_pat_your_personal_access_token \
-e DOCKERHUB_URL=https://hub.docker.com \
-e DOCKERHUB_USERNAME=your_dockerhub_username \
-e DOCKER_REGISTRY_AUTH_URL=https://auth.docker.io/token \
-e DOCKER_REGISTRY_URL=https://registry-1.docker.io \
-e DOCKER_SCOUT_URL=https://api.scout.docker.com \
-e KGTOOL=True \
-e ORGTOOL=True \
-e REGISTRYTOOL=True \
-e REPOSTOOL=True \
-e SCIMTOOL=True \
-e SCOUTTOOL=True \
-e TEAMSTOOL=True \
registry.example.invalid/dockerhub-api@sha256:<digest> dockerhub-mcp
For containerized network HTTP, supply an authenticated TLS ingress (or
direct server TLS), exact MCP_ALLOWED_HOSTS, and an exact trusted-proxy
CIDR policy through the operator-owned deployment profile. The generator
does not emit an unauthenticated non-loopback listener.
Auto-generated from the code-read env surface (MCP_TOOL_MODE + package vars) — do not edit.
Additional Deployment Options
dockerhub-api can run as a local stdio process or container, or behind a remote
network boundary. The
Deployment guide carries
the detailed transport contract.
- Local container — launch a reviewed immutable image as a least-privilege stdio child with no listener or published port.
- Remote URL — connect through an operator-supplied authenticated HTTPS
ingress. Keep its URL, outbound identity references, trust profile, and exact
MCP_ALLOWED_HOSTSinAgentConfig.
Safety Model
| Operation class | Default | Override |
|---|---|---|
| Reads (repos, tags, members, logs, SCIM) | allowed | — |
| Repository create / immutable-tag config / invites / role updates | allowed | — |
| Removes (PATs, OATs, groups, members, invites) | blocked | DOCKERHUB_ALLOW_DESTRUCTIVE=True |
Org-settings writes (PUT /v2/orgs/{org}/settings) |
blocked | DOCKERHUB_ALLOW_DESTRUCTIVE=True |
Concepts
The concept registry (CONCEPT:DH-OS.governance.hub-x) is documented in
docs/concepts.md.
License
MIT — see LICENSE.
Governed capability contract
This package ships a compact canonical skill surface with specialist procedures
kept as referenced workflows. The current MCP tools, skill metadata,
connector_manifest.yml, ontology, mappings, shapes, fixtures, migrations,
tool-schema fingerprints, and certification metadata form one versioned
capability contract. Validate them together; do not rely on stale tool names or
historical per-task skill wrappers.
Runtime endpoints, credentials, certificate trust, tenant identity, retention, and observability policy are deployment inputs and are never packaged values. See Configuration, trust, and privacy before enabling a network transport, connector ingestion, Arbora delegation, or trace export.
Environment Variables
Package environment variables
| Variable | Example | Description |
|---|---|---|
HOST |
0.0.0.0 |
|
PORT |
8000 |
|
TRANSPORT |
stdio |
options: stdio, streamable-http, sse |
FASTMCP_LOG_LEVEL |
ERROR |
|
NO_COLOR |
1 |
|
TERM |
dumb |
forced to "dumb" by the server to disable ANSI/color output |
ENABLE_OTEL |
True |
|
OTEL_EXPORTER_OTLP_ENDPOINT |
http://localhost:8080/api/public/otel |
|
OTEL_EXPORTER_OTLP_PUBLIC_KEY |
secret-injected | |
OTEL_EXPORTER_OTLP_SECRET_KEY |
secret-injected | |
OTEL_EXPORTER_OTLP_PROTOCOL |
http/protobuf |
|
EUNOMIA_TYPE |
none |
options: none, embedded, remote |
EUNOMIA_POLICY_FILE |
mcp_policies.json |
|
EUNOMIA_REMOTE_URL |
http://eunomia-server:8000 |
|
DOCKER_HUB_USER |
— | Official hub-tool credential names (primary): |
DOCKER_HUB_TOKEN |
secret-injected | |
DOCKERHUB_URL |
https://hub.docker.com |
Fallback aliases: DOCKERHUB_USERNAME / DOCKERHUB_TOKEN / DOCKERHUB_JWT |
DOCKERHUB_USERNAME |
your_dockerhub_username |
|
DOCKERHUB_TOKEN |
secret-injected | password, PAT, or org access token |
DOCKERHUB_JWT |
— | optional pre-minted bearer (overrides the above) |
DOCKERHUB_TLS_PROFILE |
system |
Named outbound TLS policy from AgentConfig. Use a reference for runtime-only trust material; peer and hostname verification remain mandatory. |
DOCKERHUB_TLS_PROFILE_REF |
— | |
DOCKER_REGISTRY_URL |
https://registry-1.docker.io |
|
DOCKER_REGISTRY_AUTH_URL |
https://auth.docker.io/token |
token-service realm; auto-discovered from the 401 challenge |
DOCKER_SCOUT_URL |
https://api.scout.docker.com |
|
DOCKERHUB_ALLOW_DESTRUCTIVE |
False |
|
AUTHTOOL |
True |
|
REPOSTOOL |
True |
|
ORGTOOL |
True |
|
TEAMSTOOL |
True |
|
AUDITTOOL |
True |
|
SCIMTOOL |
True |
|
ADMINTOOL |
True |
|
REGISTRYTOOL |
True |
|
SCOUTTOOL |
True |
|
KGTOOL |
True |
Inherited agent-connector-sdk variables (apply to every connector)
| Variable | Example | Description |
|---|---|---|
MCP_TOOL_MODE |
intent |
Tool surface: intent | condensed | verbose | both |
MCP_ENABLED_TOOLS |
— | Comma-separated tool allow-list |
MCP_DISABLED_TOOLS |
— | Comma-separated tool deny-list |
MCP_ENABLED_TAGS |
— | Comma-separated tag allow-list |
MCP_DISABLED_TAGS |
— | Comma-separated tag deny-list |
MCP_CLIENT_AUTH |
— | Outbound MCP child auth: oidc-client-credentials | basic | none |
OIDC_CLIENT_ID |
— | OIDC client id (service-account auth) |
OIDC_CLIENT_SECRET_REF |
secret://identity/oidc-client-secret |
Runtime secret reference for the OIDC service account |
MCP_BASIC_AUTH_USERNAME |
— | HTTP Basic username (MCP_CLIENT_AUTH=basic) |
MCP_BASIC_AUTH_PASSWORD_REF |
secret://identity/mcp-basic-password |
Runtime secret reference for HTTP Basic auth (MCP_CLIENT_AUTH=basic) |
DEBUG |
False |
Verbose logging |
PYTHONUNBUFFERED |
1 |
Unbuffered stdout (recommended in containers) |
MCP_URL |
http://localhost:8000/mcp |
URL of the MCP server the agent connects to |
PROVIDER |
openai |
LLM provider for the agent |
MODEL_ID |
gpt-4o |
Model id for the agent |
ENABLE_WEB_UI |
True |
Serve the AG-UI web interface |
36 package + 16 inherited variable(s). Auto-generated from .env.example + the shared agent-connector-sdk set — do not edit.
Metadata
Release files for dockerhub-api 1.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dockerhub_api-1.3.1.tar.gz | 84.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dockerhub_api-1.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 175.1 kB
Release files / dockerhub_api-1.3.1.tar.gz
| Download URL | dockerhub_api-1.3.1.tar.gz |
|---|---|
| Size | 84.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
182fd4b5276aaedd116502a2baa456e3c465fb1dbe1815009d6b1a905f068428
|
|
BLAKE2b-256 checksum How to use checksums |
69750563ef22a47c16c8667d85c0323fe1aad1377cadfaf730036a2364f29c2f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Release files / dockerhub_api-1.3.1-py3-none-any.whl
| Download URL | dockerhub_api-1.3.1-py3-none-any.whl |
|---|---|
| Size | 90.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
90015f76bbdbe8973d336a38ed9c49de0ac2c6ead99188bb55e79e4616c51159
|
|
BLAKE2b-256 checksum How to use checksums |
af0d86e35ce90d724fc21b1cfffd495969545a0396a3435e8e13dde5cf45d156
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|