Concepts covered:
- How Hatch is distributed and installed
- CLI structure and available commands
- Configuration directories and cache management
Skills you will practice:
- Installing Hatch using pip
- Verifying the installation
- Exploring CLI help and available commands
This article covers the installation of Hatch, a package manager for Model Context Protocol (MCP) servers.
-
Ensure you have Python 3.12 or later installed on your system.
-
Install Hatch using pip:
git clone https://github.com/CrackingShells/Hatch.git cd Hatch pip install -e .
-
Verify the installation by checking the version:
hatch --version
You should see output like
hatch 0.6.1. You can also view available commands:hatch --help
Hatch provides several command groups:
hatch create- Create new package templateshatch validate- Validate package structureshatch env- Environment management commandshatch package- Package management commands
The CLI accepts the following global configuration options:
--envs-dir- Directory to store environments (default:~/.hatch/envs)--cache-ttl- Cache TTL in seconds (default: 86400 seconds = 1 day)--cache-dir- Directory to store cached packages (default:~/.hatch/cache)
View detailed help for specific command groups:
# Environment management
hatch env --help
# Package management
hatch package --helpExercise:
Explore the help output for the create command. What options are available for each?
Solution
# positional arguments:
# name Package name
#
# options:
# -h, --help show this help message and exit
# --dir DIR, -d DIR Target directory (default: current directory)
# --description DESCRIPTION, -D DESCRIPTION
# Package descriptionNext: Create Environment