Skip to main content
Glama
quellant

OpenSCAD MCP Server

by quellant

check_openscad

Verify OpenSCAD installation and return version information to confirm the 3D modeling tool is properly configured for rendering operations.

Instructions

Verify OpenSCAD installation and return version info.

Args: include_paths: Include searched paths in response ctx: MCP context for logging

Returns: Dict with OpenSCAD installation information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
include_pathsNo

Implementation Reference

  • The main handler function for the 'check_openscad' tool, decorated with @mcp.tool for registration. It checks for OpenSCAD installation, retrieves version info using subprocess, and returns a dictionary with installation status.
    @mcp.tool
    async def check_openscad(
        include_paths: bool = False,
        ctx: Optional[Context] = None,
    ) -> Dict[str, Any]:
        """
        Verify OpenSCAD installation and return version info.
        
        Args:
            include_paths: Include searched paths in response
            ctx: MCP context for logging
        
        Returns:
            Dict with OpenSCAD installation information
        """
        if ctx:
            await ctx.info("Checking OpenSCAD installation...")
        
        openscad_path = find_openscad()
        
        if not openscad_path:
            searched = [
                "/usr/bin/openscad",
                "/usr/local/bin/openscad",
                "/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD",
                "C:\\Program Files\\OpenSCAD\\openscad.exe",
            ]
            
            return {
                "installed": False,
                "version": None,
                "path": None,
                "searched_paths": searched if include_paths else None,
                "message": "OpenSCAD not found. Please install from https://openscad.org",
            }
        
        # Get version
        try:
            result = subprocess.run(
                [openscad_path, "--version"],
                capture_output=True,
                text=True,
                check=False,
            )
            version = result.stdout.strip() if result.stdout else "Unknown"
        except Exception:
            version = "Unknown"
        
        if ctx:
            await ctx.info(f"Found OpenSCAD at {openscad_path}")
        
        return {
            "installed": True,
            "version": version,
            "path": str(openscad_path),
            "message": f"OpenSCAD is installed at {openscad_path}",
        }
  • Helper function to locate the OpenSCAD executable by checking config path, common names via subprocess, and standard installation paths.
    def find_openscad() -> Optional[str]:
        """Find OpenSCAD executable on the system."""
        config = get_config()
        
        # Check configured path first
        if config.openscad_path and Path(config.openscad_path).exists():
            return config.openscad_path
        
        # Common OpenSCAD executable names
        candidates = ["openscad", "OpenSCAD", "openscad.exe"]
        
        for cmd in candidates:
            try:
                subprocess.run([cmd, "--version"], capture_output=True, check=False)
                return cmd
            except FileNotFoundError:
                continue
        
        # Check common installation paths
        common_paths = [
            "/usr/bin/openscad",
            "/usr/local/bin/openscad",
            "/snap/bin/openscad",
            "/var/lib/flatpak/exports/bin/org.openscad.OpenSCAD",
            "/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD",
            "C:\\Program Files\\OpenSCAD\\openscad.exe",
            "C:\\Program Files (x86)\\OpenSCAD\\openscad.exe",
        ]
        
        for path in common_paths:
            if Path(path).exists():
                return path
        
        return None
  • The @mcp.tool decorator registers the check_openscad function as an MCP tool.
    @mcp.tool
Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/quellant/openscad-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server