Skip to content

Commit 5f5d853

Browse files
Piotr Laskowskiplaskowski
authored andcommitted
Add local Docker image setup for development
- Create docker-local/ directory with simplified Dockerfile - Use official image as base and override with local binary - Add build script for easy rebuilding - Add documentation and usage examples - Avoid SSL certificate issues by using official base image
1 parent 2c45232 commit 5f5d853

4 files changed

Lines changed: 103 additions & 0 deletions

File tree

docker-local/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github-mcp-server

docker-local/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM ghcr.io/github/github-mcp-server:latest
2+
3+
# Copy our locally built executable and set permissions in one step
4+
COPY --chmod=755 github-mcp-server /server/github-mcp-server
5+
6+
# The base image already has the correct ENTRYPOINT and CMD

docker-local/README.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
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

docker-local/build.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
# Build script for local GitHub MCP Server Docker image
4+
5+
set -e
6+
7+
echo "Building local GitHub MCP Server binary..."
8+
cd ..
9+
GOOS=linux GOARCH=arm64 go build -o docker-local/github-mcp-server cmd/github-mcp-server/main.go
10+
11+
echo "Building Docker image..."
12+
cd docker-local
13+
docker build -t github-mcp-server-local .
14+
15+
echo "Docker image built successfully!"
16+
echo "You can now use it with:"
17+
echo " docker run --rm -e GITHUB_PERSONAL_ACCESS_TOKEN=your_token github-mcp-server-local stdio"

0 commit comments

Comments
 (0)