# Distribution Guide

Multiple ways to distribute and install the Developer Onboarding MCP Server.

## 🚀 Quick Install (Recommended)

### Option 1: NPM Global Install
```bash
# Install globally
npm install -g developer-onboarding-mcp

# Auto-configure Cursor
onboarding-mcp --setup-cursor

# Restart Cursor and you're ready!
```

### Option 2: One-Line Installer

**Windows (PowerShell):**
```powershell
iwr -useb https://your-domain.com/install.ps1 | iex
```

**Unix/Linux/macOS:**
```bash
curl -fsSL https://your-domain.com/install.sh | bash
```

## 📦 Distribution Methods

### 1. NPM Package Distribution

#### Prepare for Publishing
```bash
# Update package for global installation
node scripts/prepare-npm-package.js

# Build the package
npm run build

# Publish to npm
npm publish
```

#### User Installation
```bash
# Global install
npm install -g developer-onboarding-mcp

# Setup Cursor automatically
npx onboarding-mcp --setup-cursor
```

### 2. GitHub Releases

#### Create Release Package
```bash
# Build production version
npm run build

# Create release archive
tar -czf onboarding-mcp-v1.0.0.tar.gz dist/ package.json README.md

# Or for Windows
powershell Compress-Archive -Path dist,package.json,README.md -DestinationPath onboarding-mcp-v1.0.0.zip
```

#### User Installation from Release
```bash
# Download and extract
wget https://github.com/your-username/onboarding-mcp/releases/download/v1.0.0/onboarding-mcp-v1.0.0.tar.gz
tar -xzf onboarding-mcp-v1.0.0.tar.gz
cd onboarding-mcp-v1.0.0

# Install dependencies and run
npm install --production
node dist/index.js
```

### 3. Docker Distribution

#### Build Docker Image
```bash
# Build image
docker build -t developer-onboarding-mcp:latest .

# Or use Docker Compose
docker-compose build
```

#### Distribute via Docker Hub
```bash
# Tag for Docker Hub
docker tag developer-onboarding-mcp:latest your-username/onboarding-mcp:latest

# Push to Docker Hub
docker push your-username/onboarding-mcp:latest
```

#### User Installation with Docker
```bash
# Pull and run
docker pull your-username/onboarding-mcp:latest
docker run -d --name onboarding-mcp \
  -v $(pwd):/workspace:ro \
  your-username/onboarding-mcp:latest

# Or use Docker Compose
curl -O https://raw.githubusercontent.com/your-username/onboarding-mcp/main/docker-compose.yml
docker-compose up -d
```

### 4. Standalone Executables (Future)

Using tools like `pkg` to create standalone executables:

```bash
# Install pkg
npm install -g pkg

# Create executables for all platforms
pkg package.json --targets node18-win-x64,node18-macos-x64,node18-linux-x64 --output dist/onboarding-mcp

# Results in:
# - onboarding-mcp-win.exe
# - onboarding-mcp-macos
# - onboarding-mcp-linux
```

## 🔧 Manual Cursor Configuration

If automatic setup fails, users can manually configure Cursor:

### Windows
Edit: `%APPDATA%\Cursor\User\mcp_servers.json`

### macOS
Edit: `~/Library/Application Support/Cursor/User/mcp_servers.json`

### Linux
Edit: `~/.config/Cursor/User/mcp_servers.json`

### Configuration Content
```json
{
  "servers": {
    "developer-onboarding": {
      "command": "node",
      "args": ["/path/to/onboarding-mcp/dist/index.js"],
      "env": {
        "NODE_ENV": "production",
        "PROJECT_ROOT": "${workspaceFolder}"
      }
    }
  }
}
```

## 📊 Distribution Analytics

Track usage with optional analytics:

```javascript
// Add to package.json
{
  "analytics": {
    "enabled": true,
    "endpoint": "https://your-analytics-endpoint.com/track"
  }
}
```

## 🔒 Security Considerations

- Never include sensitive data in distributed packages
- Use environment variables for configuration
- Validate user inputs thoroughly
- Consider code signing for executables

## 🎯 Distribution Checklist

- [ ] Update version in package.json
- [ ] Build and test production version
- [ ] Update README and documentation
- [ ] Create release notes
- [ ] Test installation methods
- [ ] Verify Cursor integration works
- [ ] Update distribution links
- [ ] Announce release

## 🆘 Support

- **Documentation**: README.md
- **Issues**: GitHub Issues
- **Discussions**: GitHub Discussions
- **Discord**: Your Discord Server
