Hatch is the official package manager for the Hatch! ecosystem. It provides powerful tools for managing MCP server packages, environments, and interacting with the Hatch registry. Its primary objective is to service Hatchling (interactive CLI-based chat application integrating local Large Language Models with MCP for tool calling), but can of course be included in other projects.
May 27, 2025: Version 0.2.1 release of the Hatch package manager ecosystem! 🎉
- Integration with Hatchling for MCP servers package management while chatting with LLMs
- Environment isolation system for managing different sets of MCP server packages
- Registry integration for discovering and installing packages
- Package template generation for creating new Hatch MCP server packages
- Environment Management: Create isolated environments for different sets of MCP servers
- Package Installation: Install packages from the registry or local directories
- Dependency Resolution: Automatically resolve and manage package dependencies
- Template Generation: Create new Hatch MCP server package templates with a single command
- Package Validation: Ensure packages conform to the Hatch schema standards
# From source
git clone https://github.com/CrackingShells/Hatch.git
cd Hatch
pip install -e .
Hatch provides both a command-line interface and a Python API for integration into other tools like Hatchling.
The table below summarizes the available commands with their arguments:
Command | Description | Arguments | Example |
---|---|---|---|
create |
Create a new package template | name - Package name--dir, -d - Target directory--description, -D - Package description |
hatch create my-package --description "My awesome MCP server package" |
validate |
Validate a package against schema | package_dir - Path to package directory |
hatch validate ./my-package |
env list |
List all available environments | None | hatch env list |
env create |
Create a new environment | name - Environment name--description, -D - Environment description |
hatch env create my-env --description "Environment for biology tools" |
env use |
Set the current active environment | name - Environment name |
hatch env use my-env |
env remove |
Remove an environment | name - Environment name |
hatch env remove my-env |
env current |
Show the current environment | None | hatch env current |
package add |
Add a package to an environment | package_path_or_name - Path or name of package--env, -e - Environment name--version, -v - Package version |
hatch package add ./my-package --env my-env hatch package add awesome-package --env my-env |
package list |
List packages in an environment | --env, -e - Environment name |
hatch package list --env my-env |
package remove |
Remove a package from an environment | package_name - Name of package to remove--env, -e - Environment name |
hatch package remove awesome-package --env my-env |
from hatch import HatchEnvironmentManager, create_package_template
# Create a new package template
create_package_template("my-package", target_dir="./packages", description="My awesome package")
# Manage environments
env_manager = HatchEnvironmentManager()
env_manager.create_environment("my-env", description="My testing environment")
env_manager.add_package("my-package", env_name="my-env")
packages = env_manager.list_packages("my-env")
Hatch makes it easy to create new MCP server packages:
hatch create my-package --description "My MCP server package"
This creates a template with the following structure:
my-package/
├── __init__.py
├── server.py
├── hatch_metadata.json
└── README.md
Edit the server.py
file to define your MCP tools:
import logging
from hatchling import HatchMCP
# Initialize MCP server with metadata
hatch_mcp = HatchMCP("my-package",
origin_citation="Your Name, 'Original Software', Year",
mcp_citation="Your Name, 'MCP Implementation', Year")
@hatch_mcp.tool()
def my_tool(param1: str, param2: int) -> str:
"""Description of what your tool does.
Args:
param1 (str): First parameter description.
param2 (int): Second parameter description.
Returns:
str: Description of the return value.
"""
hatch_mcp.logger.info(f"Tool called with {param1} and {param2}")
return f"Processed {param1} with value {param2}"
if __name__ == "__main__":
hatch_mcp.run()
Hatch depends on the following Python packages:
- jsonschema 4.0.0 or higher
- requests 2.25.0 or higher
- packaging 20.0 or higher
- Hatch-Validator
hatch/
: Core package source codecli_hatch.py
: CLI implementationenvironment_manager.py
: Environment management functionalitypackage_loader.py
: Package loading and installationregistry_retriever.py
: Registry interactionregistry_explorer.py
: Package search and discoverytemplate_generator.py
: Package template generation
Hatch is part of the larger Hatch! ecosystem which includes:
- Hatchling: Interactive CLI-based chat application integrating local Large Language Models with MCP for tool calling
- Hatch-Schemas: JSON schemas for package metadata and validation
- Hatch-Validator: Validation tools for Hatch packages
- Hatch-Registry: Package registry for Hatch packages
This project is licensed under the GNU Affero General Public License v3