Merge pull request 'feat: add netbox-mcp-server Docker image' (#3) from feature/netbox-mcp-server into main
All checks were successful
Build and Push Docker Images / build (push) Successful in 23s

Reviewed-on: #3
This commit was merged in pull request #3.
This commit is contained in:
2026-01-11 10:12:37 +00:00
3 changed files with 132 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
# =============================================================================
# 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
# =============================================================================
ARG NETBOX_MCP_VERSION=1.0.0
# -----------------------------------------------------------------------------
# Stage 1: Builder
# -----------------------------------------------------------------------------
FROM python:3.14-alpine3.23 AS builder
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
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 .
# 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"
EXPOSE 8000
CMD ["netbox-mcp-server"]

View File

@@ -0,0 +1 @@
1.0.0

View File

@@ -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 ?
```