MCP Server

Connect your AI assistant (Claude Desktop, VSCode Copilot, or any MCP-compatible client) to your Scalr account.

The Scalr MCP (Model Context Protocol) Server enables AI assistants to interact with your Scalr infrastructure 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

The following prerequisites are required before using the MCP server.

  • Docker installed and running on your machine.
  • Scalr account with API access.
  • Scalr API token (Personal Access Token or Service Account Token).
  • MCP-compatible client (e.g., Claude Desktop)

Getting Started

Step 1: Get Your API Token

Create a Scalr API token:

  1. Go to your Scalr account settings
  2. Navigate to Personal access tokens
  1. Create a new token with appropriate permissions
  2. Copy the token value

Step 2: Configure Claude Desktop

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"
      ]
    }
  }
}

Important Replace the values listed with your 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)

Step 3: Restart Claude Desktop

Before restarting Claude, ensure that Docker is running on your machine. Once confirmed, close and reopen Claude Desktop to load the new configuration.

Step 4: Start Using!

You can now ask Claude questions like:

  • "List all my Scalr environments"
  • "Show me workspaces in the production environment."
  • "What runs are currently active?"
  • "Create a new workspace named 'staging-app' in the dev environment"
  • "Show me Terraform module usage across all workspaces."

Available Tools

The MCP server provides 26 tools organized by category.

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

  1. Verify API token: Test your token with curl:
    curl -H "Authorization: Bearer YOUR_TOKEN" \
         https://your-account.scalr.io/api/iacp/v3/account
  2. 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

  1. Check API connectivity: Ensure you can reach your Scalr instance
  2. Review rate limits: Check if you're hitting API rate limits
  3. 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