Files
sigma/docs/cli.md
T
Tosone 187f5c4d97 refactor(server)!: remove the embedded MCP server
Sigma shipped three overlapping ways to operate a remote server: the
embedded MCP server, sigma-cli, and the sigma-api-operator skill. All
three wrapped the same HTTP API, yet each covered a different subset:
user CRUD existed only in the CLI, system-* only in MCP, and builders,
daemons, webhooks, validators, code repositories and tokens were
reachable only through raw HTTP. MCP was disabled by default and still
carried 1246 lines of production code plus 606 lines of tests to
maintain that partially overlapping surface.

Keep two surfaces instead: sigma-cli for execution and the skill for
API discovery.

- delete pkg/server/mcp and its mcp-go dependency, which also drops the
  jsonschema-go, jsonschema/v6 and uritemplate/v3 transitives
- drop ConfigurationMCP, its defaults and the authz/audit skipper
  bypasses that existed only to let the MCP endpoint bypass both
- remove the mcp section from conf/config*.yaml, docs/configuration.md,
  and the Helm chart values and configmap
- replace docs/mcp.md with docs/cli.md covering sigma-cli login, global
  flags, per-resource commands, jq composition and agent usage
- make sigma-cli the preferred path in the sigma-api-operator skill and
  rebuild its examples around the resources the CLI does not wrap yet,
  using the paths and request schemas from swagger.yaml

Lint was already red on dev for an unrelated reason: golangci-lint
v2.13.0 vendors golang.org/x/tools v0.49.0, which only decodes export
data version 4, so every import of a Go 1.27.2 standard library package
failed typecheck with "export data version 5 is greater than maximum
supported version 4". Bump to v2.15.0 (x/tools v0.52.0) and fix the two
modernize findings it reports for Go 1.27's strings.CutLast.

- .github/workflows/lint.yml: golangci-lint v2.13.0 -> v2.15.0, and
  document the export data constraint next to the pin
- pkg/authz/resolver.go, pkg/logger/logger.go: replace LastIndex slicing
  with strings.CutLast
- bump github.com/docker/cli v29.9.0 -> v29.9.1

BREAKING CHANGE: the `mcp` configuration section and the /api/v1/mcp
endpoint are gone. Use sigma-cli or the REST API for automation.

Verification:
- go build -tags "netgo,timetzdata,exclude_graphdriver_btrfs,containers_image_openpgp" ./...
- go vet -tags "netgo,timetzdata,exclude_graphdriver_btrfs,containers_image_openpgp" ./...
- golangci-lint v2.15.0 run --build-tags "netgo,timetzdata,exclude_graphdriver_btrfs,containers_image_openpgp" ./... (0 issues)
- golangci-lint config verify
- go test -tags "netgo,timetzdata,exclude_graphdriver_btrfs,containers_image_openpgp" ./pkg/authz/... ./pkg/logger/... ./cmd/cli/... ./pkg/app/... ./pkg/background/build/...
- go test -run TestConfiguration -tags "netgo,timetzdata,exclude_graphdriver_btrfs,containers_image_openpgp" ./pkg/config/...
- go mod tidy
- make swagen
- helm template sigma ./deploy/sigma
- bun run docs:build
- make build
- make build-cli
2026-10-21 19:33:07 +08:00

4.1 KiB
Raw Blame History

title
title
CLI & AI Agents

CLI & AI Agents

Sigma exposes two ways to operate a remote server from a terminal or an AI agent. Both talk to the same HTTP API, so anything you can do in the Sigma web UI can be scripted.

Path Best for
sigma-cli Humans, CI pipelines, and shell-capable agents
sigma-api-operator skill AI agents that need to discover APIs beyond what the CLI covers

There is no embedded MCP server. Agents that cannot execute commands should use a thin HTTP client against the REST API described by the OpenAPI document.

Build the CLI

make build-cli
./bin/sigma-cli --help

Login

sigma-cli stores Basic Auth credentials in ~/.sigma/cli-credentials.json with 0600 permissions. Override the location with --credentials-file or SIGMA_CREDENTIALS_FILE.

./bin/sigma-cli login \
  --server https://sigma.example.com \
  --username sigma \
  --password 'Admin@123'

Credentials can also be supplied without a credentials file through the persistent flags or environment variables:

export SIGMA_SERVER=https://sigma.example.com
export SIGMA_USERNAME=sigma
export SIGMA_PASSWORD='Admin@123'

Global flags:

Flag Env Default
--server SIGMA_SERVER http://localhost:3000
--credentials-file SIGMA_CREDENTIALS_FILE ~/.sigma/cli-credentials.json
--timeout – 30s
--debug – false

Command Reference

Namespace

sigma-cli namespace list --page 1 --limit 10
sigma-cli namespace get <namespace_id>
sigma-cli namespace create library --visibility public --description "Base images"
sigma-cli namespace update <namespace_id> --size-limit 107374182400
sigma-cli namespace delete <namespace_id>

Repository

sigma-cli repo list <namespace_id>
sigma-cli repo get <namespace_id> <repository_id>
sigma-cli repo create <namespace_id> library/alpine --visibility public
sigma-cli repo update <namespace_id> <repository_id> --description "Alpine images"
sigma-cli repo delete <namespace_id> <repository_id>

Tag

sigma-cli tag list <namespace_id> <repository_id> --type image
sigma-cli tag get <namespace_id> <repository_id> <tag_id>
sigma-cli tag delete <namespace_id> <repository_id> <tag_id>

Artifact

Artifact commands take namespace and repository names rather than IDs.

sigma-cli artifact list <namespace_name> <repository_name>
sigma-cli artifact get <namespace_name> <repository_name> <digest>
sigma-cli artifact delete <namespace_name> <repository_name> <digest>

Member

sigma-cli member list <namespace_id>
sigma-cli member add <namespace_id> <user_id> --role reader
sigma-cli member update <namespace_id> <user_id> --role admin
sigma-cli member delete <namespace_id> <user_id>

User

sigma-cli user list --without-admin
sigma-cli user create --username alice --password '...' --email alice@example.com --role user
sigma-cli user update <user_id> --role admin --status enabled

All commands print JSON on success and a formatted error body on failure, so output composes with jq:

sigma-cli namespace list --limit 100 | jq -r '.items[].name'

AI Agents

tools/skill/sigma-api-operator packages a skill for CLI agents such as Claude Code or Copilot CLI:

tools/skill/sigma-api-operator/SKILL.md
tools/skill/sigma-api-operator/swagger.yaml

The skill instructs the agent to load the OpenAPI document before issuing requests. This is required for resources the CLI does not wrap yet — builders, daemons, webhooks, validators, code repositories, and tokens — which must be called through the REST API.

Refresh the packaged specification after changing handlers:

make swagen

Safety

  • Destructive commands (delete, credential and privilege changes) require explicit confirmation by the agent.
  • Prefer HTTPS for remote servers; Basic Auth credentials travel with every request.
  • Do not print passwords, tokens, private keys, or Authorization headers.
  • Redact sensitive fields before surfacing non-2xx response bodies.