mcp-office-tools/Makefile
Ryan Malloy 322ed78427
Some checks failed
Test Dashboard / test-and-dashboard (push) Has been cancelled
Add Docker deployment with streamable-http transport for hosted MCP
- Add Dockerfile with multi-stage build using uv
- Add docker-compose.yml with caddy-docker-proxy labels for /mcp endpoint
- Add .env.example for deployment configuration
- Update Makefile with docker-* targets
- Update server.py to support MCP_TRANSPORT env var:
  - 'stdio' (default): Local CLI usage with Claude Code
  - 'streamable-http': Hosted HTTP mode behind reverse proxy

Hosted server will be available at:
  https://mcwaddams.supported.systems/mcp
2026-01-11 14:27:50 -07:00

197 lines
6.3 KiB
Makefile

# Makefile for MCP Office Tools
# Provides convenient commands for testing, development, and dashboard generation
.PHONY: help test test-dashboard test-pytest test-torture view-dashboard clean install format lint type-check \
docker-build docker-up docker-down docker-logs docker-shell docker-restart docker-clean dev-http
# Default target - show help
help:
@echo "MCP Office Tools - Available Commands"
@echo "======================================"
@echo ""
@echo "Docker / Hosted Server:"
@echo " make docker-build - Build Docker image"
@echo " make docker-up - Start server (detached, with caddy)"
@echo " make docker-down - Stop server"
@echo " make docker-logs - View server logs"
@echo " make docker-restart - Restart server"
@echo " make docker-clean - Remove Docker resources"
@echo " make dev-http - Run locally with HTTP transport"
@echo ""
@echo "Testing & Dashboard:
@echo " make test - Run all tests with dashboard generation"
@echo " make test-dashboard - Alias for 'make test'"
@echo " make test-pytest - Run only pytest tests"
@echo " make test-torture - Run only torture tests"
@echo " make view-dashboard - Open test dashboard in browser"
@echo ""
@echo "Development:"
@echo " make install - Install project with dev dependencies"
@echo " make format - Format code with black"
@echo " make lint - Lint code with ruff"
@echo " make type-check - Run type checking with mypy"
@echo " make clean - Clean temporary files and caches"
@echo ""
@echo "Examples:"
@echo " make test # Run everything and open dashboard"
@echo " make test-pytest # Quick pytest-only run"
@echo " make view-dashboard # View existing results"
# Run all tests and generate unified dashboard
test: test-dashboard
test-dashboard:
@echo "🧪 Running comprehensive test suite with dashboard generation..."
@python run_dashboard_tests.py
# Run only pytest tests
test-pytest:
@echo "🧪 Running pytest test suite..."
@uv run pytest --dashboard-output=reports/test_results.json -v
# Run only torture tests
test-torture:
@echo "🔥 Running torture tests..."
@uv run python torture_test.py
# View test dashboard in browser
view-dashboard:
@echo "📊 Opening test dashboard..."
@./view_dashboard.sh
# Install project with dev dependencies
install:
@echo "📦 Installing MCP Office Tools with dev dependencies..."
@uv sync --dev
@echo "✅ Installation complete!"
# Format code with black
format:
@echo "🎨 Formatting code with black..."
@uv run black src/ tests/ examples/
@echo "✅ Formatting complete!"
# Lint code with ruff
lint:
@echo "🔍 Linting code with ruff..."
@uv run ruff check src/ tests/ examples/
@echo "✅ Linting complete!"
# Type checking with mypy
type-check:
@echo "🔎 Running type checks with mypy..."
@uv run mypy src/
@echo "✅ Type checking complete!"
# Clean temporary files and caches
clean:
@echo "🧹 Cleaning temporary files and caches..."
@find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
@find . -type d -name "*.egg-info" -exec rm -rf {} + 2>/dev/null || true
@find . -type d -name ".pytest_cache" -exec rm -rf {} + 2>/dev/null || true
@find . -type d -name ".mypy_cache" -exec rm -rf {} + 2>/dev/null || true
@find . -type d -name ".ruff_cache" -exec rm -rf {} + 2>/dev/null || true
@find . -type f -name "*.pyc" -delete 2>/dev/null || true
@rm -rf dist/ build/ 2>/dev/null || true
@echo "✅ Cleanup complete!"
# Run full quality checks (format, lint, type-check, test)
check: format lint type-check test
@echo "✅ All quality checks passed!"
# Quick development test cycle (no dashboard)
quick-test:
@echo "⚡ Quick test run (no dashboard)..."
@uv run pytest -v --tb=short
# Coverage report
coverage:
@echo "📊 Generating coverage report..."
@uv run pytest --cov=mcwaddams --cov-report=html --cov-report=term
@echo "✅ Coverage report generated at htmlcov/index.html"
# Run server in development mode
dev:
@echo "🚀 Starting MCP Office Tools server..."
@uv run mcwaddams
# Build distribution packages
build:
@echo "📦 Building distribution packages..."
@uv build
@echo "✅ Build complete! Packages in dist/"
# ====================================
# Docker / Hosted Server Commands
# ====================================
# Ensure .env exists for Docker
.env:
@if [ ! -f .env ]; then \
echo "Creating .env from .env.example..."; \
cp .env.example .env; \
fi
# Build Docker image
docker-build:
@echo "🐳 Building mcwaddams Docker image..."
@docker compose build
@echo "✅ Docker build complete!"
# Start server (production mode with caddy-docker-proxy)
docker-up: .env
@echo "🚀 Starting mcwaddams MCP server..."
@docker compose up -d
@sleep 2
@docker compose logs --tail=20
@echo ""
@echo "✅ Server running! Connect via:"
@echo " https://$${MCWADDAMS_HOST:-mcwaddams.supported.systems}/mcp"
# Stop server
docker-down:
@echo "🛑 Stopping mcwaddams server..."
@docker compose down
@echo "✅ Server stopped"
# View server logs
docker-logs:
@docker compose logs -f
# Open shell in running container
docker-shell:
@docker compose exec mcwaddams /bin/bash
# Restart server
docker-restart: docker-down docker-up
# Clean up Docker resources
docker-clean:
@echo "🧹 Cleaning Docker resources..."
@docker compose down -v --rmi local
@echo "✅ Docker cleanup complete!"
# Development: run locally with streamable-http transport
dev-http:
@echo "🌐 Starting mcwaddams with streamable-http transport..."
@MCP_TRANSPORT=streamable-http MCP_HOST=127.0.0.1 MCP_PORT=8000 uv run python -m mcwaddams.server
# ====================================
# Project Information
# ====================================
# Show project info
info:
@echo "MCP Office Tools - Project Information"
@echo "======================================="
@echo ""
@echo "Project: mcwaddams"
@echo "Version: $(shell grep '^version' pyproject.toml | cut -d'"' -f2)"
@echo "Python: $(shell python --version)"
@echo "UV: $(shell uv --version 2>/dev/null || echo 'not installed')"
@echo ""
@echo "Directory: $(shell pwd)"
@echo "Tests: $(shell find tests -name 'test_*.py' | wc -l) test files"
@echo "Source files: $(shell find src -name '*.py' | wc -l) Python files"
@echo ""