Skip to content

About

No description, website, or topics provided.

Resources

Stars

7 stars

Watchers

0 watching

Forks

Latest commit

 

History

95 Commits

Folders and files

Repository files navigation

OpenWorkers CLI

Command-line interface for managing OpenWorkers deployments.

Installation

Prebuilt binaries (recommended):

# Using cargo-binstall (auto-detects prebuilt binaries)
cargo install cargo-binstall
cargo binstall openworkers-cli

# Or download manually from GitHub Releases
curl -L https://github.com/openworkers/openworkers-cli/releases/latest/download/ow-linux-x86_64.tar.gz | tar xz
sudo mv ow /usr/local/bin/

# macOS (Intel)
curl -L https://github.com/openworkers/openworkers-cli/releases/latest/download/ow-macos-x86_64.tar.gz | tar xz
sudo mv ow /usr/local/bin/

# macOS (Apple Silicon)
curl -L https://github.com/openworkers/openworkers-cli/releases/latest/download/ow-macos-aarch64.tar.gz | tar xz
sudo mv ow /usr/local/bin/

Docker:

docker run --rm ghcr.io/openworkers/openworkers-cli --help

Build from source:

cargo install --git https://github.com/openworkers/openworkers-cli

Quick Start

# Configure your API backend
ow alias set prod --api https://dash.openworkers.com/api/v1

# Login (prompts for API token)
ow login

# Create and deploy a worker
ow workers create my-api
ow workers deploy my-api worker.ts

# Your worker is live at https://my-api.workers.rocks

Commands

Command Short Description
workers w Create, deploy, manage workers
projects p Multi-worker deployments
env e Environment variables/secrets
storage s S3/R2 storage configurations
kv k Key-value namespaces
databases d SQL database bindings
users u User management (DB only)
alias Backend connection aliases
login Authenticate with API
migrate Database schema migrations (DB only)
setup-storage Platform storage for asset uploads (DB only)
test-latency Measure the latency to the backend
mcp MCP server for AI assistants

Common operations: list (ls), get, create, delete (rm)

Workers

Workers are serverless functions deployed to the edge.

ow workers list
ow workers create my-api -d "REST API"
ow workers get my-api

# Deploy a single file
ow workers deploy my-api ./worker.ts -m "Initial deploy"

# Deploy a folder with worker.js + static assets (SvelteKit, etc.)
ow workers upload my-app ./dist

ow workers delete my-api

Supported file types: .js, .ts, .wasm

Environments

Environments group configuration for your workers: variables, secrets, and bindings to resources.

ow env list
ow env create my-env -d "Production"
ow env get my-env

# Variables (plain text, visible in logs)
ow env set my-env API_URL "https://api.example.com"

# Secrets (encrypted, masked in output)
ow env set my-env API_KEY "secret" --secret

ow env unset my-env OLD_VAR

# Bindings connect resources to your worker code (accessible via env.CACHE, env.DB, etc.)
ow env bind my-env CACHE my-kv --type kv
ow env bind my-env DB my-db --type database
ow env bind my-env ASSETS my-storage --type assets

# Link environment to a worker
ow workers link my-api my-env

ow env delete old-env

Storage

S3-compatible object storage for files, images, and static assets.

ow storage list

# Platform-managed storage
ow storage create my-storage

# Bring your own S3/R2 bucket
ow storage create my-s3 --provider s3 \
  --bucket my-bucket \
  --endpoint https://xxx.r2.cloudflarestorage.com \
  --access-key-id AKIA... \
  --secret-access-key ...

ow storage delete my-storage

KV

Fast key-value store for caching, sessions, and feature flags.

ow kv list
ow kv create my-kv -d "API cache"
ow kv get my-kv
ow kv delete my-kv

Databases

SQL databases for persistent data. Query with env.DB.execute() in your worker.

ow databases list

# Platform-managed database
ow databases create my-db

# Bring your own Postgres
ow databases create my-pg --provider postgres \
  --connection-string "postgres://user:pass@host/db"

ow databases delete my-db

Aliases

Aliases let you manage multiple backends (production, staging, local) from the same CLI.

# API backend (hosted platform)
ow alias set prod --api https://dash.openworkers.com/api/v1

# API backend (self-hosted, self-signed certificate: skip TLS verification)
ow alias set dev --api https://dash.dev.localhost:8443/api/v1 --insecure

# DB backend (direct PostgreSQL access for migrations)
ow alias set local --db postgres://user:pass@localhost/ow --user admin@example.com

ow alias list
ow alias set-default prod
ow alias rm old-alias

The --api URL ends in /api/v1. The CLI adds the path of each call to it, for example /workers.

Prefix any command with an alias name:

ow workers list           # Uses default alias
ow prod workers list      # Uses 'prod' alias
ow dev workers get my-api # Uses 'dev' alias

Config stored in ~/.openworkers/config.json.

Model Context Protocol (MCP)

OpenWorkers CLI includes an MCP server that exposes CLI commands as tools for AI assistants like Claude.

Available tools:

  • Workers: list, get, create, deploy, delete, link
  • Environments: list, set variables/secrets, bind resources
  • KV: list, create, delete
  • Storage: list, create, delete
  • Databases: list, create, delete

Setup for Claude Code

Create .mcp.json in your project:

{
  "mcpServers": {
    "openworkers": {
      "command": "ow",
      "args": ["mcp"]
    }
  }
}

Or with a specific alias:

{
  "mcpServers": {
    "openworkers": {
      "command": "ow",
      "args": ["local", "mcp"]
    }
  }
}

Run claude in your project directory and enable the OpenWorkers server when prompted.

Setup for Claude Desktop

Edit Claude Desktop config file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%/Claude/claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

Add:

{
  "mcpServers": {
    "openworkers": {
      "command": "ow",
      "args": ["mcp"]
    }
  }
}

Restart Claude Desktop.

Usage

Once configured, you can use natural language:

"List my OpenWorkers workers"

"Create a new worker called my-api"

"Deploy worker.ts to my-api"

Claude will automatically use the appropriate MCP tools.

Note: The MCP server uses your configured alias for authentication. Ensure you have set up an alias and logged in before using MCP tools.

Migrations

Database schema migrations for self-hosted deployments. Requires a DB alias.

ow local migrate status    # Show pending migrations
ow local migrate run       # Apply pending migrations
ow local migrate baseline  # Mark all as applied (for existing databases)

Keep the alias prefix. Without it, the command uses the default alias.

On an empty database, migration 28 stops migrate run with unsafe use of new value "planetscale" of enum type. The CLI runs each file in a transaction, and PostgreSQL does not use a new enum value in the transaction that adds it. Apply that file with psql and record it, as GETTING_STARTED.md shows. Then run migrate run again.

Config File

{
  "version": 1,
  "default": "prod",
  "aliases": {
    "prod": {
      "type": "api",
      "url": "https://dash.openworkers.com/api/v1",
      "token": "ow_xxx"
    },
    "local": {
      "type": "db",
      "database_url": "postgres://localhost/openworkers",
      "user": "admin@example.com"
    }
  }
}

Development

cargo build
cargo run -- workers list
cargo run -- local migrate status

About

No description, website, or topics provided.

Resources

Stars

7 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages