CB

cwahlfeldt/blender-mcp

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

11 stars 2 forks 品質 40 トレンド 8

Blenderスクリプトの管理と実行のためのモデルコンテキストプロトコル(MCP)サーバー.

概要

Blenderスクリプトの管理と実行のためのモデルコンテキストプロトコル(MCP)サーバー。 - Blender Pythonスクリプトの追加、編集、実行、および削除 - ヘッドレス・ブレンダー環境でスクリプトを実行 - 実行結果とエラーの表示 - スクリプトメタデータを追跡する(日付、最終変更、実行回数) - Python 3.7 + - Blender をインストールしてアクセス可能 - MCP ライブラリ (pip install mcp) 2. MCP クライアント (Claude Desktop のような) を使用してサーバーに接続する 3. 指定したツールを使用してスクリプトを管理します: - add script(name, content) - 新しいスクリプトを追加 - edit script(name, content) - 既存のスクリプトを編集 - execute script(name, Blend file=None) - Blender でスクリプトを実行し、オプションで .blend ファイル - remove script(name) - スクリプトを削除 4. 情報を取得するリソースにアクセス: - scripts://list - 利用可能なスクリプトのリストを取得する - script://{name} - 特定のスクリプトのコンテンツを取得する - result://{name} - スクリプトの実行結果を取得する 1.

概要(AI 翻訳)

Blenderスクリプトの管理と実行のためのモデルコンテキストプロトコル(MCP)サーバー。

##特徴

  • Blender Pythonスクリプトの追加、編集、実行、削除
  • ヘッドレスブレンダー環境でスクリプトを実行
  • 実行結果とエラーを表示
  • スクリプトメタデータを追跡する(作成日、最終変更、実行回数)

要件

  • Python 3.7 +
  • ブレンダーのインストールとアクセス可能
  • MCPライブラリ(pip install mcp)

使用法

  1. サーバーを始めて下さい:

  2. MCP クライアント (Claude Desktop のような) を使用してサーバーに接続する

  3. 提供されたツールを使用してスクリプトを管理します。

  • [add_script(name, content) - 新しいスクリプトを追加する
  • [edit_script(name, content) - 既存のスクリプトを編集する
  • [execute_script(name, blend_file=None) - Blenderでスクリプトを実行し、オプションで.blendファイルを指定する
  • [remove_script(name) - スクリプトを削除します
  1. 情報を取得するリソースへのアクセス:
  • [scripts://list - 利用可能なスクリプトのリストを取得する
  • [script://{name} - 特定のスクリプトのコンテンツを取得する
  • [result://{name} - スクリプトの実行結果を取得する

例

##基本例

ブレンドファイルを扱う

使い方

  1. スクリプトを追加すると、[script_files/scriptsディレクトリに格納されます

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。

README

Blender MCP Server

A Model Context Protocol (MCP) server for managing and executing Blender scripts.

Features

  • Add, edit, execute, and remove Blender Python scripts
  • Execute scripts in a headless Blender environment
  • View execution results and errors
  • Track script metadata (creation date, last modified, execution count)

Requirements

  • Python 3.7+
  • Blender installed and accessible
  • MCP library (pip install mcp)

Usage

  1. Start the server:

    python server.py
    
  2. Connect to the server using an MCP client (like Claude Desktop)

  3. Use the provided tools to manage scripts:

    • add_script(name, content) - Add a new script
    • edit_script(name, content) - Edit an existing script
    • execute_script(name, blend_file=None) - Execute a script in Blender, optionally specifying a .blend file
    • remove_script(name) - Remove a script
  4. Access resources to get information:

    • scripts://list - Get list of available scripts
    • script://{name} - Get content of a specific script
    • result://{name} - Get execution result of a script

Examples

Basic Example

# Add a simple script
add_script("hello_cube", '''
import bpy

# Clear existing objects
bpy.ops.object.select_all(action='SELECT')
bpy.ops.object.delete()

# Create a cube
bpy.ops.mesh.primitive_cube_add(size=2, location=(0, 0, 0))
print("Cube created!")
''')

# Execute the script
execute_script("hello_cube")

# Get the result
# Access using: result://hello_cube

Working with Blend Files

# Add a script that works with a blend file
add_script("analyze_scene", '''
import bpy

# Print information about the current scene
print(f"Current Blender version: {bpy.app.version_string}")
print(f"Current file: {bpy.data.filepath}")

# List all objects in the scene
print("\\nObjects in the scene:")
for obj in bpy.data.objects:
    print(f" - {obj.name} ({obj.type})")
''')

# Execute with a specific blend file
execute_script("analyze_scene", blend_file="/path/to/your/project.blend")

# Get the result
# Access using: result://analyze_scene

How It Works

  1. When a script is added, it’s stored in the script_files/scripts directory
  2. When executed, the script is run in a headless Blender instance
    • If a blend file is specified, Blender will open that file before running the script
    • Otherwise, a default empty Blender scene is used
  3. Output and errors are captured and stored in the script_files/results directory
  4. Metadata about scripts is tracked in script_files/metadata.json

Installation

  1. Clone this repository
  2. Install the MCP library: pip install mcp
  3. Ensure Blender is installed and accessible from your PATH

License

MIT

GitHub で README 全文を見る

インストール

This server does not publish a one-line install command.

Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →