Skip to main content
Glama

FreeCAD MCP

by bonninr

FreeCAD MCP (モデル制御プロトコル)

概要

FreeCAD MCP(モデル制御プロトコル)は、サーバークライアントアーキテクチャを通じてFreeCADと対話するための簡素化されたインターフェースを提供します。これにより、ユーザーはコマンドを実行したり、現在のFreeCADドキュメントやシーンに関する情報を取得したりできます。

https://github.com/user-attachments/assets/5acafa17-4b5b-4fef-9f6c-617e85357d44

構成

MCPサーバーを設定するには、JSON形式を使用してサーバー設定を指定します。以下に設定例を示します。

{ "mcpServers": { "freecad": { "command": "C:\\ProgramData\\anaconda3\\python.exe", "args": [ "C:\\Users\\USER\\AppData\\Roaming\\FreeCAD\\Mod\\freecad_mcp\\src\\freecad_bridge.py" ] } } }

構成の詳細

  • command : FreeCAD MCPサーバーを実行するPython実行ファイルへのパス。これはオペレーティングシステムによって異なります。
    • Windows : 通常は、 C:\\ProgramData\\anaconda3\\python.exeまたはC:\\Python39\\python.exeのようになります。
    • Linux : /usr/bin/python3または Python インストールへのパスになります。
    • macOS : 通常は、 /usr/local/bin/python3または Python インストールへのパスになります。
  • args : Pythonコマンドに渡す引数の配列。最初の引数は、MCPサーバーロジックを処理するfreecad_bridge.pyスクリプトへのパスです。インストール環境に合わせてパスを調整してください。

異なるオペレーティングシステムの例

ウィンドウズ
{ "mcpServers": { "freecad": { "command": "C:\\ProgramData\\anaconda3\\python.exe", "args": [ "C:\\Users\\USER\\AppData\\Roaming\\FreeCAD\\Mod\\freecad_mcp\\src\\freecad_bridge.py" ] } } }
リナックス
{ "mcpServers": { "freecad": { "command": "/usr/bin/python3", "args": [ "/home/USER/.FreeCAD/Mod/freecad_mcp/src/freecad_bridge.py" ] } } }
macOS
{ "mcpServers": { "freecad": { "command": "/usr/local/bin/python3", "args": [ "/Users/USER/Library/Preferences/FreeCAD/Mod/freecad_mcp/src/freecad_bridge.py" ] } } }

特徴

FreeCAD MCP は現在、次の機能をサポートしています。

1. get_scene_info

  • 説明: 現在の FreeCAD ドキュメントに関する包括的な情報を取得します。これには以下が含まれます:
    • ドキュメントのプロパティ(名前、ラベル、ファイル名、オブジェクト数)
    • オブジェクトの詳細情報(タイプ、位置、回転、形状のプロパティ)
    • スケッチデータ(ジオメトリ、拘束)
    • ビュー情報(カメラの位置、方向など)

2. run_script

  • 説明: FreeCAD コンテキスト内で任意の Python コードを実行します。これにより、ユーザーは複雑な操作を実行したり、新しいオブジェクトを作成したり、既存のオブジェクトを変更したり、FreeCAD の Python API を使用してタスクを自動化したりできます。

使用例

FreeCAD MCP を使用するには、次のようにサーバーに接続してコマンドを送信します。

import socket import json # Connect to the FreeCAD MCP server client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) client.connect(('localhost', 9876)) # Example: Get scene information command = { "type": "get_scene_info" } client.sendall(json.dumps(command).encode('utf-8')) # Receive the response response = client.recv(4096) print(json.loads(response.decode('utf-8'))) # Example: Run a script script = """ import FreeCAD doc = FreeCAD.ActiveDocument box = doc.addObject("Part::Box", "MyBox") box.Length = 20 box.Width = 20 box.Height = 20 doc.recompute() """ command = { "type": "run_script", "params": { "script": script } } client.sendall(json.dumps(command).encode('utf-8')) # Receive the response response = client.recv(4096) print(json.loads(response.decode('utf-8'))) # Close the connection client.close()

インストール

  1. リポジトリをクローンするか、ファイルをダウンロードします。
  2. freecad_mcpディレクトリを FreeCAD モジュール ディレクトリに配置します。
    • Windows: %APPDATA%/FreeCAD/Mod/
    • Linux: ~/.FreeCAD/Mod/
    • macOS: ~/Library/Preferences/FreeCAD/Mod/
  3. FreeCAD を再起動し、ワークベンチ セレクターから「FreeCAD MCP」ワークベンチを選択します。

貢献

ぜひ、問題提起やプルリクエストを送信して、貢献してください。皆様からのフィードバックと貢献をお待ちしております!

ライセンス

このプロジェクトはMITライセンスの下でライセンスされています。詳細はLICENSEファイルをご覧ください。

-
security - not tested
A
license - permissive license
-
quality - not tested

local-only server

The server can only run on the client's local machine because it depends on local resources.

モデル コンテキスト プロトコル (MCP) を実装し、Claude Desktop を介して FreeCAD と Claude AI 間の通信を可能にする FreeCAD アドオン。

  1. 概要
    1. 構成
      1. 構成の詳細
      2. 異なるオペレーティングシステムの例
    2. 特徴
      1. 1. get_scene_info
      2. 2. run_script
      3. 使用例
    3. インストール
      1. 貢献
        1. ライセンス

          Related MCP Servers

          • A
            security
            A
            license
            A
            quality
            Connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender for AI-assisted 3D modeling, scene manipulation, and rendering.
            Last updated -
            17
            12,670
            Python
            MIT License
            • Apple
          • A
            security
            A
            license
            A
            quality
            This repository is a FreeCAD MCP that allows you to control FreeCAD from Claude Desktop.
            Last updated -
            10
            224
            Python
            MIT License
            • Apple
            • Linux
          • -
            security
            A
            license
            -
            quality
            This project provides a robust integration between AI assistants and FreeCAD CAD software using the Model Context Protocol (MCP). It allows external applications to interact with FreeCAD through a standardized interface, offering multiple connection methods and specialized tools.
            Last updated -
            10
            Python
            MIT License
            • Linux
          • A
            security
            F
            license
            A
            quality
            A Model Context Protocol (MCP) server that allows Claude AI to interact with custom tools, enabling extension of Claude's capabilities through the MCP framework.
            Last updated -
            TypeScript
            • Apple

          View all related MCP servers

          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/bonninr/freecad_mcp'

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