Hatchbox MCP server

Integrates with Hatchbox's hosting platform to manage Rails application environment variables, trigger deployments via webhooks, and read deployed configurations through SSH access.
Back to servers
Setup instructions
Provider
PulseMCP
Release date
Aug 20, 2025
Language
JavaScript
Stats
50 stars

The Hatchbox MCP server provides tools to interact with Hatchbox's API, allowing you to manage environment variables and deployments for your Rails applications directly from your AI assistant. It supports environment variable management and deployment control with built-in security features.

Installation

npm install hatchbox-mcp-server

Configuration

Environment Variables

Required Variables

  • HATCHBOX_API_KEY: Your Hatchbox API key for authentication
  • HATCHBOX_ACCOUNT_ID: Your Hatchbox account ID
  • HATCHBOX_APP_ID: Your Hatchbox application ID
  • HATCHBOX_DEPLOY_KEY: Your deployment webhook key

Optional Variables for SSH Access

  • WEB_SERVER_IP_ADDRESS: IP address of your Hatchbox server (enables getEnvVars and getEnvVar tools)
  • SSH_KEY_PATH: Path to SSH private key (defaults to ~/.ssh/id_rsa)
  • HATCHBOX_APP_NAME: App name to filter processes if multiple apps on server

Security Configuration

  • READONLY: Set to false to enable write operations (default: true)
  • ALLOW_DEPLOYS: Set to false to disable deployment operations (default: true)

You can find these values in your Hatchbox dashboard:

  • API key: Account settings
  • Account ID: Visible in the URL when viewing your account
  • App ID: Visible in the URL when viewing your application
  • Deploy key: Application deployment settings
  • Server IP: Your server's public IP address (for SSH access)

SSH Setup (Optional - for reading env vars)

To enable the getEnvVars and getEnvVar tools, you need SSH access to your Hatchbox server:

  1. Add your SSH public key to the deploy user on your Hatchbox server:

    ssh-copy-id deploy@your-server-ip
    
  2. Test SSH access:

    ssh deploy@your-server-ip "echo 'SSH access working'"
    
  3. Configure the MCP server with your server's IP address

Multiple Apps on Same Server

If you have multiple Rails applications running on the same Hatchbox server, specify the HATCHBOX_APP_NAME to identify which app's environment variables to read:

# Example: If your server has multiple apps running
# App 1: mystore (running on port 3000)
# App 2: blog (running on port 3001)

# To read env vars for the 'mystore' app:
HATCHBOX_APP_NAME=mystore

# To read env vars for the 'blog' app:
HATCHBOX_APP_NAME=blog

Claude Desktop Configuration

Add the server to your Claude Desktop configuration file:

macOS

~/Library/Application Support/Claude/claude_desktop_config.json

Windows

%APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "hatchbox": {
      "command": "npx",
      "args": ["-y", "hatchbox-mcp-server"],
      "env": {
        "HATCHBOX_API_KEY": "your-api-key-here",
        "HATCHBOX_ACCOUNT_ID": "1852",
        "HATCHBOX_APP_ID": "8540",
        "HATCHBOX_DEPLOY_KEY": "your-deploy-key-here",

        "// Optional - for SSH access to read env vars": "",
        "WEB_SERVER_IP_ADDRESS": "165.232.133.75",
        "SSH_KEY_PATH": "/Users/yourname/.ssh/id_rsa",
        "HATCHBOX_APP_NAME": "myapp",

        "// Optional - security settings": "",
        "READONLY": "false",
        "ALLOW_DEPLOYS": "true"
      }
    }
  }
}

Tools

Environment Variables

getEnvVars

Get all environment variables from the Hatchbox server via SSH.

Requirements: WEB_SERVER_IP_ADDRESS must be configured.

Parameters: None

Example:

"Show me all environment variables"

getEnvVar

Get a specific environment variable from the Hatchbox server via SSH.

Requirements: WEB_SERVER_IP_ADDRESS must be configured.

Parameters:

  • name (string, required): The name of the environment variable to retrieve

Example:

{
  "name": "RAILS_ENV"
}

setEnvVar

Set or update an environment variable.

Requirements: READONLY must be set to false.

Parameters:

  • name (string, required): The environment variable name
  • value (string, required): The environment variable value

Example:

{
  "name": "DATABASE_URL",
  "value": "postgres://user:pass@host:5432/dbname"
}

deleteEnvVars

Delete one or more environment variables.

Requirements: READONLY must be set to false.

Parameters:

  • names (array of strings, required): Array of environment variable names to delete

Example:

{
  "names": ["OLD_VAR", "UNUSED_VAR"]
}

Deployments

triggerDeploy

Trigger a new deployment for your application.

Requirements: ALLOW_DEPLOYS must be set to true (default).

Parameters:

  • sha (string, optional): Specific commit SHA to deploy (latest if not provided)

Example:

{
  "sha": "abc123def456"
}

checkDeploy

Check the status of a deployment.

Requirements: ALLOW_DEPLOYS must be set to true (default).

Parameters:

  • activityId (string, required): The deployment activity ID returned from triggerDeploy

Example:

{
  "activityId": "12345"
}

Usage Examples

Here are some example queries you can use with Claude:

Reading Environment Variables (requires WEB_SERVER_IP_ADDRESS)

  1. View all environment variables: "Show me all environment variables"

  2. Get a specific variable: "What is the value of RAILS_ENV?"

Writing Environment Variables (requires READONLY=false)

  1. Set an environment variable: "Set the RAILS_ENV to production"

  2. Delete environment variables: "Delete the OLD_VAR and UNUSED_VAR environment variables"

Deployments (requires ALLOW_DEPLOYS=true)

  1. Deploy the latest code: "Deploy the latest commit to Hatchbox"

  2. Deploy a specific commit: "Deploy commit abc123def456 to Hatchbox"

  3. Check deployment status: "Check the status of deployment activity 12345"

Security Notes

API Security

  • Store your API keys securely and never commit them to version control
  • The server only has access to the Hatchbox accounts and applications that your API key can access

SSH Security

  • SSH access exposes ALL environment variables including secrets
  • Ensure your SSH key is properly secured
  • Consider using a dedicated read-only SSH key if possible
  • Only configure WEB_SERVER_IP_ADDRESS if you trust the MCP client with your secrets

Permission Modes

  • Read-only mode (default): Prevents accidental modifications to your production environment
  • Deployment control: Can be disabled separately from write operations
  • Configure permissions based on your security requirements:
    • Development: READONLY=false, ALLOW_DEPLOYS=true
    • Staging: READONLY=false, ALLOW_DEPLOYS=true
    • Production: READONLY=true, ALLOW_DEPLOYS=false (recommended)
  • All API communications are encrypted using HTTPS

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "hatchbox" '{"command":"npx","args":["-y","hatchbox-mcp-server"],"env":{"HATCHBOX_API_KEY":"your-api-key-here","HATCHBOX_ACCOUNT_ID":"1852","HATCHBOX_APP_ID":"8540","HATCHBOX_DEPLOY_KEY":"your-deploy-key-here","WEB_SERVER_IP_ADDRESS":"165.232.133.75","SSH_KEY_PATH":"/Users/yourname/.ssh/id_rsa","HATCHBOX_APP_NAME":"myapp","READONLY":"false","ALLOW_DEPLOYS":"true"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "hatchbox": {
            "command": "npx",
            "args": [
                "-y",
                "hatchbox-mcp-server"
            ],
            "env": {
                "HATCHBOX_API_KEY": "your-api-key-here",
                "HATCHBOX_ACCOUNT_ID": "1852",
                "HATCHBOX_APP_ID": "8540",
                "HATCHBOX_DEPLOY_KEY": "your-deploy-key-here",
                "WEB_SERVER_IP_ADDRESS": "165.232.133.75",
                "SSH_KEY_PATH": "/Users/yourname/.ssh/id_rsa",
                "HATCHBOX_APP_NAME": "myapp",
                "READONLY": "false",
                "ALLOW_DEPLOYS": "true"
            }
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "hatchbox": {
            "command": "npx",
            "args": [
                "-y",
                "hatchbox-mcp-server"
            ],
            "env": {
                "HATCHBOX_API_KEY": "your-api-key-here",
                "HATCHBOX_ACCOUNT_ID": "1852",
                "HATCHBOX_APP_ID": "8540",
                "HATCHBOX_DEPLOY_KEY": "your-deploy-key-here",
                "WEB_SERVER_IP_ADDRESS": "165.232.133.75",
                "SSH_KEY_PATH": "/Users/yourname/.ssh/id_rsa",
                "HATCHBOX_APP_NAME": "myapp",
                "READONLY": "false",
                "ALLOW_DEPLOYS": "true"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later