CLI Reference (stoactl)
stoactl is a kubectl-style CLI for managing STOA Platform resources. It provides API deployment, project scaffolding, API-to-MCP bridging, diagnostics, and resource management.
Installationβ
stoactl lives in the stoa-go/ directory of the stoa-platform/stoa monorepo and requires Go 1.25+ (stoa-go/go.mod).
Do not use go install github.com/stoa-platform/stoactl@latest (frozen standalone repository at v0.3.0), brew install stoa-platform/tap/stoactl (outdated Homebrew tap formula 0.1.1 and cask 0.3.0), or https://get.gostoa.dev (legacy bootstrap URLs). Monorepo GitHub Releases stoa-go-v0.3.9 and stoa-go-v0.3.10 currently publish zero binary assets; build stoactl from a verified monorepo checkout instead.
- Release tag (stoa-go-v0.3.10)
- Verified main commit (639e8b9a)
git clone https://github.com/stoa-platform/stoa.git
cd stoa
git checkout stoa-go-v0.3.10
cd stoa-go
make install # installs stoactl (and stoa-connect) into GOBIN if set, otherwise $(go env GOPATH)/bin
# Includes post-v0.3.10 main additions (stoactl reconcile and stoa-connect Envoy xDS support)
git clone https://github.com/stoa-platform/stoa.git
cd stoa
git checkout 639e8b9a2217695cfc2f590e246ed9d4ce4d4913
cd stoa-go
go build -ldflags "-s -w -X github.com/stoa-platform/stoa-go/internal/cli/cmd.Version=0.3.10-main -X github.com/stoa-platform/stoa-go/internal/cli/cmd.Commit=639e8b9a" \
-o ./bin/stoactl ./cmd/stoactl
Verify the compiled binary using the path matching your chosen build method:
# After `make install` (with GOBIN or $(go env GOPATH)/bin on PATH):
stoactl version
# After `go build -o ./bin/stoactl`:
./bin/stoactl version
Quick Referenceβ
| Command | Description |
|---|---|
stoactl deploy | Deploy an API from a stoa.yaml file |
stoactl logs | Show deployment history for an API |
stoactl init | Initialize a new STOA project |
stoactl bridge | Convert OpenAPI spec to MCP Tool CRDs |
stoactl doctor | Run diagnostic checks |
stoactl apply | Create or update a resource from a YAML file |
stoactl get | List resources (apis, tenants, subscriptions, gateways) |
stoactl delete | Delete a resource |
stoactl auth | Authentication commands |
stoactl config | Manage CLI contexts |
stoactl token-usage | View API token usage statistics |
stoactl reconcile | Reconcile UAC contracts from a local governance snapshot |
stoactl gateway | Manage and inspect gateway instances (gw, gateways) |
stoactl mcp | List MCP servers/tools, invoke tools, and check MCP health |
stoactl catalog | Detect catalog drift or trigger synchronization |
stoactl subscription | List, inspect, approve, or revoke subscriptions (sub) |
stoactl tenant | Provision, inspect, list, or delete tenants |
stoactl connect | Inspect stoa-connect (STOA Link) agents and discover gateway APIs |
stoactl audit | Export tenant audit logs (table, json, yaml, csv) |
stoactl completion | Generate shell completion scripts (bash, zsh, fish) |
stoactl version | Print version information |
Global Flagsβ
| Flag / Env | Description |
|---|---|
--tenant <id> / STOACTL_TENANT | Override the active context's tenant ID for the command |
--admin | Authenticate with the configured service-account token instead of the user OIDC token |
--namespace <ns> / STOACTL_NAMESPACE | Deprecated global flag (prints a deprecation warning in favor of --tenant; --namespace / -n on stoactl bridge remains active for Kubernetes CRD metadata) |
Deployment Commandsβ
stoactl deployβ
Deploy an API to a target environment from a stoa.yaml file, or use sub-commands to manage deployments imperatively.
stoactl deploy [stoa.yaml] [flags]
stoactl deploy <subcommand>
File-based deploy (recommended):
stoactl deploy ./stoa.yaml --env production
stoactl deploy ./api.yaml --env dev --watch
Flags (file-based deploy):
| Flag | Default | Description |
|---|---|---|
--env | β | Target environment: dev, staging, production (required) |
--watch, -w | false | Poll deployment status until completion (success or failure) |
--output, -o | table | Output format: table, wide, yaml, json |
stoactl deploy createβ
Create a deployment imperatively (without a stoa.yaml file).
stoactl deploy create --api-id <id> --env <env> --version <version> [flags]
Flags:
| Flag | Required | Description |
|---|---|---|
--api-id | Yes | API ID to deploy |
--env | Yes | Target environment |
--version | Yes | Version to deploy (e.g. 2.0.0) |
--gateway | No | Target gateway ID |
--commit | No | Git commit SHA (for traceability) |
--watch, -w | No | Watch deployment until completion |
Example:
stoactl deploy create --api-id customer-api --env production --version 2.0.0 --watch
stoactl deploy listβ
List recent deployments with optional filters.
stoactl deploy list [flags]
stoactl deploy ls [flags]
Flags:
| Flag | Description |
|---|---|
--api-id | Filter by API ID |
--env | Filter by environment |
--status | Filter by status: pending, in_progress, success, failed, rolled_back |
--page | Page number (default: 1) |
--page-size | Items per page (default: 20) |
-o | Output format: table, wide, yaml, json |
Example:
stoactl deploy list --env production --status success -o wide
stoactl deploy getβ
Get detailed information about a specific deployment.
stoactl deploy get <deployment-id>
Example:
stoactl deploy get deploy-abc12345
stoactl deploy get deploy-abc12345 -o json
stoactl deploy rollbackβ
Rollback a deployment to its previous version.
stoactl deploy rollback <deployment-id>
Example:
# Find the deployment to roll back
stoactl deploy list --api-id customer-api --env production
# Roll back
stoactl deploy rollback deploy-abc12345
stoactl logsβ
Show deployment history for an API β recent deployments, statuses, and error messages.
stoactl logs <api-name> [flags]
Flags:
| Flag | Default | Description |
|---|---|---|
--env | β | Filter by environment (dev, staging, production) |
--limit | 10 | Number of recent deployments to show |
Example:
stoactl logs customer-api
stoactl logs customer-api --env production --limit 5
Output columns: ID, ENV, VERSION, STATUS, BY, STARTED, MESSAGE
Status values:
| Status | Meaning |
|---|---|
OK | Deployment succeeded |
FAIL | Deployment failed (see MESSAGE column) |
... | Deployment in progress |
WAIT | Deployment queued |
<<< | Deployment was rolled back |
Project Commandsβ
stoactl initβ
Create a new STOA project with everything needed to run a local MCP gateway.
stoactl init <name> [flags]
Flags:
| Flag | Default | Description |
|---|---|---|
--port | 8080 | Gateway port |
--dir | . | Parent directory for the project |
--no-context | false | Skip creating a local CLI context |
Example:
stoactl init my-api --port 9090
cd my-api
docker compose up -d
stoactl doctor
Generated files:
docker-compose.ymlβ Gateway + echo backendstoa.yamlβ Gateway configurationecho-nginx.confβ Echo backend (static JSON for testing)example-api.yamlβ Sample OpenAPI spec for bridgeREADME.mdβ Project-specific quickstarttools/β Output directory for bridge
stoactl doctorβ
Run 6 diagnostic checks to verify your local setup.
stoactl doctor
Checks:
| Check | What it verifies |
|---|---|
| Docker | Docker daemon is running |
| Gateway | Health endpoint responds (HTTP 200) |
| Keychain | OS Keychain is accessible |
| API key | Valid authentication token exists |
| Port | Gateway port is available |
| MCP endpoint | SSE endpoint is responding |
Bridge Commandsβ
stoactl bridgeβ
Convert an OpenAPI 3.x specification into STOA Tool CRDs. Each path+method operation becomes a separate MCP tool.
stoactl bridge <spec-file> [flags]
Flags:
| Flag | Default | Description |
|---|---|---|
--namespace | (required) | Target namespace for generated tools |
--output | ./tools/ | Output directory for YAML files |
--server | From spec | Override servers[0].url |
--auth-secret | β | K8s secret name for authentication |
--include-tags | All | Only include operations with these tags |
--exclude-tags | None | Exclude operations with these tags |
--include-ops | All | Only include these operationIds |
--timeout | 30s | Default timeout for generated tools |
--dry-run | false | Show summary without writing files |
--apply | false | Register tools directly via API (planned) |
Examples:
# Generate tools from an OpenAPI spec
stoactl bridge petstore.yaml --namespace tenant-acme
# Preview without writing files
stoactl bridge petstore.yaml --namespace tenant-acme --dry-run
# Filter by tags
stoactl bridge api.yaml --namespace default --include-tags payments --exclude-tags internal
# Override backend URL
stoactl bridge api.yaml --namespace default --server https://api.internal.com
Mapping rules:
| OpenAPI Field | Tool CRD Field |
|---|---|
operationId | metadata.name (kebab-case) |
summary | spec.displayName |
description | spec.description |
servers[0].url + path | spec.endpoint |
| HTTP method | spec.method |
parameters + requestBody | spec.inputSchema |
security + securitySchemes | spec.authentication |
tags | spec.tags |
Resource Commandsβ
stoactl applyβ
Create or update a resource from a YAML file.
stoactl apply -f <file>
Example:
# Apply a single tool
stoactl apply -f tools/list-pets.yaml
# Apply all tools in a directory
for f in tools/*.yaml; do stoactl apply -f "$f"; done
stoactl getβ
List resources from the control plane.
stoactl get <resource-type>
Resource types: apis, tenants, subscriptions, gateways
Example:
stoactl get apis
stoactl get api payment-api
stoactl get subscriptions
To list deployments, use stoactl deploy list.
stoactl deleteβ
Delete a resource.
stoactl delete <resource-type> <name>
Example:
stoactl delete api payment-api
Authentication Commandsβ
stoactl auth loginβ
Authenticate with STOA Platform using OAuth2 device flow.
stoactl auth login
This initiates the device authorization flow:
- You receive a code and URL
- Open the URL in your browser
- Enter the code to authorize
- Credentials are stored in your OS Keychain
stoactl auth logoutβ
Remove stored credentials.
stoactl auth logout
stoactl auth statusβ
Display current authentication status.
stoactl auth status
stoactl auth rotate-keyβ
Generate a new API key and store it in the OS Keychain.
stoactl auth rotate-key [flags]
| Flag | Default | Description |
|---|---|---|
--auto | false | Enable automatic rotation reminder |
--interval | 90d | Rotation interval |
Configuration Commandsβ
stoactl config set-contextβ
Create or update a named context.
stoactl config set-context <name> --server <url> --tenant <tenant>
Example:
stoactl config set-context prod --server ${STOA_API_URL} --tenant acme
stoactl config set-context local --server http://localhost:8080 --tenant default
stoactl config use-contextβ
Switch to a named context.
stoactl config use-context <name>
stoactl config get-contextsβ
List all configured contexts.
stoactl config get-contexts
Utility Commandsβ
stoactl token-usageβ
View API token usage statistics.
stoactl token-usage
stoactl versionβ
Print version and build information.
stoactl version
Governance, Platform & Agent Commandsβ
stoactl reconcileβ
Reconcile owned Universal API Contracts (UAC) against target gateways from a local YAML or JSON governance snapshot (stoa-go/internal/cli/cmd/reconcile/).
stoactl reconcile -f ./snapshot.yaml --once
stoactl reconcile -f ./snapshot.yaml --interval 10s --state .stoactl-reconcile.json
| Flag | Default | Description |
|---|---|---|
--file, -f | β | Local YAML or JSON snapshot containing targets and contracts (required) |
--state | .stoactl-reconcile.json | Local reconciliation status file |
--once | false | Run a single reconciliation pass and exit |
--interval | 5s | Continuous reconciliation loop interval |
stoactl gatewayβ
Manage registered gateway instances (aliases: gw, gateways; supports -o table|wide|yaml|json).
stoactl gateway list
stoactl gateway get <gateway-id>
stoactl gateway health <gateway-id>
stoactl mcpβ
Interact with MCP servers and tools via the Control Plane API (default source of truth) or check public gateway MCP health (health --gateway <url>).
stoactl mcp list-servers
stoactl mcp list-tools --server weather-mcp
stoactl mcp call get-weather --server weather-mcp --input '{"q":"Paris"}'
stoactl mcp health
stoactl mcp health --gateway http://localhost:8080
| Subcommand / Flag | Description |
|---|---|
list-servers | List registered MCP servers via the Control Plane API (--gateway is ignored) |
list-tools [--server <name>] | List MCP tools via the Control Plane API (optionally filtered by server) |
call <tool-name> --server <name> [--input '<json>'] | Invoke an MCP tool via the Control Plane API (--server is required) |
health [--gateway <url>] | Check MCP subsystem health (Control Plane API by default, or public GET <url>/mcp/health with --gateway) |
--output, -o | Output format: table, json, yaml |
--gateway direct-mode limitations (mcp.go)Use the Control Plane path above for list-tools and call. In current stoa-go, --gateway <url> works for stoactl mcp health --gateway <url> (which reads public GET <url>/mcp/health), whereas list-tools --gateway and call --gateway send unauthenticated requests to JWT-gated /mcp/v1/tools* routes and call --gateway posts legacy {"tool_name", "input"} fields whereas POST /mcp/v1/tools/invoke expects {"tool", "arguments"} (handlers.rs; POST /mcp/tools/call expects {"name", "arguments"}).
stoactl catalogβ
Inspect API catalog drift or trigger synchronization (dry-run by default unless --apply is passed).
stoactl catalog sync --tenant acme
stoactl catalog sync --tenant acme --apply -o json
stoactl subscriptionβ
Manage consumer API subscriptions (aliases: sub, subscriptions; supports -o table|wide|yaml|json).
stoactl subscription list --status pending
stoactl subscription get <subscription-id>
stoactl subscription approve <subscription-id>
stoactl subscription revoke <subscription-id>
stoactl tenantβ
Manage platform tenants and inspect Keycloak provisioning status (-o table|wide|yaml|json).
stoactl tenant list
stoactl tenant create --name acme --display-name "Acme Corp" --owner-email ops@example.com
stoactl tenant status acme
stoactl tenant get acme
stoactl tenant delete acme
stoactl connectβ
Inspect stoa-connect (STOA Link) agents and run ad-hoc admin-API discovery.
# Check stoa-connect / STOA Link agent health (:8090/health)
stoactl connect status --url http://localhost:8090
# Discover APIs directly from a third-party gateway admin API
stoactl connect discover --admin-url http://localhost:8001 --type kong --token "${KONG_ADMIN_TOKEN}"
stoactl connect discover / syncstoactl connect discoveronly supports admin-API gateways (--type kong|gravitee|webmethods|auto). Upstream Envoy has no admin-API discovery path: Envoy mode is configured on thestoa-connectagent viaSTOA_GATEWAY_TYPE=envoyand loopback mTLS ADS (STOA_ENVOY_*variables; see stoa-connect Quickstart).- The CLI also defines
stoactl connect sync --url <url>(POST <url>/sync), butcmd/stoa-connect/main.goon currentmainmounts only/health,/metrics, and/webhook/events(do not useconnect syncagainststoa-connect; policy and route synchronization runs automatically via the agent's sync/SSE loops).
stoactl auditβ
Export tenant audit logs with PII redaction enabled by default.
stoactl audit export --tenant acme --since 7d -o csv
stoactl audit export --tenant acme --action subscription.approved --redact-pii=true -o json
| Flag | Default | Description |
|---|---|---|
--tenant | β | Tenant ID (required) |
--since | 7d | Lookback window (24h, 7d, 30d, or ISO-8601 date) |
--action | "" | Filter by audit action name |
--redact-pii | true | Mask email addresses and IP addresses in exported records |
--output, -o | table | Output format: table, json, yaml, csv |
stoactl completionβ
Generate shell completion scripts for bash, zsh, or fish.
stoactl completion zsh > "${fpath[1]}/_stoactl"
stoactl completion bash > /etc/bash_completion.d/stoactl
stoactl completion fish > ~/.config/fish/completions/stoactl.fish
Workflowsβ
Deploy an API (stoa.yaml)β
# 1. Authenticate
stoactl auth login
# 2. Create stoa.yaml (or export from Console)
cat > stoa.yaml <<EOF
name: customer-api
version: 2.0.0
rate_limit:
requests_per_minute: 1000
auth:
type: oauth2
issuer: ${STOA_AUTH_URL}/realms/stoa
required: true
EOF
# 3. Deploy to staging first
stoactl deploy ./stoa.yaml --env staging --watch
# 4. Check logs
stoactl logs customer-api --env staging
# 5. Deploy to production
stoactl deploy ./stoa.yaml --env production --watch
Rollback a failed deploymentβ
# 1. Find the failed deployment
stoactl deploy list --api-id customer-api --env production
# 2. Roll back
stoactl deploy rollback deploy-abc12345
# 3. Confirm rollback succeeded
stoactl logs customer-api --env production --limit 3
Bridge an API to MCPβ
# 1. Set up project
stoactl init my-api && cd my-api
# 2. Start gateway
docker compose up -d
# 3. Verify setup
stoactl doctor
# 4. Connect to hosted platform (optional)
stoactl config set-context prod --server ${STOA_API_URL} --tenant acme
stoactl auth login
# 5. Bridge your API to MCP
stoactl bridge your-api.yaml --namespace default --output ./tools/
# 6. Register tools
for f in tools/*.yaml; do stoactl apply -f "$f"; done
Relatedβ
- stoa.yaml Reference β Full field reference for the deployment spec
- ADR-045: stoa.yaml Declarative API Spec β Design decisions
- Environment Management Guide β Managing dev, staging, production