dcc-mcp-mobu 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_mobu-0.2.0/.github/workflows/ci.yml +42 -0
- dcc_mcp_mobu-0.2.0/.github/workflows/release.yml +41 -0
- dcc_mcp_mobu-0.2.0/.gitignore +8 -0
- dcc_mcp_mobu-0.2.0/.release-please-manifest.json +3 -0
- dcc_mcp_mobu-0.2.0/CHANGELOG.md +24 -0
- dcc_mcp_mobu-0.2.0/LICENSE +21 -0
- dcc_mcp_mobu-0.2.0/PKG-INFO +65 -0
- dcc_mcp_mobu-0.2.0/README.md +38 -0
- dcc_mcp_mobu-0.2.0/pyproject.toml +48 -0
- dcc_mcp_mobu-0.2.0/release-please-config.json +1 -0
- dcc_mcp_mobu-0.2.0/src/dcc_mcp_mobu/__init__.py +5 -0
- dcc_mcp_mobu-0.2.0/src/dcc_mcp_mobu/__version__.py +3 -0
- dcc_mcp_mobu-0.2.0/src/dcc_mcp_mobu/dispatcher.py +92 -0
- dcc_mcp_mobu-0.2.0/src/dcc_mcp_mobu/mobu_plugin/startup/dcc_mcp_mobu.py +5 -0
- dcc_mcp_mobu-0.2.0/src/dcc_mcp_mobu/plugin.py +13 -0
- dcc_mcp_mobu-0.2.0/src/dcc_mcp_mobu/server.py +66 -0
- dcc_mcp_mobu-0.2.0/src/dcc_mcp_mobu/skills/mobu-scene/SKILL.md +24 -0
- dcc_mcp_mobu-0.2.0/src/dcc_mcp_mobu/skills/mobu-scene/scripts/inspect_scene.py +26 -0
- dcc_mcp_mobu-0.2.0/src/dcc_mcp_mobu/skills/mobu-scene/scripts/list_models.py +18 -0
- dcc_mcp_mobu-0.2.0/src/dcc_mcp_mobu/skills/mobu-scene/scripts/save_scene.py +28 -0
- dcc_mcp_mobu-0.2.0/src/dcc_mcp_mobu/skills/mobu-scene/tools.yaml +37 -0
- dcc_mcp_mobu-0.2.0/tests/test_package.py +20 -0
- dcc_mcp_mobu-0.2.0/tools/lint_skills.py +10 -0
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
- name: Install package and development tools
|
|
31
|
+
run: python -m pip install -e ".[dev]"
|
|
32
|
+
- name: Test
|
|
33
|
+
run: pytest
|
|
34
|
+
- name: Lint
|
|
35
|
+
run: |
|
|
36
|
+
ruff check src tests tools
|
|
37
|
+
ruff format --check src tests tools
|
|
38
|
+
python tools/lint_skills.py
|
|
39
|
+
- name: Build distribution
|
|
40
|
+
run: python -m build
|
|
41
|
+
- name: Check distribution metadata
|
|
42
|
+
run: python -m twine check dist/*
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
|
|
25
|
+
publish:
|
|
26
|
+
needs: release-please
|
|
27
|
+
if: ${{ needs.release-please.outputs.release_created == 'true' }}
|
|
28
|
+
runs-on: ubuntu-latest
|
|
29
|
+
environment: pypi
|
|
30
|
+
permissions:
|
|
31
|
+
id-token: write
|
|
32
|
+
contents: read
|
|
33
|
+
steps:
|
|
34
|
+
- uses: actions/checkout@v4
|
|
35
|
+
- uses: actions/setup-python@v5
|
|
36
|
+
with:
|
|
37
|
+
python-version: "3.12"
|
|
38
|
+
- name: Build distribution
|
|
39
|
+
run: python -m pip install build && python -m build
|
|
40
|
+
- name: Publish to PyPI
|
|
41
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,24 @@
|
|
|
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-mobu/compare/v0.1.0...v0.2.0) (2026-07-13)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* add MotionBuilder MCP adapter ([5084980](https://github.com/dcc-mcp/dcc-mcp-mobu/commit/50849808e15741b2220c7ecc517e564fce7f6afb))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* manage package version in releases ([91d3108](https://github.com/dcc-mcp/dcc-mcp-mobu/commit/91d31081c71b0d36be27e9f3e728aef5ec9c087b))
|
|
16
|
+
* mark package version for release please ([9b47a03](https://github.com/dcc-mcp/dcc-mcp-mobu/commit/9b47a030b56e58d406fd8f3ee9dabeb598f1d66c))
|
|
17
|
+
|
|
18
|
+
## [Unreleased]
|
|
19
|
+
|
|
20
|
+
## [0.1.0] - 2026-07-14
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
|
|
24
|
+
- Initial MotionBuilder MCP adapter with typed scene 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,65 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dcc-mcp-mobu
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: MCP adapter for Autodesk MotionBuilder
|
|
5
|
+
Project-URL: Homepage, https://github.com/dcc-mcp/dcc-mcp-mobu
|
|
6
|
+
Project-URL: Repository, https://github.com/dcc-mcp/dcc-mcp-mobu
|
|
7
|
+
Project-URL: Issues, https://github.com/dcc-mcp/dcc-mcp-mobu/issues
|
|
8
|
+
Author-email: loonghao <hal.long@outlook.com>
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Requires-Python: >=3.9
|
|
20
|
+
Requires-Dist: dcc-mcp-core>=0.19.13
|
|
21
|
+
Provides-Extra: dev
|
|
22
|
+
Requires-Dist: build>=1.2; extra == 'dev'
|
|
23
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
24
|
+
Requires-Dist: ruff>=0.8; extra == 'dev'
|
|
25
|
+
Requires-Dist: twine>=6; extra == 'dev'
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# dcc-mcp-mobu
|
|
29
|
+
|
|
30
|
+
An MCP adapter for Autodesk MotionBuilder, built on [dcc-mcp-core](https://github.com/dcc-mcp/dcc-mcp-core).
|
|
31
|
+
|
|
32
|
+
It exposes a small, typed scene-management surface and runs MotionBuilder API calls on the application's UI thread.
|
|
33
|
+
|
|
34
|
+
## Install
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pip install dcc-mcp-mobu
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Copy the installed `dcc_mcp_mobu/mobu_plugin/startup/dcc_mcp_mobu.py` into a MotionBuilder Python Startup directory, or add that directory to the application's Python Startup paths. Restart MotionBuilder to start the adapter.
|
|
41
|
+
|
|
42
|
+
By default the MCP server listens on port `8765`. Set `DCC_MCP_MOBU_PORT` to override it.
|
|
43
|
+
|
|
44
|
+
## Tools
|
|
45
|
+
|
|
46
|
+
- `mobu-scene.inspect_scene`
|
|
47
|
+
- `mobu-scene.list_models`
|
|
48
|
+
- `mobu-scene.save_scene`
|
|
49
|
+
|
|
50
|
+
`save_scene` is destructive and requires an explicit absolute `.fbx` path.
|
|
51
|
+
|
|
52
|
+
## Development
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
python -m pip install -e ".[dev]"
|
|
56
|
+
pytest
|
|
57
|
+
ruff check src tests tools
|
|
58
|
+
ruff format --check src tests tools
|
|
59
|
+
python tools/lint_skills.py
|
|
60
|
+
python -m build
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## License
|
|
64
|
+
|
|
65
|
+
MIT
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# dcc-mcp-mobu
|
|
2
|
+
|
|
3
|
+
An MCP adapter for Autodesk MotionBuilder, built on [dcc-mcp-core](https://github.com/dcc-mcp/dcc-mcp-core).
|
|
4
|
+
|
|
5
|
+
It exposes a small, typed scene-management surface and runs MotionBuilder API calls on the application's UI thread.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install dcc-mcp-mobu
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Copy the installed `dcc_mcp_mobu/mobu_plugin/startup/dcc_mcp_mobu.py` into a MotionBuilder Python Startup directory, or add that directory to the application's Python Startup paths. Restart MotionBuilder to start the adapter.
|
|
14
|
+
|
|
15
|
+
By default the MCP server listens on port `8765`. Set `DCC_MCP_MOBU_PORT` to override it.
|
|
16
|
+
|
|
17
|
+
## Tools
|
|
18
|
+
|
|
19
|
+
- `mobu-scene.inspect_scene`
|
|
20
|
+
- `mobu-scene.list_models`
|
|
21
|
+
- `mobu-scene.save_scene`
|
|
22
|
+
|
|
23
|
+
`save_scene` is destructive and requires an explicit absolute `.fbx` path.
|
|
24
|
+
|
|
25
|
+
## Development
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
python -m pip install -e ".[dev]"
|
|
29
|
+
pytest
|
|
30
|
+
ruff check src tests tools
|
|
31
|
+
ruff format --check src tests tools
|
|
32
|
+
python tools/lint_skills.py
|
|
33
|
+
python -m build
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## License
|
|
37
|
+
|
|
38
|
+
MIT
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.26"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "dcc-mcp-mobu"
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
description = "MCP adapter for Autodesk MotionBuilder"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [{ name = "loonghao", email = "hal.long@outlook.com" }]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 3 - Alpha",
|
|
15
|
+
"License :: OSI Approved :: MIT License",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
18
|
+
"Programming Language :: Python :: 3.9",
|
|
19
|
+
"Programming Language :: Python :: 3.10",
|
|
20
|
+
"Programming Language :: Python :: 3.11",
|
|
21
|
+
"Programming Language :: Python :: 3.12",
|
|
22
|
+
]
|
|
23
|
+
dependencies = ["dcc-mcp-core>=0.19.13"]
|
|
24
|
+
|
|
25
|
+
[project.urls]
|
|
26
|
+
Homepage = "https://github.com/dcc-mcp/dcc-mcp-mobu"
|
|
27
|
+
Repository = "https://github.com/dcc-mcp/dcc-mcp-mobu"
|
|
28
|
+
Issues = "https://github.com/dcc-mcp/dcc-mcp-mobu/issues"
|
|
29
|
+
|
|
30
|
+
[project.optional-dependencies]
|
|
31
|
+
dev = ["build>=1.2", "pytest>=8", "ruff>=0.8", "twine>=6"]
|
|
32
|
+
|
|
33
|
+
[tool.hatch.build.targets.wheel]
|
|
34
|
+
packages = ["src/dcc_mcp_mobu"]
|
|
35
|
+
artifacts = ["src/dcc_mcp_mobu/skills/**", "src/dcc_mcp_mobu/mobu_plugin/**"]
|
|
36
|
+
|
|
37
|
+
[tool.pytest.ini_options]
|
|
38
|
+
testpaths = ["tests"]
|
|
39
|
+
|
|
40
|
+
[tool.ruff]
|
|
41
|
+
target-version = "py39"
|
|
42
|
+
line-length = 100
|
|
43
|
+
|
|
44
|
+
[tool.ruff.lint]
|
|
45
|
+
select = ["E", "F", "I", "B"]
|
|
46
|
+
|
|
47
|
+
[tool.ruff.format]
|
|
48
|
+
quote-style = "double"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"packages":{".":{"release-type":"python","package-name":"dcc-mcp-mobu","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_mobu/__version__.py"}]}}}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"""UI-thread execution bridge for MotionBuilder."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from collections import deque
|
|
6
|
+
from dataclasses import dataclass
|
|
7
|
+
from threading import Event, Lock, current_thread, main_thread
|
|
8
|
+
from typing import Any, Callable, Deque, Optional
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass
|
|
12
|
+
class _PendingCall:
|
|
13
|
+
callback: Callable[..., Any]
|
|
14
|
+
args: tuple[Any, ...]
|
|
15
|
+
kwargs: dict[str, Any]
|
|
16
|
+
completed: Event
|
|
17
|
+
result: dict[str, Any]
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class MobuDispatcher:
|
|
21
|
+
"""Dispatch bridge that drains queued calls from ``FBSystem.OnUIIdle``."""
|
|
22
|
+
|
|
23
|
+
def __init__(self) -> None:
|
|
24
|
+
self._calls: Deque[_PendingCall] = deque()
|
|
25
|
+
self._lock = Lock()
|
|
26
|
+
self._system: Optional[Any] = None
|
|
27
|
+
self._installed = False
|
|
28
|
+
|
|
29
|
+
def install(self) -> None:
|
|
30
|
+
"""Register the UI-idle callback once MotionBuilder is available."""
|
|
31
|
+
if self._installed:
|
|
32
|
+
return
|
|
33
|
+
|
|
34
|
+
from pyfbsdk import FBSystem
|
|
35
|
+
|
|
36
|
+
self._system = FBSystem()
|
|
37
|
+
self._system.OnUIIdle.Add(self._drain)
|
|
38
|
+
self._installed = True
|
|
39
|
+
|
|
40
|
+
def uninstall(self) -> None:
|
|
41
|
+
"""Remove the UI-idle callback during adapter shutdown."""
|
|
42
|
+
if not self._installed or self._system is None:
|
|
43
|
+
return
|
|
44
|
+
|
|
45
|
+
self._system.OnUIIdle.Remove(self._drain)
|
|
46
|
+
self._system = None
|
|
47
|
+
self._installed = False
|
|
48
|
+
|
|
49
|
+
def dispatch_callable(self, callback: Callable[..., Any], *args: Any, **kwargs: Any) -> Any:
|
|
50
|
+
"""Run a callable on the MotionBuilder UI thread and return its result."""
|
|
51
|
+
for key in (
|
|
52
|
+
"context",
|
|
53
|
+
"action_name",
|
|
54
|
+
"skill_name",
|
|
55
|
+
"execution",
|
|
56
|
+
"timeout_hint_secs",
|
|
57
|
+
"affinity",
|
|
58
|
+
"thread_affinity",
|
|
59
|
+
):
|
|
60
|
+
kwargs.pop(key, None)
|
|
61
|
+
|
|
62
|
+
if current_thread() is main_thread():
|
|
63
|
+
return callback(*args, **kwargs)
|
|
64
|
+
if not self._installed:
|
|
65
|
+
raise RuntimeError("MotionBuilder UI dispatcher is not installed")
|
|
66
|
+
|
|
67
|
+
completed = Event()
|
|
68
|
+
result: dict[str, Any] = {}
|
|
69
|
+
pending = _PendingCall(callback, args, kwargs, completed, result)
|
|
70
|
+
with self._lock:
|
|
71
|
+
self._calls.append(pending)
|
|
72
|
+
|
|
73
|
+
if not completed.wait(timeout=30):
|
|
74
|
+
raise RuntimeError("Timed out waiting for MotionBuilder UI thread execution")
|
|
75
|
+
if "error" in result:
|
|
76
|
+
raise result["error"]
|
|
77
|
+
return result["value"]
|
|
78
|
+
|
|
79
|
+
def _drain(self, *_: Any) -> None:
|
|
80
|
+
"""Execute queued work while MotionBuilder is idle."""
|
|
81
|
+
while True:
|
|
82
|
+
with self._lock:
|
|
83
|
+
if not self._calls:
|
|
84
|
+
return
|
|
85
|
+
pending = self._calls.popleft()
|
|
86
|
+
|
|
87
|
+
try:
|
|
88
|
+
pending.result["value"] = pending.callback(*pending.args, **pending.kwargs)
|
|
89
|
+
except Exception as error:
|
|
90
|
+
pending.result["error"] = error
|
|
91
|
+
finally:
|
|
92
|
+
pending.completed.set()
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""MotionBuilder Python Startup entry points."""
|
|
2
|
+
|
|
3
|
+
from .server import start_server, stop_server
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def initialize() -> None:
|
|
7
|
+
"""Start the MCP adapter after MotionBuilder finishes startup."""
|
|
8
|
+
start_server()
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def shutdown() -> None:
|
|
12
|
+
"""Stop the MCP adapter before MotionBuilder exits."""
|
|
13
|
+
stop_server()
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"""MotionBuilder 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, HostExecutionBridge
|
|
10
|
+
from dcc_mcp_core.server_base import DccServerBase
|
|
11
|
+
|
|
12
|
+
from .__version__ import __version__
|
|
13
|
+
from .dispatcher import MobuDispatcher
|
|
14
|
+
|
|
15
|
+
DEFAULT_PORT = 8765
|
|
16
|
+
SERVER_NAME = "dcc-mcp-mobu"
|
|
17
|
+
_dispatcher = MobuDispatcher()
|
|
18
|
+
_server: Optional["MobuMcpServer"] = None
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class MobuMcpServer(DccServerBase):
|
|
22
|
+
"""DCC MCP server configured for a running MotionBuilder process."""
|
|
23
|
+
|
|
24
|
+
def __init__(self, port: int = DEFAULT_PORT) -> None:
|
|
25
|
+
options = DccServerOptions.from_env(
|
|
26
|
+
"mobu",
|
|
27
|
+
Path(__file__).resolve().parent / "skills",
|
|
28
|
+
port=port,
|
|
29
|
+
server_name=SERVER_NAME,
|
|
30
|
+
server_version=__version__,
|
|
31
|
+
execution_bridge=HostExecutionBridge(dispatcher=_dispatcher),
|
|
32
|
+
enable_file_logging=True,
|
|
33
|
+
enable_telemetry=True,
|
|
34
|
+
)
|
|
35
|
+
super().__init__(options=options)
|
|
36
|
+
|
|
37
|
+
def _version_string(self) -> str:
|
|
38
|
+
try:
|
|
39
|
+
from pyfbsdk import FBSystem
|
|
40
|
+
|
|
41
|
+
return str(FBSystem().Version)
|
|
42
|
+
except Exception:
|
|
43
|
+
return "unknown"
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def start_server(port: Optional[int] = None) -> MobuMcpServer:
|
|
47
|
+
"""Start the singleton MCP server from MotionBuilder startup code."""
|
|
48
|
+
global _server
|
|
49
|
+
if _server is not None:
|
|
50
|
+
return _server
|
|
51
|
+
|
|
52
|
+
_dispatcher.install()
|
|
53
|
+
resolved_port = port or int(os.environ.get("DCC_MCP_MOBU_PORT", DEFAULT_PORT))
|
|
54
|
+
_server = MobuMcpServer(resolved_port)
|
|
55
|
+
_server.register_builtin_actions()
|
|
56
|
+
_server.start()
|
|
57
|
+
return _server
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def stop_server() -> None:
|
|
61
|
+
"""Stop the adapter and unregister its UI-idle callback."""
|
|
62
|
+
global _server
|
|
63
|
+
if _server is not None:
|
|
64
|
+
_server.stop()
|
|
65
|
+
_server = None
|
|
66
|
+
_dispatcher.uninstall()
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mobu-scene
|
|
3
|
+
description: >-
|
|
4
|
+
Host skill - inspect and explicitly save the active MotionBuilder scene. Use
|
|
5
|
+
when checking scene metadata, model names, or saving a known FBX path. Not for raw Python execution.
|
|
6
|
+
license: MIT
|
|
7
|
+
compatibility: "MotionBuilder Python API; dcc-mcp-core 0.19+"
|
|
8
|
+
allowed-tools: Python
|
|
9
|
+
metadata:
|
|
10
|
+
dcc-mcp:
|
|
11
|
+
dcc: mobu
|
|
12
|
+
version: "0.1.0"
|
|
13
|
+
layer: domain
|
|
14
|
+
stage: scene
|
|
15
|
+
search-hint: "motionbuilder mobu scene models inspect save fbx"
|
|
16
|
+
tags: "motionbuilder, mobu, animation, scene"
|
|
17
|
+
tools: tools.yaml
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
# MotionBuilder Scene
|
|
21
|
+
|
|
22
|
+
Use these tools to inspect the currently open MotionBuilder scene, list its models, and save it to an explicit `.fbx` path.
|
|
23
|
+
|
|
24
|
+
`save_scene` changes files on disk. Confirm the intended target path before calling it.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"""Inspect the current MotionBuilder scene."""
|
|
2
|
+
|
|
3
|
+
from dcc_mcp_core.skill import skill_entry, skill_success
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@skill_entry
|
|
7
|
+
def main() -> dict:
|
|
8
|
+
"""Return concise scene metadata."""
|
|
9
|
+
from pyfbsdk import FBSystem
|
|
10
|
+
|
|
11
|
+
system = FBSystem()
|
|
12
|
+
scene = system.Scene
|
|
13
|
+
current_take = system.CurrentTake
|
|
14
|
+
return skill_success(
|
|
15
|
+
"MotionBuilder scene inspected.",
|
|
16
|
+
application_version=str(system.Version),
|
|
17
|
+
current_take=current_take.Name if current_take else None,
|
|
18
|
+
component_count=len(scene.Components),
|
|
19
|
+
model_count=len(scene.Models),
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
if __name__ == "__main__":
|
|
24
|
+
from dcc_mcp_core.skill import run_main
|
|
25
|
+
|
|
26
|
+
run_main(main)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""List models in the current MotionBuilder scene."""
|
|
2
|
+
|
|
3
|
+
from dcc_mcp_core.skill import skill_entry, skill_success
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@skill_entry
|
|
7
|
+
def main() -> dict:
|
|
8
|
+
"""Return model names without exposing a raw scripting surface."""
|
|
9
|
+
from pyfbsdk import FBSystem
|
|
10
|
+
|
|
11
|
+
models = [{"name": model.Name} for model in FBSystem().Scene.Models]
|
|
12
|
+
return skill_success("MotionBuilder models listed.", models=models, model_count=len(models))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
if __name__ == "__main__":
|
|
16
|
+
from dcc_mcp_core.skill import run_main
|
|
17
|
+
|
|
18
|
+
run_main(main)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""Save the current MotionBuilder scene to a typed path."""
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
from dcc_mcp_core.skill import skill_entry, skill_error, skill_success
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@skill_entry
|
|
9
|
+
def main(path: str) -> dict:
|
|
10
|
+
"""Save the scene as an FBX file at an explicit absolute path."""
|
|
11
|
+
from pyfbsdk import FBApplication
|
|
12
|
+
|
|
13
|
+
target = Path(path).expanduser()
|
|
14
|
+
if not target.is_absolute():
|
|
15
|
+
return skill_error("path must be absolute")
|
|
16
|
+
if target.suffix.lower() != ".fbx":
|
|
17
|
+
return skill_error("path must end with .fbx")
|
|
18
|
+
|
|
19
|
+
target.parent.mkdir(parents=True, exist_ok=True)
|
|
20
|
+
if not FBApplication().FileSave(str(target)):
|
|
21
|
+
return skill_error("MotionBuilder could not save the scene", path=str(target))
|
|
22
|
+
return skill_success("MotionBuilder scene saved.", path=str(target))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
if __name__ == "__main__":
|
|
26
|
+
from dcc_mcp_core.skill import run_main
|
|
27
|
+
|
|
28
|
+
run_main(main)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
tools:
|
|
2
|
+
- name: inspect_scene
|
|
3
|
+
description: Return metadata for the current MotionBuilder scene.
|
|
4
|
+
input_schema: {type: object, properties: {}}
|
|
5
|
+
read_only: true
|
|
6
|
+
destructive: false
|
|
7
|
+
idempotent: true
|
|
8
|
+
execution: sync
|
|
9
|
+
affinity: main
|
|
10
|
+
timeout_hint_secs: 15
|
|
11
|
+
source_file: scripts/inspect_scene.py
|
|
12
|
+
- name: list_models
|
|
13
|
+
description: List models in the current MotionBuilder scene.
|
|
14
|
+
input_schema: {type: object, properties: {}}
|
|
15
|
+
read_only: true
|
|
16
|
+
destructive: false
|
|
17
|
+
idempotent: true
|
|
18
|
+
execution: sync
|
|
19
|
+
affinity: main
|
|
20
|
+
timeout_hint_secs: 30
|
|
21
|
+
source_file: scripts/list_models.py
|
|
22
|
+
- name: save_scene
|
|
23
|
+
description: Save the current MotionBuilder scene to an absolute FBX path.
|
|
24
|
+
input_schema:
|
|
25
|
+
type: object
|
|
26
|
+
required: [path]
|
|
27
|
+
properties:
|
|
28
|
+
path:
|
|
29
|
+
type: string
|
|
30
|
+
description: Absolute output path ending in .fbx.
|
|
31
|
+
read_only: false
|
|
32
|
+
destructive: true
|
|
33
|
+
idempotent: false
|
|
34
|
+
execution: sync
|
|
35
|
+
affinity: main
|
|
36
|
+
timeout_hint_secs: 60
|
|
37
|
+
source_file: scripts/save_scene.py
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
from dcc_mcp_mobu import __version__
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def test_package_version_matches_project_metadata() -> None:
|
|
7
|
+
project = Path(__file__).parents[1] / "pyproject.toml"
|
|
8
|
+
assert f'version = "{__version__}"' in project.read_text(encoding="utf-8")
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def test_startup_script_is_packaged_with_source() -> None:
|
|
12
|
+
startup = (
|
|
13
|
+
Path(__file__).parents[1]
|
|
14
|
+
/ "src"
|
|
15
|
+
/ "dcc_mcp_mobu"
|
|
16
|
+
/ "mobu_plugin"
|
|
17
|
+
/ "startup"
|
|
18
|
+
/ "dcc_mcp_mobu.py"
|
|
19
|
+
)
|
|
20
|
+
assert startup.is_file()
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""Validate bundled DCC MCP skill metadata."""
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
from dcc_mcp_core import validate_skill
|
|
6
|
+
|
|
7
|
+
skills_root = Path(__file__).parents[1] / "src" / "dcc_mcp_mobu" / "skills"
|
|
8
|
+
reports = [validate_skill(str(path)) for path in skills_root.iterdir() if path.is_dir()]
|
|
9
|
+
assert all(report.is_clean for report in reports), [report.issues for report in reports]
|
|
10
|
+
print(f"validated {len(reports)} bundled skills")
|