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_herewith your actual Scalr API tokenyour-account.scalr.iowith 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.
| Category | Function | Description |
|---|---|---|
| Environments | list_environments | List all environments |
get_environment | Get details of a specific environment | |
| Workspaces | list_workspaces | List all workspaces (with filtering and pagination) |
get_workspace | Get details of a specific workspace | |
create_workspace | Create a new workspace | |
| Runs | list_runs | List Terraform/OpenTofu runs |
get_run | Get details of a specific run | |
| Policy Groups | list_policy_groups | List policy groups |
get_policy_group | Get details of a specific policy group | |
list_pull_request_policy_check_results | List policy check results for pull requests | |
| Modules | list_modules | List Terraform modules in the registry |
get_module | Get details of a specific module | |
| VCS Providers | list_vcs_providers | List VCS (Version Control System) providers |
get_vcs_provider | Get details of a specific VCS provider | |
| Token Usage | list_access_token_usage | View access token usage statistics |
| Modules Usage | list_module_usage_namespaces | List unique module namespaces |
list_terraform_module_sources | List unique Terraform module sources | |
list_terraform_module_usages | List module usage across workspaces | |
list_terraform_module_usage | Get detailed usage for a specific module | |
list_terraform_module_versions_usage | List module versions in use | |
| Provider Usage | list_terraform_provider_sources | List unique Terraform provider sources |
list_terraform_provider_usages | List provider usage across workspaces | |
list_terraform_provider_usage | Get detailed usage for a specific provider | |
list_terraform_provider_versions_usage | List provider versions in use | |
| Resource Usage | list_terraform_resource_providers | List unique resource provider types |
list_terraform_resource_usages | List Terraform resource usage | |
list_terraform_resource_instances_usage | List resource instances with details | |
| Version Usage | list_terraform_versions_usage_versions | List 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
- macOS:
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-serverTools 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
- Scalr API Documentation: https://docs.scalr.io/reference/overview-1
- Model Context Protocol: https://modelcontextprotocol.io/
- Docker Hub: https://hub.docker.com/r/scalr/mcp-server
Updated about 15 hours ago
