Skip to content

Commit ba3b1ae

Browse files
authored
Merge branch 'main' into feat/tools-scripts
2 parents 43822bd + ced985a commit ba3b1ae

File tree

3 files changed

+168
-128
lines changed

3 files changed

+168
-128
lines changed

README.md

Lines changed: 133 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,68 @@
11
# Docker Hub MCP Server
2+
23
The Docker Hub MCP Server is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) server that interfaces with Docker Hub APIs to make them accessible to LLMs, enabling intelligent content discovery and repository management.
34

45
Developers building with containers, especially in AI and LLM-powered workflows, often face inadequate context across the vast landscape of Docker Hub images. As a result, LLMs struggle to recommend the right images, and developers lose time manually searching instead of building.
56

67
### Use Cases
78

89
- AI-powered image recommendations - LLMs access real-time Docker Hub data for accurate container image suggestions.
9-
- Enhanced content discovery - AI tools help developers find the right images faster.
10+
- Enhanced content discovery - AI tools help developers find the right images faster.
1011
- Simplified Hub workflows - Manage Docker repositories and images using natural language.
1112

1213
## Prerequisites
14+
1315
- [Docker](https://docs.docker.com/get-docker/) installed
1416
- [Node.js](https://nodejs.org/) (version 22+)
1517
- [Optional] A [Docker Personal Access Token (PAT)](https://docs.docker.com/security/for-developers/access-tokens/) with appropriate permissions
1618

17-
18-
19-
20-
2119
## Setup
20+
2221
1. **Build**
23-
```bash
24-
npm install
25-
npm run build
26-
```
22+
23+
```bash
24+
npm install
25+
npm run build
26+
```
2727

2828
2. **Run**
2929

30-
```bash
31-
npm start -- [--transport=http|stdio] [--port=3000]
32-
```
30+
```bash
31+
npm start -- [--transport=http|stdio] [--port=3000]
32+
```
33+
3334
- Default args:
34-
- `transport`: Choose between `http` or `stdio` (default: `stdio`)
35-
- `port=3000`
36-
37-
This starts the server with default settings and can only access public Docker Hub content.
35+
- `transport`: Choose between `http` or `stdio` (default: `stdio`)
36+
- `port=3000`
37+
This starts the server with default settings and can only access public Docker Hub content.
3838

3939
### Run in inspector [Optional]
40-
The MCP Inspector provides a web interface to test your server:
40+
41+
The MCP Inspector provides a web interface to test your server:
4142

4243
```
4344
npx @modelcontextprotocol/inspector node dist/index.js [--transport=http|stdio] [--port=3000]
4445
```
4546
4647
## Authenticate with docker
48+
4749
By default this MCP server can only query public content on Docker Hub. In order to manage your repositories you need to provide authentication.
4850
4951
### Run with authentication
52+
5053
```
5154
HUB_PAT_TOKEN=<a_pat_token> npm start -- [--username=<the_hub_username_for_the_pat>]
5255
```
56+
5357
### Run in inspector [Optional]
58+
5459
```
5560
HUB_PAT_TOKEN=<a_pat_token> npx @modelcontextprotocol/inspector node dist/index.js[--username=<the_hub_username_for_the_pat>]
5661
```
5762
58-
59-
6063
## Gordon Setup
64+
6165
[Ask Gordon](https://docs.docker.com/ai/gordon/) is your personal AI assistant embedded in Docker Desktop and the Docker CLI. It's designed to streamline your workflow and help you make the most of the Docker ecosystem.
62-
6366
6467
You can configure Gordon to be a client that can interact with the Docker Hub MCP server.
6568
@@ -79,82 +82,103 @@ services:
7982
3. Run `docker ai`
8083
8184
## Usage with Claude Desktop
85+
8286
1. Add the Docker Hub MCP Server configuration to your `claude_desktop_config.json`:
8387
8488
#### For public repositories only:
8589
86-
- `/FULL/PATH/TO/YOUR/docker-hub-mcp-server` - The complete path to where you cloned this repository
90+
- `/FULL/PATH/TO/YOUR/docker-hub-mcp-server` - The complete path to where you cloned this repository
91+
8792
```json
8893
{
89-
"mcpServers": {
90-
"docker-hub": {
91-
"command": "node",
92-
"args": ["/FULL/PATH/TO/YOUR/docker-hub-mcp-server/dist/index.js", "--transport=stdio"]
94+
"mcpServers": {
95+
"docker-hub": {
96+
"command": "node",
97+
"args": ["/FULL/PATH/TO/YOUR/docker-hub-mcp-server/dist/index.js", "--transport=stdio"]
98+
}
9399
}
94-
}
95100
}
96101
```
102+
97103
#### For authenticated access (recommended):
98-
Replace the following values:
99-
- `YOUR_DOCKER_HUB_USERNAME` - Your Docker Hub username
100-
- `YOUR_DOCKER_HUB_PERSONAL_ACCESS_TOKEN` - Your Docker Hub Personal Access Token
101-
- `/FULL/PATH/TO/YOUR/docker-hub-mcp-server` - The complete path to where you cloned this
104+
105+
Replace the following values:
106+
107+
- `YOUR_DOCKER_HUB_USERNAME` - Your Docker Hub username
108+
- `YOUR_DOCKER_HUB_PERSONAL_ACCESS_TOKEN` - Your Docker Hub Personal Access Token
109+
- `/FULL/PATH/TO/YOUR/docker-hub-mcp-server` - The complete path to where you cloned this
102110

103111
```json
104112
{
105-
"mcpServers": {
106-
"docker-hub": {
107-
"command": "node",
108-
"args": ["/FULL/PATH/TO/YOUR/docker-hub-mcp-server/dist/index.js", "--transport=stdio", "--username=YOUR_DOCKER_HUB_USERNAME"],
109-
"env": {
110-
"HUB_PAT_TOKEN": "YOUR_DOCKER_HUB_PERSONAL_ACCESS_TOKEN"
111-
}
113+
"mcpServers": {
114+
"docker-hub": {
115+
"command": "node",
116+
"args": [
117+
"/FULL/PATH/TO/YOUR/docker-hub-mcp-server/dist/index.js",
118+
"--transport=stdio",
119+
"--username=YOUR_DOCKER_HUB_USERNAME"
120+
],
121+
"env": {
122+
"HUB_PAT_TOKEN": "YOUR_DOCKER_HUB_PERSONAL_ACCESS_TOKEN"
123+
}
124+
}
112125
}
113-
}
114126
}
115127
```
128+
116129
2. Save the configuration file and completely restart Claude Desktop for the changes to take effect.
117130

118131
## Usage with VS Code
132+
119133
1. Add the Docker Hub MCP Server configuration to your User Settings (JSON) file in VS Code. You can do this by opening the `Command Palette` and typing `Preferences: Open User Settings (JSON)`.
120134

121135
#### For public repositories only:
122136

123-
- `/FULL/PATH/TO/YOUR/docker-hub-mcp-server` - The complete path to where you cloned this repository
137+
- `/FULL/PATH/TO/YOUR/docker-hub-mcp-server` - The complete path to where you cloned this repository
138+
124139
```json
125140
{
126-
"mcpServers": {
127-
"docker-hub": {
128-
"command": "node",
129-
"args": ["/FULL/PATH/TO/YOUR/docker-hub-mcp-server/dist/index.js", "--transport=stdio"]
141+
"mcpServers": {
142+
"docker-hub": {
143+
"command": "node",
144+
"args": ["/FULL/PATH/TO/YOUR/docker-hub-mcp-server/dist/index.js", "--transport=stdio"]
145+
}
130146
}
131-
}
132147
}
133148
```
149+
134150
#### For authenticated access (recommended):
135-
Replace the following values:
136-
- `YOUR_DOCKER_HUB_USERNAME` - Your Docker Hub username
137-
- `YOUR_DOCKER_HUB_PERSONAL_ACCESS_TOKEN` - Your Docker Hub Personal Access Token
138-
- `/FULL/PATH/TO/YOUR/docker-hub-mcp-server` - The complete path to where you cloned this
151+
152+
Replace the following values:
153+
154+
- `YOUR_DOCKER_HUB_USERNAME` - Your Docker Hub username
155+
- `YOUR_DOCKER_HUB_PERSONAL_ACCESS_TOKEN` - Your Docker Hub Personal Access Token
156+
- `/FULL/PATH/TO/YOUR/docker-hub-mcp-server` - The complete path to where you cloned this
139157

140158
```json
141159
{
142-
"mcpServers": {
143-
"docker-hub": {
144-
"command": "node",
145-
"args": ["/FULL/PATH/TO/YOUR/docker-hub-mcp-server/dist/index.js", "--transport=stdio", "--username=YOUR_DOCKER_HUB_USERNAME"],
146-
"env": {
147-
"HUB_PAT_TOKEN": "YOUR_DOCKER_HUB_PERSONAL_ACCESS_TOKEN"
148-
}
160+
"mcpServers": {
161+
"docker-hub": {
162+
"command": "node",
163+
"args": [
164+
"/FULL/PATH/TO/YOUR/docker-hub-mcp-server/dist/index.js",
165+
"--transport=stdio",
166+
"--username=YOUR_DOCKER_HUB_USERNAME"
167+
],
168+
"env": {
169+
"HUB_PAT_TOKEN": "YOUR_DOCKER_HUB_PERSONAL_ACCESS_TOKEN"
170+
}
171+
}
149172
}
150-
}
151173
}
174+
```
175+
152176
2. Open the `Command Palette` and type `MCP: List Servers`.
153177
3. Select `docker-hub` and select `Start Server`.
154178

155-
156179
## Task Examples
157-
### Finding images
180+
181+
### Finding images
158182

159183
```console
160184
# Search for official images
@@ -163,7 +187,7 @@ $ docker ai "Search for official nginx images on Docker Hub"
163187
# Search for lightweight images to reduce deployment size and improve performance
164188
$ docker ai "Search for minimal Node.js images with small footprint"
165189

166-
# Get the most recent tag of a base image
190+
# Get the most recent tag of a base image
167191
$ docker ai "Show me the latest tag details for go"
168192

169193
# Find a production-ready database with enterprise features and reliability
@@ -173,7 +197,6 @@ $ docker ai "Search for production ready database images"
173197
$ docker ai "Help me find the right Ubuntu version for my project"
174198
```
175199

176-
177200
### Repository Management
178201

179202
```console
@@ -196,7 +219,8 @@ $ docker ai "Show me my most recently updated repositories"
196219
$ docker ai "Show me information about my '<repository-name>' repository"
197220
```
198221

199-
### Pull/Push Images
222+
### Pull/Push Images
223+
200224
```console
201225
# Pull latest PostgreSQL version
202226
$ docker ai "Pull the latest postgres image"
@@ -235,87 +259,83 @@ $ docker ai "Can you help me update my Dockerfile to use a docker hardened image
235259
```
236260

237261
## Tools
262+
238263
### Search
239264

240265
- **search** - Search repositories and content using Search V4 API
241-
- `query`: Search query parameter (string, required)
242-
- `architectures`: Filter on architectures (string, optional)
243-
- `badges`: Filter by image content type badges (string, optional)
244-
- `categories`: Filter on categories (string, optional)
245-
- `extension_reviewed`: Filter on reviewed extensions (boolean, optional)
246-
- `from`: Number of documents to skip for pagination (number, optional)
247-
- `images`: Filter on image names (string, optional)
248-
- `operating_systems`: Filter on operating systems (string, optional)
249-
- `order`: Change the ordering of results (string, optional)
250-
- `size`: Maximum number of results to return (number, optional)
251-
- `sort`: Sort results by search field (string, optional)
252-
- `type`: Filter on repository content type (string, optional)
253-
266+
- `query`: Search query parameter (string, required)
267+
- `architectures`: Filter on architectures (string, optional)
268+
- `badges`: Filter by image content type badges (string, optional)
269+
- `categories`: Filter on categories (string, optional)
270+
- `extension_reviewed`: Filter on reviewed extensions (boolean, optional)
271+
- `from`: Number of documents to skip for pagination (number, optional)
272+
- `images`: Filter on image names (string, optional)
273+
- `operating_systems`: Filter on operating systems (string, optional)
274+
- `order`: Change the ordering of results (string, optional)
275+
- `size`: Maximum number of results to return (number, optional)
276+
- `sort`: Sort results by search field (string, optional)
277+
- `type`: Filter on repository content type (string, optional)
254278

255279
### Namespace Management
256280

257281
- **get_namespaces** - Get list of namespaces the user is a member of
258-
- `page`: Page number for pagination (string, optional)
259-
- `page_size`: Number of items per page (string, optional)
282+
- `page`: Page number for pagination (string, optional)
283+
- `page_size`: Number of items per page (string, optional)
260284

261285
### Repository Management
286+
262287
- **list_repositories_by_namespace** - List all repositories under the provided namespace
263-
- `namespace`: Repository namespace (string, required)
264-
- `content_types`: Comma-delimited list of content types (string, optional)
265-
- `media_types`: Comma-delimited list of media types (string, optional)
266-
- `name`: Search by repository name (string, optional)
267-
- `ordering`: Sort order (string, optional)
268-
- `page`: Page number (number, optional)
269-
- `page_size`: Number of items per page (number, optional)
288+
- `namespace`: Repository namespace (string, required)
289+
- `content_types`: Comma-delimited list of content types (string, optional)
290+
- `media_types`: Comma-delimited list of media types (string, optional)
291+
- `name`: Search by repository name (string, optional)
292+
- `ordering`: Sort order (string, optional)
293+
- `page`: Page number (number, optional)
294+
- `page_size`: Number of items per page (number, optional)
270295

271296
- **get_repository_info** - Get information about a repository
272-
- `namespace`: Repository namespace (string, required)
273-
- `repository`: Repository name (string, required)
274-
297+
- `namespace`: Repository namespace (string, required)
298+
- `repository`: Repository name (string, required)
275299

276300
- **check_repository** - Check if a repository exists
277-
- `namespace`: Repository namespace (string, required)
278-
- `repository`: Repository name (string, required)
301+
- `namespace`: Repository namespace (string, required)
302+
- `repository`: Repository name (string, required)
279303

280304
- **check_repository_tag** - Check if a specific tag exists in a repository
281-
- `namespace`: Repository namespace (string, required)
282-
- `repository`: Repository name (string, required)
283-
- `tag`: Tag name (string, required)
305+
- `namespace`: Repository namespace (string, required)
306+
- `repository`: Repository name (string, required)
307+
- `tag`: Tag name (string, required)
284308

285309
- **create_repository** - Create a new repository in the provided namespace
286-
- `namespace`: Repository namespace (string, required)
287-
- `body`: Request body data (object, optional)
288-
310+
- `namespace`: Repository namespace (string, required)
311+
- `body`: Request body data (object, optional)
289312

290313
- **update_repository_info** - Update repository information
291-
- `namespace`: Repository namespace (string, required)
292-
- `repository`: Repository name (string, required)
293-
- `body`: Request body data (object, optional)
314+
- `namespace`: Repository namespace (string, required)
315+
- `repository`: Repository name (string, required)
316+
- `body`: Request body data (object, optional)
294317

295-
296318
### Tag Management
319+
297320
- **list_repository_tags** - List all tags for a repository
298-
- `namespace`: Repository namespace (string, required)
299-
- `repository`: Repository name (string, required)
300-
- `architecture`: Filter by architecture (string, optional)
301-
- `os`: Filter by operating system (string, optional)
302-
- `page`: Page number (number, optional)
303-
- `page_size`: Number of items per page (number, optional)
304-
321+
- `namespace`: Repository namespace (string, required)
322+
- `repository`: Repository name (string, required)
323+
- `architecture`: Filter by architecture (string, optional)
324+
- `os`: Filter by operating system (string, optional)
325+
- `page`: Page number (number, optional)
326+
- `page_size`: Number of items per page (number, optional)
305327
- **read_repository_tag** - Get details of a specific repository tag
306-
- `namespace`: Repository namespace (string, required)
307-
- `repository`: Repository name (string, required)
308-
- `tag`: Tag name (string, required)
309-
310-
311-
328+
- `namespace`: Repository namespace (string, required)
329+
- `repository`: Repository name (string, required)
330+
- `tag`: Tag name (string, required)
312331

313332
### Hardened Images
333+
314334
- **docker_hardened_images** - Query for mirrored Docker Hardened Images (DHI) in the namespace
315-
- `namespace`: The namespace to query for mirrored hardened repositories (string, optional)
335+
- `namespace`: The namespace to query for mirrored hardened repositories (string, optional)
316336

317337
## Licensing
318338

319-
docker/hub-mcp is licensed under the Apache License, Version 2.0. See
339+
[docker/hub-mcp](https://github.com/docker/hub-mcp) is licensed under the Apache License, Version 2.0. See
320340
[LICENSE](https://github.com/docker/docker/blob/master/LICENSE) for the full
321341
license text.

0 commit comments

Comments
 (0)