Files
excalidraw-mcp-sentinel/docker-compose.yml
T
newblaccandClaude Sonnet 4.6 5539235004 feat(security): harden canvas server with auth, rate-limiting, and validation
- Add security.ts: helmet, CORS allowlist, timing-safe API key auth, prototype
  pollution guard, Mermaid input limits, rate limiting (general/destructive/burst)
- WS auth challenge-response with 5 s timeout and close code 4001
- Fix sync crash: array check before logger access (500 → 400)
- Fix sync/v2: validate element type before write (invalid → 400)
- Upgrade zod 3.22.4 → 3.25.5 (fixes ERR_PACKAGE_PATH_NOT_EXPORTED on startup)
- Extract ElementSharedFieldsSchema; move VALID_ELEMENT_TYPES to module level
- Docker: resource limits, .dockerignore hardening
- Add .project-hooks/pre-commit; expand test coverage (369 tests)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 16:06:04 +02:00

81 lines
2.4 KiB
YAML

version: '3.8'
# Docker Compose for MCP Excalidraw
#
# Usage scenarios:
# 1. Canvas only: docker-compose up canvas
# 2. MCP only: docker-compose up mcp (requires canvas running elsewhere)
# 3. Both: docker-compose --profile full up
#
# Most common: Run canvas locally, MCP via Claude Desktop config
services:
# Canvas server (optional) - Visual UI and REST API
canvas:
build:
context: .
dockerfile: Dockerfile.canvas
image: sanjibdevnath/mcp-excalidraw-local-canvas:latest
container_name: mcp-excalidraw-canvas
ports:
- "3000:3000"
environment:
- NODE_ENV=production
- PORT=3000
# HOST=0.0.0.0 is intentional in Docker — the container's port is
# exposed only via the published port mapping above. For local dev
# without Docker, the default is localhost (set in src/server.ts).
- HOST=0.0.0.0
- DEBUG=false
# Optional: set to enable API key auth on all /api/* routes.
# Must match EXCALIDRAW_API_KEY in the mcp service below so inter-service calls succeed.
- EXCALIDRAW_API_KEY=${EXCALIDRAW_API_KEY:-}
restart: unless-stopped
healthcheck:
test: ["CMD", "node", "-e", "require('http').get('http://localhost:3000/health', (r) => process.exit(r.statusCode === 200 ? 0 : 1))"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
deploy:
resources:
limits:
cpus: '1.0'
memory: 512M
networks:
- mcp-network
# MCP server - Core product (typically run via Claude Desktop, not docker-compose)
# This is here for testing or special deployment scenarios
mcp:
build:
context: .
dockerfile: Dockerfile
image: sanjibdevnath/mcp-excalidraw-local:latest
container_name: mcp-excalidraw-mcp
stdin_open: true
tty: true
environment:
- NODE_ENV=production
- EXPRESS_SERVER_URL=http://canvas:3000
- ENABLE_CANVAS_SYNC=true
- DEBUG=false
# Must match canvas EXCALIDRAW_API_KEY so inter-service sync calls are authenticated.
- EXCALIDRAW_API_KEY=${EXCALIDRAW_API_KEY:-}
depends_on:
canvas:
condition: service_healthy
deploy:
resources:
limits:
cpus: '0.5'
memory: 256M
networks:
- mcp-network
profiles:
- full
networks:
mcp-network:
driver: bridge