Skip to content

Commit c5b663c

Browse files
committed
docker
Signed-off-by: Jason Madigan <jason@jasonmadigan.com>
1 parent 51093a1 commit c5b663c

File tree

8 files changed

+609
-283
lines changed

8 files changed

+609
-283
lines changed

.dockerignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
kuadrant-mcp-server
2+
*.exe
3+
*.test
4+
*.out
5+
.git
6+
.gitignore
7+
README.md
8+
Dockerfile
9+
docker-compose.yml
10+
.dockerignore

.github/workflows/docker.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Docker Build and Publish
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- 'v*'
9+
pull_request:
10+
branches:
11+
- main
12+
13+
env:
14+
REGISTRY: ghcr.io
15+
IMAGE_NAME: ${{ github.repository }}
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
22+
packages: write
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
28+
- name: Set up Docker Buildx
29+
uses: docker/setup-buildx-action@v3
30+
31+
- name: Log in to the Container registry
32+
uses: docker/login-action@v3
33+
with:
34+
registry: ${{ env.REGISTRY }}
35+
username: ${{ github.actor }}
36+
password: ${{ secrets.GITHUB_TOKEN }}
37+
38+
- name: Extract metadata
39+
id: meta
40+
uses: docker/metadata-action@v5
41+
with:
42+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
43+
tags: |
44+
type=ref,event=branch
45+
type=ref,event=pr
46+
type=semver,pattern={{version}}
47+
type=semver,pattern={{major}}.{{minor}}
48+
type=sha
49+
50+
- name: Build and push Docker image
51+
uses: docker/build-push-action@v5
52+
with:
53+
context: .
54+
push: true
55+
tags: ${{ steps.meta.outputs.tags }}
56+
labels: ${{ steps.meta.outputs.labels }}
57+
cache-from: type=gha
58+
cache-to: type=gha,mode=max

Dockerfile

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Build stage
2+
FROM golang:1.23-alpine AS builder
3+
4+
# Install necessary packages
5+
RUN apk add --no-cache git
6+
7+
# Set working directory
8+
WORKDIR /app
9+
10+
# Copy go mod files
11+
COPY go.mod go.sum ./
12+
13+
# Download dependencies
14+
RUN go mod download
15+
16+
# Copy source code
17+
COPY *.go ./
18+
19+
# Build the binary
20+
RUN CGO_ENABLED=0 GOOS=linux go build -o kuadrant-mcp-server .
21+
22+
# Final stage
23+
FROM alpine:latest
24+
25+
# Install ca-certificates for HTTPS
26+
RUN apk --no-cache add ca-certificates
27+
28+
# Create non-root user
29+
RUN addgroup -g 1001 -S mcp && \
30+
adduser -u 1001 -S mcp -G mcp
31+
32+
# Set working directory
33+
WORKDIR /app
34+
35+
# Copy binary from builder
36+
COPY --from=builder /app/kuadrant-mcp-server .
37+
38+
# Change ownership
39+
RUN chown -R mcp:mcp /app
40+
41+
# Switch to non-root user
42+
USER mcp
43+
44+
# The MCP server uses stdio for communication
45+
ENTRYPOINT ["./kuadrant-mcp-server"]

README.md

Lines changed: 89 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,55 @@ All manifests are generated in YAML format, matching the actual Kuadrant CRD spe
1313

1414
## Installation
1515

16+
### Using Go
1617
```bash
1718
go install github.com/jasonmadigan/kuadrant-mcp-server@latest
1819
```
1920

21+
### Using Docker
22+
```bash
23+
docker pull ghcr.io/jasonmadigan/kuadrant-mcp-server:latest
24+
```
25+
26+
### Building from Source
27+
```bash
28+
git clone https://github.com/jasonmadigan/kuadrant-mcp-server
29+
cd kuadrant-mcp-server
30+
docker build -t kuadrant-mcp-server:latest .
31+
```
32+
2033
## Usage
2134

22-
Run the server:
35+
### Standalone
2336
```bash
2437
kuadrant-mcp-server
2538
```
2639

40+
### With Docker
41+
```bash
42+
docker run -i --rm ghcr.io/jasonmadigan/kuadrant-mcp-server:latest
43+
```
44+
45+
### With Docker Compose
46+
```bash
47+
docker-compose up
48+
```
49+
50+
### MCP Client Configuration
51+
52+
Add to your MCP client configuration:
53+
54+
```json
55+
{
56+
"mcpServers": {
57+
"kuadrant-mcp": {
58+
"command": "docker",
59+
"args": ["run", "-i", "--rm", "ghcr.io/jasonmadigan/kuadrant-mcp-server:latest"]
60+
}
61+
}
62+
}
63+
```
64+
2765
## Available Tools
2866

2967
### `create_gateway`
@@ -382,6 +420,56 @@ cd kuadrant-mcp-server
382420
go build -o kuadrant-mcp-server
383421
```
384422

423+
## Docker Usage
424+
425+
### Build the Docker image
426+
427+
```bash
428+
docker build -t kuadrant-mcp-server:latest .
429+
```
430+
431+
### Run with Docker
432+
433+
Since MCP servers communicate via stdio, run interactively:
434+
435+
```bash
436+
docker run -i kuadrant-mcp-server:latest
437+
```
438+
439+
### Use with docker-compose
440+
441+
```bash
442+
docker-compose build
443+
docker-compose run --rm kuadrant-mcp
444+
```
445+
446+
## MCP Configuration
447+
448+
To use this server with an MCP client (like Claude Desktop), add it to your MCP configuration:
449+
450+
```json
451+
{
452+
"mcpServers": {
453+
"kuadrant": {
454+
"command": "docker",
455+
"args": ["run", "-i", "kuadrant-mcp-server:latest"]
456+
}
457+
}
458+
}
459+
```
460+
461+
Or if running locally:
462+
463+
```json
464+
{
465+
"mcpServers": {
466+
"kuadrant": {
467+
"command": "/path/to/kuadrant-mcp-server"
468+
}
469+
}
470+
}
471+
```
472+
385473
## License
386474

387475
Apache 2.0

docker-compose.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: '3.8'
2+
3+
services:
4+
kuadrant-mcp:
5+
build: .
6+
image: kuadrant-mcp-server:latest
7+
stdin_open: true
8+
tty: true
9+
# MCP servers communicate via stdio, so we keep stdin open
10+
# To use with an MCP client, you would typically run:
11+
# docker run -i kuadrant-mcp-server:latest

examples/mcp-client-config.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"mcpServers": {
3+
"kuadrant-mcp": {
4+
"command": "docker",
5+
"args": ["run", "-i", "--rm", "kuadrant-mcp-server:latest"],
6+
"env": {}
7+
}
8+
}
9+
}

go.mod

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
module github.com/jasonmadigan/kuadrant-mcp-server
22

3-
go 1.23.0
4-
5-
toolchain go1.24.3
3+
go 1.23
64

75
require (
86
github.com/modelcontextprotocol/go-sdk v0.1.0

0 commit comments

Comments
 (0)