* ci: add caching and fix workflow failures - Add UV package caching to all workflows for faster dependency installation - Add pre-commit hook caching with OS-specific cache keys - Skip no-commit-to-branch hook in CI (fails on main branch) - Remove broken apt cache action (doesn't work with PPAs) - Simplify FreeCAD command detection (PPA installs to standard PATH) - Add FreeCAD Python version logging for debugging * ci: Add code Rabbit configuration file * ci: fix issues in CI workflows * ci: add uv.lock * ci: tweaks * ci: Fix errors and add UUID generation and checking * ci: Use the GitHub FreeCAD release latest stables * ci: skip macro test for now, due to headless mode * feat: Add a multi export macro * ci: Fix tests * ci: fix docker build workflow * ci: skip trufflehog in GitHub Actions due to wasm panic bug TruffleHog has a known wasm/go-re2 panic bug that causes failures in GitHub Actions environment. The hook still runs locally during development for secrets detection. - Add trufflehog to SKIP env var in pre-commit.yaml - Update trufflehog to v3.88.7 (latest) - Add reference to upstream issue #3321 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * test: use boolean holes instead of PartDesign::Hole in CI PartDesign::Hole has a CADKernelError bug in FreeCAD AppImage headless mode on Linux (used in GitHub Actions) where it fails with "Cannot make face from profile". The SmartCutter class already supports boolean holes as an alternative. Changes: - Modify SmartCutter.execute() to use boolean holes by default - Update all test assertions for Part::Feature output type - Update test docstrings and class descriptions - Remove PartDesign-specific checks (Group, Sketcher::SketchObject) - Update workflow comment explaining the CI limitation Boolean holes work reliably in both GUI and headless mode across all FreeCAD configurations. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * ci: clean up GitHub Actions workflows * ci: Dependabot improvements * ci: add CodeQL scanning workflow * ci: AI review suggested improvements * ci: add coderabbit updates for intentional decisions --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
72 lines
2.1 KiB
Plaintext
72 lines
2.1 KiB
Plaintext
"""FreeCAD Macro: Start MCP Bridge Server.
|
|
|
|
SPDX-License-Identifier: MIT
|
|
Copyright (c) 2025 Sean P. Kane (GitHub: spkane)
|
|
|
|
Start the MCP bridge server for AI assistant integration with FreeCAD.
|
|
|
|
Version: 1.0.0
|
|
|
|
Requirements:
|
|
- FreeCAD 0.21 or later
|
|
- freecad-mcp project installed and accessible
|
|
|
|
Usage:
|
|
1. Install via: just install-bridge-macro
|
|
2. Run the macro from: Macro -> Macros -> StartMCPBridge -> Execute
|
|
3. Connect your MCP client (Claude Code, etc.) to the running bridge
|
|
"""
|
|
|
|
import sys
|
|
|
|
import FreeCAD
|
|
|
|
|
|
def start_mcp_bridge():
|
|
"""Start the MCP bridge server for AI assistant integration."""
|
|
# The project path is injected during macro installation
|
|
# This placeholder will be replaced with the actual path
|
|
project_path = "__PROJECT_PATH__"
|
|
|
|
if project_path == "__PROJECT_PATH__":
|
|
FreeCAD.Console.PrintError(
|
|
"MCP Bridge macro not properly installed.\n"
|
|
"Please run: just install-bridge-macro\n"
|
|
)
|
|
return
|
|
|
|
if project_path not in sys.path:
|
|
sys.path.insert(0, project_path)
|
|
|
|
try:
|
|
# Import and start the plugin
|
|
from freecad_mcp.freecad_plugin.server import FreecadMCPPlugin
|
|
|
|
# Create and start the plugin
|
|
plugin = FreecadMCPPlugin(
|
|
host="localhost",
|
|
port=9876, # JSON-RPC socket port
|
|
xmlrpc_port=9875, # XML-RPC port (neka-nat compatible)
|
|
enable_xmlrpc=True,
|
|
)
|
|
plugin.start()
|
|
|
|
FreeCAD.Console.PrintMessage("MCP Bridge started!\n")
|
|
FreeCAD.Console.PrintMessage(" - XML-RPC: localhost:9875\n")
|
|
FreeCAD.Console.PrintMessage(" - Socket: localhost:9876\n")
|
|
FreeCAD.Console.PrintMessage(
|
|
"\nYou can now connect your MCP client (Claude Code, etc.) to FreeCAD.\n"
|
|
)
|
|
|
|
except ImportError as e:
|
|
FreeCAD.Console.PrintError(
|
|
f"Failed to import MCP Bridge module: {e}\n"
|
|
f"Ensure the freecad-mcp project is accessible at: {project_path}\n"
|
|
)
|
|
except Exception as e:
|
|
FreeCAD.Console.PrintError(f"Failed to start MCP Bridge: {e}\n")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
start_mcp_bridge()
|