DockerHub MCP Server
Integrates with DockerHub's API to search images with advanced filters, inspect image details and layer breakdowns, list tags and fetch manifests, check vulnerabilities and image history, compare images side-by-side, estimate pull sizes, track pull/star statistics and base image updates, and optionally authenticate against private registries.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@DockerHub MCP Server compare the latest nginx and httpd images by size and vulnerabilities"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
π³ DockerHub MCP Server
Production-ready Model Context Protocol (MCP) server for comprehensive DockerHub integration
A high-performance, production-ready MCP server that seamlessly integrates DockerHub with AI assistants like Claude Desktop, Cursor, Cline, and OpenAI Desktop. This server provides comprehensive Docker image management capabilities through a standardized MCP interface.
π― What This Does
Transform your AI assistant into a Docker expert! This MCP server enables AI assistants to:
π Search DockerHub for images with advanced filters
π Analyze image details, layers, and security vulnerabilities
π·οΈ Manage image tags and versions
π Compare images side-by-side for optimization
π Monitor download statistics and popularity metrics
π Estimate pull sizes and optimize deployments
Related MCP server: Docker Explorer
β¨ Key Features
π οΈ 12 Comprehensive Tools
Category | Tools | Description |
Search & Discovery |
| Advanced image search with filters |
Image Analysis |
| Deep image inspection |
Tag Management |
| Complete tag and manifest access |
Security |
| Security scanning and audit |
Optimization |
| Performance optimization tools |
Monitoring |
| Usage analytics and updates |
π Performance Optimized
Intelligent Caching: Multi-level caching with operation-specific TTL
Rate Limiting: Smart rate limiting with exponential backoff
Parallel Processing: Concurrent API requests for faster responses
Memory Efficient: < 50MB memory usage for typical workloads
π Enterprise Security
Multi-Registry Support: Public DockerHub + private registries
Secure Authentication: Token-based auth with scope validation
Input Validation: Zod schema validation for all inputs
Error Handling: Graceful degradation with no data leakage
π Quick Start
Prerequisites
Node.js 18+ (Download)
DockerHub Account (optional, for authenticated features)
DockerHub Access Token (optional, for enhanced features)
1. Installation
# Clone the repository
git clone https://github.com/raghav-jeogani/dockerhub-mcp-server.git
cd dockerhub-mcp-server
# Install dependencies
npm install
# Build the project
npm run build
# Verify installation
npm test2. Configuration
Create a .env file in the project root:
# π DockerHub Authentication (Optional but recommended)
DOCKERHUB_TOKEN=your_dockerhub_personal_access_token_here
# π’ Private Registries (Optional)
PRIVATE_REGISTRIES='[
{
"name": "my-private-registry",
"url": "https://registry.example.com",
"username": "your_username",
"password": "your_password"
}
]'
# β‘ Performance Settings
CACHE_TTL=300 # Cache duration in seconds
RATE_LIMIT_PER_MINUTE=60 # API requests per minute
RATE_LIMIT_PER_HOUR=1000 # API requests per hour
LOG_LEVEL=info # Log level: error, warn, info, debug3. Start the Server
# Start the MCP server
npm start
# Or run in development mode
npm run devπ€ MCP Client Integration
Claude Desktop
Open Claude Desktop Settings
Navigate to MCP Servers
Add new server configuration:
{
"mcpServers": {
"dockerhub": {
"command": "node",
"args": ["/path/to/dockerhub-mcp-server/dist/index.js"],
"cwd": "/path/to/dockerhub-mcp-server",
"env": {
"DOCKERHUB_TOKEN": "your_token_here",
"LOG_LEVEL": "info"
}
}
}
}Cursor
Open Cursor Settings (
Ctrl/Cmd + ,)Search for "MCP"
Add server configuration:
{
"mcpServers": {
"dockerhub": {
"command": "node",
"args": ["/path/to/dockerhub-mcp-server/dist/index.js"],
"cwd": "/path/to/dockerhub-mcp-server",
"env": {
"DOCKERHUB_TOKEN": "your_token_here",
"LOG_LEVEL": "info"
}
}
}
}Cline
Create/edit Cline config file
Add server configuration:
mcp_servers:
dockerhub:
command: node
args: [/path/to/dockerhub-mcp-server/dist/index.js]
cwd: /path/to/dockerhub-mcp-server
env:
DOCKERHUB_TOKEN: your_token_here
LOG_LEVEL: infoOpenAI Desktop
Open OpenAI Desktop Settings
Navigate to MCP Configuration
Add server configuration:
{
"mcpServers": {
"dockerhub": {
"command": "node",
"args": ["/path/to/dockerhub-mcp-server/dist/index.js"],
"cwd": "/path/to/dockerhub-mcp-server",
"env": {
"DOCKERHUB_TOKEN": "your_token_here"
}
}
}
}π Usage Examples
π Image Search & Discovery
"Find the most popular Python images and compare their sizes"Expected Response:
π Popular Python Images Found:
1. library/python:latest
β Stars: 15,000+ | π₯ Pulls: 1B+ | π¦ Size: 45MB
π Official Python latest image with comprehensive tooling
2. library/python:3.9-slim
β Stars: 15,000+ | π₯ Pulls: 500M+ | π¦ Size: 28MB
π Lightweight Python 3.9 with minimal dependencies
3. library/python:alpine
β Stars: 15,000+ | π₯ Pulls: 300M+ | π¦ Size: 15MB
π Alpine-based Python image for security and sizeπ Image Comparison & Optimization
"Compare nginx:latest with nginx:alpine and show optimization opportunities"Expected Response:
π Image Comparison: nginx:latest vs nginx:alpine
π¦ Size Analysis:
β’ nginx:latest: 133MB
β’ nginx:alpine: 23MB
β’ Savings: 110MB (83% reduction)
π§ Layer Analysis:
β’ nginx:latest: 12 layers
β’ nginx:alpine: 8 layers
β’ Common layers: 3 (25% efficiency)
π‘οΈ Security Profile:
β’ nginx:latest: 5 vulnerabilities (2 high, 3 medium)
β’ nginx:alpine: 1 vulnerability (1 low)
β’ Recommendation: Use alpine for better security
π‘ Optimization Opportunities:
β’ Switch to alpine base for 83% size reduction
β’ Fewer vulnerabilities with alpine
β’ Faster deployment and reduced bandwidthπ Security Analysis
"Check if our production images have any critical vulnerabilities"Expected Response:
π Security Analysis for Production Images:
π¨ CRITICAL FINDINGS:
β’ nginx:latest: 0 critical vulnerabilities β
β’ postgres:13: 0 critical vulnerabilities β
β’ redis:6: 0 critical vulnerabilities β
β οΈ MEDIUM RISK:
β’ nginx:latest: 3 medium vulnerabilities
β’ postgres:13: 1 medium vulnerability
β’ redis:6: 2 medium vulnerabilities
π Recommendations:
β’ Consider nginx:alpine for better security profile
β’ Update postgres to latest patch version
β’ Monitor redis vulnerabilities for updatesπ Performance Monitoring
"Analyze the layers of nginx:latest and identify optimization opportunities"Expected Response:
π Layer Analysis: nginx:latest
π Layer Breakdown:
β’ Total Layers: 12
β’ Total Size: 133MB
β’ Base Image: debian:bullseye-slim (80MB)
π Layer Details:
1. debian:bullseye-slim (80MB) - Base OS
2. nginx package installation (45MB) - Main application
3. Configuration files (2MB) - App config
4. Entrypoint script (1MB) - Runtime setup
π‘ Optimization Opportunities:
β’ Use alpine base: -60MB (45% reduction)
β’ Multi-stage build: -20MB (15% reduction)
β’ Remove unnecessary packages: -10MB (8% reduction)
β’ Total potential savings: 90MB (68% reduction)ποΈ Architecture
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MCP Client (Claude/Cursor/Cline) β
βββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββ
β JSON-RPC over stdio
βββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββ
β MCP Server Layer β
β βββββββββββββββββββ βββββββββββββββββββ ββββββββββββββββ β
β β Server.ts β β Tools.ts β β Types.ts β β
β β (JSON-RPC) β β (MCP Tools) β β (Schemas) β β
β βββββββββββββββββββ βββββββββββββββββββ ββββββββββββββββ β
βββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββ
β Service Layer
βββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββ
β Service Layer β
β βββββββββββββββββββ βββββββββββββββββββ ββββββββββββββββ β
β β DockerHub API β β Cache.ts β β Rate Limiter β β
β β Service β β (In-Memory) β β Service β β
β βββββββββββββββββββ βββββββββββββββββββ ββββββββββββββββ β
βββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββ
β External APIs
βββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββ
β External Services β
β βββββββββββββββββββ βββββββββββββββββββ ββββββββββββββββ β
β β DockerHub API β β Private Registryβ β Cache β β
β β (Public) β β APIs β β Store β β
β βββββββββββββββββββ βββββββββββββββββββ ββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββKey Components
MCP Server Layer: Handles JSON-RPC communication and tool routing
Service Layer: Business logic with caching, rate limiting, and API integration
External APIs: DockerHub API and private registry integrations
π§ Development
Project Structure
dockerhub-mcp-server/
βββ π src/ # Source code
β βββ π services/ # Business logic services
β β βββ dockerhub-api.ts # DockerHub API client
β β βββ cache.ts # Caching service
β β βββ rate-limiter.ts # Rate limiting service
β βββ π tools/ # MCP tools implementation
β β βββ index.ts # All 12 MCP tools
β βββ π types/ # TypeScript definitions
β β βββ index.ts # Zod schemas & types
β β βββ mcp.ts # MCP protocol types
β βββ π config/ # Configuration management
β β βββ index.ts # Environment & config
β βββ π utils/ # Utility functions
β β βββ logger.ts # Winston logging
β βββ server.ts # MCP server implementation
β βββ index.ts # Application entry point
βββ π tests/ # Test files
βββ π docs/ # Documentation
βββ π examples/ # Example configurations
βββ π package.json # Dependencies & scripts
βββ π tsconfig.json # TypeScript configuration
βββ π jest.config.js # Test configuration
βββ π README.md # This fileDevelopment Commands
# π οΈ Development
npm run dev # Start development server with hot reload
npm run build # Build for production
npm run clean # Clean build artifacts
# π§ͺ Testing
npm test # Run all tests
npm run test:watch # Run tests in watch mode
npm run test:coverage # Run tests with coverage report
# π Code Quality
npm run lint # Run ESLint
npm run lint:fix # Fix linting issues
npm run format # Format code with Prettier
# π¦ Package Management
npm run deps:check # Check for outdated dependencies
npm run deps:update # Update dependenciesAdding New Tools
Define the tool schema in
src/types/index.ts:
export const NewToolInputSchema = z.object({
parameter: z.string().describe("Parameter description"),
// ... other parameters
});Implement the tool in
src/tools/index.ts:
private async newTool(args: any) {
const { parameter } = args;
const result = await this.apiService.newToolMethod(parameter);
return { success: true, data: result };
}Add to tools list:
getTools(): Tool[] {
return [
// ... existing tools
{
name: "docker_new_tool",
description: "Description of the new tool",
inputSchema: NewToolInputSchema,
},
];
}π§ͺ Testing
Running Tests
# Run all tests
npm test
# Run specific test file
npm test -- tests/api.test.ts
# Run tests with coverage
npm run test:coverage
# Run integration tests
npm run test:integrationTest Examples
# Test MCP communication
node examples/test-mcp-communication.js
# Test DockerHub API integration
node examples/test-dockerhub-api.js
# Test all tools individually
node examples/test-all-tools.js
# Test authentication
node examples/test-authentication.jsπ Deployment
Docker Deployment
# Build Docker image
docker build -t dockerhub-mcp-server .
# Run container
docker run -d \
--name dockerhub-mcp-server \
-e DOCKERHUB_TOKEN=your_token \
-e LOG_LEVEL=info \
dockerhub-mcp-serverDocker Compose
version: '3.8'
services:
dockerhub-mcp-server:
build: .
container_name: dockerhub-mcp-server
environment:
- DOCKERHUB_TOKEN=${DOCKERHUB_TOKEN}
- LOG_LEVEL=info
- CACHE_TTL=300
restart: unless-stopped
volumes:
- ./logs:/app/logsProduction Deployment
# Build for production
npm run build
# Start production server
NODE_ENV=production npm start
# Or use PM2 for process management
pm2 start dist/index.js --name dockerhub-mcp-serverπ Performance & Benchmarks
Performance Metrics
Metric | Value | Status |
Response Time | < 100ms (cached) | β‘ Excellent |
Throughput | 1000+ req/min | π High |
Memory Usage | < 50MB | πΎ Efficient |
CPU Usage | < 5% | π Low |
Cache Hit Rate | 85% | π Good |
Error Rate | < 1% | β Reliable |
Optimization Features
Intelligent Caching: Multi-level caching with operation-specific TTL
Rate Limiting: Per-registry rate limiting with exponential backoff
Connection Pooling: HTTP connection reuse for better performance
Parallel Processing: Concurrent API requests where possible
Memory Management: Efficient data structures and cleanup
π Security
Security Features
Input Validation: Zod schema validation for all inputs
Authentication: Secure token-based authentication
Rate Limiting: Protection against API abuse
Error Handling: No sensitive information leakage
HTTPS: Secure communication with all APIs
Scope Validation: Token permission validation
Security Best Practices
β Store tokens in environment variables
β Use HTTPS for all API communications
β Validate all inputs and outputs
β Implement proper error handling
β Regular security updates
β No sensitive data in logs
π€ Contributing
We welcome contributions! Please see our Contributing Guide for details.
Quick Contribution Steps
Fork the repository
Create a feature branch:
git checkout -b feature/amazing-featureMake your changes
Add tests for new functionality
Run tests:
npm testCommit your changes:
git commit -m "feat: add amazing feature"Push to your fork:
git push origin feature/amazing-featureCreate a pull request
Development Guidelines
Use TypeScript for all new code
Follow existing code style and formatting
Write comprehensive tests
Update documentation
Use conventional commit messages
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Acknowledgments
Model Context Protocol for the MCP specification
DockerHub API for comprehensive API documentation
Anthropic for Claude Desktop
Cursor for the Cursor editor
Cline for the Cline CLI
OpenAI for OpenAI Desktop
π Support & Community
Getting Help
π Documentation: Wiki
π Issues: GitHub Issues
π¬ Discussions: GitHub Discussions
π§ Email: raghavjeogani@gmail.com
Community Resources
Examples: Check the
examples/directory for usage examplesTroubleshooting: See Troubleshooting Guide
Changelog: Version History
πΊοΈ Roadmap
Upcoming Features
Redis-based distributed caching for multi-instance deployments
Plugin architecture for custom tools and extensions
Advanced security features including vulnerability scanning
Multi-registry support enhancement with registry discovery
Performance optimizations including request batching
Enhanced documentation with interactive examples
Made with β€οΈ for the AI and Docker communities
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
Maintenance
Related MCP Connectors
AI agent registry β search, discover, register, and connect agents via MCP.
Search & install 13,000+ AI agent skills from skills-hub.ai inside any MCP tool.
MCP Hub: AI service discovery, per-user OAuth, and multi-service workflow orchestration
Search and inspect source-pinned agent skills, plugins and tools through a free public MCP.
Related MCP Servers
- AlicenseAqualityDmaintenanceAllows Claude and other AI assistants to interact with Docker through the MCP protocol, enabling container and image management including listing, running, stopping, and pulling Docker resources.64MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that provides tools for interacting with Docker images, containers, and registries, enabling AI assistants to search, analyze, and manage Docker resources through a standardized interface.1MIT

Docker Hub MCP Serverofficial
AlicenseNot gradedqualityCmaintenanceEnables LLMs to search Docker Hub repositories, discover container images, and manage Docker Hub repositories and tags through natural language queries. Supports both public content access and authenticated operations with Docker Personal Access Tokens.171Apache 2.0- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to search, analyze, and manage Docker images on Docker Hub through standardized MCP tools, with features including security scanning, layer analysis, and image comparison.MIT