3.0.1 • Published 4 months ago

@codai/glass-cli v3.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

@codai/glass-cli

Command-line interface for GlassMCP - Machine Control Protocol server for Windows automation.

Installation

# Install globally (recommended)
npm install -g @codai/glass-cli

# Or use directly with npx
npx @codai/glass-cli --help

Available Commands

Server Management

# Start the GlassMCP server
glassmcp start [options]

# Start with custom port
glassmcp start --port 8080

# Start with authentication token
glassmcp start --token your-secure-token

# Stop the server
glassmcp stop

# Check server status
glassmcp status

# View server logs
glassmcp logs

Interactive Playground

# Start interactive testing mode
glassmcp playground

# Test specific functionality
glassmcp playground --focus window
glassmcp playground --focus keyboard
glassmcp playground --focus mouse

Configuration

# View current configuration
glassmcp config list

# Set configuration values
glassmcp config set server.port 8080
glassmcp config set auth.token your-token

# Reset configuration to defaults
glassmcp config reset

System Information

# Display system information
glassmcp info

# Check health status
glassmcp health

# View performance metrics
glassmcp metrics

Connection Testing

# Test connection to running server
glassmcp connect

# Test with custom URL
glassmcp connect --url http://localhost:8080

# Test with authentication
glassmcp connect --token your-token

Command Options

Global Options

  • --help, -h - Show help information
  • --version, -v - Display version number
  • --verbose - Enable verbose logging
  • --quiet - Suppress non-essential output
  • --config <path> - Use custom config file

Start Command Options

  • --port <number> - Server port (default: 7700)
  • --host <string> - Server host (default: localhost)
  • --token <string> - Authentication token
  • --cors - Enable CORS
  • --rate-limit <number> - Rate limit requests per minute
  • --log-level <level> - Logging level (debug, info, warn, error)

Playground Options

  • --focus <module> - Focus on specific module (window, keyboard, mouse, etc.)
  • --auto-start - Automatically start server if not running
  • --mock - Use mock responses for testing

Configuration File

The CLI uses a configuration file located at:

  • Windows: %APPDATA%/glassmcp/config.json
  • macOS/Linux: ~/.config/glassmcp/config.json

Example configuration:

{
  "server": {
    "port": 7700,
    "host": "localhost",
    "logLevel": "info"
  },
  "auth": {
    "token": "your-secure-token",
    "tokenFile": "~/.mcp-token"
  },
  "security": {
    "cors": true,
    "rateLimit": 100
  }
}

Environment Variables

  • GLASSMCP_PORT - Override server port
  • GLASSMCP_HOST - Override server host
  • GLASSMCP_TOKEN - Override authentication token
  • GLASSMCP_LOG_LEVEL - Override log level
  • NODE_ENV - Environment mode (development, production)

Examples

Basic Server Setup

# Install globally
npm install -g @codai/glass-cli

# Set up authentication token
glassmcp config set auth.token $(openssl rand -hex 32)

# Start server
glassmcp start

# Test in another terminal
glassmcp playground

Production Deployment

# Set production configuration
export NODE_ENV=production
export GLASSMCP_TOKEN=your-secure-production-token
export GLASSMCP_PORT=7700

# Start server with production settings
glassmcp start --log-level warn

Development Testing

# Start server in verbose mode
glassmcp start --verbose --cors

# Test specific functionality
glassmcp playground --focus window

# View real-time logs
glassmcp logs --follow

Troubleshooting

Common Issues

  1. Port already in use:

    glassmcp start --port 8080
  2. Permission denied:

    • Run as administrator (Windows)
    • Check file permissions
  3. Authentication errors:

    glassmcp config reset
    glassmcp config set auth.token new-token
  4. Server not responding:

    glassmcp status
    glassmcp stop
    glassmcp start

Debug Mode

# Enable detailed logging
glassmcp start --verbose --log-level debug

# Check health status
glassmcp health --verbose

Integration Examples

With npm scripts

{
  "scripts": {
    "automation:start": "glassmcp start",
    "automation:test": "glassmcp playground",
    "automation:stop": "glassmcp stop"
  }
}

With Docker

# Install in container
RUN npm install -g @codai/glass-cli

# Start server in container
CMD ["glassmcp", "start", "--host", "0.0.0.0"]

License

MIT - see LICENSE file for details.