Creating Bundles

Learn how to create, package, and distribute Station environment bundles that work seamlessly across different deployments and teams.

What are Station Bundles?

Station bundles are portable environment packages that contain:

  • Agent definitions - Pre-configured AI agents with specialized prompts
  • MCP tool configurations - Connections to security, DevOps, and development tools
  • Environment settings - Ready-to-deploy configurations

Bundles enable you to share complete AI-powered workflows and quickly replicate environments across teams.

graph LR
    subgraph "Bundle Creation"
        Env[Station Environment] --> Bundle[Bundle.tar.gz]
        Bundle --> Registry[Registry Distribution]
    end
    
    subgraph "Environment Contents"
        Agents[AI Agents]
        MCP[MCP Tools]
        Config[Configuration Files]
    end
    
    subgraph "Installation Methods"
        UI[Station UI]
        API[REST API]
        CLI[CLI Command]
        MCP_Tools[MCP Tools]
    end
    
    Env --> Agents
    Env --> MCP
    Env --> Config
    
    Registry --> UI
    Registry --> API
    Registry --> CLI
    Registry --> MCP_Tools
    
    UI --> NewEnv[New Environment]
    API --> NewEnv
    CLI --> NewEnv
    MCP_Tools --> NewEnv
    
    style Bundle fill:#e1f5fe
    style Registry fill:#f3e5f5
    style NewEnv fill:#e8f5e8

Bundle Creation Methods

Create a bundle from any existing environment:

# List your environments
stn environments list

# Create bundle from environment
stn bundle my-environment --output my-custom-bundle.tar.gz

Method 2: MCP Tools (For Claude Code/AI)

Use Station’s MCP integration to create bundles programmatically:

# Available via Claude Code when Station MCP is connected
create_bundle_from_environment(environmentName="my-environment", outputPath="./bundle.tar.gz")

Method 3: API Integration

Create bundles via the Station CLI for CI/CD integration:

stn bundle create my-environment --output ./bundle.tar.gz

Setting Up Your Environment for Bundling

1. Configure MCP Tools

Create MCP server configurations in your environment directory:

// ~/.config/station/environments/my-env/security-tools.json
{
  "mcpServers": {
    "ship-checkov": {
      "command": "ship",
      "args": ["mcp", "checkov"]
    },
    "ship-tflint": {
      "command": "ship", 
      "args": ["mcp", "tflint"]
    }
  }
}

2. Create Agent Definitions

Add specialized agents to your environment:

# Create agents through the UI or CLI
stn agent create --name "Security Scanner" \
  --description "Scans repositories for security vulnerabilities" \
  --environment my-env \
  --tools "__checkov_scan_directory,__checkov_scan_file,__checkov_scan_secrets"

3. Test Your Environment

Verify everything works before bundling:

# Check MCP tools are loaded
stn tools list --environment my-env

# Test agent execution  
stn agent run "Security Scanner" "Scan the current directory for vulnerabilities"

4. Create the Bundle

# Bundle your tested environment
stn bundle my-env --output production-security-bundle.tar.gz

# Verify bundle contents
tar -tzf production-security-bundle.tar.gz

Bundle Structure

A Station bundle contains these files:

agents/
├── Security Scanner.prompt      # Agent definition files
├── Terraform Auditor.prompt    
security-tools.json             # MCP server configurations
other-tools.json                 # Additional MCP configs

Installing Bundles

Via Station UI

Install Bundle Interface
  1. Navigate to Bundles section
  2. Paste bundle URL or upload file
  3. Select target environment name
  4. Click “Install Bundle”

Via CLI

# Install from local file
stn bundle install ./my-bundle.tar.gz new-environment

# Install from URL (e.g., GitHub release)
stn bundle install https://github.com/user/repo/releases/download/v1.0/bundle.tar.gz production

Real-World Example: DevOps Security Bundle

Here’s how to create a production-ready security bundle:

1. Set up the environment

# Initialize environment with security tools
stn load https://github.com/shiptools/ship-checkov
stn load https://github.com/shiptools/ship-tflint

# Create security agents
stn agent create --name "Security Scanner" \
  --prompt "Scan repositories for security vulnerabilities using checkov tools" \
  --tools "__checkov_scan_directory,__checkov_scan_file,__checkov_scan_secrets"

stn agent create --name "Terraform Auditor" \
  --prompt "Analyze Terraform files for best practices using tflint" \
  --tools "__tflint_check,__tflint_init"

2. Test in CI/CD

# .github/workflows/security-scan.yml  
- name: Run Security Analysis
  run: |
    docker run -v $(pwd):/workspace epuerta18/station-default:latest \
      stn agent run "Security Scanner" "Scan /workspace for security issues"

3. Create and publish bundle

# Create bundle
stn bundle security-environment --output devops-security-bundle.tar.gz

# Test installation in fresh environment  
stn bundle install ./devops-security-bundle.tar.gz test-install

Bundle Best Practices

  • Environment Isolation - Test bundles in clean environments before publishing
  • Tool Dependencies - Ensure all required tools are available in target environments
  • Agent Validation - Verify agents work with their assigned tools
  • Documentation - Include usage examples and tool requirements
  • Version Control - Tag releases and maintain changelog
  • Security Review - Audit tools and permissions before sharing

CI/CD Integration

Automate bundle creation and testing in your workflows:

graph TB
    subgraph "CI/CD Pipeline"
        Push[Code Push] --> Build[Build Station Environment]
        Build --> Bundle[Create Bundle]
        Bundle --> Test[Test Bundle Installation]
        Test --> Deploy[Deploy to Registry]
    end
    
    subgraph "Station Container"
        Agents[Security Agents]
        Tools[Ship CLI Tools]
        Docker[Docker Socket]
    end
    
    subgraph "Security Analysis"
        Checkov[Checkov Scan]
        TFLint[TFLint Validation]
        Secrets[Secret Detection]
    end
    
    Build --> Agents
    Build --> Tools
    Build --> Docker
    
    Agents --> Checkov
    Agents --> TFLint
    Agents --> Secrets
    
    Checkov --> Results[Analysis Results]
    TFLint --> Results
    Secrets --> Results
    
    Results --> PRComment[PR Comment]
    Results --> Artifacts[Build Artifacts]
    
    style Build fill:#e1f5fe
    style Bundle fill:#f3e5f5
    style Results fill:#e8f5e8
name: Build and Test Bundle
on:
  push:
    paths: ['environments/production/**']

jobs:
  bundle:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      
      - name: Create Bundle  
        run: |
          # Use Station CLI to create bundle from environment
          stn bundle create production --output ./production-bundle.tar.gz
            
      - name: Test Bundle Installation
        run: |
          docker run -v $(pwd):/workspace epuerta18/station-default:latest \
            stn bundle install /workspace/production-bundle.tar.gz ci-test
            
      - name: Upload Bundle Artifact
        uses: actions/upload-artifact@v4
        with:
          name: production-bundle
          path: production-bundle.tar.gz

Next Steps