Merged
Conversation
Complete deployment tooling for Docker and cloud platforms with health checks, graceful shutdown, and CLI commands for one-click deployment. Core Features: - Health check system with liveness and readiness probes - Graceful shutdown with SIGTERM/SIGINT handling - Template system for Dockerfile, docker-compose.yml generation - CLI commands: `mcp init --docker` and `mcp deploy` - Platform support: Docker, Railway, Render, Fly.io, Kubernetes Components Added: Deployment Infrastructure (nextmcp/deployment/): - health.py: HealthCheck system with liveness/readiness checks - Custom check registration - Status types: Healthy, Unhealthy, Degraded - Duration measurement for checks - Kubernetes-compatible health endpoints - lifecycle.py: GracefulShutdown for clean termination - Signal handler registration (SIGTERM/SIGINT) - Cleanup handler management - Async and sync support - Configurable timeout - templates.py: TemplateRenderer for config generation - Jinja2-like syntax (variables, defaults, conditionals) - Auto-detection of project configuration - Template variable extraction Docker Templates (nextmcp/templates/docker/): - Dockerfile.template: Multi-stage optimized build - Python 3.10 slim base (~100MB) - Non-root user (UID 1000) - Built-in health check - docker-compose.yml.template: Local dev environment - Optional PostgreSQL integration - Optional Redis integration - Volume management - Health checks for all services - .dockerignore.template: Minimal context CLI Enhancements (nextmcp/cli.py): - `mcp init --docker`: Generate Docker deployment files - Auto-detects app configuration - --with-database: Include PostgreSQL - --with-redis: Include Redis - --port: Custom port - `mcp deploy`: One-command deployment - Platform auto-detection - Supports: docker, railway, render, fly - Build control - CLI validation Examples: - deployment_simple/: Basic deployment with health checks - Simple health checks - Graceful shutdown - Production logging - Comprehensive README - deployment_docker/: Production-ready example - Database integration - Metrics collection - Advanced health checks (disk, database) - Multi-service Docker Compose - Environment configuration Tests (66 new tests): - test_deployment_health.py: 21 tests - Health check creation and status - Liveness and readiness checks - Multiple check handling - Error handling - test_deployment_lifecycle.py: 15 tests - Graceful shutdown initialization - Signal handling - Cleanup handlers (async/sync) - Error handling - test_deployment_templates.py: 30 tests - Template rendering - Variable substitution and defaults - Conditionals - Docker template rendering - Auto-detection Deployment Workflow: cd my-mcp-project mcp init --docker --with-database mcp deploy --platform docker Health Checks: GET /health # Liveness probe GET /health/ready # Readiness probe Platform Support: ✅ Docker - Local development ✅ Railway - Automated deployment ✅ Render - Git-based deployment ✅ Fly.io - Edge deployment ✅ Kubernetes - Health checks included Test Results: - 363/363 tests passing - 66 new deployment tests - 100% backward compatible 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🚀 v0.5.0: Production Deployment System
Complete deployment tooling for Docker and cloud platforms with health checks, graceful shutdown, and one-click deployment commands.
What's New
🏥 Health Check System
Production-ready health monitoring with Kubernetes-compatible endpoints:
🛑 Graceful Shutdown
Clean application termination with resource cleanup:
🐳 Docker Templates
Optimized Docker deployment with one command:
🚢 One-Command Deployment
Deploy to multiple platforms instantly:
🎯 Enhanced CLI
📊 Stats
📁 Changes
Core Components
nextmcp/deployment/health.py- Health check system (210 lines)nextmcp/deployment/lifecycle.py- Graceful shutdown (145 lines)nextmcp/deployment/templates.py- Template rendering (174 lines)Docker Templates
nextmcp/templates/docker/Dockerfile.template- Multi-stage buildnextmcp/templates/docker/docker-compose.yml.template- Dev environmentnextmcp/templates/docker/.dockerignore.template- Optimized contextCLI Enhancements
mcp initwith--docker,--with-database,--with-redismcp deploycommand with platform auto-detectionExamples
examples/deployment_simple/- Basic deployment with health checksexamples/deployment_docker/- Production example with databaseTests
tests/test_deployment_health.py- 21 health check teststests/test_deployment_lifecycle.py- 15 lifecycle teststests/test_deployment_templates.py- 30 template tests🎬 Demo
Quick Start
Example Output
{ "status": "healthy", "uptime_seconds": 123.45, "checks": { "database": { "status": "healthy", "message": "Database connection is healthy", "duration_ms": 2.34 } } }🏗️ Platform Support
🧪 Testing
All tests passing:
$ pytest tests/ -v 363 passed in 5.34s ✓Test coverage:
📖 Documentation
Each example includes comprehensive README with:
🔄 Migration Guide
No breaking changes! This release is 100% backward compatible.
To use new features:
🎯 Next Steps
After merging:
✅ Pre-merge Checklist
Ready to merge! 🚀