Update docker-compose.yml

This commit is contained in:
Jacob Magar
2025-06-11 16:35:24 -04:00
parent 76588cf4e1
commit 00e07fad38
12 changed files with 1398 additions and 0 deletions

23
.dockerignore Normal file
View File

@@ -0,0 +1,23 @@
Dockerfile
.dockerignore
.git
.gitignore
__pycache__
*.pyc
*.pyo
*.pyd
.env
.env.local
.env.*
*.log
logs/
*.db
*.sqlite3
instance/
.pytest_cache/
.mypy_cache/
.venv/
venv/
env/
.vscode/
cline_docs/

18
.env.example Normal file
View File

@@ -0,0 +1,18 @@
# Unraid MCP Server Configuration
UNRAID_API_URL=https://your-unraid-server-url/graphql # Ensure this matches what the server script (unraid-mcp-server.py) expects
UNRAID_API_KEY=your_unraid_api_key
# MCP Server Settings
UNRAID_MCP_TRANSPORT=sse
UNRAID_MCP_HOST=0.0.0.0
UNRAID_MCP_PORT=6970
# Logging
UNRAID_MCP_LOG_LEVEL=INFO # Changed from UNRAID_LOG_LEVEL
UNRAID_MCP_LOG_FILE=unraid-mcp.log # Added
# Optional: SSL verification for Unraid API calls
# Set to 'false' or '0' to disable (e.g., for self-signed certs).
# Set to a path to a CA bundle file to use custom CAs.
# Defaults to 'true' (SSL verification enabled) if not set in server code, but explicitly configurable via UNRAID_VERIFY_SSL in script.
UNRAID_VERIFY_SSL=true

22
.gitignore vendored Normal file
View File

@@ -0,0 +1,22 @@
# Python-generated files
__pycache__/
*.py[oc]
build/
dist/
wheels/
*.egg-info
# Virtual environments
.venv
.venv-backend
.env
.env.local
*.log
.bivvy
.cursor
web-ui/frontend/node_modules
web-ui/backend/.venv-backend/
.pnpm-store/

30
Dockerfile Normal file
View File

@@ -0,0 +1,30 @@
# Use an official Python runtime as a parent image
FROM python:3.9-slim
# Set the working directory in the container
WORKDIR /app
# Copy the dependencies file to the working directory
COPY requirements.txt .
# Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application's code to the working directory
COPY . .
# Make port UNRAID_MCP_PORT available to the world outside this container
# Defaulting to 6970, but can be overridden by environment variable
EXPOSE 6970
# Define environment variables (defaults, can be overridden at runtime)
ENV UNRAID_MCP_PORT=6970
ENV UNRAID_MCP_HOST="0.0.0.0"
ENV UNRAID_MCP_TRANSPORT="streamable-http"
ENV UNRAID_API_URL=""
ENV UNRAID_API_KEY=""
ENV UNRAID_VERIFY_SSL="true"
ENV UNRAID_MCP_LOG_LEVEL="INFO"
# Run unraid-mcp-server.py when the container launches
CMD ["python", "unraid-mcp-server.py"]

View File

@@ -0,0 +1,18 @@
# Active Context
## What you're working on now
Containerizing the Python MCP server located in the `/mnt/cache/compose/unraid-mcp` directory. The main script is `unraid-mcp-server.py`.
## Recent changes
- Confirmed project path accessible to tools is `/mnt/cache/compose/unraid-mcp/`.
- Created the `cline_docs` directory at the correct path.
## Next steps
1. Create `Dockerfile` for the Python MCP server.
2. Create `.dockerignore` file to optimize the Docker build context.
3. Inspect `unraid-mcp-server.py` to determine the run command and any exposed ports.
4. Inspect `requirements.txt` for dependencies.
5. Update `README.md` with instructions for building and running the Docker container.

View File

