# Docker Hub MCP Server Docker Hub MCP Server provides integration with Docker Hub through the Model Context Protocol, enabling image search, query, and management capabilities. ## Features - ๐Ÿ” **Image Search** - Search for images on Docker Hub - ๐Ÿ“Š **Image Info** - Get detailed image information - ๐Ÿท๏ธ **Tag Management** - View image tags - ๐Ÿ“ˆ **Statistics** - View download counts and stars - ๐Ÿ‘ค **User Management** - Manage Docker Hub account - ๐Ÿ“ **Repository Info** - Repository information queries ## Environment Variables | Variable | Default | Description | | ----------------------------- | -------- | ---------------------------------------------- | | `DOCKERHUB_MCP_VERSION` | `latest` | Docker image version | | `DOCKERHUB_MCP_PORT_OVERRIDE` | `8000` | Service port | | `DOCKERHUB_USERNAME` | - | Docker Hub username (optional, for auth) | | `DOCKERHUB_PASSWORD` | - | Docker Hub password (optional, for auth) | | `DOCKERHUB_TOKEN` | - | Docker Hub access token (recommended for auth) | | `TZ` | `UTC` | Timezone | ## Authentication Methods The service supports three authentication methods: ### 1. No Authentication (Public Access) Only public images and information can be accessed. ### 2. Username & Password Authentication ```env DOCKERHUB_USERNAME=your_username DOCKERHUB_PASSWORD=your_password ``` ### 3. Access Token Authentication (Recommended) ```env DOCKERHUB_TOKEN=your_access_token ``` ## Quick Start ### 1. Configure Environment Create a `.env` file: #### No Authentication Mode (Public Access Only) ```env DOCKERHUB_MCP_VERSION=latest DOCKERHUB_MCP_PORT_OVERRIDE=8000 TZ=Asia/Shanghai ``` #### Token Authentication Mode (Recommended) ```env DOCKERHUB_MCP_VERSION=latest DOCKERHUB_MCP_PORT_OVERRIDE=8000 DOCKERHUB_TOKEN=dckr_pat_your_token_here TZ=Asia/Shanghai ``` ### 2. Get Docker Hub Access Token 1. Login to [Docker Hub](https://hub.docker.com/) 2. Click avatar โ†’ **Account Settings** 3. Navigate to **Security** โ†’ **Access Tokens** 4. Click **New Access Token** 5. Set permissions (read-only recommended) 6. Generate and copy the token ### 3. Start Service ```bash docker compose up -d ``` ### 4. Verify Service ```bash curl http://localhost:8000/health ``` ## Resource Requirements - Minimum memory: 128MB - Recommended memory: 512MB - CPU: 0.25-1.0 cores ## Common Use Cases 1. **Image Search** - Search for Docker images suitable for projects 2. **Version Query** - View all available tags for an image 3. **Dependency Analysis** - Analyze base images and dependencies 4. **Security Check** - View image security scan reports 5. **Download Statistics** - Check image popularity ## API Features The MCP server provides the following main features: - โœ… Search public and private images - โœ… Get image tag lists - โœ… View detailed image information - โœ… Query repository statistics - โœ… Check for image updates - โœ… View Dockerfiles ## Permission Types ### Read-Only Token Permissions Recommended for most query operations: - โœ… Search images - โœ… View image information - โœ… Get tag lists - โŒ Push images - โŒ Delete images ### Read-Write Token Permissions For management operations: - โœ… All read-only operations - โœ… Push images - โœ… Delete images - โœ… Update repository settings ## Security Recommendations โš ๏ธ **Important**: 1. **Prefer Access Tokens**: More secure than passwords 2. **Least Privilege**: Only grant necessary permissions 3. **Regular Rotation**: Update access tokens regularly 4. **Protect Environment Variables**: Don't commit `.env` to version control 5. **Monitor Access**: Regularly check token usage 6. **Use Read-Only Tokens**: Unless write access is needed ## Rate Limits Docker Hub has API rate limits: - **Unauthenticated**: 100 requests/6 hours - **Free Account**: 200 requests/6 hours - **Paid Account**: Higher rate limits Authentication is recommended for higher rate limits. ## References - [Docker Hub Official Site](https://hub.docker.com/) - [Docker Hub API Documentation](https://docs.docker.com/docker-hub/api/latest/) - [MCP Documentation](https://modelcontextprotocol.io/) ## License MIT License ้€š่ฟ‡ AI ๅฏไปฅ่ฟ›่กŒไปฅไธ‹ๆŸฅ่ฏข: 1. "ๆœ็ดข nginx ็›ธๅ…ณ็š„้•œๅƒ" 2. "ๆŸฅ็œ‹ python:3.11 ้•œๅƒ็š„ๆ‰€ๆœ‰ๆ ‡็ญพ" 3. "่Žทๅ– redis:alpine ้•œๅƒ็š„่ฏฆ็ป†ไฟกๆฏ" 4. "ๆŸฅๆ‰พๆœ€ๆต่กŒ็š„ PostgreSQL ้•œๅƒ" 5. "ๆฏ”่พƒไธๅŒ Node.js ้•œๅƒ็š„ๅคงๅฐ" ## ๅ‚่€ƒ้“พๆŽฅ - [Docker Hub](https://hub.docker.com/) - [Docker Hub API ๆ–‡ๆกฃ](https://docs.docker.com/docker-hub/api/latest/) - [Docker Hub ่ฎฟ้—ฎไปค็‰Œ](https://docs.docker.com/docker-hub/access-tokens/) - [MCP ๅฎ˜ๆ–นๆ–‡ๆกฃ](https://modelcontextprotocol.io/) - [Docker Hub - mcp/dockerhub](https://hub.docker.com/r/mcp/dockerhub) ## ่ฎธๅฏ่ฏ MIT License