@ajsmonty/adobe-mcp 1.3.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/README.md +80 -25
- package/SECURITY.md +5 -0
- package/adapters/ae_more.mjs +208 -0
- package/adapters/an.mjs +96 -0
- package/adapters/assets.mjs +194 -0
- package/adapters/id.mjs +250 -0
- package/adapters/ppro_more.mjs +393 -0
- package/adapters/ps_ai_more.mjs +277 -0
- package/cep/mcp-bridge/CSXS/manifest.xml +36 -2
- package/cep/mcp-bridge/main.js +48 -20
- package/cli/doctor.mjs +46 -15
- package/cli/install.mjs +20 -13
- package/core/barrows.mjs +16 -0
- package/core/bridge.mjs +66 -27
- package/core/harness.jsx +11 -6
- package/core/helpers.mjs +196 -0
- package/core/platform.mjs +4 -0
- package/core/win/run_com.js +12 -4
- package/package.json +13 -2
- package/server.mjs +36 -13
- package/workflow/setup.mjs +106 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.5.0
|
|
4
|
+
- **After Effects connects by itself.** The MCP Bridge panel now also runs inside After Effects and starts when AE opens. Scripts go through it, so there's no "Allow Scripts to Write Files" setting to switch on and no macOS Automation prompt. Without the panel, the old route still works.
|
|
5
|
+
- **Premiere connects by itself too:** the panel starts when Premiere opens, and a script error now comes back straight away instead of after a timeout.
|
|
6
|
+
- **Set up from the chat:** `adobe_setup_check`, `adobe_install_panel`, `adobe_whats_new`, and a "Set up Adobe for Claude" prompt.
|
|
7
|
+
- **Works alongside the Barrows AE Bridge:** when it's installed, the four basic After Effects tools it covers step aside (`ADOBE_MCP_BARROWS=keep` keeps them).
|
|
8
|
+
- **28 production tools** from the Barrows line, with thanks to Derrin Byrne: InDesign, Animate, Media Encoder, Premiere editing (clips, markers, captions, MOGRTs, relink), After Effects templates and versions from a spreadsheet, Photoshop mockups and batch export, Illustrator data merge and palette recolour, batch rename and metadata.
|
|
9
|
+
- After the install, run `npx -y @ajsmonty/adobe-mcp install` once more (or `adobe_install_panel`) and restart Premiere / After Effects to get the new panel.
|
|
10
|
+
|
|
11
|
+
## 1.3.0
|
|
12
|
+
- Windows support: Photoshop and Illustrator over COM, After Effects via `AfterFX.exe`, Premiere's panel, Blender and Substance.
|
|
13
|
+
- `doctor` and `install` commands, single-app packages, a Claude Code plugin, opt-in telemetry and tag-driven releases.
|
|
14
|
+
|
|
15
|
+
## 1.2.0
|
|
16
|
+
- Blender and Substance 3D Painter bridges, the cinematic creature pipeline and free CC0 texture libraries.
|
|
17
|
+
|
|
18
|
+
## 1.1.2
|
|
19
|
+
- First public release for macOS.
|
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
One MCP server that lets Claude, Cursor or any MCP client work inside **After Effects, Photoshop,
|
|
10
10
|
Illustrator, Premiere Pro and Character Animator**, plus **Blender** and **Substance 3D Painter**, on
|
|
11
|
-
**macOS and Windows
|
|
11
|
+
**macOS and Windows**, plus InDesign, Media Encoder and Animate for layout and delivery. 72 tools, full scripting access in every app, inline previews so the model
|
|
12
12
|
can see its work, and hand-offs that move assets from one app to the next.
|
|
13
13
|
|
|
14
14
|
```bash
|
|
@@ -33,10 +33,14 @@ npx -y @ajsmonty/adobe-mcp install --client claude-desktop # or cursor, windsu
|
|
|
33
33
|
|
|
34
34
|
| App | Tools | How it connects (macOS) | How it connects (Windows) |
|
|
35
35
|
|---|---|---|---|
|
|
36
|
-
| After Effects | `ae_*` (
|
|
37
|
-
| Photoshop | `ps_*` (
|
|
38
|
-
| Illustrator | `ai_*` (
|
|
39
|
-
|
|
|
36
|
+
| After Effects | `ae_*` (7) | MCP Bridge panel, or AppleScript `DoScript` | MCP Bridge panel, or `AfterFX.exe -r` |
|
|
37
|
+
| Photoshop | `ps_*` (7) | AppleScript `do javascript` | COM `DoJavaScriptFile` |
|
|
38
|
+
| Illustrator | `ai_*` (6) | AppleScript `do javascript` | COM `DoJavaScriptFile` |
|
|
39
|
+
| InDesign | `id_*` (6) | AppleScript `do script` | COM `DoScript` |
|
|
40
|
+
| Premiere Pro | `ppro_*` (12) | MCP Bridge CEP panel | MCP Bridge CEP panel |
|
|
41
|
+
| Media Encoder | `ame_*` (3) | through Premiere's encoder | through Premiere's encoder |
|
|
42
|
+
| Animate | `an_*` (3) | `.jsfl` opened in Animate | `.jsfl` passed to `Animate.exe` |
|
|
43
|
+
| Files | `assets_*` (3) | batch rename, XMP metadata via an open Adobe app | same |
|
|
40
44
|
| Character Animator | `ch_*` (2) | puppet PSDs via Photoshop | puppet PSDs via Photoshop |
|
|
41
45
|
| Blender | `blender_*` (6) | Python add-on socket or headless | Python add-on socket or headless |
|
|
42
46
|
| Substance 3D Painter | `substance_*` (4) | remote scripting (HTTP) | remote scripting (HTTP) |
|
|
@@ -61,9 +65,10 @@ Or limit this package with `ADOBE_MCP_APPS=ae,ps` (keeps the tool list short for
|
|
|
61
65
|
|
|
62
66
|
## Install
|
|
63
67
|
|
|
64
|
-
You need the Adobe apps you want to drive (and/or Blender, Substance 3D Painter).
|
|
65
|
-
|
|
66
|
-
|
|
68
|
+
You need the Adobe apps you want to drive (and/or Blender, Substance 3D Painter). For Premiere Pro
|
|
69
|
+
and After Effects, run `npx -y @ajsmonty/adobe-mcp install` once (or ask Claude to "set up Adobe",
|
|
70
|
+
which uses the `adobe_install_panel` tool): it adds the MCP Bridge panel, which then starts by itself
|
|
71
|
+
whenever those apps open.
|
|
67
72
|
|
|
68
73
|
### Claude Desktop: one click (no Node needed)
|
|
69
74
|
|
|
@@ -138,9 +143,11 @@ git clone https://github.com/AJSMonty/adobe-mcp.git && cd adobe-mcp && npm insta
|
|
|
138
143
|
|
|
139
144
|
| App | One-time setup |
|
|
140
145
|
|---|---|
|
|
141
|
-
| After Effects |
|
|
142
|
-
| Photoshop, Illustrator | Nothing. macOS asks for Automation permission on first use: click Allow. |
|
|
143
|
-
|
|
|
146
|
+
| After Effects | Install the MCP Bridge panel (above) and restart AE: scripts then go through it, with no preference to change and no Automation prompt. Without the panel, turn on Preferences → Scripting & Expressions → "Allow Scripts to Write Files and Access Network". AE must be open with a project (the empty default is fine). |
|
|
147
|
+
| Photoshop, Illustrator, InDesign | Nothing. macOS asks for Automation permission on first use: click Allow. |
|
|
148
|
+
| Media Encoder | Nothing extra: the `ame_*` tools hand work to Media Encoder through Premiere Pro, so Premiere (and its panel) must be open. |
|
|
149
|
+
| Animate | Nothing. Animate must be open with no dialog showing. |
|
|
150
|
+
| Premiere Pro | Install the MCP Bridge panel (above) and restart Premiere: it starts by itself from then on (or open Window → Extensions → MCP Bridge). |
|
|
144
151
|
| Character Animator | Nothing: puppets are built in Photoshop, then opened in Character Animator. |
|
|
145
152
|
| Blender | Background mode works out of the box. For live mode, install `bridges/blender/adobe_mcp_bridge.py` as an add-on. |
|
|
146
153
|
| Substance 3D Painter | Start it with `--enable-remote-scripting` (see the 3D section). |
|
|
@@ -152,9 +159,22 @@ npx -y @ajsmonty/adobe-mcp doctor # what's installed, running and confi
|
|
|
152
159
|
npx -y @ajsmonty/adobe-mcp doctor --live # also runs a one-line script in each open app
|
|
153
160
|
```
|
|
154
161
|
|
|
155
|
-
It checks Node, the workspace folder, every Adobe app,
|
|
156
|
-
|
|
157
|
-
|
|
162
|
+
It checks Node, the workspace folder, every Adobe app, the MCP Bridge panel (installed, up to date,
|
|
163
|
+
running in Premiere and After Effects) and `PlayerDebugMode`, AE's scripting preference when the
|
|
164
|
+
panel isn't running, COM availability on Windows, the Barrows AE Bridge, Blender and Substance, and
|
|
165
|
+
prints the fix for anything that fails. `--json` gives machine-readable output.
|
|
166
|
+
|
|
167
|
+
**From inside the chat:** the same checks are the `adobe_setup_check` tool, the installer is
|
|
168
|
+
`adobe_install_panel`, and the `setup_adobe` prompt ("Set up Adobe for Claude") walks through both.
|
|
169
|
+
`adobe_whats_new` shows the release notes.
|
|
170
|
+
|
|
171
|
+
### Using the Barrows AE Bridge too
|
|
172
|
+
|
|
173
|
+
The Barrows AE Bridge is a separate extension with its own installer. Install both and Claude gets
|
|
174
|
+
both tool sets. When adobe-mcp sees the Barrows extension, it hides the four basic After Effects
|
|
175
|
+
tools that Barrows covers (`ae_run_extendscript`, `ae_get_state`, `ae_save_frame`, `ae_render_comp`)
|
|
176
|
+
so there's one obvious choice; its other After Effects tools stay. Set `ADOBE_MCP_BARROWS=keep` to
|
|
177
|
+
show them anyway.
|
|
158
178
|
|
|
159
179
|
## Tools
|
|
160
180
|
|
|
@@ -202,6 +222,28 @@ anything that fails. `--json` gives machine-readable output.
|
|
|
202
222
|
| `knowledge_search` | Search the scripting lessons and gotchas. |
|
|
203
223
|
| `knowledge_add` | Record a new lesson so future sessions benefit. |
|
|
204
224
|
|
|
225
|
+
**Production tools** (templates, versions, delivery):
|
|
226
|
+
|
|
227
|
+
| Tool | What it does |
|
|
228
|
+
|---|---|
|
|
229
|
+
| `ae_template_fill` | Set text and swap footage/image layers in a template comp by layer name, optionally on a copy. |
|
|
230
|
+
| `ae_versions_from_data` | One version of a template comp per spreadsheet row (prices, regions, stores), optionally rendered. |
|
|
231
|
+
| `ae_queue_render` | Queue comps with chosen render and output templates; render now or hand to Media Encoder. |
|
|
232
|
+
| `ps_replace_smart_object` | Drop artwork into mockup smart objects by layer name and save the result. |
|
|
233
|
+
| `ps_batch_export` | Every size in one go: cover/contain/width/height fits, PNG/JPG/TIF. |
|
|
234
|
+
| `ai_data_merge` | Price cards, shelf talkers and signage from a spreadsheet and an Illustrator template. |
|
|
235
|
+
| `ai_recolor_to_palette` | Map every colour to the nearest brand colour (dry run by default). |
|
|
236
|
+
| `id_run_extendscript`, `id_get_state` | Script InDesign; pages, frames, styles, links, missing fonts, merge fields. |
|
|
237
|
+
| `id_fill_text`, `id_export`, `id_save_preview` | Fill named frames; export PDF (named preset)/PNG/JPG; inline page preview. |
|
|
238
|
+
| `id_data_merge` | Run InDesign's Data Merge on a template with a CSV and export the PDF. |
|
|
239
|
+
| `ppro_insert_clip`, `ppro_edit_clip` | Put clips on a track (overwrite or ripple insert, source in/out); trim, move, remove, rename, enable. |
|
|
240
|
+
| `ppro_add_markers`, `ppro_import_captions` | Sequence markers; caption tracks from `.srt`. |
|
|
241
|
+
| `ppro_add_mogrt`, `ppro_relink_media` | Place a `.mogrt` and fill its fields; find and relink offline media (dry run by default). |
|
|
242
|
+
| `ame_queue_sequence`, `ame_encode_files`, `ame_list_presets` | Encode in Media Encoder with a named or `.epr` preset while Premiere stays free. |
|
|
243
|
+
| `an_run_jsfl`, `an_get_state`, `an_export` | Script Animate; document state; PNG sequence/frame, video or Publish. |
|
|
244
|
+
| `assets_batch_rename` | Bridge-style batch rename with `{name}`, `{n:3}`, `{parent}`, `{date}` tokens and regex replace. |
|
|
245
|
+
| `assets_read_metadata`, `assets_write_metadata` | Read and set title, description, keywords, creator and copyright (XMP) on many files. |
|
|
246
|
+
|
|
205
247
|
## 3D & cinematic VFX pipeline (Blender + Substance 3D Painter)
|
|
206
248
|
|
|
207
249
|
Two Python bridges extend the server beyond ExtendScript so one agent can take a shot from
|
|
@@ -299,8 +341,9 @@ Drop your own `.jsx` / `.jsxbin` / `.py` files in to extend it.
|
|
|
299
341
|
|
|
300
342
|
| | macOS | Windows |
|
|
301
343
|
|---|---|---|
|
|
302
|
-
| After Effects, Photoshop, Illustrator | ✅ | ✅ |
|
|
303
|
-
| Premiere Pro (CEP panel) | ✅ | ✅ |
|
|
344
|
+
| After Effects, Photoshop, Illustrator, InDesign | ✅ | ✅ |
|
|
345
|
+
| Premiere Pro (CEP panel), Media Encoder (via Premiere) | ✅ | ✅ |
|
|
346
|
+
| Animate | ✅ | ✅ |
|
|
304
347
|
| Character Animator (via Photoshop) | ✅ | ✅ |
|
|
305
348
|
| Blender, Substance 3D Painter, texture libraries | ✅ | ✅ |
|
|
306
349
|
| Inline previews downscaled | `sips` | Windows PowerShell + System.Drawing |
|
|
@@ -323,12 +366,12 @@ Run `npx -y @ajsmonty/adobe-mcp doctor --live` first. Common cases:
|
|
|
323
366
|
|
|
324
367
|
| Symptom | Fix |
|
|
325
368
|
|---|---|
|
|
326
|
-
| "no result file appeared" from AE |
|
|
369
|
+
| "no result file appeared" from AE | Install the MCP Bridge panel and restart AE (recommended), or turn on "Allow Scripts to Write Files and Access Network". |
|
|
327
370
|
| Timeouts | The app is showing a modal dialog: dismiss it. Long renders: raise `timeout_seconds`, and check the output file before re-running. |
|
|
328
371
|
| macOS: "not authorized" / -1743 | System Settings → Privacy & Security → Automation → allow your MCP client to control the app. Each new client (Cursor, a different terminal) asks once. |
|
|
329
372
|
| Windows: `COM_CREATE_FAILED 0x800401f3` | The app isn't registered for COM: open it once normally, or set `PS_COM_PROGID` / `AI_COM_PROGID`. |
|
|
330
373
|
| Windows: `0x80070005` Access denied | Run the Adobe app and the MCP client at the same privilege level. |
|
|
331
|
-
| "
|
|
374
|
+
| "MCP Bridge panel is not running" | `npx -y @ajsmonty/adobe-mcp install`, restart Premiere / After Effects. If it still doesn't start by itself, open Window → Extensions → MCP Bridge. |
|
|
332
375
|
| Client shows no tools (Windows) | Use `"command": "cmd", "args": ["/c", "npx", ...]` in the config. |
|
|
333
376
|
| Client shows no tools (macOS, nvm) | GUI apps can't see nvm's Node; install Node from nodejs.org or Homebrew. |
|
|
334
377
|
|
|
@@ -336,20 +379,24 @@ Run `npx -y @ajsmonty/adobe-mcp doctor --live` first. Common cases:
|
|
|
336
379
|
|
|
337
380
|
| Variable | Default | Purpose |
|
|
338
381
|
|---|---|---|
|
|
339
|
-
| `ADOBE_MCP_APPS` | all | Comma list of tool sets: `ae, ps, ai, ppro, ch, blender, substance, textures, vfx`. |
|
|
382
|
+
| `ADOBE_MCP_APPS` | all | Comma list of tool sets: `ae, ps, ai, id, ppro (includes Media Encoder), an, ch, blender, substance, textures, vfx, files`. Names like `indesign`, `animate` or `media-encoder` work too. |
|
|
340
383
|
| `ADOBE_MCP_WORKSPACE` | `~/AdobeMCP` | Rendered assets, asset registry, learned lessons. |
|
|
341
|
-
| `AE_APP_NAME`, `PS_APP_NAME`, `AI_APP_NAME`, `PPRO_APP_NAME` | newest installed | macOS app names, e.g. `Adobe After Effects 2025`. |
|
|
384
|
+
| `AE_APP_NAME`, `PS_APP_NAME`, `AI_APP_NAME`, `ID_APP_NAME`, `PPRO_APP_NAME`, `AN_APP_NAME` | newest installed | macOS app names, e.g. `Adobe After Effects 2025`. |
|
|
342
385
|
| `AE_EXE` | newest `AfterFX.exe` | Windows path to After Effects. |
|
|
343
|
-
| `PS_COM_PROGID`, `AI_COM_PROGID` | `Photoshop.Application`, `Illustrator.Application` | Windows COM ProgIDs. |
|
|
386
|
+
| `PS_COM_PROGID`, `AI_COM_PROGID`, `ID_COM_PROGID` | `Photoshop.Application`, `Illustrator.Application`, `InDesign.Application` | Windows COM ProgIDs. |
|
|
387
|
+
| `AN_EXE` (Windows), `AN_APP_PATH` (macOS) | newest installed | Where Animate is. |
|
|
344
388
|
| `BLENDER_PATH`, `BLENDER_MCP_PORT` | auto, `9877` | Blender executable, live add-on port. |
|
|
345
389
|
| `SUBSTANCE_PAINTER_PORT` | `60041` | Substance remote-scripting port. |
|
|
390
|
+
| `ADOBE_MCP_AE_ROUTE` | panel when running | `script` forces After Effects onto AppleScript / `AfterFX.exe` even when the panel is up. |
|
|
391
|
+
| `ADOBE_MCP_BARROWS` | auto | `keep` shows the basic AE tools even when the Barrows AE Bridge is installed. |
|
|
346
392
|
| `ADOBE_MCP_TELEMETRY`, `ADOBE_MCP_TELEMETRY_URL` | off | Opt-in anonymous usage counts (see below). |
|
|
347
393
|
|
|
348
394
|
## Real limits
|
|
349
395
|
|
|
350
396
|
- These are scripting bridges into desktop apps. The app must be installed, and usually open.
|
|
351
397
|
- A modal dialog in any app blocks its bridge until someone dismisses it.
|
|
352
|
-
- The
|
|
398
|
+
- The MCP Bridge panel is unsigned, which is why `PlayerDebugMode` is needed. It talks to the server
|
|
399
|
+
only through files in `~/AdobeMCP/ppro-bridge` and `~/AdobeMCP/ae-bridge`: no network port.
|
|
353
400
|
- Character Animator has no scripting API: puppets are authored in Photoshop around it.
|
|
354
401
|
- The Blender add-on and Substance remote scripting listen on localhost without authentication.
|
|
355
402
|
Read [SECURITY.md](SECURITY.md).
|
|
@@ -374,9 +421,17 @@ on macOS, Windows and Linux in CI. All merges to `main` and `dev` need maintaine
|
|
|
374
421
|
protection + CODEOWNERS). Lessons for the knowledge base are the easiest high-value contribution.
|
|
375
422
|
Read [SECURITY.md](SECURITY.md) before installing: this server runs scripts in your apps by design.
|
|
376
423
|
|
|
377
|
-
Releases: bump the version in `package.json`, `manifest.json`, `server.json` and
|
|
378
|
-
(CI checks they agree)
|
|
379
|
-
the `.mcpb` bundle and the MCP registry entry.
|
|
424
|
+
Releases are automatic: bump the version in `package.json`, `manifest.json`, `server.json` and
|
|
425
|
+
`.claude-plugin/*` in your PR (CI checks they agree) and merge it. Any merge to `main` whose version
|
|
426
|
+
has no GitHub release yet publishes the npm packages, the `.mcpb` bundle and the MCP registry entry.
|
|
427
|
+
Merges without a version bump publish nothing. To retry a release, run the **release** workflow
|
|
428
|
+
from the Actions tab.
|
|
429
|
+
|
|
430
|
+
## Credits
|
|
431
|
+
|
|
432
|
+
Created by [AJ Montgomery](https://github.com/AJSMonty). The InDesign, Animate, Media Encoder, Premiere
|
|
433
|
+
editing, After Effects templating, Photoshop/Illustrator production and file tools come from the
|
|
434
|
+
Barrows line of adobe-mcp, with contributions by Derrin Byrne.
|
|
380
435
|
|
|
381
436
|
## License
|
|
382
437
|
|
package/SECURITY.md
CHANGED
|
@@ -33,6 +33,11 @@ Additional notes:
|
|
|
33
33
|
`blender_apply_texture` / `blender_set_hdri` with a library id) make network calls, and only
|
|
34
34
|
plain GETs to `api.polyhaven.com`, `ambientcg.com` and their download CDNs. They send search
|
|
35
35
|
keywords and asset ids, never your files or scene data.
|
|
36
|
+
- **The MCP Bridge panel** (Premiere Pro and After Effects) opens no port. It reads command files from
|
|
37
|
+
`~/AdobeMCP/ppro-bridge` / `~/AdobeMCP/ae-bridge` and writes results next to them, so anything that
|
|
38
|
+
can write to your home folder can already run scripts as you. It starts by itself when those apps open.
|
|
39
|
+
- The **Barrows AE Bridge** is a separate extension with its own security model; adobe-mcp only checks
|
|
40
|
+
whether it is installed and never talks to it.
|
|
36
41
|
- Library scripts under `scripts/` run with the same privileges; only add scripts you trust.
|
|
37
42
|
|
|
38
43
|
## Reporting a vulnerability
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
// After Effects: template filling, data-driven versions, render queue / Media Encoder.
|
|
2
|
+
// Ported from the Barrows line of adobe-mcp (contributions by Derrin Byrne).
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import fs from "node:fs";
|
|
6
|
+
import { runJSX } from "../core/bridge.mjs";
|
|
7
|
+
import { lit, esPath, loadRows, safeName } from "../core/helpers.mjs";
|
|
8
|
+
|
|
9
|
+
// Shared ExtendScript helpers (ES3).
|
|
10
|
+
const AE_LIB = `
|
|
11
|
+
function findComp(name) {
|
|
12
|
+
for (var i = 1; i <= app.project.numItems; i++) {
|
|
13
|
+
var it = app.project.item(i);
|
|
14
|
+
if (it instanceof CompItem && it.name === name) return it;
|
|
15
|
+
}
|
|
16
|
+
var names = [];
|
|
17
|
+
for (var j = 1; j <= app.project.numItems; j++) if (app.project.item(j) instanceof CompItem) names.push(app.project.item(j).name);
|
|
18
|
+
throw new Error('Comp "' + name + '" not found. Comps: ' + names.slice(0, 40).join(', '));
|
|
19
|
+
}
|
|
20
|
+
var __footCache = {};
|
|
21
|
+
function importFootage(p) {
|
|
22
|
+
if (__footCache[p]) return __footCache[p];
|
|
23
|
+
var f = new File(p);
|
|
24
|
+
if (!f.exists) throw new Error('File not found: ' + p);
|
|
25
|
+
for (var i = 1; i <= app.project.numItems; i++) {
|
|
26
|
+
var it = app.project.item(i);
|
|
27
|
+
if (it instanceof FootageItem && it.file && it.file.fsName === f.fsName) { __footCache[p] = it; return it; }
|
|
28
|
+
}
|
|
29
|
+
var item = app.project.importFile(new ImportOptions(f));
|
|
30
|
+
__footCache[p] = item;
|
|
31
|
+
return item;
|
|
32
|
+
}
|
|
33
|
+
function setText(layer, value) {
|
|
34
|
+
var st = layer.property('ADBE Text Properties').property('ADBE Text Document');
|
|
35
|
+
if (st.numKeys > 0) {
|
|
36
|
+
for (var k = 1; k <= st.numKeys; k++) { var tdk = st.keyValue(k); tdk.text = String(value); st.setValueAtKey(k, tdk); }
|
|
37
|
+
} else { var td = st.value; td.text = String(value); st.setValue(td); }
|
|
38
|
+
}
|
|
39
|
+
function applyFields(comp, textMap, footMap, report) {
|
|
40
|
+
for (var ln in textMap) {
|
|
41
|
+
var L = comp.layer(ln);
|
|
42
|
+
if (!L) { report.missing.push(ln); continue; }
|
|
43
|
+
if (!(L instanceof TextLayer)) { report.missing.push(ln + ' (not a text layer)'); continue; }
|
|
44
|
+
setText(L, textMap[ln]); report.text++;
|
|
45
|
+
}
|
|
46
|
+
for (var fn in footMap) {
|
|
47
|
+
var F = comp.layer(fn);
|
|
48
|
+
if (!F) { report.missing.push(fn); continue; }
|
|
49
|
+
if (!footMap[fn]) continue;
|
|
50
|
+
F.replaceSource(importFootage(footMap[fn]), false); report.footage++;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function queueComp(comp, opts) {
|
|
54
|
+
var rq = app.project.renderQueue.items.add(comp);
|
|
55
|
+
if (opts.render_settings_template) {
|
|
56
|
+
try { rq.applyTemplate(opts.render_settings_template); }
|
|
57
|
+
catch (e) { throw new Error('Render settings template "' + opts.render_settings_template + '" not found. Available: ' + rq.templates.join(', ')); }
|
|
58
|
+
}
|
|
59
|
+
var om = rq.outputModule(1);
|
|
60
|
+
if (opts.output_module_template) {
|
|
61
|
+
try { om.applyTemplate(opts.output_module_template); }
|
|
62
|
+
catch (e2) { throw new Error('Output module template "' + opts.output_module_template + '" not found. Available: ' + om.templates.join(', ')); }
|
|
63
|
+
}
|
|
64
|
+
var folder = new Folder(opts.output_folder);
|
|
65
|
+
if (!folder.exists) folder.create();
|
|
66
|
+
om.file = new File(opts.output_folder + '/' + (opts.file_name || comp.name));
|
|
67
|
+
return { comp: comp.name, output: om.file.fsName };
|
|
68
|
+
}
|
|
69
|
+
function startQueue(mode) {
|
|
70
|
+
if (mode === 'render') { app.project.renderQueue.render(); return 'rendered'; }
|
|
71
|
+
if (mode === 'ame') { app.project.renderQueue.queueInAME(true); return 'sent to Media Encoder (rendering there)'; }
|
|
72
|
+
if (mode === 'ame_queue') { app.project.renderQueue.queueInAME(false); return 'sent to Media Encoder queue (not started)'; }
|
|
73
|
+
return 'queued in After Effects (not started)';
|
|
74
|
+
}
|
|
75
|
+
`;
|
|
76
|
+
|
|
77
|
+
const renderSchema = {
|
|
78
|
+
output_folder: z.string().describe("Folder for rendered files (created if missing)."),
|
|
79
|
+
output_module_template: z.string().optional().describe("AE output module template name, e.g. 'H.264 - Match Render Settings - 15 Mbps'. Omit for AE's default."),
|
|
80
|
+
render_settings_template: z.string().optional().describe("AE render settings template name, e.g. 'Best Settings'."),
|
|
81
|
+
start: z.enum(["none", "render", "ame", "ame_queue"]).optional()
|
|
82
|
+
.describe("none = just queue (default); render = render now in AE (blocks); ame = send to Media Encoder and start; ame_queue = send to Media Encoder without starting."),
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export function register(server, { text, errText, registerAsset }) {
|
|
86
|
+
server.registerTool(
|
|
87
|
+
"ae_template_fill",
|
|
88
|
+
{
|
|
89
|
+
title: "Fill an After Effects template comp",
|
|
90
|
+
description:
|
|
91
|
+
"Set text layers and swap footage/image layers in a comp by layer name — the reliable way to customise " +
|
|
92
|
+
"a template. Optionally duplicate the comp first so the template stays untouched (note: duplicating a " +
|
|
93
|
+
"comp does not duplicate precomps inside it; edit precomps directly if the layers live there).",
|
|
94
|
+
inputSchema: {
|
|
95
|
+
comp: z.string().describe("Comp name."),
|
|
96
|
+
duplicate_as: z.string().optional().describe("Duplicate the comp under this name and edit the copy."),
|
|
97
|
+
text: z.record(z.string()).optional().describe("{ layerName: newText }"),
|
|
98
|
+
footage: z.record(z.string()).optional().describe("{ layerName: absolutePathToReplacementFile }"),
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
async ({ comp, duplicate_as, text: textMap, footage }) => {
|
|
102
|
+
try {
|
|
103
|
+
const jsx = `${AE_LIB}
|
|
104
|
+
var c = findComp(${lit(comp)});
|
|
105
|
+
if (${lit(duplicate_as || null)}) { c = c.duplicate(); c.name = ${lit(duplicate_as || "")}; }
|
|
106
|
+
var rep = { text: 0, footage: 0, missing: [] };
|
|
107
|
+
applyFields(c, ${lit(textMap || {})}, ${lit(Object.fromEntries(Object.entries(footage || {}).map(([k, v]) => [k, esPath(v)])))}, rep);
|
|
108
|
+
return { comp: c.name, text_layers_set: rep.text, footage_replaced: rep.footage, layers_not_found: rep.missing };`;
|
|
109
|
+
return text(await runJSX("ae", jsx, 300000));
|
|
110
|
+
} catch (e) {
|
|
111
|
+
return errText(e);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
server.registerTool(
|
|
117
|
+
"ae_versions_from_data",
|
|
118
|
+
{
|
|
119
|
+
title: "Make After Effects versions from a spreadsheet",
|
|
120
|
+
description:
|
|
121
|
+
"Data-driven versioning: for each row of a CSV/TSV (or inline rows), duplicate a template comp, fill " +
|
|
122
|
+
"its text and footage layers from columns, and optionally queue/render every version. Use for price " +
|
|
123
|
+
"changes, store/region variants, multiple languages, promo lists. Test with max_rows: 1 first.",
|
|
124
|
+
inputSchema: {
|
|
125
|
+
comp: z.string().describe("Template comp name."),
|
|
126
|
+
csv_path: z.string().optional().describe("Path to a .csv or .tsv with a header row."),
|
|
127
|
+
rows: z.array(z.record(z.string())).optional().describe("Inline rows instead of csv_path."),
|
|
128
|
+
text_columns: z.record(z.string()).optional().describe("{ layerName: columnName } for text layers."),
|
|
129
|
+
footage_columns: z.record(z.string()).optional().describe("{ layerName: columnName } where the column holds a file path."),
|
|
130
|
+
name_column: z.string().optional().describe("Column used to name each version (default: row number)."),
|
|
131
|
+
name_prefix: z.string().optional().describe("Prefix for version names (default: template comp name)."),
|
|
132
|
+
max_rows: z.number().int().optional().describe("Only process the first N rows (good for a test run)."),
|
|
133
|
+
render: z.object(renderSchema).optional().describe("Queue every version for rendering."),
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
async ({ comp, csv_path, rows, text_columns, footage_columns, name_column, name_prefix, max_rows, render }) => {
|
|
137
|
+
try {
|
|
138
|
+
let data = loadRows({ rows, csv_path });
|
|
139
|
+
if (max_rows) data = data.slice(0, max_rows);
|
|
140
|
+
const jobs = data.map((r, i) => {
|
|
141
|
+
const name = `${name_prefix ?? comp} - ${safeName(name_column ? r[name_column] : String(i + 1).padStart(3, "0"))}`;
|
|
142
|
+
const t = {}, f = {};
|
|
143
|
+
for (const [layer, col] of Object.entries(text_columns || {})) {
|
|
144
|
+
if (!(col in r)) throw new Error(`Column "${col}" not in data. Columns: ${Object.keys(r).join(", ")}`);
|
|
145
|
+
t[layer] = r[col];
|
|
146
|
+
}
|
|
147
|
+
for (const [layer, col] of Object.entries(footage_columns || {})) if (r[col]) f[layer] = esPath(r[col]);
|
|
148
|
+
return { name, text: t, footage: f };
|
|
149
|
+
});
|
|
150
|
+
const jsx = `${AE_LIB}
|
|
151
|
+
var tpl = findComp(${lit(comp)});
|
|
152
|
+
var jobs = ${lit(jobs)}, render = ${lit(render ? { ...render, output_folder: esPath(render.output_folder) } : null)};
|
|
153
|
+
var out = [], missing = {};
|
|
154
|
+
var folder = app.project.items.addFolder(${lit(`${comp} versions`)});
|
|
155
|
+
for (var i = 0; i < jobs.length; i++) {
|
|
156
|
+
var c = tpl.duplicate(); c.name = jobs[i].name; c.parentFolder = folder;
|
|
157
|
+
var rep = { text: 0, footage: 0, missing: [] };
|
|
158
|
+
applyFields(c, jobs[i].text, jobs[i].footage, rep);
|
|
159
|
+
for (var m = 0; m < rep.missing.length; m++) missing[rep.missing[m]] = true;
|
|
160
|
+
var entry = { comp: c.name };
|
|
161
|
+
if (render) entry.output = queueComp(c, { output_folder: render.output_folder, output_module_template: render.output_module_template,
|
|
162
|
+
render_settings_template: render.render_settings_template, file_name: c.name }).output;
|
|
163
|
+
out.push(entry);
|
|
164
|
+
}
|
|
165
|
+
var started = render ? startQueue(render.start || 'none') : null;
|
|
166
|
+
var miss = []; for (var k in missing) miss.push(k);
|
|
167
|
+
return { versions: out.length, project_folder: folder.name, items: out, layers_not_found: miss, render_status: started };`;
|
|
168
|
+
const timeout = render?.start === "render" ? 6 * 3600 * 1000 : 600000;
|
|
169
|
+
return text(await runJSX("ae", jsx, timeout));
|
|
170
|
+
} catch (e) {
|
|
171
|
+
return errText(e);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
server.registerTool(
|
|
177
|
+
"ae_queue_render",
|
|
178
|
+
{
|
|
179
|
+
title: "Queue After Effects comps for rendering",
|
|
180
|
+
description:
|
|
181
|
+
"Add one or more comps to the render queue with chosen output module / render settings templates and " +
|
|
182
|
+
"an output folder, then optionally render now or hand them to Adobe Media Encoder. If a template name " +
|
|
183
|
+
"is wrong, the error lists the available templates.",
|
|
184
|
+
inputSchema: { comps: z.array(z.string()).min(1).describe("Comp names."), ...renderSchema },
|
|
185
|
+
},
|
|
186
|
+
async ({ comps, output_folder, output_module_template, render_settings_template, start }) => {
|
|
187
|
+
try {
|
|
188
|
+
const jsx = `${AE_LIB}
|
|
189
|
+
var names = ${lit(comps)}, out = [];
|
|
190
|
+
for (var i = 0; i < names.length; i++) out.push(queueComp(findComp(names[i]), { output_folder: ${lit(esPath(output_folder))},
|
|
191
|
+
output_module_template: ${lit(output_module_template || null)}, render_settings_template: ${lit(render_settings_template || null)} }));
|
|
192
|
+
return { queued: out, status: startQueue(${lit(start || "none")}) };`;
|
|
193
|
+
const r = await runJSX("ae", jsx, start === "render" ? 6 * 3600 * 1000 : 300000);
|
|
194
|
+
if (start === "render" && registerAsset)
|
|
195
|
+
for (const q of r.queued || []) {
|
|
196
|
+
const dir = path.dirname(q.output);
|
|
197
|
+
try {
|
|
198
|
+
const f = fs.readdirSync(dir).find((n) => n.startsWith(path.basename(q.output)));
|
|
199
|
+
if (f) registerAsset({ app: "ae", kind: "video", path: path.join(dir, f), meta: { comp: q.comp } });
|
|
200
|
+
} catch { /* ignore */ }
|
|
201
|
+
}
|
|
202
|
+
return text(r);
|
|
203
|
+
} catch (e) {
|
|
204
|
+
return errText(e);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
);
|
|
208
|
+
}
|
package/adapters/an.mjs
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// Animate adapter (JSFL, handed to Animate on the command line; result via file).
|
|
2
|
+
// Ported from the Barrows line of adobe-mcp (contributions by Derrin Byrne).
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { runJSFL, lit, esPath } from "../core/helpers.mjs";
|
|
6
|
+
|
|
7
|
+
export function register(server, { text, errText, registerAsset }) {
|
|
8
|
+
server.registerTool(
|
|
9
|
+
"an_run_jsfl",
|
|
10
|
+
{
|
|
11
|
+
title: "Run JSFL in Adobe Animate",
|
|
12
|
+
description:
|
|
13
|
+
"Execute JSFL (Animate's JavaScript API) inside Animate and return the result. Runs as a function body: " +
|
|
14
|
+
"end with `return <value>`. Key DOM: fl.getDocumentDOM(), doc.getTimeline(), timeline.layers[].frames[], " +
|
|
15
|
+
"doc.library.items, doc.exportPNG / exportVideo / publish, FLfile for files (file:/// URIs — convert with " +
|
|
16
|
+
"FLfile.platformPathToURI). Animate must be open.",
|
|
17
|
+
inputSchema: {
|
|
18
|
+
code: z.string(),
|
|
19
|
+
timeout_seconds: z.number().optional().describe("Default 120."),
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
async ({ code, timeout_seconds }) => {
|
|
23
|
+
try {
|
|
24
|
+
return text({ ok: true, result: (await runJSFL(code, (timeout_seconds ?? 120) * 1000)) ?? null });
|
|
25
|
+
} catch (e) {
|
|
26
|
+
return errText(e);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
server.registerTool(
|
|
32
|
+
"an_get_state",
|
|
33
|
+
{
|
|
34
|
+
title: "Inspect open Animate documents",
|
|
35
|
+
description: "Lists open documents; for the current one: stage size, frame rate, document type, scenes, layers with frame counts, and library items.",
|
|
36
|
+
inputSchema: {},
|
|
37
|
+
},
|
|
38
|
+
async () => {
|
|
39
|
+
try {
|
|
40
|
+
const code = `
|
|
41
|
+
var out = { documents: [], current: null };
|
|
42
|
+
for (var i = 0; i < fl.documents.length; i++) out.documents.push(fl.documents[i].name);
|
|
43
|
+
var d = fl.getDocumentDOM();
|
|
44
|
+
if (d) {
|
|
45
|
+
var tl = d.getTimeline(), layers = [];
|
|
46
|
+
for (var l = 0; l < tl.layers.length; l++) layers.push({ name: tl.layers[l].name, type: tl.layers[l].layerType, frames: tl.layers[l].frameCount });
|
|
47
|
+
var lib = [];
|
|
48
|
+
for (var k = 0; k < d.library.items.length && k < 300; k++) lib.push({ name: d.library.items[k].name, type: d.library.items[k].itemType });
|
|
49
|
+
var scenes = []; for (var s = 0; s < d.timelines.length; s++) scenes.push(d.timelines[s].name);
|
|
50
|
+
out.current = { name: d.name, path: d.pathURI || null, width: d.width, height: d.height, fps: d.frameRate,
|
|
51
|
+
type: d.type || null, scenes: scenes, frames: tl.frameCount, layers: layers, library: lib };
|
|
52
|
+
}
|
|
53
|
+
return out;`;
|
|
54
|
+
return text(await runJSFL(code, 120000));
|
|
55
|
+
} catch (e) {
|
|
56
|
+
return errText(e);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
server.registerTool(
|
|
62
|
+
"an_export",
|
|
63
|
+
{
|
|
64
|
+
title: "Export from Adobe Animate",
|
|
65
|
+
description:
|
|
66
|
+
"Export the current Animate document: 'png_sequence' (every frame), 'png_frame' (current frame), " +
|
|
67
|
+
"'video' (MOV/MP4 via Animate's video export), or 'publish' (runs File → Publish with the document's " +
|
|
68
|
+
"own publish settings, e.g. HTML5 Canvas).",
|
|
69
|
+
inputSchema: {
|
|
70
|
+
kind: z.enum(["png_sequence", "png_frame", "video", "publish"]),
|
|
71
|
+
output_path: z.string().optional().describe("Required except for publish. For png_sequence give the first file name, e.g. .../frames/shot.png"),
|
|
72
|
+
transparent: z.boolean().optional().describe("Video: transparent background where supported."),
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
async ({ kind, output_path, transparent }) => {
|
|
76
|
+
try {
|
|
77
|
+
if (kind !== "publish" && !output_path) throw new Error("output_path is required.");
|
|
78
|
+
const code = `
|
|
79
|
+
var d = fl.getDocumentDOM(); if (!d) throw new Error('No Animate document is open.');
|
|
80
|
+
var kind = ${lit(kind)}, p = ${lit(output_path ? esPath(output_path) : null)};
|
|
81
|
+
if (p) { var dir = p.substring(0, p.lastIndexOf('/')); FLfile.createFolder(FLfile.platformPathToURI(dir)); }
|
|
82
|
+
var uri = p ? FLfile.platformPathToURI(p) : null, ok;
|
|
83
|
+
if (kind === 'png_sequence') ok = d.exportPNG(uri, true, false);
|
|
84
|
+
else if (kind === 'png_frame') ok = d.exportPNG(uri, true, true);
|
|
85
|
+
else if (kind === 'video') ok = d.exportVideo(uri, false, ${lit(!!transparent)}, false, 0);
|
|
86
|
+
else { d.publish(); ok = true; }
|
|
87
|
+
return { document: d.name, kind: kind, output: p, ok: ok !== false };`;
|
|
88
|
+
const r = await runJSFL(code, 1800000);
|
|
89
|
+
if (output_path) registerAsset?.({ app: "an", kind: path.extname(output_path).slice(1) || kind, path: output_path, meta: { doc: r.document } });
|
|
90
|
+
return text(r);
|
|
91
|
+
} catch (e) {
|
|
92
|
+
return errText(e);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
}
|