# 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 ""