SchreiverJ/cookie-cutter-mcp
If you are the rightful owner of cookie-cutter-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The Cookie Cutter MCP Server is an advanced server that leverages computer vision and computational geometry to transform images into 3D printable cookie cutters.
🍪 Cookie Cutter MCP Server
An advanced MCP (Model Context Protocol) server that transforms images into 3D printable cookie cutters using computer vision and computational geometry.
🌟 Features
🔍 Advanced Image Processing
- Multi-algorithm thresholding: Adaptive, Otsu, and manual threshold methods
- Original algorithm: Exact replication of the proven Cookie Cutter Monster algorithm
- Robust contour detection: Handles complex images with multiple objects
- Smart shape selection: Automatically picks the best contour for cookie cutters
🎯 Intelligent Shape Analysis
- Quality scoring: Evaluates contours by size, compactness, and position
- Boundary creation: "Draw and detect" method for perfect inner/outer boundaries
- Edge case handling: Gracefully processes challenging images
🛠️ Professional 3D Generation
- Watertight meshes: Uses Trimesh library for proper extrusion (like Three.js ExtrudeBufferGeometry)
- No geometry holes: Professional-quality STL files ready for 3D printing
- Configurable parameters: Control every aspect of cookie cutter design
- Handle integration: Automatic comfortable handle generation
🚀 Quick Start
Installation
# Clone and install
cd cookie-cutter-mcp
uv sync
# Or with pip
pip install -e .
Claude Desktop Setup
Add to your Claude Desktop MCP configuration:
{
"mcpServers": {
"cookie-cutter": {
"command": "uv",
"args": ["run", "python", "-m", "cookie_cutter_mcp.server"]
}
}
}
Basic Usage
Generate a cookie cutter from ~/images/logo.png
Analyze ~/complex-image.jpg to see what shapes can be detected
Create cookie cutters for all images in ~/designs/ using professional settings
🎮 Available Tools
1. analyze_image
Preview processing results and get recommendations before generating STL.
Example:
Analyze the image at ~/images/logo.png to see what cookie cutter shapes can be detected
Features:
- Detailed contour analysis with statistics
- Processing recommendations
- Quality assessment and suggestions
2. generate_cookie_cutter
Create a 3D printable cookie cutter STL file.
Example:
Generate a cookie cutter from ~/images/logo.png and save it as ~/3d-prints/logo-cutter.stl with professional quality settings
Configuration options:
thickness
: Wall thickness (0.5-3.0mm)depth
: Cutting depth (8-25mm)size
: Maximum dimension (20-150mm)bevel_cutter
: Sharp beveled edgeround_handle
: Comfortable rounded handletolerance
: Detail level (0.05-1.0)
3. batch_generate_cutters
Process multiple images at once.
Example:
Generate cookie cutters for all images in ~/logos/ and save them to ~/cutters/
4. create_preset_config
Get optimized configurations for different use cases.
Example:
Show me the configuration preset for small detailed cookie cutters
Available presets:
small_detailed
: Intricate designs, fine detailslarge_simple
: Big shapes, fast printingprofessional
: Balanced quality and speedminiature
: Tiny detailed cutterscustom
: Your own specifications
🧠 Algorithm Overview
1. Image Processing (Exact Original Algorithm)
- Padding: 10px with
BORDER_WRAP
(notBORDER_CONSTANT
) - Thresholding: Adaptive with block_size=5, C=1 (exact original parameters)
- Contour Detection:
RETR_LIST
method for comprehensive shape finding - Area Filtering: 10%-90% of image area to exclude noise and boundaries
2. Boundary Creation ("Draw and Detect" Method)
- 10x Scale Drawing: Draw contour as thick lines at 10x target size
- Dual Thresholding: Binary inversion + second threshold for clean boundaries
- Inner/Outer Extraction: Automatically find cutting boundaries
- Scale Back: Return to target dimensions with proper offsets
3. 3D Geometry Generation
- Trimesh Extrusion: Uses
trimesh.creation.extrude_polygon()
to extrude polygons
🎛️ Configuration Reference
Parameter | Default | Range | Description |
---|---|---|---|
thickness | 1.0mm | 0.5-3.0mm | Wall thickness |
depth | 16.0mm | 8-25mm | Cutting depth |
size | 76.0mm | 20-150mm | Maximum dimension |
tolerance | 0.15 | 0.05-1.0 | Point simplification |
bevel_cutter | false | boolean | Sharp beveled edge |
round_handle | false | boolean | Rounded handle |
threshold_method | adaptive | adaptive/otsu/manual | Edge detection method |
🖨️ 3D Printing Guidelines
Recommended Settings
- Layer height: 0.15-0.2mm
- Infill: 15-20%
- Print speed: 40-60mm/s
- Supports: None needed
- Bed adhesion: Skirt
Material Recommendations
- PLA: Easy printing, food safe when certified, some can be dishwasher safe if annealed
- PETG: More durable, pptentially food safe
Post-Processing
- Light sanding of cutting edge for sharpness
- Clean with isopropyl alcohol before food use
- Store in dry location to prevent warping
- Try annealing to make your plastic dishwasher resistant, works with some PLAs
🐛 Troubleshooting
No Contours Detected or Too Many Small Contours
- Try preprocessing image for better contrast
🔬 Technical Details
Dependencies
- OpenCV: Image processing and contour detection
- Trimesh: Professional 3D mesh operations and STL export
- Shapely: Robust geometric operations
- NumPy: Numerical computations
- mapbox-earcut: Polygon triangulation
🤝 Contributing
This project demonstrates advanced computer vision and 3D geometry techniques. Key areas for enhancement:
- Additional visualization tools for debugging
- More sophisticated contour selection algorithms
- Advanced mesh optimization techniques
- Support for multi-part cookie cutters
- Integration with slicing software APIs
📜 License
MIT License - Feel free to use and modify for your projects!
🙏 Acknowledgments
Based on the original Cookie Cutter Monster algorithm, reimagined for modern Python tooling and MCP integration. https://github.com/SchreiverJ/CookieCutterMonster#