|
| 1 | +# Local GitHub MCP Server Docker Image |
| 2 | + |
| 3 | +This directory contains a Docker setup to build a local version of the GitHub MCP Server using the official image as a base and overriding it with your locally built executable. |
| 4 | + |
| 5 | +## Quick Start |
| 6 | + |
| 7 | +1. **Build the image:** |
| 8 | + ```bash |
| 9 | + ./build.sh |
| 10 | + ``` |
| 11 | + |
| 12 | +2. **Use the image:** |
| 13 | + ```bash |
| 14 | + docker run --rm -e GITHUB_PERSONAL_ACCESS_TOKEN=your_token github-mcp-server-local stdio |
| 15 | + ``` |
| 16 | + |
| 17 | +## Manual Build |
| 18 | + |
| 19 | +If you prefer to build manually: |
| 20 | + |
| 21 | +1. **Build the binary for Linux ARM64:** |
| 22 | + ```bash |
| 23 | + cd .. |
| 24 | + GOOS=linux GOARCH=arm64 go build -o docker-local/github-mcp-server cmd/github-mcp-server/main.go |
| 25 | + ``` |
| 26 | + |
| 27 | +2. **Build the Docker image:** |
| 28 | + ```bash |
| 29 | + cd docker-local |
| 30 | + docker build -t github-mcp-server-local . |
| 31 | + ``` |
| 32 | + |
| 33 | +## Usage |
| 34 | + |
| 35 | +The image works exactly like the official `ghcr.io/github/github-mcp-server` image, but uses your locally built binary instead. |
| 36 | + |
| 37 | +### Environment Variables |
| 38 | + |
| 39 | +- `GITHUB_PERSONAL_ACCESS_TOKEN`: Your GitHub Personal Access Token (required) |
| 40 | + |
| 41 | +### Example with VS Code |
| 42 | + |
| 43 | +Add this to your VS Code MCP configuration: |
| 44 | + |
| 45 | +```json |
| 46 | +{ |
| 47 | + "servers": { |
| 48 | + "github": { |
| 49 | + "command": "docker", |
| 50 | + "args": [ |
| 51 | + "run", |
| 52 | + "-i", |
| 53 | + "--rm", |
| 54 | + "-e", |
| 55 | + "GITHUB_PERSONAL_ACCESS_TOKEN", |
| 56 | + "github-mcp-server-local" |
| 57 | + ], |
| 58 | + "env": { |
| 59 | + "GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github_token}" |
| 60 | + } |
| 61 | + } |
| 62 | + }, |
| 63 | + "inputs": [ |
| 64 | + { |
| 65 | + "type": "promptString", |
| 66 | + "id": "github_token", |
| 67 | + "description": "GitHub Personal Access Token", |
| 68 | + "password": true |
| 69 | + } |
| 70 | + ] |
| 71 | +} |
| 72 | +``` |
| 73 | + |
| 74 | +## Advantages |
| 75 | + |
| 76 | +- **Fast builds**: Uses the official image as base, only rebuilds your local changes |
| 77 | +- **No build issues**: Avoids SSL certificate and dependency issues from building from scratch |
| 78 | +- **Consistent environment**: Uses the same runtime environment as the official image |
| 79 | +- **Easy updates**: Just rebuild the binary and Docker image when you make changes |
0 commit comments