dcc-mcp-aftereffects 0.2.0__tar.gz
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.
- dcc_mcp_aftereffects-0.2.0/.github/workflows/ci.yml +36 -0
- dcc_mcp_aftereffects-0.2.0/.github/workflows/release.yml +35 -0
- dcc_mcp_aftereffects-0.2.0/.gitignore +8 -0
- dcc_mcp_aftereffects-0.2.0/.release-please-manifest.json +1 -0
- dcc_mcp_aftereffects-0.2.0/CHANGELOG.md +22 -0
- dcc_mcp_aftereffects-0.2.0/LICENSE +21 -0
- dcc_mcp_aftereffects-0.2.0/PKG-INFO +42 -0
- dcc_mcp_aftereffects-0.2.0/README.md +17 -0
- dcc_mcp_aftereffects-0.2.0/pyproject.toml +39 -0
- dcc_mcp_aftereffects-0.2.0/release-please-config.json +1 -0
- dcc_mcp_aftereffects-0.2.0/src/dcc_mcp_aftereffects/__init__.py +6 -0
- dcc_mcp_aftereffects-0.2.0/src/dcc_mcp_aftereffects/__version__.py +3 -0
- dcc_mcp_aftereffects-0.2.0/src/dcc_mcp_aftereffects/aftereffects_cep/CSXS/manifest.xml +6 -0
- dcc_mcp_aftereffects-0.2.0/src/dcc_mcp_aftereffects/aftereffects_cep/index.html +1 -0
- dcc_mcp_aftereffects-0.2.0/src/dcc_mcp_aftereffects/aftereffects_cep/js/index.js +5 -0
- dcc_mcp_aftereffects-0.2.0/src/dcc_mcp_aftereffects/aftereffects_cep/jsx/host.jsx +7 -0
- dcc_mcp_aftereffects-0.2.0/src/dcc_mcp_aftereffects/bridge.py +132 -0
- dcc_mcp_aftereffects-0.2.0/src/dcc_mcp_aftereffects/server.py +57 -0
- dcc_mcp_aftereffects-0.2.0/src/dcc_mcp_aftereffects/skills/aftereffects-project/SKILL.md +20 -0
- dcc_mcp_aftereffects-0.2.0/src/dcc_mcp_aftereffects/skills/aftereffects-project/scripts/inspect_project.py +17 -0
- dcc_mcp_aftereffects-0.2.0/src/dcc_mcp_aftereffects/skills/aftereffects-project/scripts/list_compositions.py +17 -0
- dcc_mcp_aftereffects-0.2.0/src/dcc_mcp_aftereffects/skills/aftereffects-project/scripts/save_project.py +17 -0
- dcc_mcp_aftereffects-0.2.0/src/dcc_mcp_aftereffects/skills/aftereffects-project/tools.yaml +34 -0
- dcc_mcp_aftereffects-0.2.0/tests/test_bridge.py +16 -0
- dcc_mcp_aftereffects-0.2.0/tests/test_package.py +17 -0
- dcc_mcp_aftereffects-0.2.0/tools/lint_skills.py +8 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
test:
|
|
13
|
+
name: ${{ matrix.os }} / Python ${{ matrix.python-version }}
|
|
14
|
+
runs-on: ${{ matrix.os }}
|
|
15
|
+
strategy:
|
|
16
|
+
fail-fast: false
|
|
17
|
+
matrix:
|
|
18
|
+
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
19
|
+
python-version: ["3.9", "3.11", "3.12"]
|
|
20
|
+
exclude:
|
|
21
|
+
- os: windows-latest
|
|
22
|
+
python-version: "3.9"
|
|
23
|
+
- os: macos-latest
|
|
24
|
+
python-version: "3.9"
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/checkout@v4
|
|
27
|
+
- uses: actions/setup-python@v5
|
|
28
|
+
with:
|
|
29
|
+
python-version: ${{ matrix.python-version }}
|
|
30
|
+
- run: python -m pip install -e ".[dev]"
|
|
31
|
+
- run: pytest
|
|
32
|
+
- run: ruff check src tests tools
|
|
33
|
+
- run: ruff format --check src tests tools
|
|
34
|
+
- run: python tools/lint_skills.py
|
|
35
|
+
- run: python -m build
|
|
36
|
+
- run: python -m twine check dist/*
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: write
|
|
10
|
+
pull-requests: write
|
|
11
|
+
id-token: write
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
release-please:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
outputs:
|
|
17
|
+
release_created: ${{ steps.release.outputs.release_created }}
|
|
18
|
+
steps:
|
|
19
|
+
- id: release
|
|
20
|
+
uses: googleapis/release-please-action@v4
|
|
21
|
+
with:
|
|
22
|
+
config-file: release-please-config.json
|
|
23
|
+
manifest-file: .release-please-manifest.json
|
|
24
|
+
publish:
|
|
25
|
+
needs: release-please
|
|
26
|
+
if: ${{ needs.release-please.outputs.release_created == 'true' }}
|
|
27
|
+
runs-on: ubuntu-latest
|
|
28
|
+
environment: pypi
|
|
29
|
+
permissions: {id-token: write, contents: read}
|
|
30
|
+
steps:
|
|
31
|
+
- uses: actions/checkout@v4
|
|
32
|
+
- uses: actions/setup-python@v5
|
|
33
|
+
with: {python-version: "3.12"}
|
|
34
|
+
- run: python -m pip install build && python -m build
|
|
35
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{".":"0.2.0"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## [0.2.0](https://github.com/dcc-mcp/dcc-mcp-aftereffects/compare/v0.1.0...v0.2.0) (2026-07-14)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* add After Effects MCP adapter ([5c0d65b](https://github.com/dcc-mcp/dcc-mcp-aftereffects/commit/5c0d65be4b3771158b7c2218aabc85f86655d59b))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* parse release manifest in version test ([332a385](https://github.com/dcc-mcp/dcc-mcp-aftereffects/commit/332a3857777234b8cd8975188335925f302dc3f4))
|
|
16
|
+
* use valid CI expression syntax ([ade0c0a](https://github.com/dcc-mcp/dcc-mcp-aftereffects/commit/ade0c0ad1140eb1eeaaefed27c9a8df66a956809))
|
|
17
|
+
|
|
18
|
+
## [0.1.0] - 2026-07-14
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- Initial After Effects MCP adapter with CEP bridge and typed project tools.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 dcc-mcp contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dcc-mcp-aftereffects
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: MCP adapter for Adobe After Effects
|
|
5
|
+
Project-URL: Homepage, https://github.com/dcc-mcp/dcc-mcp-aftereffects
|
|
6
|
+
Project-URL: Repository, https://github.com/dcc-mcp/dcc-mcp-aftereffects
|
|
7
|
+
Author-email: loonghao <hal.long@outlook.com>
|
|
8
|
+
License: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Requires-Python: >=3.9
|
|
18
|
+
Requires-Dist: dcc-mcp-core<1.0.0,>=0.19.13
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Requires-Dist: build>=1.2; extra == 'dev'
|
|
21
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
22
|
+
Requires-Dist: ruff>=0.8; extra == 'dev'
|
|
23
|
+
Requires-Dist: twine>=6; extra == 'dev'
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# dcc-mcp-aftereffects
|
|
27
|
+
|
|
28
|
+
MCP adapter for Adobe After Effects. It uses a bundled CEP panel and typed ExtendScript handlers over a localhost-only bridge.
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pip install dcc-mcp-aftereffects
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Install the shipped `dcc_mcp_aftereffects/aftereffects_cep` extension, open its panel in After Effects, and start `dcc-mcp-aftereffects` through the normal MCP launcher. The MCP endpoint defaults to `http://127.0.0.1:8765/mcp`.
|
|
35
|
+
|
|
36
|
+
Set the same non-default `DCC_MCP_AFTEREFFECTS_BRIDGE_TOKEN` in the adapter environment and CEP panel before production use.
|
|
37
|
+
|
|
38
|
+
## Tools
|
|
39
|
+
|
|
40
|
+
- `aftereffects-project.inspect_project`
|
|
41
|
+
- `aftereffects-project.list_compositions`
|
|
42
|
+
- `aftereffects-project.save_project`
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# dcc-mcp-aftereffects
|
|
2
|
+
|
|
3
|
+
MCP adapter for Adobe After Effects. It uses a bundled CEP panel and typed ExtendScript handlers over a localhost-only bridge.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
pip install dcc-mcp-aftereffects
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Install the shipped `dcc_mcp_aftereffects/aftereffects_cep` extension, open its panel in After Effects, and start `dcc-mcp-aftereffects` through the normal MCP launcher. The MCP endpoint defaults to `http://127.0.0.1:8765/mcp`.
|
|
10
|
+
|
|
11
|
+
Set the same non-default `DCC_MCP_AFTEREFFECTS_BRIDGE_TOKEN` in the adapter environment and CEP panel before production use.
|
|
12
|
+
|
|
13
|
+
## Tools
|
|
14
|
+
|
|
15
|
+
- `aftereffects-project.inspect_project`
|
|
16
|
+
- `aftereffects-project.list_compositions`
|
|
17
|
+
- `aftereffects-project.save_project`
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.26"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "dcc-mcp-aftereffects"
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
description = "MCP adapter for Adobe After Effects"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [{ name = "loonghao", email = "hal.long@outlook.com" }]
|
|
13
|
+
classifiers = ["Development Status :: 3 - Alpha", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12"]
|
|
14
|
+
dependencies = ["dcc-mcp-core>=0.19.13,<1.0.0"]
|
|
15
|
+
|
|
16
|
+
[project.urls]
|
|
17
|
+
Homepage = "https://github.com/dcc-mcp/dcc-mcp-aftereffects"
|
|
18
|
+
Repository = "https://github.com/dcc-mcp/dcc-mcp-aftereffects"
|
|
19
|
+
|
|
20
|
+
[project.optional-dependencies]
|
|
21
|
+
dev = ["build>=1.2", "pytest>=8", "ruff>=0.8", "twine>=6"]
|
|
22
|
+
|
|
23
|
+
[project.entry-points."dcc_mcp.adapters"]
|
|
24
|
+
aftereffects = "dcc_mcp_aftereffects:AfterEffectsMcpServer"
|
|
25
|
+
|
|
26
|
+
[tool.hatch.build.targets.wheel]
|
|
27
|
+
packages = ["src/dcc_mcp_aftereffects"]
|
|
28
|
+
artifacts = ["src/dcc_mcp_aftereffects/skills/**", "src/dcc_mcp_aftereffects/aftereffects_cep/**"]
|
|
29
|
+
|
|
30
|
+
[tool.pytest.ini_options]
|
|
31
|
+
testpaths = ["tests"]
|
|
32
|
+
|
|
33
|
+
[tool.ruff]
|
|
34
|
+
target-version = "py39"
|
|
35
|
+
line-length = 100
|
|
36
|
+
|
|
37
|
+
[tool.ruff.lint]
|
|
38
|
+
select = ["E", "F", "I", "B"]
|
|
39
|
+
ignore = ["E501"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"packages":{".":{"release-type":"python","package-name":"dcc-mcp-aftereffects","changelog-path":"CHANGELOG.md","include-component-in-tag":false,"extra-files":[{"type":"toml","path":"pyproject.toml","jsonpath":"$.project.version"},{"type":"generic","path":"src/dcc_mcp_aftereffects/__version__.py"}]}}}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<ExtensionManifest Version="7.0" ExtensionBundleId="com.dccmcp.aftereffects" ExtensionBundleVersion="0.1.0" ExtensionBundleName="DCC MCP After Effects">
|
|
3
|
+
<ExtensionList><Extension Id="com.dccmcp.aftereffects.panel" Version="0.1.0" /></ExtensionList>
|
|
4
|
+
<ExecutionEnvironment><HostList><Host Name="AEFT" Version="[16.0,99.9]" /></HostList><LocaleList><Locale Code="All" /></LocaleList><RequiredRuntimeList><RequiredRuntime Name="CSXS" Version="10.0" /></RequiredRuntimeList></ExecutionEnvironment>
|
|
5
|
+
<DispatchInfoList><Extension Id="com.dccmcp.aftereffects.panel"><DispatchInfo><Resources><MainPath>index.html</MainPath><ScriptPath>jsx/host.jsx</ScriptPath></Resources><Lifecycle><AutoVisible>true</AutoVisible></Lifecycle><UI><Type>Panel</Type><Menu>DCC MCP</Menu><Geometry><Size><Width>280</Width><Height>80</Height></Size></Geometry></UI></DispatchInfo></Extension></DispatchInfoList>
|
|
6
|
+
</ExtensionManifest>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<!doctype html><html><body>DCC MCP bridge connected.<script src="js/index.js"></script></body></html>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
var baseUrl = "http://127.0.0.1:47394";
|
|
2
|
+
var token = "dev-token"; // Set the same value as DCC_MCP_AFTEREFFECTS_BRIDGE_TOKEN before production use.
|
|
3
|
+
function request(method, path, body, done) { var xhr = new XMLHttpRequest(); xhr.open(method, baseUrl + path, true); xhr.setRequestHeader("X-DCC-MCP-Token", token); xhr.setRequestHeader("Content-Type", "application/json"); xhr.onload = function () { done(xhr.responseText); }; xhr.send(body ? JSON.stringify(body) : null); }
|
|
4
|
+
function poll() { request("GET", "/next", null, function (raw) { var job = JSON.parse(raw); if (!job.id) return setTimeout(poll, 50); window.__adobe_cep__.evalScript("dccMcpAfterEffects(" + JSON.stringify(JSON.stringify(job)) + ")", function (response) { var result; var error = null; try { result = JSON.parse(response); } catch (e) { error = response || String(e); } request("POST", "/result", {id: job.id, result: result, error: error}, function () { setTimeout(poll, 0); }); }); }); }
|
|
5
|
+
poll();
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
function dccMcpAfterEffects(raw) {
|
|
2
|
+
var job = JSON.parse(raw); var project = app.project;
|
|
3
|
+
if (job.action === "inspect_project") return JSON.stringify({project_name: project.file ? project.file.name : null, item_count: project.numItems, active_item: project.activeItem ? project.activeItem.name : null});
|
|
4
|
+
if (job.action === "list_compositions") { var comps = []; for (var i = 1; i <= project.numItems; i++) { var item = project.item(i); if (item instanceof CompItem) comps.push({name: item.name, width: item.width, height: item.height, duration: item.duration}); } return JSON.stringify({compositions: comps, composition_count: comps.length}); }
|
|
5
|
+
if (job.action === "save_project") { var path = job.params.path; if (!/^([A-Za-z]:[\\/]|\/)/.test(path) || !/\.aep$/i.test(path)) throw new Error("path must be absolute and end with .aep"); project.save(new File(path)); return JSON.stringify({path: path, saved: true}); }
|
|
6
|
+
throw new Error("Unsupported action: " + job.action);
|
|
7
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"""Minimal localhost request broker shared by the MCP server and CEP panel."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
import os
|
|
7
|
+
import queue
|
|
8
|
+
import threading
|
|
9
|
+
import uuid
|
|
10
|
+
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
|
11
|
+
from typing import Any, Optional
|
|
12
|
+
from urllib.request import Request, urlopen
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class BridgeBroker:
|
|
16
|
+
"""Queue typed requests until the installed Adobe panel completes them."""
|
|
17
|
+
|
|
18
|
+
def __init__(self, prefix: str, default_port: int) -> None:
|
|
19
|
+
self._prefix = prefix
|
|
20
|
+
self._port = int(os.environ.get(f"{prefix}_BRIDGE_PORT", default_port))
|
|
21
|
+
self._token = os.environ.get(f"{prefix}_BRIDGE_TOKEN", "dev-token")
|
|
22
|
+
self._pending: queue.Queue[dict[str, Any]] = queue.Queue()
|
|
23
|
+
self._waiting: dict[str, tuple[threading.Event, dict[str, Any]]] = {}
|
|
24
|
+
self._lock = threading.Lock()
|
|
25
|
+
self._httpd: Optional[ThreadingHTTPServer] = None
|
|
26
|
+
self._thread: Optional[threading.Thread] = None
|
|
27
|
+
os.environ.setdefault(f"{prefix}_BRIDGE_URL", f"http://127.0.0.1:{self._port}")
|
|
28
|
+
|
|
29
|
+
def start(self) -> None:
|
|
30
|
+
if self._httpd is not None:
|
|
31
|
+
return
|
|
32
|
+
broker = self
|
|
33
|
+
|
|
34
|
+
class Handler(BaseHTTPRequestHandler):
|
|
35
|
+
def do_GET(self): # noqa: N802
|
|
36
|
+
if self.path != "/next" or not self._authorized():
|
|
37
|
+
return self._send(403, {"error": "forbidden"})
|
|
38
|
+
self._send(200, broker.next())
|
|
39
|
+
|
|
40
|
+
def do_POST(self): # noqa: N802
|
|
41
|
+
if not self._authorized():
|
|
42
|
+
return self._send(403, {"error": "forbidden"})
|
|
43
|
+
try:
|
|
44
|
+
payload = json.loads(self.rfile.read(int(self.headers["Content-Length"])))
|
|
45
|
+
except (KeyError, ValueError, json.JSONDecodeError):
|
|
46
|
+
return self._send(400, {"error": "invalid JSON"})
|
|
47
|
+
if self.path == "/call":
|
|
48
|
+
try:
|
|
49
|
+
return self._send(
|
|
50
|
+
200, broker.submit(payload["action"], payload.get("params", {}))
|
|
51
|
+
)
|
|
52
|
+
except (KeyError, RuntimeError) as error:
|
|
53
|
+
return self._send(503, {"error": str(error)})
|
|
54
|
+
if self.path == "/result":
|
|
55
|
+
broker.resolve(
|
|
56
|
+
payload.get("id", ""), payload.get("result"), payload.get("error")
|
|
57
|
+
)
|
|
58
|
+
return self._send(200, {"ok": True})
|
|
59
|
+
return self._send(404, {"error": "not found"})
|
|
60
|
+
|
|
61
|
+
def log_message(self, *_: Any) -> None:
|
|
62
|
+
return
|
|
63
|
+
|
|
64
|
+
def _authorized(self) -> bool:
|
|
65
|
+
return self.headers.get("X-DCC-MCP-Token") == broker._token
|
|
66
|
+
|
|
67
|
+
def _send(self, status: int, payload: dict[str, Any]) -> None:
|
|
68
|
+
body = json.dumps(payload).encode("utf-8")
|
|
69
|
+
self.send_response(status)
|
|
70
|
+
self.send_header("Content-Type", "application/json")
|
|
71
|
+
self.send_header("Content-Length", str(len(body)))
|
|
72
|
+
self.end_headers()
|
|
73
|
+
self.wfile.write(body)
|
|
74
|
+
|
|
75
|
+
self._httpd = ThreadingHTTPServer(("127.0.0.1", self._port), Handler)
|
|
76
|
+
self._thread = threading.Thread(target=self._httpd.serve_forever, daemon=True)
|
|
77
|
+
self._thread.start()
|
|
78
|
+
|
|
79
|
+
def stop(self) -> None:
|
|
80
|
+
if self._httpd is not None:
|
|
81
|
+
self._httpd.shutdown()
|
|
82
|
+
self._httpd.server_close()
|
|
83
|
+
self._httpd = None
|
|
84
|
+
|
|
85
|
+
def submit(self, action: str, params: dict[str, Any], timeout: int = 30) -> dict[str, Any]:
|
|
86
|
+
request_id = uuid.uuid4().hex
|
|
87
|
+
completed, result = threading.Event(), {}
|
|
88
|
+
with self._lock:
|
|
89
|
+
self._waiting[request_id] = (completed, result)
|
|
90
|
+
self._pending.put({"id": request_id, "action": action, "params": params})
|
|
91
|
+
if not completed.wait(timeout):
|
|
92
|
+
with self._lock:
|
|
93
|
+
self._waiting.pop(request_id, None)
|
|
94
|
+
raise RuntimeError("Adobe bridge did not respond; open the bundled CEP panel")
|
|
95
|
+
if "error" in result:
|
|
96
|
+
raise RuntimeError(str(result["error"]))
|
|
97
|
+
return result.get("result", {})
|
|
98
|
+
|
|
99
|
+
def next(self) -> dict[str, Any]:
|
|
100
|
+
try:
|
|
101
|
+
return self._pending.get(timeout=25)
|
|
102
|
+
except queue.Empty:
|
|
103
|
+
return {"id": None}
|
|
104
|
+
|
|
105
|
+
def resolve(self, request_id: str, result: Any, error: Any) -> None:
|
|
106
|
+
with self._lock:
|
|
107
|
+
waiting = self._waiting.pop(request_id, None)
|
|
108
|
+
if waiting is None:
|
|
109
|
+
return
|
|
110
|
+
completed, payload = waiting
|
|
111
|
+
if error:
|
|
112
|
+
payload["error"] = error
|
|
113
|
+
else:
|
|
114
|
+
payload["result"] = result if isinstance(result, dict) else {"value": result}
|
|
115
|
+
completed.set()
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def call_bridge(prefix: str, action: str, params: dict[str, Any]) -> dict[str, Any]:
|
|
119
|
+
"""Call a running adapter-local bridge from a skill subprocess."""
|
|
120
|
+
url = os.environ[f"{prefix}_BRIDGE_URL"].rstrip("/") + "/call"
|
|
121
|
+
token = os.environ.get(f"{prefix}_BRIDGE_TOKEN", "dev-token")
|
|
122
|
+
request = Request(
|
|
123
|
+
url,
|
|
124
|
+
data=json.dumps({"action": action, "params": params}).encode("utf-8"),
|
|
125
|
+
headers={"Content-Type": "application/json", "X-DCC-MCP-Token": token},
|
|
126
|
+
method="POST",
|
|
127
|
+
)
|
|
128
|
+
with urlopen(request, timeout=35) as response: # noqa: S310 - loopback URL is adapter-owned.
|
|
129
|
+
payload = json.loads(response.read().decode("utf-8"))
|
|
130
|
+
if "error" in payload:
|
|
131
|
+
raise RuntimeError(payload["error"])
|
|
132
|
+
return payload
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"""After Effects MCP server lifecycle."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from typing import Optional
|
|
8
|
+
|
|
9
|
+
from dcc_mcp_core import DccServerOptions
|
|
10
|
+
from dcc_mcp_core.server_base import DccServerBase
|
|
11
|
+
|
|
12
|
+
from .__version__ import __version__
|
|
13
|
+
from .bridge import BridgeBroker
|
|
14
|
+
|
|
15
|
+
DEFAULT_PORT = 8765
|
|
16
|
+
_server: Optional["AfterEffectsMcpServer"] = None
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class AfterEffectsMcpServer(DccServerBase):
|
|
20
|
+
"""MCP server whose typed calls are completed by the CEP panel."""
|
|
21
|
+
|
|
22
|
+
def __init__(self, port: int = DEFAULT_PORT) -> None:
|
|
23
|
+
self.bridge = BridgeBroker("DCC_MCP_AFTEREFFECTS", 47394)
|
|
24
|
+
options = DccServerOptions.from_env(
|
|
25
|
+
"aftereffects",
|
|
26
|
+
Path(__file__).resolve().parent / "skills",
|
|
27
|
+
port=port,
|
|
28
|
+
server_name="dcc-mcp-aftereffects",
|
|
29
|
+
server_version=__version__,
|
|
30
|
+
)
|
|
31
|
+
super().__init__(options=options)
|
|
32
|
+
|
|
33
|
+
def start(self, **kwargs):
|
|
34
|
+
self.bridge.start()
|
|
35
|
+
return super().start(**kwargs)
|
|
36
|
+
|
|
37
|
+
def stop(self) -> None:
|
|
38
|
+
super().stop()
|
|
39
|
+
self.bridge.stop()
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def start_server(port: Optional[int] = None) -> AfterEffectsMcpServer:
|
|
43
|
+
global _server
|
|
44
|
+
if _server is None or not _server.is_running:
|
|
45
|
+
_server = AfterEffectsMcpServer(
|
|
46
|
+
port or int(os.environ.get("DCC_MCP_AFTEREFFECTS_PORT", DEFAULT_PORT))
|
|
47
|
+
)
|
|
48
|
+
_server.register_builtin_actions()
|
|
49
|
+
_server.start()
|
|
50
|
+
return _server
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def stop_server() -> None:
|
|
54
|
+
global _server
|
|
55
|
+
if _server is not None:
|
|
56
|
+
_server.stop()
|
|
57
|
+
_server = None
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: aftereffects-project
|
|
3
|
+
description: >-
|
|
4
|
+
Host skill - inspect compositions and explicitly save the active After Effects
|
|
5
|
+
project. Use when working with AEP projects. Not for raw ExtendScript execution.
|
|
6
|
+
license: MIT
|
|
7
|
+
compatibility: "After Effects CEP/ExtendScript; dcc-mcp-core 0.19+"
|
|
8
|
+
allowed-tools: Python
|
|
9
|
+
metadata:
|
|
10
|
+
dcc-mcp:
|
|
11
|
+
dcc: aftereffects
|
|
12
|
+
version: "0.1.0"
|
|
13
|
+
layer: domain
|
|
14
|
+
stage: scene
|
|
15
|
+
search-hint: "after effects project composition inspect save aep"
|
|
16
|
+
tags: "adobe, aftereffects, compositing, animation"
|
|
17
|
+
tools: tools.yaml
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
# After Effects Project
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from dcc_mcp_core.skill import skill_entry, skill_success
|
|
2
|
+
|
|
3
|
+
from dcc_mcp_aftereffects.bridge import call_bridge
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@skill_entry
|
|
7
|
+
def main(**_kwargs):
|
|
8
|
+
return skill_success(
|
|
9
|
+
"After Effects project inspected.",
|
|
10
|
+
**call_bridge("DCC_MCP_AFTEREFFECTS", "inspect_project", {}),
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
if __name__ == "__main__":
|
|
15
|
+
from dcc_mcp_core.skill import run_main
|
|
16
|
+
|
|
17
|
+
run_main(main)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from dcc_mcp_core.skill import skill_entry, skill_success
|
|
2
|
+
|
|
3
|
+
from dcc_mcp_aftereffects.bridge import call_bridge
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@skill_entry
|
|
7
|
+
def main(**_kwargs):
|
|
8
|
+
return skill_success(
|
|
9
|
+
"After Effects compositions listed.",
|
|
10
|
+
**call_bridge("DCC_MCP_AFTEREFFECTS", "list_compositions", {}),
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
if __name__ == "__main__":
|
|
15
|
+
from dcc_mcp_core.skill import run_main
|
|
16
|
+
|
|
17
|
+
run_main(main)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from dcc_mcp_core.skill import skill_entry, skill_success
|
|
2
|
+
|
|
3
|
+
from dcc_mcp_aftereffects.bridge import call_bridge
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@skill_entry
|
|
7
|
+
def main(path: str, **_kwargs):
|
|
8
|
+
return skill_success(
|
|
9
|
+
"After Effects project saved.",
|
|
10
|
+
**call_bridge("DCC_MCP_AFTEREFFECTS", "save_project", {"path": path}),
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
if __name__ == "__main__":
|
|
15
|
+
from dcc_mcp_core.skill import run_main
|
|
16
|
+
|
|
17
|
+
run_main(main)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
tools:
|
|
2
|
+
- name: inspect_project
|
|
3
|
+
description: Return active After Effects project and item metadata.
|
|
4
|
+
input_schema: {type: object, properties: {}}
|
|
5
|
+
read_only: true
|
|
6
|
+
destructive: false
|
|
7
|
+
idempotent: true
|
|
8
|
+
execution: sync
|
|
9
|
+
affinity: any
|
|
10
|
+
timeout_hint_secs: 30
|
|
11
|
+
source_file: scripts/inspect_project.py
|
|
12
|
+
- name: list_compositions
|
|
13
|
+
description: List compositions in the active After Effects project.
|
|
14
|
+
input_schema: {type: object, properties: {}}
|
|
15
|
+
read_only: true
|
|
16
|
+
destructive: false
|
|
17
|
+
idempotent: true
|
|
18
|
+
execution: sync
|
|
19
|
+
affinity: any
|
|
20
|
+
timeout_hint_secs: 30
|
|
21
|
+
source_file: scripts/list_compositions.py
|
|
22
|
+
- name: save_project
|
|
23
|
+
description: Save the After Effects project to an explicit absolute .aep path.
|
|
24
|
+
input_schema:
|
|
25
|
+
type: object
|
|
26
|
+
required: [path]
|
|
27
|
+
properties: {path: {type: string, description: Absolute .aep output path.}}
|
|
28
|
+
read_only: false
|
|
29
|
+
destructive: true
|
|
30
|
+
idempotent: false
|
|
31
|
+
execution: sync
|
|
32
|
+
affinity: any
|
|
33
|
+
timeout_hint_secs: 60
|
|
34
|
+
source_file: scripts/save_project.py
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import threading
|
|
2
|
+
|
|
3
|
+
from dcc_mcp_aftereffects.bridge import BridgeBroker
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def test_broker_delivers_and_resolves_a_typed_request():
|
|
7
|
+
broker = BridgeBroker("TEST_AFTEREFFECTS", 0)
|
|
8
|
+
result = {}
|
|
9
|
+
thread = threading.Thread(
|
|
10
|
+
target=lambda: result.setdefault("value", broker.submit("inspect_project", {}))
|
|
11
|
+
)
|
|
12
|
+
thread.start()
|
|
13
|
+
job = broker.next()
|
|
14
|
+
broker.resolve(job["id"], {"project_name": "demo"}, None)
|
|
15
|
+
thread.join(timeout=1)
|
|
16
|
+
assert result["value"] == {"project_name": "demo"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
from dcc_mcp_aftereffects import __version__
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def test_version_metadata_is_synchronized():
|
|
8
|
+
root = Path(__file__).parents[1]
|
|
9
|
+
assert f'version = "{__version__}"' in (root / "pyproject.toml").read_text(encoding="utf-8")
|
|
10
|
+
manifest = json.loads((root / ".release-please-manifest.json").read_text(encoding="utf-8"))
|
|
11
|
+
assert manifest["."] == __version__
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def test_cep_panel_is_packaged_with_source():
|
|
15
|
+
panel = Path(__file__).parents[1] / "src" / "dcc_mcp_aftereffects" / "aftereffects_cep"
|
|
16
|
+
assert (panel / "CSXS" / "manifest.xml").is_file()
|
|
17
|
+
assert (panel / "jsx" / "host.jsx").is_file()
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
from dcc_mcp_core import validate_skill
|
|
4
|
+
|
|
5
|
+
skills_root = Path(__file__).parents[1] / "src" / "dcc_mcp_aftereffects" / "skills"
|
|
6
|
+
reports = [validate_skill(str(path)) for path in skills_root.iterdir() if path.is_dir()]
|
|
7
|
+
assert all(report.is_clean for report in reports), [report.issues for report in reports]
|
|
8
|
+
print(f"validated {len(reports)} bundled skills")
|