Skip to main content
Glama

MikroTik MCP

by tarcisiodier
Dockerfile2.52 kB
# Multi-stage build for MikroTik MCP Server FROM python:3.11-slim as builder # Set environment variables ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ PYTHONHASHSEED=random \ PIP_NO_CACHE_DIR=1 \ PIP_DISABLE_PIP_VERSION_CHECK=1 # Install system dependencies RUN apt-get update && apt-get install -y \ build-essential \ git \ && rm -rf /var/lib/apt/lists/* # Create virtual environment RUN python -m venv /opt/venv ENV PATH="/opt/venv/bin:$PATH" # Copy requirements and install Python dependencies COPY requirements.txt pyproject.toml ./ RUN pip install --upgrade pip && \ pip install build && \ pip install -r requirements.txt # Copy source code and build the package COPY src/ ./src/ COPY README.md LICENSE ./ RUN python -m build # Install the built package RUN pip install dist/*.whl # Production stage FROM python:3.11-slim as production # Set environment variables ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ PYTHONHASHSEED=random \ PATH="/opt/venv/bin:$PATH" # Install runtime dependencies RUN apt-get update && apt-get install -y \ openssh-client \ && rm -rf /var/lib/apt/lists/* \ && apt-get clean # Create non-root user RUN groupadd -r mikrotik && useradd -r -g mikrotik -d /app -s /bin/bash mikrotik # Copy virtual environment from builder stage COPY --from=builder /opt/venv /opt/venv # Create app directory and set ownership RUN mkdir -p /app && chown -R mikrotik:mikrotik /app WORKDIR /app # Copy configuration examples COPY --chown=mikrotik:mikrotik mcp-config.json.example ./ # Switch to non-root user USER mikrotik # Create SSH directory for the mikrotik user RUN mkdir -p /app/.ssh && chmod 700 /app/.ssh # Health check HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ CMD python -c "import mcp_mikrotik; print('MCP MikroTik server is healthy')" || exit 1 # Expose port for MCP communication (if needed) EXPOSE 8000 # Default command ENTRYPOINT ["mcp-server-mikrotik"] # Default arguments (can be overridden) CMD ["--host", "192.168.1.1", "--username", "admin", "--password", "", "--port", "22"] # Labels for metadata LABEL maintainer="Jeff Nasseri <sir.jeff.nasseri@gmail.com>" \ description="MCP server for MikroTik integration with Claude and other AI assistants" \ version="0.1.14" \ org.opencontainers.image.source="https://github.com/jeff-nasseri/mikrotik-mcp" \ org.opencontainers.image.documentation="https://github.com/jeff-nasseri/mikrotik-mcp/blob/master/README.md" \ org.opencontainers.image.licenses="MIT"

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/tarcisiodier/mcp-mikrotik'

If you have feedback or need assistance with the MCP directory API, please join our Discord server