StackWiz MCP Examples¶
This guide provides practical examples of using StackWiz MCP with Claude for common deployment scenarios.
Table of Contents¶
- Basic Service Deployments
- Database Deployments
- Full Stack Applications
- Monitoring and Observability
- Development Workflows
- Production Deployments
- Advanced Scenarios
Basic Service Deployments¶
Example 1: Simple Web Server¶
Request to Claude:
"Deploy an nginx web server to serve static files"
What Claude Does:
{
"tool": "create_stack",
"parameters": {
"name": "static-site",
"type": "generic",
"image": "nginx:alpine",
"port": 80,
"volumes": ["./html:/usr/share/nginx/html:ro"],
"create_dns": true
}
}
Result:
- Stack created at /srv/dockerdata/static-site
- Accessible at https://static-site.rbnk.uk
- Place HTML files in ./html directory
Example 2: API Service¶
Request to Claude:
"I need to deploy a Node.js API service running on port 3000"
What Claude Does:
{
"tool": "create_stack",
"parameters": {
"name": "api-service",
"type": "generic",
"image": "node:18-alpine",
"port": 3000,
"volumes": ["./app:/app"],
"environment": {
"NODE_ENV": "production"
},
"create_dns": true
}
}
Example 3: Development Tool¶
Request to Claude:
"Set up a code-server (VS Code in the browser) for remote development"
What Claude Does:
{
"tool": "create_stack",
"parameters": {
"name": "code-server",
"type": "generic",
"image": "codercom/code-server:latest",
"port": 8080,
"environment": {
"PASSWORD": "your-secure-password"
},
"volumes": [
"./config:/home/coder/.config",
"./workspace:/home/coder/workspace"
],
"create_dns": true
}
}
Database Deployments¶
Example 4: PostgreSQL with Custom Configuration¶
Request to Claude:
"Deploy PostgreSQL 15 with a database for my e-commerce app, 2GB memory limit, and daily backups"
What Claude Does:
{
"tool": "create_stack",
"parameters": {
"name": "postgres-ecommerce",
"type": "generic",
"image": "postgres:15-alpine",
"port": 5432,
"environment": {
"POSTGRES_DB": "ecommerce",
"POSTGRES_USER": "ecommerce_user",
"POSTGRES_PASSWORD": "secure_password_here",
"POSTGRES_INITDB_ARGS": "--encoding=UTF8 --lc-collate=en_US.utf8"
},
"volumes": [
"./data:/var/lib/postgresql/data",
"./backups:/backups"
],
"resources": {
"memory": "2G",
"cpus": "1.0"
},
"labels": {
"backup.enable": "true",
"backup.schedule": "daily"
}
}
}
Example 5: Redis Cache with Persistence¶
Request to Claude:
"Create a Redis cache with persistence and password protection"
What Claude Does:
{
"tool": "create_stack",
"parameters": {
"name": "redis-cache",
"type": "generic",
"image": "redis:7-alpine",
"port": 6379,
"environment": {
"REDIS_PASSWORD": "strong_redis_password"
},
"volumes": ["./data:/data"],
"command": "redis-server --requirepass ${REDIS_PASSWORD} --appendonly yes",
"resources": {
"memory": "512M"
}
}
}
Example 6: MongoDB Replica Set¶
Request to Claude:
"Set up MongoDB with authentication for a production app"
What Claude Does:
{
"tool": "create_stack",
"parameters": {
"name": "mongodb",
"type": "generic",
"image": "mongo:6",
"port": 27017,
"environment": {
"MONGO_INITDB_ROOT_USERNAME": "admin",
"MONGO_INITDB_ROOT_PASSWORD": "secure_mongo_password",
"MONGO_INITDB_DATABASE": "myapp"
},
"volumes": [
"./data:/data/db",
"./init-scripts:/docker-entrypoint-initdb.d"
],
"resources": {
"memory": "4G",
"cpus": "2.0"
}
}
}
Full Stack Applications¶
Example 7: Complete Todo Application¶
Request to Claude:
"Create a complete todo application with Pocketbase backend and React frontend"
What Claude Does:
-
Creates Pocketbase backend:
-
Creates React frontend:
Example 8: WordPress Site¶
Request to Claude:
"Deploy WordPress with MySQL database and persistent storage"
What Claude Does:
-
Creates MySQL database:
{ "tool": "create_stack", "parameters": { "name": "wordpress-db", "type": "generic", "image": "mysql:8.0", "port": 3306, "environment": { "MYSQL_ROOT_PASSWORD": "root_password", "MYSQL_DATABASE": "wordpress", "MYSQL_USER": "wordpress", "MYSQL_PASSWORD": "wordpress_password" }, "volumes": ["./data:/var/lib/mysql"] } } -
Creates WordPress:
{ "tool": "create_stack", "parameters": { "name": "wordpress", "type": "generic", "image": "wordpress:latest", "port": 80, "environment": { "WORDPRESS_DB_HOST": "wordpress-db:3306", "WORDPRESS_DB_USER": "wordpress", "WORDPRESS_DB_PASSWORD": "wordpress_password", "WORDPRESS_DB_NAME": "wordpress" }, "volumes": ["./wp-content:/var/www/html/wp-content"], "networks": ["traefik_proxy", "wordpress_network"], "create_dns": true } }
Monitoring and Observability¶
Example 9: Grafana with Prometheus¶
Request to Claude:
"Set up Grafana with Prometheus for infrastructure monitoring"
What Claude Does:
-
Creates Prometheus:
{ "tool": "create_stack", "parameters": { "name": "prometheus", "type": "generic", "image": "prom/prometheus:latest", "port": 9090, "volumes": [ "./prometheus.yml:/etc/prometheus/prometheus.yml", "./data:/prometheus" ], "command": "--config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/prometheus" } } -
Creates Grafana:
{ "tool": "create_stack", "parameters": { "name": "grafana", "type": "generic", "image": "grafana/grafana:latest", "port": 3000, "environment": { "GF_SECURITY_ADMIN_PASSWORD": "admin_password", "GF_INSTALL_PLUGINS": "grafana-clock-panel,grafana-simple-json-datasource" }, "volumes": [ "./data:/var/lib/grafana", "./provisioning:/etc/grafana/provisioning" ], "create_dns": true } }
Example 10: ELK Stack for Logs¶
Request to Claude:
"Deploy Elasticsearch, Logstash, and Kibana for log analysis"
Complex deployment example showing multi-service coordination
Development Workflows¶
Example 11: Development Environment¶
Request to Claude:
"Create a development environment with PostgreSQL, Redis, and MinIO for local testing"
What Claude Does: - Creates isolated development stack - Uses internal networking - Configures with development-friendly settings - Provides connection strings
Example 12: CI/CD Runner¶
Request to Claude:
"Set up a GitLab runner for CI/CD pipelines"
What Claude Does:
{
"tool": "create_stack",
"parameters": {
"name": "gitlab-runner",
"type": "generic",
"image": "gitlab/gitlab-runner:latest",
"volumes": [
"./config:/etc/gitlab-runner",
"/var/run/docker.sock:/var/run/docker.sock"
],
"environment": {
"RUNNER_NAME": "docker-runner",
"RUNNER_TOKEN": "your-runner-token"
}
}
}
Production Deployments¶
Example 13: High-Availability Service¶
Request to Claude:
"Deploy a production API with health checks, auto-restart, and resource limits"
What Claude Does:
{
"tool": "create_stack",
"parameters": {
"name": "prod-api",
"type": "generic",
"image": "myapp:latest",
"port": 8080,
"environment": {
"ENV": "production",
"LOG_LEVEL": "info"
},
"resources": {
"memory": "2G",
"cpus": "1.0"
},
"restart_policy": "always",
"labels": {
"traefik.http.services.prod-api.loadbalancer.healthcheck.path": "/health",
"traefik.http.services.prod-api.loadbalancer.healthcheck.interval": "10s"
},
"create_dns": true
}
}
Example 14: Secure Database¶
Request to Claude:
"Create a production PostgreSQL with encryption, limited connections, and monitoring"
Includes: - Encrypted connections - Connection pooling - Prometheus metrics - Automated backups - Access restrictions
Advanced Scenarios¶
Example 15: Microservices Architecture¶
Request to Claude:
"Help me set up a microservices architecture with API gateway, service discovery, and message queue"
Claude orchestrates: 1. Traefik API Gateway 2. Consul for service discovery 3. RabbitMQ for messaging 4. Multiple microservices 5. Shared Redis cache
Example 16: Data Pipeline¶
Request to Claude:
"Create a data pipeline with Kafka, processing service, and TimescaleDB"
Components deployed: - Apache Kafka with Zookeeper - Stream processing service - TimescaleDB for time-series data - Grafana for visualization
Example 17: Machine Learning Platform¶
Request to Claude:
"Deploy JupyterHub for my data science team with GPU support"
Configuration includes: - JupyterHub with authentication - Persistent user workspaces - GPU resource allocation - Shared datasets volume
Common Patterns¶
Health Checks¶
{
"labels": {
"traefik.http.services.myapp.loadbalancer.healthcheck.path": "/health",
"traefik.http.services.myapp.loadbalancer.healthcheck.interval": "30s",
"traefik.http.services.myapp.loadbalancer.healthcheck.timeout": "10s"
}
}
Backup Configuration¶
Monitoring Integration¶
{
"labels": {
"prometheus.io/scrape": "true",
"prometheus.io/port": "9090",
"prometheus.io/path": "/metrics"
}
}
Tips for Claude Interactions¶
1. Iterative Deployment¶
Start simple and add features:
"Create a basic PostgreSQL database" "Now add a pgAdmin interface for it" "Connect it to our monitoring system"
2. Environment-Specific Deployments¶
"Create a staging environment that mirrors our production Grafana setup"
3. Troubleshooting Deployments¶
"My WordPress site is showing database connection errors, can you help debug?"
4. Infrastructure as Code¶
"Generate a script to recreate our entire monitoring stack"
Next Steps¶
- Tool Reference - Detailed API documentation
- Troubleshooting - Common issues and solutions
- Development Guide - Extend StackWiz MCP