Automate Substance 3D Painter: MCP vs Python Plugins vs CLI

Updated 2026-11-27 · MCP Pro for Painter v1.2 · Tested with Substance 3D Painter 12.0.3 and 12.2.0

There are several ways to automate Adobe Substance 3D Painter, and they suit different jobs. A Python plugin runs inside Painter and is good for UI tools. The remote scripting endpoint lets any external script send code to a running Painter. An MCP server lets an AI agent do the scripting for you, and a CLI wraps the same operations for shell scripts and CI-style batch jobs. This guide compares them and shows working examples of each.

The options at a glance

ApproachRuns whereBest forCost
Python pluginInside Painter, loaded at startupCustom panels, menu actions, event hooks, studio toolingYou write and maintain Python against the substance_painter API
Remote scripting endpointAny process on the machine, via HTTP to localhost:60041Pipeline scripts that drive an already-running PainterYou write the Python snippets and handle errors and API drift
MCP server (MCP Pro for Painter)Your AI client, such as Claude Code or CursorOne-off and exploratory work described in plain languageNo code, but it needs an AI client in the loop
painter-cliYour shell or scriptsRepeatable batch jobs built from tested tool callsShell scripting only, with JSON output and exit codes

These approaches stack. MCP Pro for Painter and painter-cli are both built on the remote scripting endpoint, which in turn runs Painter's own Python API. Moving between them is incremental, not a rewrite.

Option 1: Painter Python plugins

Painter embeds a Python interpreter and exposes its API as the substance_painter package, with modules such as project, textureset, layerstack, baking, export, resource and event. A plugin is a Python module placed in Painter's user plugins folder, under python/plugins inside your Painter documents folder. Painter loads it at startup and calls its start_plugin() and close_plugin() functions. You can enable and reload plugins from Painter's Python menu.

Plugins are the right tool when you need something that lives in Painter's UI: a custom dock, a menu command artists click, or a handler that runs on every project open or export. They are also the most work. You own the code, the Qt UI, and updates when the API shifts between Painter releases.

Plugins don't help with "do this across 40 files tonight" unless you also build a way to trigger them from outside. That is what the next option is for.

Option 2: the remote scripting endpoint

Start Painter with --enable-remote-scripting and it accepts JSON requests on http://localhost:60041/run.json. Each request carries a Python (or JavaScript) command, and the reply carries the value of the last expression:

curl -s -X POST http://localhost:60041/run.json \
     -H 'Content-Type: application/json' \
     -d '{"command": "import json; json.dumps(2+2)", "type": "python"}'
# -> {"value": "4"}

From Python, the same call needs only the standard library:

import json, urllib.request

def painter(code: str):
    req = urllib.request.Request(
        "http://localhost:60041/run.json",
        data=json.dumps({"command": code, "type": "python"}).encode(),
        headers={"Content-Type": "application/json"},
    )
    with urllib.request.urlopen(req, timeout=30) as resp:
        return json.loads(resp.read())

print(painter("import substance_painter.project as p\np.is_open()"))

This is powerful and raw. Every snippet is code you write and maintain. Errors come back as Python tracebacks inside the response. Long operations such as bakes and exports are asynchronous inside Painter, so you have to wait for their events yourself. API differences between Painter versions are yours to handle too.

Security: the endpoint runs whatever code it receives. Painter listens on localhost, but any process on the machine can reach it. Only enable remote scripting on machines you control, and close Painter, or restart it without the flag, when you don't need it.

Option 3: an AI agent over MCP

MCP Pro for Painter puts a library of tested, version-tolerant snippets behind named tools, 200+ of them, and exposes them to AI clients over the Model Context Protocol. Instead of writing the snippet, you describe the outcome:

For every texture set whose name starts with weapon_, set the resolution to 2048, apply the smart material I name next, then export for Unreal to D:/UE5/Game/Content/Textures/Weapons/.

The agent chains list_texture_sets, batch_set_resolution, batch_apply_smart_material and export_for_unreal. What you get compared with raw scripting:

When no dedicated tool exists, the agent can fall back to execute_python, which works like the raw endpoint but returns the same envelope. Start the server with --no-execute-arbitrary to remove that escape hatch, together with execute_js, when you want the agent limited to the named tools.

The trade-off: an agent is ideal for one-off, exploratory or loosely specified work. For a job you will run unchanged every night, you want something deterministic.

Option 4: painter-cli for scripts and batch jobs

painter-cli ships with MCP Pro for Painter and calls the same tool functions directly, with no MCP client and no AI. The wire behavior matches what the agent sees one-to-one. Commands are grouped:

painter-cli                        # list groups
painter-cli export                 # list commands in a group
painter-cli export for-unreal --help

The groups are connect, project, set, layer, mask, material, export, bake, validate, batch, probe and raw. Output is pretty-printed JSON, or one line with --raw for jq. Exit codes are designed for scripts:

Exit codeMeaning
0The tool returned ok: true
1The tool returned ok: false
2Usage error, such as a bad argument
3Painter could not be reached

Global options --host, --port and --timeout go before the group name.

Example: batch export a folder of projects

This bash script opens every .spp in a folder, runs a stack audit, exports for Unreal into a per-asset folder, and closes the project. close_project closes without saving, so nothing is modified on disk.

#!/usr/bin/env bash
set -u
SRC="D:/Art/props"
OUT="D:/UE5/Game/Content/Textures/Props"

painter-cli connect ping > /dev/null || { echo "Painter not reachable"; exit 1; }

for f in "$SRC"/*.spp; do
  name=$(basename "$f" .spp)
  echo "== $name"
  painter-cli project close > /dev/null
  painter-cli project open "$f" > /dev/null || { echo "open failed: $f"; continue; }
  painter-cli --raw validate audit > "$OUT/$name.audit.json"
  painter-cli export for-unreal "$OUT/$name/" > /dev/null || echo "export failed: $name"
  painter-cli project close > /dev/null
done

Because the exit codes are reliable, the same pattern works in a scheduled task or a build step on a machine that keeps Painter open with remote scripting enabled.

Example: a pre-export budget check

painter-cli --raw validate budget --rules '[{"pattern":"prop_*","max_width":1024,"max_height":1024},{"pattern":"char_*","max_width":4096,"max_height":4096}]' \
  | jq '.data.total_violations'

The --rules value uses the same {pattern, max_width, max_height} shape as the validate_resolution_budget tool.

Saved workflows: from agent session to repeatable job

A practical path is to let the agent figure out a sequence once, then freeze it. In full mode the workflow tools store a named list of tool calls as JSON:

That audit-and-export sequence worked. Save it as a workflow called unreal_props_export so I can replay it on the next project.

The saved JSON is also readable documentation of exactly what ran, which helps when a teammate asks how a set of textures was produced.

Dealing with Painter version drift

The Python API changes between Painter releases, and that is the main maintenance cost of any automation. MCP Pro for Painter includes tools to detect drift before it breaks a job:

Run the smoke tests after every Painter update. If a check fails, you know which tool to avoid until an update ships, rather than finding out halfway through a batch.

Which one should you use?