From 3c2a4886e6c4db7f875a36190cf71e867c3c7781 Mon Sep 17 00:00:00 2001 From: Damien Arnodo Date: Sat, 10 Jan 2026 20:19:05 +0000 Subject: [PATCH 1/4] feat: add netbox-mcp-server image --- images/netbox-mcp-server/Dockerfile | 43 +++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 images/netbox-mcp-server/Dockerfile diff --git a/images/netbox-mcp-server/Dockerfile b/images/netbox-mcp-server/Dockerfile new file mode 100644 index 0000000..aec9329 --- /dev/null +++ b/images/netbox-mcp-server/Dockerfile @@ -0,0 +1,43 @@ +# ============================================================================= +# NetBox MCP Server +# +# Image Docker pour le serveur MCP NetBox (Model Context Protocol) +# Permet l'interaction read-only avec NetBox via LLMs +# Source: https://github.com/netboxlabs/netbox-mcp-server +# ============================================================================= + +FROM python:3.12-slim + +LABEL maintainer="Damien Arnodo" +LABEL description="NetBox MCP Server for read-only interaction with NetBox data in LLMs" + +ARG NETBOX_MCP_VERSION=1.0.0 + +# Installation des dépendances système +RUN apt-get update && apt-get install -y --no-install-recommends \ + git \ + && rm -rf /var/lib/apt/lists/* + +# Installation de uv pour la gestion des dépendances Python +RUN pip install --no-cache-dir uv + +# Clone et installation du netbox-mcp-server +WORKDIR /app +RUN git clone --depth 1 --branch v${NETBOX_MCP_VERSION} \ + https://github.com/netboxlabs/netbox-mcp-server.git . \ + && uv sync --frozen + +# Variables d'environnement (à surcharger au runtime) +ENV NETBOX_URL="" +ENV NETBOX_TOKEN="" +ENV TRANSPORT="stdio" +ENV VERIFY_SSL="true" +ENV LOG_LEVEL="INFO" + +# Pour le mode HTTP (optionnel) +ENV HOST="0.0.0.0" +ENV PORT="8000" +EXPOSE 8000 + +# Entrypoint pour le mode STDIO (compatible MCP) +ENTRYPOINT ["uv", "run", "netbox-mcp-server"] -- 2.52.0 From 9b7264bf568e8bc951a8787a62d428896999cf6e Mon Sep 17 00:00:00 2001 From: Damien Arnodo Date: Sat, 10 Jan 2026 20:19:11 +0000 Subject: [PATCH 2/4] feat: add netbox-mcp-server version file --- images/netbox-mcp-server/NETBOX_MCP_VERSION | 1 + 1 file changed, 1 insertion(+) create mode 100644 images/netbox-mcp-server/NETBOX_MCP_VERSION diff --git a/images/netbox-mcp-server/NETBOX_MCP_VERSION b/images/netbox-mcp-server/NETBOX_MCP_VERSION new file mode 100644 index 0000000..3eefcb9 --- /dev/null +++ b/images/netbox-mcp-server/NETBOX_MCP_VERSION @@ -0,0 +1 @@ +1.0.0 -- 2.52.0 From b577369cdd245f6a43fd504cdadd4ad952aad1b4 Mon Sep 17 00:00:00 2001 From: Damien Arnodo Date: Sat, 10 Jan 2026 20:19:25 +0000 Subject: [PATCH 3/4] docs: add netbox-mcp-server README --- images/netbox-mcp-server/README.md | 70 ++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 images/netbox-mcp-server/README.md diff --git a/images/netbox-mcp-server/README.md b/images/netbox-mcp-server/README.md new file mode 100644 index 0000000..703772a --- /dev/null +++ b/images/netbox-mcp-server/README.md @@ -0,0 +1,70 @@ +# NetBox MCP Server + +Image Docker pour le [NetBox MCP Server](https://github.com/netboxlabs/netbox-mcp-server) - serveur Model Context Protocol permettant l'interaction read-only avec NetBox via LLMs. + +## Usage avec Claude Desktop (STDIO) + +Configuration dans `claude_desktop_config.json` : + +```json +{ + "mcpServers": { + "netbox": { + "command": "docker", + "args": [ + "run", "-i", "--rm", + "-e", "NETBOX_URL", + "-e", "NETBOX_TOKEN", + "gitea.arnodo.fr/damien/netbox-mcp-server:latest" + ], + "env": { + "NETBOX_URL": "https://netbox.example.com/", + "NETBOX_TOKEN": "your-api-token" + } + } + } +} +``` + +## Usage en mode HTTP + +Pour les clients web MCP : + +```bash +docker run --rm \ + -e NETBOX_URL=https://netbox.example.com/ \ + -e NETBOX_TOKEN=your-api-token \ + -e TRANSPORT=http \ + -p 8000:8000 \ + gitea.arnodo.fr/damien/netbox-mcp-server:latest +``` + +Le serveur sera accessible sur `http://localhost:8000/mcp`. + +## Variables d'environnement + +| Variable | Défaut | Description | +|----------|--------|-------------| +| `NETBOX_URL` | - | URL de l'instance NetBox (requis) | +| `NETBOX_TOKEN` | - | Token API NetBox read-only (requis) | +| `TRANSPORT` | `stdio` | Transport MCP : `stdio` ou `http` | +| `VERIFY_SSL` | `true` | Vérification des certificats SSL | +| `LOG_LEVEL` | `INFO` | Niveau de log | +| `HOST` | `0.0.0.0` | Adresse d'écoute (mode HTTP) | +| `PORT` | `8000` | Port d'écoute (mode HTTP) | + +## Outils MCP disponibles + +| Outil | Description | +|-------|-------------| +| `get_objects` | Récupère les objets NetBox selon type et filtres | +| `get_object_by_id` | Détails d'un objet par son ID | +| `get_changelogs` | Historique des modifications | + +## Exemples de requêtes + +``` +> Liste tous les devices du site 'DC1' +> Montre-moi l'utilisation IPAM +> Qui a modifié le routeur principal cette semaine ? +``` -- 2.52.0 From 9e6ac27484b0fa50e44261f5594dd3e72c953b23 Mon Sep 17 00:00:00 2001 From: Damien Arnodo Date: Sat, 10 Jan 2026 20:22:51 +0000 Subject: [PATCH 4/4] fix: use multi-stage build based on official Dockerfile --- images/netbox-mcp-server/Dockerfile | 68 ++++++++++++++++++----------- 1 file changed, 43 insertions(+), 25 deletions(-) diff --git a/images/netbox-mcp-server/Dockerfile b/images/netbox-mcp-server/Dockerfile index aec9329..c9f07b6 100644 --- a/images/netbox-mcp-server/Dockerfile +++ b/images/netbox-mcp-server/Dockerfile @@ -6,38 +6,56 @@ # Source: https://github.com/netboxlabs/netbox-mcp-server # ============================================================================= -FROM python:3.12-slim - -LABEL maintainer="Damien Arnodo" -LABEL description="NetBox MCP Server for read-only interaction with NetBox data in LLMs" - ARG NETBOX_MCP_VERSION=1.0.0 -# Installation des dépendances système -RUN apt-get update && apt-get install -y --no-install-recommends \ - git \ - && rm -rf /var/lib/apt/lists/* +# ----------------------------------------------------------------------------- +# Stage 1: Builder +# ----------------------------------------------------------------------------- +FROM python:3.14-alpine3.23 AS builder -# Installation de uv pour la gestion des dépendances Python -RUN pip install --no-cache-dir uv +ARG NETBOX_MCP_VERSION + +RUN apk add --no-cache git \ + && pip install --root-user-action=ignore --no-cache-dir --upgrade pip \ + && pip install --root-user-action=ignore --no-cache-dir uv + +ENV UV_LINK_MODE=copy -# Clone et installation du netbox-mcp-server WORKDIR /app + +# Clone le repo à la version spécifiée RUN git clone --depth 1 --branch v${NETBOX_MCP_VERSION} \ - https://github.com/netboxlabs/netbox-mcp-server.git . \ - && uv sync --frozen + https://github.com/netboxlabs/netbox-mcp-server.git . -# Variables d'environnement (à surcharger au runtime) -ENV NETBOX_URL="" -ENV NETBOX_TOKEN="" -ENV TRANSPORT="stdio" -ENV VERIFY_SSL="true" -ENV LOG_LEVEL="INFO" +# Sync des dépendances avec cache uv +RUN --mount=type=cache,target=/root/.cache/uv \ + uv sync --locked --no-dev + +# ----------------------------------------------------------------------------- +# Stage 2: Runtime +# ----------------------------------------------------------------------------- +FROM python:3.14-alpine3.23 + +LABEL maintainer="Damien Arnodo" +LABEL org.opencontainers.image.title="NetBox MCP Server" +LABEL org.opencontainers.image.description="A read-only MCP server for NetBox" +LABEL org.opencontainers.image.url="https://github.com/netboxlabs/netbox-mcp-server" +LABEL org.opencontainers.image.source="https://github.com/netboxlabs/netbox-mcp-server" +LABEL org.opencontainers.image.licenses="Apache-2.0" + +ENV PYTHONUNBUFFERED=1 + +RUN apk add --no-cache ca-certificates \ + && addgroup -g 1000 appuser \ + && adduser -D -u 1000 -G appuser appuser + +COPY --from=builder --chown=appuser:appuser /app /app + +WORKDIR /app +USER appuser + +ENV PATH="/app/.venv/bin:$PATH" -# Pour le mode HTTP (optionnel) -ENV HOST="0.0.0.0" -ENV PORT="8000" EXPOSE 8000 -# Entrypoint pour le mode STDIO (compatible MCP) -ENTRYPOINT ["uv", "run", "netbox-mcp-server"] +CMD ["netbox-mcp-server"] -- 2.52.0