Skip to main content

Overview

Advanced usage patterns, automation scripts, and power user workflows for ntcli.

Multi-Environment Deployment

#\!/bin/bash
# Deploy to multiple environments
environments=("dev" "staging" "prod")

for env in "${environments[@]}"; do
  echo "Deploying to $env..."
  ntcli workspace switch $env
  ntcli server deploy nationalparks-mcp --version stable
  ntcli secrets set NPS_API_KEY=${\!env}_API_KEY
done

Automated Scaling

# Scale based on time of day
current_hour=$(date +"%H")
if [ $current_hour -ge 9 ] && [ $current_hour -le 17 ]; then
  ntcli server scale nationalparks-mcp 4  # Business hours
else
  ntcli server scale nationalparks-mcp 1  # Off hours
fi

Monitoring Scripts

#\!/bin/bash
# Health check script
for server in $(ntcli server list --json | jq -r '.[].name'); do
  echo "Checking $server..."
  ntcli mcp connect $server --timeout 5000 || echo "❌ $server failed"
done
I