Creating Bundles

Station bundles package environments with agents, MCP configurations, and tools into distributable .tar.gz archives that can be shared and installed across different Station instances.

Bundle Creation Methods

  1. Navigate to http://localhost:8585/environments
  2. Select your environment
  3. Click β€œCreate Bundle”
  4. Choose local save or upload to registry

Method 2: CLI Command

# Create bundle from environment
stn bundle create my-environment

# Create with custom output path
stn bundle create my-environment --output my-bundle.tar.gz

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

# Use MCP tools to create bundles programmatically
create_bundle_from_environment(environmentName="my-environment", outputPath="./bundle.tar.gz")

Setting Up Your Environment for Bundling

1. Configure MCP Tools

Create MCP server configurations in your environment:

# Initialize with Ship integration for curated tools
stn init --ship

# Add custom MCP servers
echo '{
  "description": "Filesystem operations with MCP server integration",
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem@latest", "{{ .ALLOWED_PATH }}"]
    }
  },
  "name": "filesystem-config"
}' > ~/.config/station/environments/default/filesystem-config.json

# Create variables file for template processing
echo "ALLOWED_PATH: /home/user/projects" > ~/.config/station/environments/default/variables.yml

# Sync to discover tools
stn sync

2. Create and Test Agents

# Create agents using discovered MCP tools
stn agent create "File Monitor" "Monitor filesystem changes" --tools filesystem

# Test agent execution
stn agent run "File Monitor" "Check recent file changes"

Bundle Structure

Station bundles use a standardized format:

bundle.tar.gz
β”œβ”€β”€ agents/                    # Agent definition files
β”‚   β”œβ”€β”€ file-monitor.prompt
β”‚   β”œβ”€β”€ security-scanner.prompt
β”‚   └── terraform-auditor.prompt
β”œβ”€β”€ mcp-configs/               # MCP server configurations  
β”‚   β”œβ”€β”€ filesystem-config.json
β”‚   β”œβ”€β”€ security-tools.json
β”‚   └── terraform-tools.json
β”œβ”€β”€ variables.yml              # Template variables
β”œβ”€β”€ bundle-info.json           # Bundle metadata
└── README.md                  # Documentation

Bundle Metadata

Each bundle includes metadata for validation:

{
  "name": "devops-security-bundle",
  "version": "1.0.0",
  "description": "Comprehensive DevOps security scanning tools",
  "agents": [
    "Security Scanner",
    "Terraform Auditor", 
    "Infrastructure Auditor"
  ],
  "mcp_configs": [
    "checkov-config",
    "tflint-config",
    "filesystem-config"
  ],
  "tools_count": 16,
  "created_at": "2024-08-28T12:00:00Z"
}

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 with Ship integration
stn init --ship

# Add security-specific MCP tools
stn sync

2. Create specialized agents

# Create security scanning agents
stn agent create "Security Scanner" "Comprehensive security vulnerability scanning" --tools checkov,tflint

stn agent create "Terraform Auditor" "Infrastructure as Code security analysis" --tools tflint,filesystem  

stn agent create "Infrastructure Auditor" "Cloud infrastructure compliance scanning" --tools checkov,filesystem

3. Test and validate

# Test each agent
stn agent run "Security Scanner" "Scan current directory for vulnerabilities"
stn agent run "Terraform Auditor" "Analyze Terraform configurations"

4. Create and test bundle

# Create bundle
stn bundle create 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

1. Environment Naming

  • Use descriptive names: devops-security, data-science, frontend-tools
  • Include version in bundle filename: devops-security-v1.2.tar.gz

2. Documentation

  • Include README.md with setup instructions
  • Document required variables and their purposes
  • Provide usage examples for each agent

3. Template Variables

  • Use meaningful variable names: PROJECT_ROOT, API_KEY_PATH
  • Set sensible defaults in variables.yml
  • Document all variables in README.md

4. Testing

  • Test bundle installation in clean environments
  • Verify all tools are discovered correctly
  • Ensure agents execute successfully

CI/CD Integration

GitHub Actions Example

name: Create and Test Bundle
on:
  push:
    branches: [main]

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

Docker Integration

FROM epuerta18/station-default:latest
COPY ./my-bundle.tar.gz /tmp/
RUN stn bundle install /tmp/my-bundle.tar.gz production && \
    stn sync production

Publishing to Bundle Registry

  1. Create GitHub release with your bundle
  2. Tag with semantic versioning: v1.0.0
  3. Upload .tar.gz bundle as release asset
  4. Submit to Station Bundle Registry

Troubleshooting

Bundle Creation Fails

  • Verify environment exists and has agents/configurations
  • Check file permissions in environment directory
  • Ensure all MCP servers are running

Bundle Installation Fails

  • Verify bundle file exists and is not corrupted
  • Check target environment name doesn’t already exist
  • Ensure Station server is running for CLI installs

Missing Tools After Installation

  • Run stn sync <environment> after installation
  • Verify MCP server commands are available
  • Check variables.yml has correct values for your system

Next Steps