{"id":26111196,"url":"https://github.com/dmontgomery40/mcp-3d-printer-server","last_synced_at":"2025-04-12T22:35:02.380Z","repository":{"id":279676919,"uuid":"939583958","full_name":"DMontgomery40/mcp-3D-printer-server","owner":"DMontgomery40","description":"Connects MCP to major 3D printer APIs (OctoPrint, Klipper, Duet, Repetier, Bambu, Prusa, Creality). Control prints, monitor status, and perform advanced STL operations like scaling, rotation, sectional editing, and base extension. Includes slicing and visualization.","archived":false,"fork":false,"pushed_at":"2025-03-11T13:53:40.000Z","size":16186,"stargazers_count":14,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-04T09:46:41.864Z","etag":null,"topics":["3d-printing","bambu-lab","bambu-studio","duet","g-code","klipper","mcp","mcp-server","modelcontextprotocol","moonraker","octoprint","repetier","repetier-server","stl-files","three-js","threejs"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DMontgomery40.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-26T19:19:47.000Z","updated_at":"2025-03-28T04:16:08.000Z","dependencies_parsed_at":"2025-02-26T20:40:30.557Z","dependency_job_id":null,"html_url":"https://github.com/DMontgomery40/mcp-3D-printer-server","commit_stats":null,"previous_names":["dmontgomery40/mcp-3d-printer-server"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DMontgomery40%2Fmcp-3D-printer-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DMontgomery40%2Fmcp-3D-printer-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DMontgomery40%2Fmcp-3D-printer-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DMontgomery40%2Fmcp-3D-printer-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DMontgomery40","download_url":"https://codeload.github.com/DMontgomery40/mcp-3D-printer-server/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248642308,"owners_count":21138350,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["3d-printing","bambu-lab","bambu-studio","duet","g-code","klipper","mcp","mcp-server","modelcontextprotocol","moonraker","octoprint","repetier","repetier-server","stl-files","three-js","threejs"],"created_at":"2025-03-10T01:48:41.605Z","updated_at":"2025-04-12T22:35:02.373Z","avatar_url":"https://github.com/DMontgomery40.png","language":"TypeScript","funding_links":[],"categories":["Embedded System","カテゴリ"],"sub_categories":["How to Submit","📡 \u003ca name=\"iot--hardware\"\u003e\u003c/a\u003eIoT・ハードウェア"],"readme":"# MCP 3D Printer Server\n\n[![npm version](https://img.shields.io/npm/v/mcp-3d-printer-server.svg)](https://www.npmjs.com/package/mcp-3d-printer-server)\n[![License: GPL-2.0](https://img.shields.io/badge/License-GPL%20v2-blue.svg)](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)\n[![TypeScript](https://img.shields.io/badge/TypeScript-4.9%2B-blue)](https://www.typescriptlang.org/)\n[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/yourusername/mcp-3d-printer-server/graphs/commit-activity)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://makeapullrequest.com)\n[![Node.js Version](https://img.shields.io/badge/node-%3E%3D%2018.0.0-green.svg)](https://nodejs.org/en/download/)\n[![Downloads](https://img.shields.io/npm/dm/mcp-3d-printer-server.svg)](https://www.npmjs.com/package/mcp-3d-printer-server)\n[![GitHub stars](https://img.shields.io/github/stars/yourusername/mcp-3d-printer-server.svg?style=social\u0026label=Star)](https://github.com/yourusername/mcp-3d-printer-server)\n\n\u003ca href=\"https://glama.ai/mcp/servers/7f6v2enbgk\"\u003e\n  \u003cimg width=\"380\" height=\"200\" src=\"https://glama.ai/mcp/servers/7f6v2enbgk/badge\" alt=\"3D Printer Server MCP server\" /\u003e\n\u003c/a\u003e\n\n## Description\n\nThis is a server that allows MCP users to connect with the API endpoints of these 3D Printers: \n\n- OctoPrint\n- Klipper (Moonraker)\n- Duet\n- Repetier\n- Bambu Labs\n- Prusa Connect\n- Creality/Ender\n\nThis server is a Model Context Protocol (MCP) server for connecting Claude with 3D printer management systems. It allows Claude to interact with 3D printers through the APIs of various printer management systems such as OctoPrint, Klipper (via Moonraker), Duet, Repetier, and Bambu Labs printers.\n\n**Note on Resource Usage**: This MCP server includes advanced 3D model manipulation features that can be memory-intensive when working with large STL files. Please see the \"Limitations and Considerations\" section for important information about memory usage and performance.\n\n## Features\n\n- Get printer status (temperatures, print progress, etc.)\n- List files on the printer\n- Upload G-code files to the printer\n- Start, cancel, and monitor print jobs\n- Set printer temperatures\n- Advanced STL file manipulation:\n  - Extend base for better adhesion\n  - Scale models uniformly or along specific axes\n  - Rotate models around any axis\n  - Translate (move) models\n  - Modify specific sections of STL files (top, bottom, center, or custom)\n- Comprehensive STL analysis with detailed model information\n- Generate multi-angle SVG visualizations of STL files\n- Real-time progress reporting for long operations\n- Error handling with detailed diagnostics\n- Slice STL files to generate G-code\n- Confirm temperature settings in G-code files\n- Complete end-to-end workflow from STL modification to printing\n\n## Installation\n\n### Prerequisites\n\n- Node.js 18 or higher\n- npm or yarn\n\n### Install from npm\n\n```bash\nnpm install -g mcp-3d-printer-server\n```\n\n### Install from source\n\n```bash\ngit clone https://github.com/yourusername/mcp-3d-printer-server.git\ncd mcp-3d-printer-server\nnpm install\nnpm link  # Makes the command available globally\n```\n\n## Configuration\n\nCreate a `.env` file in the directory where you'll run the server or set environment variables:\n\n```env\n# Required for authentication with your printer management system\nAPI_KEY=your_api_key_here\n\n# Default printer connection settings\nPRINTER_HOST=localhost\nPRINTER_PORT=80\nPRINTER_TYPE=octoprint  # Options: octoprint, klipper, duet, repetier, bambu\n\n# Optional: Directory for temporary files\nTEMP_DIR=/path/to/temp/dir\n\n# Bambu Labs specific configuration\nBAMBU_SERIAL=your_printer_serial\nBAMBU_TOKEN=your_access_token\n\n# Slicer configuration\nSLICER_TYPE=prusaslicer  # Options: prusaslicer, cura, slic3r\nSLICER_PATH=/path/to/slicer/executable\nSLICER_PROFILE=/path/to/slicer/profile\n```\n\n## Usage with Claude Desktop\n\n1. Edit your Claude Desktop configuration file:\n\n```json\n{\n  \"mcpServers\": {\n    \"3dprint\": {\n      \"command\": \"mcp-3d-printer-server\",\n      \"env\": {\n        \"API_KEY\": \"your_api_key_here\",\n        \"PRINTER_HOST\": \"your_printer_ip\",\n        \"PRINTER_TYPE\": \"octoprint\"\n      }\n    }\n  }\n}\n```\n\n2. For Bambu Labs printers:\n\n```json\n{\n  \"mcpServers\": {\n    \"3dprint\": {\n      \"command\": \"mcp-3d-printer-server\",\n      \"env\": {\n        \"PRINTER_HOST\": \"your_printer_ip\",\n        \"PRINTER_TYPE\": \"bambu\",\n        \"BAMBU_SERIAL\": \"your_printer_serial\",\n        \"BAMBU_TOKEN\": \"your_access_token\"\n      }\n    }\n  }\n}\n```\n\n3. Restart Claude Desktop\n4. Connect to your printer through Claude\n\n## Supported Printer Management Systems\n\n### OctoPrint\n\nOctoPrint is a popular web interface for 3D printers. It provides a REST API for controlling the printer.\n\n- Default port: 80 (http) or 443 (https)\n- Authentication: API key required\n\n### Klipper (via Moonraker)\n\nKlipper is a firmware for 3D printers that works with the Moonraker API server.\n\n- Default port: 7125\n- Authentication: Depends on your Moonraker configuration\n\n### Duet\n\nDuet is a control board for 3D printers with its own web interface (DuetWebControl).\n\n- Default port: 80 (http) or 443 (https)\n- Authentication: Depends on your Duet configuration\n\n### Repetier\n\nRepetier-Server is a host software for 3D printers.\n\n- Default port: 3344\n- Authentication: API key required\n\n### Bambu Labs\n\nBambu Lab printers use MQTT for status and control and FTP for file operations.\n\n- Authentication: Serial number and access token required\n- Requirements: Printer must be on the same network or have cloud connection enabled\n- Compatible with: X1C, P1S, P1P, A1, and other Bambu Lab printers\n\n#### Finding Your Bambu Printer's Serial Number and Access Token\n\nTo connect to your Bambu Lab printer, you need two things:\n\n1. **Printer Serial Number**: \n   - Look on the back or bottom of your printer for a sticker with a serial number (typically starts with \"01P\" or \"01A\" followed by numbers/letters)\n   - Alternatively, open Bambu Studio, connect to your printer, go to Device \u003e Device Management, and view your printer's information\n\n2. **Access Token**: \n   - The access token is a security code needed to connect directly to your printer\n   - For P1 Series printers: Go to the touchscreen, select Settings \u003e Network \u003e LAN Mode, and you'll see the access code\n   - For X1 Series printers: Go to the touchscreen, select Settings \u003e Network \u003e LAN Mode, and enable LAN Mode to see the access code\n   - For A1 Mini: Use the Bambu Handy app to connect to your printer, then go to Settings \u003e Network \u003e LAN Mode\n\n**Note**: If your printer is not on the same local network or you can't find the access token, you may need to update your printer's firmware to the latest version to enable LAN Mode.\n\n### Prusa Connect\n\nPrusa Connect is Prusa's own cloud-based solution for managing their printers.\n\n- Default port: 80 (http) or 443 (https)\n- Authentication: API key required\n- Compatible with: Prusa MK4, Prusa Mini, Prusa XL, and other Prusa printers with Prusa Connect\n\n#### Setting up Prusa Connect\n\n1. Make sure your Prusa printer is updated to the latest firmware\n2. Connect your printer to your Wi-Fi network\n3. Create a Prusa Connect account and register your printer\n4. Generate an API key from the Prusa Connect web interface under Settings \u003e API Access\n\n### Creality Cloud\n\nCreality Cloud is Creality's management system for their printers.\n\n- Default port: 80 (http) or 443 (https)\n- Authentication: Bearer token required\n- Compatible with: Ender series, CR series, and other Creality printers with network capabilities\n\n#### Setting up Creality Cloud\n\n1. Install the Creality Cloud app on your mobile device\n2. Create an account and add your printer\n3. Enable local network access for your printer\n4. Generate a token from the Creality Cloud app under Settings \u003e Developer Options\n\n## Available Tools\n\n### STL Manipulation Tools\n\n\u003e **Memory Usage Warning**: The following STL manipulation tools load entire 3D models into memory. For large or complex STL files (\u003e10MB), these operations can consume significant memory. When using these tools within the MCP environment, be mindful of memory constraints.\n\n#### get_stl_info\n\nGet detailed information about an STL file, including dimensions, vertex count, and bounding box.\n\n```json\n{\n  \"stl_path\": \"/path/to/file.stl\"\n}\n```\n\n#### extend_stl_base\n\nExtend the base of an STL file by a specified amount.\n\n```json\n{\n  \"stl_path\": \"/path/to/file.stl\",\n  \"extension_inches\": 2\n}\n```\n\n#### scale_stl\n\nScale an STL model uniformly or along specific axes.\n\n```json\n{\n  \"stl_path\": \"/path/to/file.stl\",\n  \"scale_factor\": 1.5\n}\n```\n\nOr for non-uniform scaling:\n\n```json\n{\n  \"stl_path\": \"/path/to/file.stl\",\n  \"scale_x\": 1.2,\n  \"scale_y\": 1.0,\n  \"scale_z\": 1.5\n}\n```\n\n#### rotate_stl\n\nRotate an STL model around specific axes (in degrees).\n\n```json\n{\n  \"stl_path\": \"/path/to/file.stl\",\n  \"rotate_x\": 45,\n  \"rotate_y\": 0,\n  \"rotate_z\": 90\n}\n```\n\n#### translate_stl\n\nMove an STL model along specific axes (in millimeters).\n\n```json\n{\n  \"stl_path\": \"/path/to/file.stl\",\n  \"translate_x\": 10,\n  \"translate_y\": 5,\n  \"translate_z\": 0\n}\n```\n\n#### modify_stl_section\n\nApply a specific transformation to a selected section of an STL file. This allows for detailed modifications of specific parts of a model.\n\n```json\n{\n  \"stl_path\": \"/path/to/file.stl\",\n  \"section\": \"top\",\n  \"transformation_type\": \"scale\",\n  \"value_x\": 1.5,\n  \"value_y\": 1.5, \n  \"value_z\": 1.5\n}\n```\n\nFor custom section bounds:\n\n```json\n{\n  \"stl_path\": \"/path/to/file.stl\",\n  \"section\": \"custom\",\n  \"transformation_type\": \"rotate\",\n  \"value_x\": 0,\n  \"value_y\": 0, \n  \"value_z\": 45,\n  \"custom_min_x\": -10,\n  \"custom_min_y\": 0,\n  \"custom_min_z\": -10,\n  \"custom_max_x\": 10,\n  \"custom_max_y\": 20,\n  \"custom_max_z\": 10\n}\n```\n\n#### generate_stl_visualization\n\nGenerate an SVG visualization of an STL file from multiple angles (front, side, top, and isometric views).\n\n```json\n{\n  \"stl_path\": \"/path/to/file.stl\",\n  \"width\": 400,\n  \"height\": 400\n}\n```\n\n#### slice_stl\n\nSlice an STL file to generate G-code.\n\n```json\n{\n  \"stl_path\": \"/path/to/file.stl\",\n  \"slicer_type\": \"prusaslicer\",\n  \"slicer_path\": \"/path/to/prusaslicer\",\n  \"slicer_profile\": \"/path/to/profile.ini\"\n}\n```\n\n#### confirm_temperatures\n\nConfirm temperature settings in a G-code file.\n\n```json\n{\n  \"gcode_path\": \"/path/to/file.gcode\",\n  \"extruder_temp\": 200,\n  \"bed_temp\": 60\n}\n```\n\n#### process_and_print_stl\n\nProcess an STL file (extend base), slice it, confirm temperatures, and start printing.\n\n```json\n{\n  \"stl_path\": \"/path/to/file.stl\",\n  \"extension_inches\": 2,\n  \"extruder_temp\": 200,\n  \"bed_temp\": 60,\n  \"host\": \"192.168.1.100\",\n  \"type\": \"octoprint\",\n  \"api_key\": \"YOUR_API_KEY\"\n}\n```\n\n### Printer Control Tools\n\n#### get_printer_status\n\nGet the current status of the 3D printer.\n\n```json\n{\n  \"host\": \"192.168.1.100\",\n  \"type\": \"octoprint\",\n  \"api_key\": \"YOUR_API_KEY\"\n}\n```\n\nFor Bambu printers:\n\n```json\n{\n  \"host\": \"192.168.1.100\",\n  \"type\": \"bambu\",\n  \"bambu_serial\": \"YOUR_PRINTER_SERIAL\",\n  \"bambu_token\": \"YOUR_ACCESS_TOKEN\"\n}\n```\n\n### list_printer_files\n\nList files available on the printer.\n\n```json\n{\n  \"host\": \"192.168.1.100\",\n  \"type\": \"octoprint\",\n  \"api_key\": \"YOUR_API_KEY\"\n}\n```\n\n### upload_gcode\n\nUpload a G-code file to the printer.\n\n```json\n{\n  \"host\": \"192.168.1.100\",\n  \"type\": \"octoprint\",\n  \"api_key\": \"YOUR_API_KEY\",\n  \"filename\": \"my_print.gcode\",\n  \"gcode\": \"G28\\nG1 X100 Y100 Z10 F3000\\n...\",\n  \"print\": true\n}\n```\n\n### start_print\n\nStart printing a file that is already on the printer.\n\n```json\n{\n  \"host\": \"192.168.1.100\",\n  \"type\": \"octoprint\",\n  \"api_key\": \"YOUR_API_KEY\",\n  \"filename\": \"my_print.gcode\"\n}\n```\n\n### cancel_print\n\nCancel the current print job.\n\n```json\n{\n  \"host\": \"192.168.1.100\",\n  \"type\": \"octoprint\",\n  \"api_key\": \"YOUR_API_KEY\"\n}\n```\n\n### set_printer_temperature\n\nSet the temperature of a printer component.\n\n```json\n{\n  \"host\": \"192.168.1.100\",\n  \"type\": \"octoprint\",\n  \"api_key\": \"YOUR_API_KEY\",\n  \"component\": \"extruder\",\n  \"temperature\": 200\n}\n```\n\n## Available Resources\n\n- `printer://{host}/status` - Current status of the 3D printer\n- `printer://{host}/files` - List of files available on the 3D printer\n- `printer://{host}/file/{filename}` - Content of a specific file on the 3D printer\n\n## Example Commands for Claude\n\nHere are some example commands you can give to Claude after connecting the MCP server:\n\n### Printer Control\n- \"What's the current status of my 3D printer?\"\n- \"Show me the list of files on my printer.\"\n- \"Upload this G-code to my printer: [G-code content]\"\n- \"Start printing the file named 'benchy.gcode'.\"\n- \"Cancel the current print job.\"\n- \"Set the extruder temperature to 200°C.\"\n- \"Set the bed temperature to 60°C.\"\n\n### STL Manipulation and Printing\n- \"Take this STL file and extend the base by 2 inches, then send to slicer and queue up in my printer.\"\n- \"Extend the base of model.stl by 1.5 inches.\"\n- \"Scale this STL file by 150% uniformly.\"\n- \"Scale model.stl to be twice as wide but keep the same height.\"\n- \"Rotate this model 90 degrees around the Z axis.\"\n- \"Move this STL model up by 5mm to create a gap underneath.\"\n- \"Can you modify just the top part of this model to make it 20% larger?\"\n- \"Analyze this STL file and tell me its dimensions and details.\"\n- \"Generate a visualization of this STL file so I can see what it looks like.\"\n- \"Create SVG visualizations of my model from different angles.\"\n- \"Make the base of this model wider without changing its height.\"\n- \"Slice the modified STL file using PrusaSlicer.\"\n- \"Confirm that the temperatures in the G-code are 200°C for the extruder and 60°C for the bed.\"\n- \"Process this STL file, make the base 2 inches longer, slice it, and start printing, but confirm the temperatures first.\"\n\n## Bambu Lab Printer Limitations\n\nDue to the nature of the Bambu Lab printer API, there are some limitations:\n\n1. **Starting prints**: Starting a print requires the 3MF project file path, gcode file name, print name, and MD5 hash. The simplified API in this server doesn't support this fully yet.\n\n2. **Temperature control**: The Bambu API doesn't provide direct methods to set temperatures. This would require custom G-code commands.\n\n3. **File management**: Files must be uploaded to the \"gcodes\" directory on the printer.\n\n## Limitations and Considerations\n\n### Memory Usage\n- **Large STL Files**: Processing large or complex STL files can consume significant memory. The entire STL geometry is loaded into memory during operations.\n- **Multiple Operations**: Running multiple STL operations in sequence (especially on large files) may cause memory to accumulate if garbage collection doesn't keep up.\n- **MCP Environment**: Since this runs as an MCP server, be aware that Claude's MCP environment has memory constraints. Complex operations on very large STL files may cause out-of-memory issues.\n\n### STL Manipulation Limitations\n- **Section Modification**: The section-specific modification feature works best on simpler geometries. Complex or non-manifold meshes may produce unexpected results.\n- **Base Extension**: The base extension algorithm works by adding a new geometry underneath the model. For models with complex undersides, results may not be perfect.\n- **Error Handling**: While we've added robust error handling, some edge cases in complex STL files might still cause issues.\n\n### Visualization Limitations\n- **SVG Representation**: The SVG visualization is a simplified schematic representation, not a true 3D render.\n- **Complex Models**: For very complex models, the visualization may not accurately represent all details.\n\n### Performance Considerations\n- **Slicing Operations**: External slicer processes can be CPU-intensive and may take considerable time for complex models.\n- **Progress Reporting**: For large files, progress updates may appear to stall at certain processing stages.\n\n### Testing Recommendations\n- Start with smaller STL files (\u003c 10MB) to test functionality\n- Monitor memory usage when processing large files\n- Test modifications on simple geometries before attempting complex ones\n- Consider running on a system with at least 4GB of available RAM for larger operations\n\n## Badges\n\n| Badge | Description |\n|-------|-------------|\n| [![npm version](https://img.shields.io/npm/v/mcp-3d-printer-server.svg)](https://www.npmjs.com/package/mcp-3d-printer-server) | The current version of the package on npm |\n| [![License: GPL-2.0](https://img.shields.io/badge/License-GPL%20v2-blue.svg)](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html) | This project is licensed under GPL-2.0 |\n| [![TypeScript](https://img.shields.io/badge/TypeScript-4.9%2B-blue)](https://www.typescriptlang.org/) | This project is written in TypeScript 4.9+ |\n| [![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/yourusername/mcp-3d-printer-server/graphs/commit-activity) | This project is actively maintained |\n| [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://makeapullrequest.com) | We welcome contributions via Pull Requests |\n| [![Node.js Version](https://img.shields.io/badge/node-%3E%3D%2018.0.0-green.svg)](https://nodejs.org/en/download/) | Requires Node.js 18.0.0 or higher |\n| [![Downloads](https://img.shields.io/npm/dm/mcp-3d-printer-server.svg)](https://www.npmjs.com/package/mcp-3d-printer-server) | Number of downloads per month from npm |\n| [![GitHub stars](https://img.shields.io/github/stars/yourusername/mcp-3d-printer-server.svg?style=social\u0026label=Star)](https://github.com/yourusername/mcp-3d-printer-server) | Number of GitHub stars this project has received |\n\n## License\n\nGPL-2.0","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmontgomery40%2Fmcp-3d-printer-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdmontgomery40%2Fmcp-3d-printer-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmontgomery40%2Fmcp-3d-printer-server/lists"}