Scalr · Capability

Scalr Infrastructure as Code

Unified workflow capability for managing Terraform and OpenTofu infrastructure as code operations through Scalr's remote execution platform. Combines workspace management, environment management, run execution, cloud management, and account-level configuration for platform teams and DevOps engineers managing infrastructure at scale with policy enforcement and cost estimation.

Run with Naftiko DevOpsFinOpsGitOpsInfrastructure as CodeOpenTofuPolicyScalrTerraform

What You Can Do

GET
List environments — List Scalr environments
/v1/environments
POST
Create environment — Create a Scalr environment
/v1/environments
GET
Get environment — Get environment details
/v1/environments/{id}
GET
List farms — List Scalr farms
/v1/farms
POST
Create farm — Create a Scalr farm
/v1/farms
POST
Execute farm action — Execute a farm lifecycle action (launch, suspend, terminate)
/v1/farms/{id}/actions/{action}
GET
List servers — List servers in a farm role
/v1/servers
GET
List cloud credentials — List cloud credentials
/v1/cloud-credentials
GET
List roles — List account roles
/v1/roles
GET
List global variables — List global variables
/v1/global-variables

MCP Tools

list-environments

List Scalr environments within an account

read-only
create-environment

Create a new Scalr environment

get-environment

Get details of a specific Scalr environment

read-only
list-farms

List Scalr cloud management farms

read-only
create-farm

Create a new Scalr farm

execute-farm-action

Execute a lifecycle action on a Scalr farm (launch, suspend, terminate)

list-servers

List cloud servers managed by Scalr farm role

read-only
list-cloud-credentials

List cloud provider credentials configured in Scalr

read-only
list-roles

List roles defined in Scalr account

read-only
list-global-variables

List global variables available across all Scalr environments

read-only
list-global-images

List images available globally across all Scalr accounts

read-only
list-global-roles

List roles defined globally in Scalr

read-only

APIs Used

scalr-user scalr-account scalr-global

Capability Spec

infrastructure-as-code.yaml Raw ↑
naftiko: "1.0.0-alpha1"

info:
  label: "Scalr Infrastructure as Code"
  description: >-
    Unified workflow capability for managing Terraform and OpenTofu infrastructure as code
    operations through Scalr's remote execution platform. Combines workspace management,
    environment management, run execution, cloud management, and account-level configuration
    for platform teams and DevOps engineers managing infrastructure at scale with policy
    enforcement and cost estimation.
  tags:
    - DevOps
    - FinOps
    - GitOps
    - Infrastructure as Code
    - OpenTofu
    - Policy
    - Scalr
    - Terraform
  created: "2026-05-02"
  modified: "2026-05-02"

binds:
  - namespace: env
    keys:
      SCALR_TOKEN: SCALR_TOKEN
      SCALR_API_KEY: SCALR_API_KEY
      SCALR_ACCOUNT: SCALR_ACCOUNT

capability:
  consumes:
    - import: scalr-user
      location: ./shared/user-api.yaml
    - import: scalr-account
      location: ./shared/account-api.yaml
    - import: scalr-global
      location: ./shared/global-api.yaml

  exposes:
    - type: rest
      port: 8080
      namespace: scalr-iac-api
      description: "Unified REST API for Scalr IaC platform management."
      resources:
        - path: /v1/environments
          name: environments
          description: "Environment management (account-level)"
          operations:
            - method: GET
              name: list-environments
              description: "List Scalr environments"
              call: "scalr-account.list-environments"
              with:
                accountId: "rest.accountId"
              outputParameters:
                - type: object
                  mapping: "$."
            - method: POST
              name: create-environment
              description: "Create a Scalr environment"
              call: "scalr-account.create-environment"
              with:
                accountId: "rest.accountId"
              outputParameters:
                - type: object
                  mapping: "$."
        - path: /v1/environments/{id}
          name: environment
          description: "Manage a specific environment"
          operations:
            - method: GET
              name: get-environment
              description: "Get environment details"
              call: "scalr-account.get-environment"
              with:
                accountId: "rest.accountId"
                envId: "rest.id"
              outputParameters:
                - type: object
                  mapping: "$."
        - path: /v1/farms
          name: farms
          description: "Cloud management farms (user-level)"
          operations:
            - method: GET
              name: list-farms
              description: "List Scalr farms"
              call: "scalr-user.list-farms"
              with:
                envId: "rest.envId"
              outputParameters:
                - type: object
                  mapping: "$."
            - method: POST
              name: create-farm
              description: "Create a Scalr farm"
              call: "scalr-user.create-farm"
              with:
                envId: "rest.envId"
              outputParameters:
                - type: object
                  mapping: "$."
        - path: /v1/farms/{id}/actions/{action}
          name: farm-action
          description: "Execute farm lifecycle actions"
          operations:
            - method: POST
              name: execute-farm-action
              description: "Execute a farm lifecycle action (launch, suspend, terminate)"
              call: "scalr-user.execute-farm-action"
              with:
                envId: "rest.envId"
                farmId: "rest.id"
                action: "rest.action"
              outputParameters:
                - type: object
                  mapping: "$."
        - path: /v1/servers
          name: servers
          description: "Cloud servers managed by Scalr"
          operations:
            - method: GET
              name: list-servers
              description: "List servers in a farm role"
              call: "scalr-user.list-servers"
              with:
                envId: "rest.envId"
                farmRoleId: "rest.farmRoleId"
              outputParameters:
                - type: object
                  mapping: "$."
        - path: /v1/cloud-credentials
          name: cloud-credentials
          description: "Cloud provider credentials"
          operations:
            - method: GET
              name: list-cloud-credentials
              description: "List cloud credentials"
              call: "scalr-account.list-cloud-credentials"
              with:
                accountId: "rest.accountId"
              outputParameters:
                - type: object
                  mapping: "$."
        - path: /v1/roles
          name: roles
          description: "Role definitions"
          operations:
            - method: GET
              name: list-roles
              description: "List account roles"
              call: "scalr-account.list-roles"
              with:
                accountId: "rest.accountId"
              outputParameters:
                - type: object
                  mapping: "$."
        - path: /v1/global-variables
          name: global-variables
          description: "Global variables"
          operations:
            - method: GET
              name: list-global-variables
              description: "List global variables"
              call: "scalr-global.list-global-variables"
              outputParameters:
                - type: object
                  mapping: "$."

    - type: mcp
      port: 9090
      namespace: scalr-iac-mcp
      transport: http
      description: "MCP server for AI-assisted Terraform and OpenTofu infrastructure management via Scalr."
      tools:
        - name: list-environments
          description: "List Scalr environments within an account"
          hints:
            readOnly: true
            openWorld: true
          call: "scalr-account.list-environments"
          with:
            accountId: "tools.accountId"
          outputParameters:
            - type: object
              mapping: "$."
        - name: create-environment
          description: "Create a new Scalr environment"
          hints:
            readOnly: false
            destructive: false
            idempotent: false
          call: "scalr-account.create-environment"
          with:
            accountId: "tools.accountId"
          outputParameters:
            - type: object
              mapping: "$."
        - name: get-environment
          description: "Get details of a specific Scalr environment"
          hints:
            readOnly: true
            openWorld: false
          call: "scalr-account.get-environment"
          with:
            accountId: "tools.accountId"
            envId: "tools.envId"
          outputParameters:
            - type: object
              mapping: "$."
        - name: list-farms
          description: "List Scalr cloud management farms"
          hints:
            readOnly: true
            openWorld: true
          call: "scalr-user.list-farms"
          with:
            envId: "tools.envId"
          outputParameters:
            - type: object
              mapping: "$."
        - name: create-farm
          description: "Create a new Scalr farm"
          hints:
            readOnly: false
            destructive: false
            idempotent: false
          call: "scalr-user.create-farm"
          with:
            envId: "tools.envId"
          outputParameters:
            - type: object
              mapping: "$."
        - name: execute-farm-action
          description: "Execute a lifecycle action on a Scalr farm (launch, suspend, terminate)"
          hints:
            readOnly: false
            destructive: true
            idempotent: false
          call: "scalr-user.execute-farm-action"
          with:
            envId: "tools.envId"
            farmId: "tools.farmId"
            action: "tools.action"
          outputParameters:
            - type: object
              mapping: "$."
        - name: list-servers
          description: "List cloud servers managed by Scalr farm role"
          hints:
            readOnly: true
            openWorld: false
          call: "scalr-user.list-servers"
          with:
            envId: "tools.envId"
            farmRoleId: "tools.farmRoleId"
          outputParameters:
            - type: object
              mapping: "$."
        - name: list-cloud-credentials
          description: "List cloud provider credentials configured in Scalr"
          hints:
            readOnly: true
            openWorld: true
          call: "scalr-account.list-cloud-credentials"
          with:
            accountId: "tools.accountId"
          outputParameters:
            - type: object
              mapping: "$."
        - name: list-roles
          description: "List roles defined in Scalr account"
          hints:
            readOnly: true
            openWorld: true
          call: "scalr-account.list-roles"
          with:
            accountId: "tools.accountId"
          outputParameters:
            - type: object
              mapping: "$."
        - name: list-global-variables
          description: "List global variables available across all Scalr environments"
          hints:
            readOnly: true
            openWorld: true
          call: "scalr-global.list-global-variables"
          outputParameters:
            - type: object
              mapping: "$."
        - name: list-global-images
          description: "List images available globally across all Scalr accounts"
          hints:
            readOnly: true
            openWorld: true
          call: "scalr-global.list-global-images"
          outputParameters:
            - type: object
              mapping: "$."
        - name: list-global-roles
          description: "List roles defined globally in Scalr"
          hints:
            readOnly: true
            openWorld: true
          call: "scalr-global.list-global-roles"
          outputParameters:
            - type: object
              mapping: "$."