Skip to main content

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).

Legacy install channels

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.

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

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​

CommandDescription
stoactl deployDeploy an API from a stoa.yaml file
stoactl logsShow deployment history for an API
stoactl initInitialize a new STOA project
stoactl bridgeConvert OpenAPI spec to MCP Tool CRDs
stoactl doctorRun diagnostic checks
stoactl applyCreate or update a resource from a YAML file
stoactl getList resources (apis, tenants, subscriptions, gateways)
stoactl deleteDelete a resource
stoactl authAuthentication commands
stoactl configManage CLI contexts
stoactl token-usageView API token usage statistics
stoactl reconcileReconcile UAC contracts from a local governance snapshot
stoactl gatewayManage and inspect gateway instances (gw, gateways)
stoactl mcpList MCP servers/tools, invoke tools, and check MCP health
stoactl catalogDetect catalog drift or trigger synchronization
stoactl subscriptionList, inspect, approve, or revoke subscriptions (sub)
stoactl tenantProvision, inspect, list, or delete tenants
stoactl connectInspect stoa-connect (STOA Link) agents and discover gateway APIs
stoactl auditExport tenant audit logs (table, json, yaml, csv)
stoactl completionGenerate shell completion scripts (bash, zsh, fish)
stoactl versionPrint version information

Global Flags​

Flag / EnvDescription
--tenant <id> / STOACTL_TENANTOverride the active context's tenant ID for the command
--adminAuthenticate with the configured service-account token instead of the user OIDC token
--namespace <ns> / STOACTL_NAMESPACEDeprecated 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):

FlagDefaultDescription
--envβ€”Target environment: dev, staging, production (required)
--watch, -wfalsePoll deployment status until completion (success or failure)
--output, -otableOutput 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:

FlagRequiredDescription
--api-idYesAPI ID to deploy
--envYesTarget environment
--versionYesVersion to deploy (e.g. 2.0.0)
--gatewayNoTarget gateway ID
--commitNoGit commit SHA (for traceability)
--watch, -wNoWatch 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:

FlagDescription
--api-idFilter by API ID
--envFilter by environment
--statusFilter by status: pending, in_progress, success, failed, rolled_back
--pagePage number (default: 1)
--page-sizeItems per page (default: 20)
-oOutput 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:

FlagDefaultDescription
--envβ€”Filter by environment (dev, staging, production)
--limit10Number 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:

StatusMeaning
OKDeployment succeeded
FAILDeployment failed (see MESSAGE column)
...Deployment in progress
WAITDeployment 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:

FlagDefaultDescription
--port8080Gateway port
--dir.Parent directory for the project
--no-contextfalseSkip 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 backend
  • stoa.yaml β€” Gateway configuration
  • echo-nginx.conf β€” Echo backend (static JSON for testing)
  • example-api.yaml β€” Sample OpenAPI spec for bridge
  • README.md β€” Project-specific quickstart
  • tools/ β€” Output directory for bridge

stoactl doctor​

Run 6 diagnostic checks to verify your local setup.

stoactl doctor

Checks:

CheckWhat it verifies
DockerDocker daemon is running
GatewayHealth endpoint responds (HTTP 200)
KeychainOS Keychain is accessible
API keyValid authentication token exists
PortGateway port is available
MCP endpointSSE 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:

FlagDefaultDescription
--namespace(required)Target namespace for generated tools
--output./tools/Output directory for YAML files
--serverFrom specOverride servers[0].url
--auth-secretβ€”K8s secret name for authentication
--include-tagsAllOnly include operations with these tags
--exclude-tagsNoneExclude operations with these tags
--include-opsAllOnly include these operationIds
--timeout30sDefault timeout for generated tools
--dry-runfalseShow summary without writing files
--applyfalseRegister 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 FieldTool CRD Field
operationIdmetadata.name (kebab-case)
summaryspec.displayName
descriptionspec.description
servers[0].url + pathspec.endpoint
HTTP methodspec.method
parameters + requestBodyspec.inputSchema
security + securitySchemesspec.authentication
tagsspec.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:

  1. You receive a code and URL
  2. Open the URL in your browser
  3. Enter the code to authorize
  4. 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]
FlagDefaultDescription
--autofalseEnable automatic rotation reminder
--interval90dRotation 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
FlagDefaultDescription
--file, -fβ€”Local YAML or JSON snapshot containing targets and contracts (required)
--state.stoactl-reconcile.jsonLocal reconciliation status file
--oncefalseRun a single reconciliation pass and exit
--interval5sContinuous 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 / FlagDescription
list-serversList 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, -oOutput 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}"
Envoy xDS mode vs stoactl connect discover / sync
  • stoactl connect discover only supports admin-API gateways (--type kong|gravitee|webmethods|auto). Upstream Envoy has no admin-API discovery path: Envoy mode is configured on the stoa-connect agent via STOA_GATEWAY_TYPE=envoy and loopback mTLS ADS (STOA_ENVOY_* variables; see stoa-connect Quickstart).
  • The CLI also defines stoactl connect sync --url <url> (POST <url>/sync), but cmd/stoa-connect/main.go on current main mounts only /health, /metrics, and /webhook/events (do not use connect sync against stoa-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
FlagDefaultDescription
--tenantβ€”Tenant ID (required)
--since7dLookback window (24h, 7d, 30d, or ISO-8601 date)
--action""Filter by audit action name
--redact-piitrueMask email addresses and IP addresses in exported records
--output, -otableOutput 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

Cookies and privacy

With your permission, we use cookies to measure visits and understand navigation to improve the site.

Learn more

Google Analytics measures visits and useful clicks. Microsoft Clarity provides masked interaction replays. No advertising use. Your choice is saved for six months. You can change or withdraw it at any time using the β€œCookies” button.

Read the audience measurement details