How dughogan/nuke_mcp works
Project Type and Purpose
• This is an integration/middleware tool that bridges The Foundry’s Nuke application with AI systems via the Model Context Protocol (MCP).
• It consists of three runtime components: a Nuke Addon (in-process plugin), an external MCP Server (Python process), and an AI Client (e.g., Claude Desktop).
Main Components
a. AI Client
• Runs in a separate application (e.g., Claude Desktop).
• Uses FastMCP to speak MCP over a TCP socket.
b. MCP Server (nuke_mcp_server.py + main.py)
• A Python process you launch via main.py.
• Imports FastMCP, registers @mcp.tool() endpoints.
• Forwards tool calls to the Nuke Addon over a second socket.
c. Nuke Addon (nuke_mcp_addon.py)
• Runs inside Nuke via nukescripts.PythonPanel.
• Starts a socket server on startup.
• Implements handlers to create/modify/delete nodes, control playback, execute code.
d. Nuke Application
• Hosts the Addon and node graph UI.
e. Optional External Services
• Firewalls/network for socket connectivity.
• Asset management or template systems (future extension).
Relationships and Data Flows
1. AI Client ⇄ MCP Server (MCP protocol over TCP)
2. MCP Server ⇄ Nuke Addon (custom JSON commands over TCP)
3. Nuke Addon → Nuke API (nukescripts)
Architectural Patterns and Design Principles
• Client-server: decouples AI logic from Nuke process.
• Plugin architecture: Nuke Addon loads dynamically into host.
• Tool-based RPC: each @mcp.tool() is a remote procedure.
• Separation of concerns: UI (panel), transport (sockets), business logic (tools).
Technologies and Frameworks
• Python 3.7+
• FastMCP package for MCP protocol
• sockets (TCP) for communication
• nukescripts.PythonPanel for UI in Nuke
• JSON for payloads
• Context and logger utilities (in server and addon)