@ajsmonty/adobe-mcp 1.1.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.
@@ -0,0 +1,10 @@
1
+ // Auto Vertical Reframe — runs Premiere's AI Auto Reframe on the active sequence to
2
+ // produce a 9:16 vertical duplicate with subject tracking, named "<sequence> 9x16".
3
+ // Gotcha encoded here: the motion preset argument MUST be the string 'default'
4
+ // (a numeric preset throws 'Illegal Parameter type').
5
+ (function () {
6
+ var seq = app.project.activeSequence;
7
+ if (!seq) return "no active sequence";
8
+ var v = seq.autoReframeSequence(9, 16, "default", seq.name + " 9x16", false);
9
+ return v ? "created: " + v.name : "autoReframeSequence returned null";
10
+ })();
@@ -0,0 +1,12 @@
1
+ // Blueprint Line Extract — converts the active layer to white line-art on black
2
+ // (desaturate + contrast boost + Smart Blur Edge Only). Composite the result in
3
+ // SCREEN blend mode over a colored ground for blueprint / technical-drawing looks.
4
+ // Best on isolated, high-contrast subjects; the levels boost makes silhouettes register.
5
+ (function () {
6
+ var doc = app.activeDocument;
7
+ var lyr = doc.activeLayer;
8
+ lyr.desaturate();
9
+ lyr.adjustLevels(30, 190, 1.15, 0, 255);
10
+ lyr.applySmartBlur(2, 14, SmartBlurQuality.HIGH, SmartBlurMode.EDGEONLY);
11
+ lyr.name = lyr.name + " [linework]";
12
+ })();
package/server.mjs ADDED
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * adobe-mcp — Model Context Protocol server for the Adobe Creative Cloud suite (macOS).
4
+ *
5
+ * Bridges MCP tool calls into each app's scripting engine:
6
+ * AE / Photoshop / Illustrator → osascript (DoScript / do javascript) → ExtendScript
7
+ * Premiere Pro → mcp-bridge CEP panel (command-file handoff)
8
+ * Character Animator → integrated around (PSD puppet authoring via Photoshop)
9
+ *
10
+ * Adapters register namespaced tools (ae_*, ps_*, ai_*, ppro_*, ch_*), plus cross-app
11
+ * workflow tools (asset registry, layered handoffs, per-app script libraries).
12
+ */
13
+
14
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
15
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
16
+
17
+ import { register as registerAE } from "./adapters/ae.mjs";
18
+ import { register as registerPS } from "./adapters/ps.mjs";
19
+ import { register as registerAI } from "./adapters/ai.mjs";
20
+ import { register as registerPPRO } from "./adapters/ppro.mjs";
21
+ import { register as registerCH } from "./adapters/ch.mjs";
22
+ import { register as registerWorkflow, makeRegisterAsset } from "./workflow/workflow.mjs";
23
+ import { register as registerKnowledge, instructionsDigest } from "./knowledge/knowledge.mjs";
24
+
25
+ const server = new McpServer(
26
+ { name: "adobe-mcp", version: "1.1.0" },
27
+ { instructions: instructionsDigest() }
28
+ );
29
+
30
+ const ctx = {
31
+ text: (obj) => ({
32
+ content: [{ type: "text", text: typeof obj === "string" ? obj : JSON.stringify(obj, null, 2) }],
33
+ }),
34
+ errText: (e) => ({
35
+ content: [{ type: "text", text: `ERROR: ${e.message || e}` }],
36
+ isError: true,
37
+ }),
38
+ registerAsset: makeRegisterAsset(),
39
+ };
40
+
41
+ registerAE(server, ctx);
42
+ registerPS(server, ctx);
43
+ registerAI(server, ctx);
44
+ registerPPRO(server, ctx);
45
+ registerCH(server, ctx);
46
+ registerWorkflow(server, ctx);
47
+ registerKnowledge(server, ctx);
48
+
49
+ const transport = new StdioServerTransport();
50
+ await server.connect(transport);
51
+ console.error("adobe-mcp ready (ae, ps, ai, ppro, ch + workflow + knowledge)");
@@ -0,0 +1,180 @@
1
+ // Cross-app workflow: shared asset registry, native handoffs, per-app script libraries.
2
+ import { z } from "zod";
3
+ import fs from "node:fs";
4
+ import path from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+ import { runJSX, WORKSPACE, APPS } from "../core/bridge.mjs";
7
+
8
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
9
+ const SCRIPTS_ROOT = path.join(__dirname, "..", "scripts");
10
+ const MANIFEST = path.join(WORKSPACE, "assets.json");
11
+
12
+ function loadManifest() {
13
+ try { return JSON.parse(fs.readFileSync(MANIFEST, "utf8")); } catch { return []; }
14
+ }
15
+
16
+ export function makeRegisterAsset() {
17
+ return function registerAsset(asset) {
18
+ const list = loadManifest();
19
+ list.push({ id: `${asset.app}-${Date.now().toString(36)}`, at: new Date().toISOString(), ...asset });
20
+ fs.writeFileSync(MANIFEST, JSON.stringify(list, null, 2), "utf8");
21
+ };
22
+ }
23
+
24
+ export function register(server, { text, errText, registerAsset }) {
25
+ server.registerTool(
26
+ "workflow_assets",
27
+ {
28
+ title: "List workflow assets",
29
+ description:
30
+ "The shared cross-app asset registry. Every export/render from any adapter registers here " +
31
+ "with {id, app, kind, path}. Use it to pull one app's output into another.",
32
+ inputSchema: {
33
+ app: z.string().optional().describe("Filter by app (ae/ps/ai/ppro)."),
34
+ kind: z.string().optional().describe("Filter by kind (png/svg/psd/ai/video...)."),
35
+ },
36
+ },
37
+ async ({ app, kind }) => {
38
+ try {
39
+ let list = loadManifest();
40
+ if (app) list = list.filter((a) => a.app === app);
41
+ if (kind) list = list.filter((a) => a.kind === kind);
42
+ // drop entries whose file vanished
43
+ list = list.filter((a) => { try { return fs.existsSync(a.path); } catch { return false; } });
44
+ return text({ workspace: WORKSPACE, count: list.length, assets: list });
45
+ } catch (e) {
46
+ return errText(e);
47
+ }
48
+ }
49
+ );
50
+
51
+ server.registerTool(
52
+ "handoff_import_to_ae",
53
+ {
54
+ title: "Import a file into After Effects (layered handoff)",
55
+ description:
56
+ "Import a file into the AE project. Layered .psd (Photoshop) and .ai (Illustrator) files can " +
57
+ "import as a COMP — every source layer becomes an animatable AE layer. This is the design→" +
58
+ "motion handoff.",
59
+ inputSchema: {
60
+ file_path: z.string().describe("Absolute path (.psd/.ai for layered import, or any footage)."),
61
+ import_as: z.enum(["comp", "footage"]).optional().describe("Default comp for .psd/.ai, else footage."),
62
+ },
63
+ },
64
+ async ({ file_path, import_as }) => {
65
+ try {
66
+ const ext = path.extname(file_path).toLowerCase();
67
+ const asComp = import_as ? import_as === "comp" : ext === ".psd" || ext === ".ai";
68
+ const jsx = `
69
+ var io = new ImportOptions(new File(${JSON.stringify(file_path)}));
70
+ if (!io.file.exists) throw new Error('File not found: ' + ${JSON.stringify(file_path)});
71
+ ${asComp ? "if (io.canImportAs(ImportAsType.COMP)) io.importAs = ImportAsType.COMP;" : ""}
72
+ var item = app.project.importFile(io);
73
+ return { imported: item.name, type: item.typeName,
74
+ isComp: item instanceof CompItem,
75
+ numLayers: (item instanceof CompItem) ? item.numLayers : null };`;
76
+ return text(await runJSX("ae", jsx, 120000));
77
+ } catch (e) {
78
+ return errText(e);
79
+ }
80
+ }
81
+ );
82
+
83
+ server.registerTool(
84
+ "handoff_place_in_ps",
85
+ {
86
+ title: "Place a file into the active Photoshop document",
87
+ description:
88
+ "Place an image/vector file (SVG, PNG, AI...) as a layer in the active Photoshop document — " +
89
+ "the Illustrator→Photoshop handoff.",
90
+ inputSchema: {
91
+ file_path: z.string().describe("Absolute path to place."),
92
+ },
93
+ },
94
+ async ({ file_path }) => {
95
+ try {
96
+ const jsx = `
97
+ if (!app.documents.length) throw new Error('No document open in Photoshop');
98
+ var idPlc = charIDToTypeID('Plc ');
99
+ var desc = new ActionDescriptor();
100
+ desc.putPath(charIDToTypeID('null'), new File(${JSON.stringify(file_path)}));
101
+ desc.putEnumerated(charIDToTypeID('FTcs'), charIDToTypeID('QCSt'), charIDToTypeID('Qcsa'));
102
+ executeAction(idPlc, desc, DialogModes.NO);
103
+ return { placed: ${JSON.stringify(path.basename(file_path))}, layer: app.activeDocument.activeLayer.name };`;
104
+ return text(await runJSX("ps", jsx, 120000));
105
+ } catch (e) {
106
+ return errText(e);
107
+ }
108
+ }
109
+ );
110
+
111
+ server.registerTool(
112
+ "list_scripts",
113
+ {
114
+ title: "List installed script tools",
115
+ description:
116
+ "List .jsx/.jsxbin tools in the per-app scripts library (scripts/{ae,ps,ai,ppro}/), with " +
117
+ "descriptions from header comments.",
118
+ inputSchema: {
119
+ app: z.string().optional().describe("Filter to one app (ae/ps/ai/ppro)."),
120
+ },
121
+ },
122
+ async ({ app }) => {
123
+ try {
124
+ const apps = app ? [app] : Object.keys(APPS);
125
+ const out = {};
126
+ for (const a of apps) {
127
+ const dir = path.join(SCRIPTS_ROOT, a);
128
+ let entries = [];
129
+ try { entries = fs.readdirSync(dir).filter((f) => /\.(jsx|jsxbin)$/i.test(f)); } catch { /* none */ }
130
+ out[a] = entries.map((f) => {
131
+ let description = "[compiled .jsxbin]";
132
+ if (/\.jsx$/i.test(f)) {
133
+ try {
134
+ const head = fs.readFileSync(path.join(dir, f), "utf8").slice(0, 1500);
135
+ const m = head.match(/\/\*+([\s\S]*?)\*\//) || head.match(/^((?:\s*\/\/[^\n]*\n)+)/);
136
+ description = m ? m[1].replace(/^\s*(\/\/|\*)?\s?/gm, "").replace(/\s+/g, " ").trim().slice(0, 250) : "(no header)";
137
+ } catch { description = "(unreadable)"; }
138
+ }
139
+ return { name: f, description };
140
+ });
141
+ }
142
+ return text(out);
143
+ } catch (e) {
144
+ return errText(e);
145
+ }
146
+ }
147
+ );
148
+
149
+ server.registerTool(
150
+ "run_script",
151
+ {
152
+ title: "Run an installed script tool",
153
+ description:
154
+ "Execute a script from the library in its app (like File → Scripts → Run Script File). Action " +
155
+ "scripts run immediately; ScriptUI panels open for the user. Set up selections first via the " +
156
+ "app's run_extendscript.",
157
+ inputSchema: {
158
+ app: z.string().describe("Which app: ae/ps/ai/ppro."),
159
+ name: z.string().describe("Script filename from list_scripts (case-insensitive)."),
160
+ timeout_seconds: z.number().optional().describe("Max seconds (default 120)."),
161
+ },
162
+ },
163
+ async ({ app, name, timeout_seconds }) => {
164
+ try {
165
+ const dir = path.join(SCRIPTS_ROOT, app);
166
+ const match = fs.readdirSync(dir).find((f) => f.toLowerCase() === name.toLowerCase());
167
+ if (!match) throw new Error(`No script "${name}" in scripts/${app}/.`);
168
+ const full = path.join(dir, match);
169
+ const jsx = `
170
+ var __sf = new File(${JSON.stringify(full)});
171
+ if (!__sf.exists) throw new Error('Script not found: ' + __sf.fsName);
172
+ $.evalFile(__sf);
173
+ return 'Ran ' + ${JSON.stringify(match)};`;
174
+ return text(await runJSX(app, jsx, (timeout_seconds ?? 120) * 1000));
175
+ } catch (e) {
176
+ return errText(e);
177
+ }
178
+ }
179
+ );
180
+ }