feat: Initial NPM MCP server implementation

- NpmClient with JWT auth and auto-refresh
- FastMCP server with 5 tools (list_proxy_hosts, get_proxy_host_details, get_system_health, search_audit_logs, list_certificates)
- Docker support with multi-stage build using uv
- Supports stdio and streamable HTTP transports
- GitHub Actions for tests and Docker builds
This commit is contained in:
Ben
2025-12-18 03:16:49 +00:00
commit 18b76b673b
19 changed files with 2080 additions and 0 deletions

40
Dockerfile Normal file
View File

@@ -0,0 +1,40 @@
# syntax=docker/dockerfile:1
FROM python:3.13-slim AS builder
WORKDIR /app
# Install uv for fast package installation
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
# Copy project files
COPY pyproject.toml README.md ./
COPY src/ src/
# Create virtual environment and install dependencies
RUN uv venv /app/.venv && \
uv pip install --python /app/.venv/bin/python .
# Production image
FROM python:3.13-slim
WORKDIR /app
# Copy virtual environment from builder
COPY --from=builder /app/.venv /app/.venv
# Set environment variables
ENV PATH="/app/.venv/bin:$PATH" \
PYTHONUNBUFFERED=1 \
NPM_MCP_TRANSPORT=http \
NPM_MCP_HOST=0.0.0.0 \
NPM_MCP_PORT=8000
# Expose port for HTTP transport
EXPOSE 8000
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD python -c "import httpx; httpx.get('http://localhost:8000/mcp', timeout=5)" || exit 1
# Run the MCP server
ENTRYPOINT ["python", "-m", "npm_mcp.main"]