mirror of
https://github.com/samerfarida/mcp-ssh-orchestrator.git
synced 2026-11-19 02:14:04 +00:00
* fix: Remove unused variable in fix-markdownlint.py * fix: Remove unused code_block_lang variable * chore: Update documentation, workflows, and examples - Updated all wiki documentation files (markdownlint fixes) - Updated GitHub workflows and issue templates - Updated example configuration files - Updated metadata.json and pyproject.toml - Updated Dockerfile and compose files - Updated validation scripts Note: yamllint warnings are style-only (missing ---, line length) and don't affect functionality
122 lines
3.6 KiB
Bash
Executable File
122 lines
3.6 KiB
Bash
Executable File
#!/bin/bash
|
|
# Setup script for mcp-ssh-orchestrator docker-compose environment
|
|
# Usage: ./setup.sh [dev|enduser]
|
|
|
|
set -e
|
|
|
|
# Detect mode (dev by default if in repo, enduser if standalone)
|
|
MODE="${1:-auto}"
|
|
|
|
# Auto-detect mode based on context
|
|
if [ "$MODE" = "auto" ]; then
|
|
if [ -f "../examples/example-servers.yml" ]; then
|
|
MODE="dev"
|
|
else
|
|
MODE="enduser"
|
|
fi
|
|
fi
|
|
|
|
if [ "$MODE" = "dev" ]; then
|
|
echo "Setting up mcp-ssh-orchestrator (Development Mode)..."
|
|
BASE_DIR=".."
|
|
elif [ "$MODE" = "enduser" ]; then
|
|
echo "Setting up mcp-ssh-orchestrator (End User Mode)..."
|
|
# For end users, assume they're running from their config location
|
|
BASE_DIR="."
|
|
else
|
|
echo "Invalid mode: $MODE. Use 'dev' or 'enduser'"
|
|
exit 1
|
|
fi
|
|
|
|
# Create required directories
|
|
echo "Creating directories..."
|
|
mkdir -p "${BASE_DIR}/config" "${BASE_DIR}/keys" "${BASE_DIR}/secrets"
|
|
|
|
if [ "$MODE" = "dev" ]; then
|
|
# Copy example configuration files
|
|
echo "Copying example configuration files..."
|
|
if [ -f "../examples/example-servers.yml" ]; then
|
|
cp ../examples/example-servers.yml "${BASE_DIR}/config/servers.yml"
|
|
echo " - servers.yml copied"
|
|
else
|
|
echo " - example-servers.yml not found"
|
|
fi
|
|
|
|
if [ -f "../examples/example-credentials.yml" ]; then
|
|
cp ../examples/example-credentials.yml "${BASE_DIR}/config/credentials.yml"
|
|
echo " - credentials.yml copied"
|
|
else
|
|
echo " - example-credentials.yml not found"
|
|
fi
|
|
|
|
if [ -f "../examples/example-policy.yml" ]; then
|
|
cp ../examples/example-policy.yml "${BASE_DIR}/config/policy.yml"
|
|
echo " - policy.yml copied"
|
|
else
|
|
echo " - example-policy.yml not found"
|
|
fi
|
|
else
|
|
# For end users, just create empty config files with instructions
|
|
echo "Creating configuration file templates..."
|
|
cat > "${BASE_DIR}/config/servers.yml" << 'EOF'
|
|
# servers.yml - Add your SSH hosts here
|
|
# See examples at: https://github.com/samerfarida/mcp-ssh-orchestrator/blob/main/examples/example-servers.yml
|
|
|
|
hosts: []
|
|
EOF
|
|
|
|
cat > "${BASE_DIR}/config/credentials.yml" << 'EOF'
|
|
# credentials.yml - Add your SSH credentials here
|
|
# See examples at: https://github.com/samerfarida/mcp-ssh-orchestrator/blob/main/examples/example-credentials.yml
|
|
|
|
entries: []
|
|
EOF
|
|
|
|
cat > "${BASE_DIR}/config/policy.yml" << 'EOF'
|
|
# policy.yml - Configure security policies
|
|
# See examples at: https://github.com/samerfarida/mcp-ssh-orchestrator/blob/main/examples/example-policy.yml
|
|
|
|
limits:
|
|
max_seconds: 60
|
|
max_output_bytes: 1048576
|
|
|
|
network:
|
|
allow_cidrs: []
|
|
block_ips: []
|
|
|
|
rules: []
|
|
EOF
|
|
|
|
echo " Configuration templates created"
|
|
fi
|
|
|
|
# Copy environment file
|
|
echo "Setting up environment..."
|
|
cat > .env <<'EOF'
|
|
# Generated by setup.sh
|
|
# Override these only if you mount the configs to a different path inside the container.
|
|
# MCP_SSH_CONFIG_DIR=/app/config
|
|
# MCP_SSH_KEYS_DIR=/app/keys
|
|
# MCP_SSH_SECRETS_DIR=/app/secrets
|
|
|
|
# Example: export secrets via env instead of files
|
|
# MCP_SSH_SECRET_DB_PASSWORD=supersecretvalue
|
|
EOF
|
|
echo " .env created with default values"
|
|
|
|
echo ""
|
|
echo "Setup complete!"
|
|
echo ""
|
|
echo "Next steps:"
|
|
echo "1. Edit ${BASE_DIR}/config/servers.yml with your server details"
|
|
echo "2. Edit ${BASE_DIR}/config/credentials.yml with your credentials"
|
|
echo "3. Edit ${BASE_DIR}/config/policy.yml with your security policies"
|
|
echo "4. Add SSH keys to ${BASE_DIR}/keys/ directory"
|
|
echo "5. Add any password files to ${BASE_DIR}/secrets/ directory"
|
|
if [ "$MODE" = "dev" ]; then
|
|
echo "6. Run: docker compose -f docker-compose.dev.yml up --build"
|
|
else
|
|
echo "6. Run: docker compose up"
|
|
fi
|
|
echo ""
|