DN

dughogan/nuke_mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

40 stars 5 forks 质量 59 趋势 12

核子的MCP服务器和工具代码

概览

利用模型上下文协议(MCP)连接The Foundry的核动力系统与AI系统。 Nuke-MCP 允许 AI 助手通过套接字连接与 Nuke 交互,从而实现: - 获取关于 Nuke 脚本的信息 - 创建、修改和删除节点 - 在节点图中定位节点 - 连接节点 - 控制播放和渲染 - 在 Nuke 中执行任意 Python 代码 1. (nuke_mcp_addon.py):一个在Nuke内部创建套接字服务器的Nuke脚本 2.(nuke_mcp_server.py):一个连接Nuke插件并将工具暴露给AI系统的Python服务器 3.(main.py):一个用于启动MCP服务器的简单脚本 - The Foundry's Nuke(任何最新版本都应可用)- Python 3.7+ - FastMCP包 - Claude桌面版 1. 克隆或下载该仓库 2.将nuke_mcp_addon.py复制到你的 Nuke 脚本文件夹或 Nuke Python 路径中的某个位置 1. : - 拿着nuke_mcp_addon。

概述(AI 翻译)

利用模型上下文协议(MCP)连接The Foundry的核动力系统与AI系统。

概述

Nuke-MCP 允许 AI 助手通过套接字连接与 Nuke 交互,从而实现:

  • 获取关于核子脚本的信息
  • 创建、修改和删除节点
  • 节点图中的位置节点
  • 连接节点
  • 控制播放与渲染
  • 在 Nuke 中执行任意 Python 代码

组成部分

  1. Nuke 插件(nuke_mcp_addon.py):一个在 Nuke 内部创建套接字服务器的 Nuke 脚本
  2. MCP 服务器(nuke_mcp_server.py):一个连接 Nuke 插件并将工具暴露给 AI 系统的 Python 服务器
  3. 入口点(main.py):启动MCP服务器的简单脚本

安装

先决条件

  • 铸造厂的核弹(任何最新版本都可用)
  • Python 3.7+
  • FastMCP 软件包
  • Claude桌面

安装FastMCP包

安装核子MCP

  1. 克隆或下载此仓库
  2. 将nuke_mcp_addon.py复制到你的Nuke scripts文件夹或Nuke Python路径中的某个位置

用途

安装核弹附加元件

  1. 复制附加文件:
  • 拿’nuke_mcp_addon。

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Nuke-MCP

A bridge between The Foundry’s Nuke and AI systems using the Model Context Protocol (MCP).

Overview

Nuke-MCP allows AI assistants to interact with Nuke through a socket connection, enabling them to:

  • Get information about Nuke scripts
  • Create, modify, and delete nodes
  • Position nodes in the node graph
  • Connect nodes together
  • Control playback and rendering
  • Execute arbitrary Python code in Nuke

Components

  1. Nuke Addon (nuke_mcp_addon.py): A Nuke script that creates a socket server within Nuke
  2. MCP Server (nuke_mcp_server.py): A Python server that connects to the Nuke addon and exposes tools to AI systems
  3. Entry Point (main.py): A simple script to start the MCP server

Installation

Prerequisites

  • The Foundry’s Nuke (any recent version should work)
  • Python 3.7+
  • FastMCP package
  • Claude Desktop

Installing the FastMCP package

pip install fastmcp

Installing Nuke-MCP

  1. Clone or download this repository
  2. Copy nuke_mcp_addon.py to your Nuke scripts folder or a location in your Nuke Python path

Usage

Installing the Nuke Addon

  1. Copy the Addon File:

    • Take the nuke_mcp_addon.py file and place it in a location where Nuke can find it:
      • Copy it to your Nuke scripts folder (usually in ~/.nuke/python on Linux/Mac or in your home directory on Windows)
      • Or place it in a folder that’s in your Nuke Python path
  2. Create a Startup Script (Recommended):

    • Create or edit an existing init.py file in your .nuke directory
    • Add the following line to automatically load the addon when Nuke starts and making sure you’re pointing to the python subfolder where the MCP tools live:
      nuke.pluginAddPath("./python")
      
      import nuke_mcp_addon
      
  3. Manual Loading (Alternative):

    • If you don’t want to load it automatically, you can manually load it each time by:
      • Opening Nuke
      • Make sure you have a python subfolder setup in the init.py where the MCP tools live
      • Going to the Script Editor panel
      • Running import nuke_mcp_addon

Docking the NukeMCP Panel

By default, the NukeMCP panel opens as a floating window. If you prefer to have it docked in Nuke’s interface, you can modify the NukeMCPPanel class in nuke_mcp_addon.py:

# Find the NukeMCPPanel class definition (around line 380)
class NukeMCPPanel(nukescripts.PythonPanel):
    def __init__(self):
        nukescripts.PythonPanel.__init__(self, 'Nuke MCP', 'com.example.NukeMCP')
        # ... existing code ...

# Add this method to enable docking
    def addToPane(self):
        pane = nuke.getPaneFor('Properties.1')
        if not pane:
            pane = nuke.getPaneFor('Viewer.1')
        self.setMinimumSize(300, 200)  # Set a reasonable minimum size
        return pane.addPermanentAsQWidget(self)

# Modify the show_panel function to use docking
def show_panel():
    """Show the NukeMCP panel"""
在 GitHub 查看完整 README

安装

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

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "nuke": { "command": "python", "args": [ "/path/to/your/nuke-mcp/main.py" ], "trusted": true } } }