Scalr MCP Server

Overview

The Scalr MCP (Model Context Protocol) Server enables AI assistants to interact with the Scalr API through natural language. Ask questions, query resources, create workspaces, and manage your infrastructure—all through conversation.

Currently, the MCP server runs locally, where you create the Docker container, with data remaining within your environment.

In the example below, we'll configure Claude Desktop, but the MCP server will work with any LLM.

Prerequisites

Regardless of the MCP client you are using, you will need to review the following prerequisites before using the MCP server.

  • Docker installed and running on your machine. Docker must be running when starting the MCP server.
  • Scalr API token (Personal Access Token or Service Account Token). Learn how to generate a token here.
  • MCP-compatible client (e.g., Claude Desktop)

Example LLM Configuration

Claude Desktop

The following section provides information specific to configuring the Claude desktop app and running the MCP server locally. To start, add the following configuration to your 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

{
  "mcpServers": {
    "scalr": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "--pull=always",
        "--env",
        "SCALR_API_TOKEN=your_api_token_here",
        "--env",
        "SCALR_API_URL=https://your-account.scalr.io",
        "scalr/mcp-server:latest"
      ]
    }
  }
}

You must replace the following values:

  • your_api_token_here with your actual Scalr API token
  • your-account.scalr.io with your Scalr instance URL (e.g., mycompany.scalr.io)

Before restarting Claude, ensure that Docker is running on your machine. Once confirmed, close and reopen Claude Desktop to load the new configuration. Start with a simple question like "List all of my Scalr environments" to make sure that it is pulling the information back from the Scalr API:

Available MCP Tools

MCP tools give large language models (LLMs) the ability to perform actions by calling executable functions exposed by servers. The following tools are available for the Scalr MCP server.

Note: All endpoints marked with x-mcp-tool: true in the Scalr Public OpenAPI Specification are available as MCP tools.

CategoryFunctionDescription
Environmentslist_environmentsList all environments
get_environmentGet details of a specific environment
Workspaceslist_workspacesList all workspaces (with filtering and pagination)
get_workspaceGet details of a specific workspace
create_workspaceCreate a new workspace
Runslist_runsList Terraform/OpenTofu runs
get_runGet details of a specific run
Policy Groupslist_policy_groupsList policy groups
get_policy_groupGet details of a specific policy group
list_pull_request_policy_check_resultsList policy check results for pull requests
Moduleslist_modulesList Terraform modules in the registry
get_moduleGet details of a specific module
VCS Providerslist_vcs_providersList VCS (Version Control System) providers
get_vcs_providerGet details of a specific VCS provider
Token Usagelist_access_token_usageView access token usage statistics
Modules Usagelist_module_usage_namespacesList unique module namespaces
list_terraform_module_sourcesList unique Terraform module sources
list_terraform_module_usagesList module usage across workspaces
list_terraform_module_usageGet detailed usage for a specific module
list_terraform_module_versions_usageList module versions in use
Provider Usagelist_terraform_provider_sourcesList unique Terraform provider sources
list_terraform_provider_usagesList provider usage across workspaces
list_terraform_provider_usageGet detailed usage for a specific provider
list_terraform_provider_versions_usageList provider versions in use
Resource Usagelist_terraform_resource_providersList unique resource provider types
list_terraform_resource_usagesList Terraform resource usage
list_terraform_resource_instances_usageList resource instances with details
Version Usagelist_terraform_versions_usage_versionsList Terraform/OpenTofu versions in use

Troubleshooting

Claude Desktop doesn't show Scalr tools

  • Check configuration file syntax: Ensure your JSON is valid (use a JSON validator)
  • Restart Claude Desktop: Completely quit and reopen the application
  • Check Docker: Ensure Docker is running: docker ps
  • View logs: Check Claude Desktop logs for errors:
    • macOS: ~/Library/Logs/Claude/mcp-server-scalr.log
    • Windows: %APPDATA%\Claude\Logs\mcp-server-scalr.log
    • Linux: ~/.config/Claude/logs/mcp-server-scalr.log

Authentication Errors

  • Verify API token: Test your token with curl:
curl -H "Authorization: Bearer YOUR_TOKEN" \
     https://your-account.scalr.io/api/iacp/v3/account
  • Check token permissions: Ensure the token has appropriate read/write permissions

Docker pull errors

If you see "pull access denied" or network errors:

# Manually pull the image to test connectivity
docker pull scalr/mcp-server:latest

# Check if image exists
docker images | grep scalr/mcp-server

Tools not responding

  • Check API connectivity: Ensure you can reach your Scalr instance
  • Review rate limits: Check if you're hitting API rate limits
  • Increase timeout: Docker might need more time on slower connections

Example Queries

Here are some example questions you can ask Claude:

** Discovery & Exploration**

  • "Show me all workspaces in the production environment"
  • "Which Terraform modules are most used?"
  • "What versions of Terraform are running across my infrastructure?"

Monitoring & Insights

  • "Show me recent runs that failed"
  • "What policy checks have failed recently?"
  • "Show me usage statistics for AWS provider"

Management

  • "Create a workspace named 'new-app-staging' in the dev environment"
  • "Show me details about workspace ws-abc123"
  • "List all VCS providers configured in my account"

Analytics

  • "Which Terraform resources are most commonly used?"
  • "Show me module usage by namespace"
  • "What provider versions are in use?"
  • "List all access tokens and their usage"

Security & Privacy

** Data Privacy**

When using this MCP server, all data remains completely local to your environment. The server operates within a Docker container on your machine, ensuring that your information never leaves your controlled infrastructure. The system makes direct API calls from your machine to your Scalr instance without routing through any third-party servers or intermediaries. For token security, API tokens are passed exclusively as environment variables and are never stored persistently, providing an additional layer of protection for your credentials.

Best Practices

To maintain optimal security when using the MCP server, you should create dedicated API tokens specifically for MCP server usage rather than reusing existing tokens. These tokens should be configured with only the minimum necessary permissions required for the intended operations, following the principle of least privilege. Regular token rotation is essential for maintaining security, so establish a schedule for replacing API tokens periodically. Additionally, you should actively monitor API token usage through the Scalr dashboard to detect any unusual activity or unauthorized access attempts.

Support & Resources