Blender AI Wiki / Русский Поиск

P28: CUSTOM MCP TOOLS DEVELOPMENT

Свои MCP инструменты: серверная сторона (FastMCP) + Blender addon handler

📝 Промпты ⭐⭐⭐ 4 блоков кода обновлено 2026-10-01

ID: P28 | Кластер: MCP Integration | Сложность: ⭐⭐⭐ | Теги: #mcp #custom-tools #python #fastmcp #addon


🎯 ЦЕЛЬ

Свои MCP-инструменты: серверная сторона (FastMCP) + Blender addon handler


📝 ПРОМПТ (РУС)

Создай MCP tool "[NAME]": параметры {...}, выполняет [действие bpy],
возвращает {...}. Зарегистрируй в сервере и аддоне.

📝 ПРОМПТ (ENG)

Create MCP tool "[NAME]": params {...}, runs [bpy action], returns {...}. Register in server and addon.

🔧 ШАБЛОН

# Server (src/blender_mcp/tools/custom.py)
from mcp.server.fastmcp import FastMCP
mcp = FastMCP("Custom")

@mcp.tool()
async def my_tool(param: str) -> str:
    '''Description for LLM'''
    blender = get_blender_connection()
    return blender.send_command("my_command", {"param": param})

# Addon (addon.py) — в execute_command handlers:
# def my_command_handler(self, param): ...
# GenesisCore style (встроенный):
# src/tools/my_tools.py
from .common import ToolsPackageBase
class MyTools(ToolsPackageBase):
    def my_tool(param: str) -> dict:
        '''Description for LLM'''
        import bpy
        return {"result": "success"}
# + import в src/tools/__init__.py

🔗 СВЯЗИ

Связанные материалы

Подобраны по тегам и категории.