The HUD CLI provides a complete toolkit for creating, developing, and running MCP environments. Commands are organized into two main workflows:

Building Environments

Directory-based commands for creating and sharing environments:
  • hud init - Create new environment
  • hud dev - Develop with hot-reload
  • hud build - Build and generate lock file
  • hud push - Share to registry

Running Environments

Target-based commands for consuming environments:
  • hud pull - Get from registry
  • hud analyze - Inspect capabilities
  • hud debug - Test compliance
  • hud run - Execute locally/remotely

Installation

uv tool install hud-python
hud --version

Commands

Building Workflow

CommandInputDescriptionExample
hud initDirectoryCreate new environmenthud init my-env
hud devDirectoryHot-reload developmenthud dev . --interactive
hud buildDirectoryBuild image & lock filehud build . --tag v1.0
hud pushDirectoryShare to registryhud push . --tag prod

Running Workflow

CommandInputDescriptionExample
hud pullTargetGet environment from registryhud pull org/env:latest
hud analyzeTargetInspect tools & capabilitieshud analyze org/env
hud debugTargetTest MCP compliancehud debug my-env:latest
hud runTargetExecute serverhud run my-env --local

Utilities

CommandDescriptionExample
hud quickstartClone quickstart repositoryhud quickstart
hud cursor-listList Cursor MCP servershud cursor-list
hud versionShow version infohud version

Complete Workflows

Building an Environment

1

Initialize

Create a new HUD environment with minimal boilerplate:
hud init my-env && cd my-env
Creates Dockerfile, pyproject.toml, and minimal MCP server with context.
2

Develop

Run with hot-reload and interactive testing:
hud dev
Your changes reload automatically. Test tools interactively with arrow keys.
3

Build

Create production image and lock file:
hud build
Generates hud.lock.yaml with metadata and labels image for reproducibility.
4

Push

Share to Docker and HUD registries:
hud push
Requires HUD_API_KEY. Auto-detects registry from Docker login.

Running an Environment

1

Pull

Get environment with metadata preview:
hud pull hudpython/text_init:latest
Shows tools, env vars, and build info before downloading.
2

Analyze

Quick inspection without running:
hud analyze hudpython/text_init    # Fast (from metadata)
hud analyze hudpython/text_init --live  # Full (runs container)
3

Debug

Test MCP protocol compliance:
hud debug hudpython/text_init:latest
Validates through 5 phases of initialization.
4

Run

Execute in production mode:
hud run hudpython/text_init:latest        # Remote (default)
hud run hudpython/text_init:latest --local  # Local Docker

Common Usage

Docker Images

# Basic
hud debug my-image:latest

# With options
hud debug my-image:latest -e DEBUG=true -p 8080:8080

# From registry
hud analyze ghcr.io/org/image:v1.0.0

Local Commands

# Python script
hud debug --command "python server.py"

# Node.js server
hud debug --command "node mcp-server.js"

Cursor Integration

# Debug Cursor server
hud debug --cursor my-dev-server

# List all servers
hud cursor-list

Output Formats

Interactive (Default)

hud analyze my-env

🔍 Analyzing MCP environment: my-env
 Connected successfully
 Found 12 tools

Available Tools:
 click - Click at coordinates
 type - Type text
  ...

JSON

hud analyze my-env --format json

{
  "tools": [{
    "name": "click",
    "description": "Click at coordinates",
    "parameters": {...}
  }]
}

Markdown

hud analyze my-env --format markdown > docs/tools.md

CI/CD Example

#!/bin/bash
set -e

# Test environment
hud debug "$IMAGE_NAME"

# Verify tools
TOOLS=$(hud analyze "$IMAGE_NAME" --format json | jq '.tools | length')
if [ "$TOOLS" -lt 3 ]; then
  echo "Not enough tools!"
  exit 1
fi

Python Scripting

import subprocess
import json

def get_tools(image):
    result = subprocess.run(
        ["hud", "analyze", image, "--format", "json"],
        capture_output=True,
        text=True,
        check=True
    )
    return json.loads(result.stdout)["tools"]

# Use
tools = get_tools("my-env:latest")
for tool in tools:
    print(f"- {tool['name']}: {tool['description']}")

Exit Codes

CodeMeaningDescription
0SuccessCommand completed
1General ErrorCommand failed
2Usage ErrorInvalid arguments
3Connection ErrorFailed to connect
4TimeoutOperation timed out
5Protocol ErrorMCP violation

Environment Variables

# Debug output
export HUD_CLI_DEBUG=true

# Custom timeout
export HUD_CLI_TIMEOUT=120

# Provider keys
export ANCHOR_API_KEY=...

Next Steps

Building Commands

Running Commands