Skip to content
Back to search

freecad_mcp

FreecadMCP connects Freecad to Claude AI and other MCP-ready tools like Cursor through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Freecad. This integration enables prompt assisted CAD 3d Design.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/bonninr--freecad-mcp/badge.svg)](/listings/bonninr--freecad-mcp)

HTML

<a href="/listings/bonninr--freecad-mcp"><img src="/api/listings/bonninr--freecad-mcp/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

1. Clone the repository or download the files. 2. Place the `freecad_mcp` directory in your FreeCAD modules directory: - Windows: `%APPDATA%/FreeCAD/Mod/` - Linux: `~/.FreeCAD/Mod/` - macOS: `~/Library/Preferences/FreeCAD/Mod/` 3. Restart FreeCAD and select the "FreeCAD MCP" workbench from the workbench selector.

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 157 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # FreeCAD MCP (Model Control Protocol)
  2. ## Overview
  3. The FreeCAD MCP (Model Control Protocol) provides a simplified interface for interacting with FreeCAD through a server-client architecture. This allows users to execute commands and retrieve information about the current FreeCAD document and scene.
  4. https://github.com/user-attachments/assets/5acafa17-4b5b-4fef-9f6c-617e85357d44
  5. ## Configuration
  6. To configure the MCP server, you can use a JSON format to specify the server settings. Below is an example configuration:
  7. ```json
  8. {
  9. "mcpServers": {
  10. "freecad": {
  11. "command": "C:\\ProgramData\\anaconda3\\python.exe",
  12. "args": [
  13. "C:\\Users\\USER\\AppData\\Roaming\\FreeCAD\\Mod\\freecad_mcp\\src\\freecad_bridge.py"
  14. ]
  15. }
  16. }
  17. }
  18. ```
  19. ### Configuration Details
  20. - **command**: The path to the Python executable that will run the FreeCAD MCP server. This can vary based on your operating system:
  21. - **Windows**: Typically, it might look like `C:\\ProgramData\\anaconda3\\python.exe` or `C:\\Python39\\python.exe`.
  22. - **Linux**: It could be `/usr/bin/python3` or the path to your Python installation.
  23. - **macOS**: Usually, it would be `/usr/local/bin/python3` or the path to your Python installation.
  24. - **args**: An array of arguments to pass to the Python command. The first argument should be the path to the `freecad_bridge.py` script, which is responsible for handling the MCP server logic. Make sure to adjust the path according to your installation.
  25. ### Example for Different Operating Systems
  26. #### Windows
  27. ```json
  28. {
  29. "mcpServers": {
  30. "freecad": {
  31. "command": "C:\\ProgramData\\anaconda3\\python.exe",
  32. "args": [
  33. "C:\\Users\\USER\\AppData\\Roaming\\FreeCAD\\Mod\\freecad_mcp\\src\\freecad_bridge.py"
  34. ]
  35. }
  36. }
  37. }
  38. ```
  39. #### Linux
  40. ```json
  41. {
  42. "mcpServers": {
  43. "freecad": {
  44. "command": "/usr/bin/python3",
  45. "args": [
  46. "/home/USER/.FreeCAD/Mod/freecad_mcp/src/freecad_bridge.py"
  47. ]
  48. }
  49. }
  50. }
  51. ```
  52. #### macOS
  53. ```json
  54. {
  55. "mcpServers": {
  56. "freecad": {
  57. "command": "/usr/local/bin/python3",
  58. "args": [
  59. "/Users/USER/Library/Preferences/FreeCAD/Mod/freecad_mcp/src/freecad_bridge.py"
  60. ]
  61. }
  62. }
  63. }
  64. ```
  65. ## Features
  66. The FreeCAD MCP currently supports the following functionalities:
  67. ### 1. `get_scene_info`
  68. - **Description**: Retrieves comprehensive information about the current FreeCAD document, including:
  69. - Document properties (name, label, filename, object count)
  70. - Detailed object information (type, position, rotation, shape properties)
  71. - Sketch data (geometry, constraints)
  72. - View information (camera position, direction, etc.)
  73. ### 2. `run_script`
  74. - **Description**: Executes arbitrary Python code within the FreeCAD context. This allows users to perform complex operations, create new objects, modify existing ones, and automate tasks using FreeCAD's Python API.
  75. ### Example Usage
  76. To use the FreeCAD MCP, you can connect to the server and send commands as follows:
  77. ```python
  78. import socket
  79. import json
  80. # Connect to the FreeCAD MCP server
  81. client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  82. client.connect(('localhost', 9876))
  83. # Example: Get scene information
  84. command = {
  85. "type": "get_scene_info"
  86. }
  87. client.sendall(json.dumps(command).encode('utf-8'))
  88. # Receive the response
  89. response = client.recv(4096)
  90. print(json.loads(response.decode('utf-8')))
  91. # Example: Run a script
  92. script = """
  93. import FreeCAD
  94. doc = FreeCAD.ActiveDocument
  95. box = doc.addObject("Part::Box", "MyBox")
  96. box.Length = 20
  97. box.Width = 20
  98. box.Height = 20
  99. doc.recompute()
  100. """
  101. command = {
  102. "type": "run_script",
  103. "params": {
  104. "script": script
  105. }
  106. }
  107. client.sendall(json.dumps(command).encode('utf-8'))
  108. # Receive the response
  109. response = client.recv(4096)
  110. print(json.loads(response.decode('utf-8')))
  111. # Close the connection
  112. client.close()
  113. ```
  114. ## Installation
  115. 1. Clone the repository or download the files.
  116. 2. Place the `freecad_mcp` directory in your FreeCAD modules directory:
  117. - Windows: `%APPDATA%/FreeCAD/Mod/`
  118. - Linux: `~/.FreeCAD/Mod/`
  119. - macOS: `~/Library/Preferences/FreeCAD/Mod/`
  120. 3. Restart FreeCAD and select the "FreeCAD MCP" workbench from the workbench selector.
  121. ## Contributing
  122. Feel free to contribute by submitting issues or pull requests. Your feedback and contributions are welcome!
  123. ## License
  124. This project is licensed under the MIT License. See the LICENSE file for details.

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.