@@ -0,0 +1,15 @@
# Product Context
## Why this project exists
To package the Python MCP server (`unraid-mcp-server.py`) into a portable, isolated, and reproducible Docker container.
## What problems it solves
- Simplifies deployment of the MCP server across different environments.
- Ensures a consistent runtime environment for the server.
- Facilitates easier management and scaling if needed.
## How it should work
A Docker image should be buildable from the provided `Dockerfile`. Running a container from this image should successfully start the `unraid-mcp-server.py` application, making its services available as configured.

19
cline_docs/progress.md Normal file
View File

@@ -0,0 +1,19 @@
# Progress
## What works
- The Python MCP server (`unraid-mcp-server.py`) is assumed to be functional in a local Python environment with dependencies installed from `requirements.txt`.
- `cline_docs` directory has been created at `/mnt/cache/compose/unraid-mcp/cline_docs/`.
- `productContext.md`, `activeContext.md`, `systemPatterns.md`, `techContext.md`, and `progress.md` have been written to `cline_docs`.
## What's left to build
- `Dockerfile`
- `.dockerignore`
- Updated `README.md` with Docker build and run instructions.
## Progress status
- **Initiated**: Task of containerizing the Python MCP server has begun.
- **Documentation Created**: `cline_docs` files have been successfully written.
- **Pending**: Creation of Docker-related files and documentation updates.

View File

@@ -0,0 +1,18 @@
# System Patterns
## How the system is built
- The core application is a Python script: `unraid-mcp-server.py`.
- Python dependencies are managed via `requirements.txt`.
- The application will be containerized using Docker.
## Key technical decisions
- Utilize an official Python base image for the Docker container to ensure a stable and secure foundation.
- Python dependencies will be installed within the Docker image using `pip` and the `requirements.txt` file.
- Environment variables will be the primary method for configuring the application within the Docker container. The `.env.example` and `.env.local` files provide templates for these variables, but will not be copied directly into the image for security and flexibility.
## Architecture patterns
- Standard Docker containerization pattern for a Python application.
- The application is expected to be a network service, exposing one or more ports.

19
cline_docs/techContext.md Normal file
View File

@@ -0,0 +1,19 @@
# Tech Context
## Technologies used
- Python (for the MCP server application)
- Docker (for containerization)
- `pip` (for Python package management)
## Development setup
- Current: Local Python development environment.
- Target: Dockerized application runnable in any Docker-compatible environment.
## Technical constraints
- The Docker container must successfully run the `unraid-mcp-server.py` script.
- All dependencies listed in `requirements.txt` must be installed in the Docker image.
- The container should be configurable via environment variables (e.g., for API keys, server address/port if applicable).
- The necessary network ports used by the MCP server must be exposed by the Docker container.

18
docker-compose.yml Normal file
View File

@@ -0,0 +1,18 @@
services:
unraid-mcp:
image: unraid-mcp-server # Assumes you've built this image locally using 'docker build -t unraid-mcp-server .'
# Or, to build automatically if the image doesn't exist:
# build:
# context: .
# dockerfile: Dockerfile
container_name: unraid-mcp
restart: unless-stopped
ports:
# HostPort:ContainerPort (maps to UNRAID_MCP_PORT inside the container, default 6970)
# Change the host port (left side) if 6970 is already in use on your host
- "6970:6970"
env_file:
- .env.local # Loads environment variables from .env.local in the same directory as this docker-compose.yml
# Optional: If you want to mount a specific directory for logs (ensure UNRAID_MCP_LOG_FILE in .env.local points within this mount)
# volumes:
# - ./logs:/app/logs # Example: maps ./logs on host to /app/logs in container

5
requirements.txt Normal file
View File

@@ -0,0 +1,5 @@
python-dotenv>=1.0.0
fastmcp>=0.4.0
httpx>=0.25.0
fastapi>=0.100.0
uvicorn>=0.23.0

1193
unraid-mcp-server.py Normal file

File diff suppressed because it is too large Load Diff