dcc-mcp-katana 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_katana-0.2.0/.github/workflows/ci.yml +36 -0
- dcc_mcp_katana-0.2.0/.github/workflows/release.yml +35 -0
- dcc_mcp_katana-0.2.0/.gitignore +8 -0
- dcc_mcp_katana-0.2.0/.release-please-manifest.json +1 -0
- dcc_mcp_katana-0.2.0/CHANGELOG.md +22 -0
- dcc_mcp_katana-0.2.0/LICENSE +21 -0
- dcc_mcp_katana-0.2.0/PKG-INFO +42 -0
- dcc_mcp_katana-0.2.0/README.md +17 -0
- dcc_mcp_katana-0.2.0/pyproject.toml +38 -0
- dcc_mcp_katana-0.2.0/release-please-config.json +1 -0
- dcc_mcp_katana-0.2.0/src/dcc_mcp_katana/__init__.py +6 -0
- dcc_mcp_katana-0.2.0/src/dcc_mcp_katana/__version__.py +3 -0
- dcc_mcp_katana-0.2.0/src/dcc_mcp_katana/dispatcher.py +83 -0
- dcc_mcp_katana-0.2.0/src/dcc_mcp_katana/katana_plugin/Plugins/dcc_mcp_katana.py +5 -0
- dcc_mcp_katana-0.2.0/src/dcc_mcp_katana/plugin.py +11 -0
- dcc_mcp_katana-0.2.0/src/dcc_mcp_katana/server.py +62 -0
- dcc_mcp_katana-0.2.0/src/dcc_mcp_katana/skills/katana-nodegraph/SKILL.md +20 -0
- dcc_mcp_katana-0.2.0/src/dcc_mcp_katana/skills/katana-nodegraph/scripts/inspect_nodegraph.py +25 -0
- dcc_mcp_katana-0.2.0/src/dcc_mcp_katana/skills/katana-nodegraph/scripts/list_nodes.py +19 -0
- dcc_mcp_katana-0.2.0/src/dcc_mcp_katana/skills/katana-nodegraph/scripts/save_project.py +26 -0
- dcc_mcp_katana-0.2.0/src/dcc_mcp_katana/skills/katana-nodegraph/tools.yaml +34 -0
- dcc_mcp_katana-0.2.0/tests/test_package.py +17 -0
- dcc_mcp_katana-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-katana/compare/v0.1.0...v0.2.0) (2026-07-14)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* add Katana MCP adapter ([eb633db](https://github.com/dcc-mcp/dcc-mcp-katana/commit/eb633dbb93ac94bfccb045b20591e3388e2593b2))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* parse release manifest in version test ([02934c3](https://github.com/dcc-mcp/dcc-mcp-katana/commit/02934c3d92eb7beda116132b94d20f93c7c5e968))
|
|
16
|
+
* use valid CI expression syntax ([4b15be5](https://github.com/dcc-mcp/dcc-mcp-katana/commit/4b15be5ad17743d06e38fdc5923240c700820afb))
|
|
17
|
+
|
|
18
|
+
## [0.1.0] - 2026-07-14
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- Initial Katana MCP adapter with typed NodegraphAPI 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-katana
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: MCP adapter for Foundry Katana
|
|
5
|
+
Project-URL: Homepage, https://github.com/dcc-mcp/dcc-mcp-katana
|
|
6
|
+
Project-URL: Repository, https://github.com/dcc-mcp/dcc-mcp-katana
|
|
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-katana
|
|
27
|
+
|
|
28
|
+
MCP adapter for Foundry Katana. It runs typed NodegraphAPI operations on Katana's event-processing thread.
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pip install dcc-mcp-katana
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Add the installed `dcc_mcp_katana/katana_plugin` directory to `KATANA_RESOURCES`, then start Katana. The MCP endpoint defaults to `http://127.0.0.1:8765/mcp`; set `DCC_MCP_KATANA_PORT` to change it.
|
|
35
|
+
|
|
36
|
+
## Tools
|
|
37
|
+
|
|
38
|
+
- `katana-nodegraph.inspect_nodegraph`
|
|
39
|
+
- `katana-nodegraph.list_nodes`
|
|
40
|
+
- `katana-nodegraph.save_project`
|
|
41
|
+
|
|
42
|
+
`save_project` changes files and requires an absolute `.katana` path.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# dcc-mcp-katana
|
|
2
|
+
|
|
3
|
+
MCP adapter for Foundry Katana. It runs typed NodegraphAPI operations on Katana's event-processing thread.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
pip install dcc-mcp-katana
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Add the installed `dcc_mcp_katana/katana_plugin` directory to `KATANA_RESOURCES`, then start Katana. The MCP endpoint defaults to `http://127.0.0.1:8765/mcp`; set `DCC_MCP_KATANA_PORT` to change it.
|
|
10
|
+
|
|
11
|
+
## Tools
|
|
12
|
+
|
|
13
|
+
- `katana-nodegraph.inspect_nodegraph`
|
|
14
|
+
- `katana-nodegraph.list_nodes`
|
|
15
|
+
- `katana-nodegraph.save_project`
|
|
16
|
+
|
|
17
|
+
`save_project` changes files and requires an absolute `.katana` path.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.26"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "dcc-mcp-katana"
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
description = "MCP adapter for Foundry Katana"
|
|
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-katana"
|
|
18
|
+
Repository = "https://github.com/dcc-mcp/dcc-mcp-katana"
|
|
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
|
+
katana = "dcc_mcp_katana:KatanaMcpServer"
|
|
25
|
+
|
|
26
|
+
[tool.hatch.build.targets.wheel]
|
|
27
|
+
packages = ["src/dcc_mcp_katana"]
|
|
28
|
+
artifacts = ["src/dcc_mcp_katana/skills/**", "src/dcc_mcp_katana/katana_plugin/**"]
|
|
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"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"packages":{".":{"release-type":"python","package-name":"dcc-mcp-katana","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_katana/__version__.py"}]}}}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"""Katana main-thread dispatcher backed by the native event queue."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from dataclasses import dataclass
|
|
6
|
+
from threading import Event, current_thread, main_thread
|
|
7
|
+
from typing import Any, Callable, Optional
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@dataclass
|
|
11
|
+
class _PendingCall:
|
|
12
|
+
callback: Callable[..., Any]
|
|
13
|
+
args: tuple[Any, ...]
|
|
14
|
+
kwargs: dict[str, Any]
|
|
15
|
+
completed: Event
|
|
16
|
+
result: dict[str, Any]
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class KatanaDispatcher:
|
|
20
|
+
"""Execute work from Katana's ``Utils.EventModule`` processing loop."""
|
|
21
|
+
|
|
22
|
+
event_type = "dcc_mcp_katana_call"
|
|
23
|
+
|
|
24
|
+
def __init__(self) -> None:
|
|
25
|
+
self._installed = False
|
|
26
|
+
|
|
27
|
+
def install(self) -> None:
|
|
28
|
+
if self._installed:
|
|
29
|
+
return
|
|
30
|
+
from Katana import Utils
|
|
31
|
+
|
|
32
|
+
Utils.EventModule.RegisterEventHandler(self._run, eventType=self.event_type)
|
|
33
|
+
self._installed = True
|
|
34
|
+
|
|
35
|
+
def uninstall(self) -> None:
|
|
36
|
+
if not self._installed:
|
|
37
|
+
return
|
|
38
|
+
from Katana import Utils
|
|
39
|
+
|
|
40
|
+
Utils.EventModule.UnregisterEventHandler(self._run, eventType=self.event_type)
|
|
41
|
+
self._installed = False
|
|
42
|
+
|
|
43
|
+
def dispatch_callable(self, callback: Callable[..., Any], *args: Any, **kwargs: Any) -> Any:
|
|
44
|
+
for key in (
|
|
45
|
+
"context",
|
|
46
|
+
"action_name",
|
|
47
|
+
"skill_name",
|
|
48
|
+
"execution",
|
|
49
|
+
"timeout_hint_secs",
|
|
50
|
+
"affinity",
|
|
51
|
+
"thread_affinity",
|
|
52
|
+
):
|
|
53
|
+
kwargs.pop(key, None)
|
|
54
|
+
if current_thread() is main_thread():
|
|
55
|
+
return callback(*args, **kwargs)
|
|
56
|
+
if not self._installed:
|
|
57
|
+
raise RuntimeError("Katana event dispatcher is not installed")
|
|
58
|
+
|
|
59
|
+
pending = _PendingCall(callback, args, kwargs, Event(), {})
|
|
60
|
+
from Katana import Utils
|
|
61
|
+
|
|
62
|
+
Utils.EventModule.QueueEvent(self.event_type, id(pending), pending=pending)
|
|
63
|
+
if not pending.completed.wait(30):
|
|
64
|
+
raise RuntimeError("Timed out waiting for Katana main-thread execution")
|
|
65
|
+
if "error" in pending.result:
|
|
66
|
+
raise pending.result["error"]
|
|
67
|
+
return pending.result["value"]
|
|
68
|
+
|
|
69
|
+
def _run(
|
|
70
|
+
self,
|
|
71
|
+
_event_type: str,
|
|
72
|
+
_event_id: int,
|
|
73
|
+
pending: Optional[_PendingCall] = None,
|
|
74
|
+
**_: Any,
|
|
75
|
+
) -> None:
|
|
76
|
+
if pending is None:
|
|
77
|
+
return
|
|
78
|
+
try:
|
|
79
|
+
pending.result["value"] = pending.callback(*pending.args, **pending.kwargs)
|
|
80
|
+
except Exception as error:
|
|
81
|
+
pending.result["error"] = error
|
|
82
|
+
finally:
|
|
83
|
+
pending.completed.set()
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"""Katana 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 KatanaDispatcher
|
|
14
|
+
|
|
15
|
+
DEFAULT_PORT = 8765
|
|
16
|
+
SERVER_NAME = "dcc-mcp-katana"
|
|
17
|
+
_dispatcher = KatanaDispatcher()
|
|
18
|
+
_server: Optional["KatanaMcpServer"] = None
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class KatanaMcpServer(DccServerBase):
|
|
22
|
+
"""MCP server hosted by a running Katana session."""
|
|
23
|
+
|
|
24
|
+
def __init__(self, port: int = DEFAULT_PORT) -> None:
|
|
25
|
+
options = DccServerOptions.from_env(
|
|
26
|
+
"katana",
|
|
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
|
+
)
|
|
33
|
+
super().__init__(options=options)
|
|
34
|
+
|
|
35
|
+
def _version_string(self) -> str:
|
|
36
|
+
try:
|
|
37
|
+
import KatanaInfo
|
|
38
|
+
|
|
39
|
+
return str(KatanaInfo.version)
|
|
40
|
+
except Exception:
|
|
41
|
+
return "Katana"
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def start_server(port: Optional[int] = None) -> KatanaMcpServer:
|
|
45
|
+
"""Install the native event handler and start the singleton server."""
|
|
46
|
+
global _server
|
|
47
|
+
if _server is not None and _server.is_running:
|
|
48
|
+
return _server
|
|
49
|
+
_dispatcher.install()
|
|
50
|
+
_server = KatanaMcpServer(port or int(os.environ.get("DCC_MCP_KATANA_PORT", DEFAULT_PORT)))
|
|
51
|
+
_server.register_builtin_actions()
|
|
52
|
+
_server.start()
|
|
53
|
+
return _server
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def stop_server() -> None:
|
|
57
|
+
"""Stop the server and remove the native event handler."""
|
|
58
|
+
global _server
|
|
59
|
+
if _server is not None:
|
|
60
|
+
_server.stop()
|
|
61
|
+
_server = None
|
|
62
|
+
_dispatcher.uninstall()
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: katana-nodegraph
|
|
3
|
+
description: >-
|
|
4
|
+
Host skill - inspect and explicitly save the active Katana node graph. Use when
|
|
5
|
+
checking nodes, selection, and project state. Not for raw Python execution.
|
|
6
|
+
license: MIT
|
|
7
|
+
compatibility: "Katana NodegraphAPI; dcc-mcp-core 0.19+"
|
|
8
|
+
allowed-tools: Python
|
|
9
|
+
metadata:
|
|
10
|
+
dcc-mcp:
|
|
11
|
+
dcc: katana
|
|
12
|
+
version: "0.1.0"
|
|
13
|
+
layer: domain
|
|
14
|
+
stage: scene
|
|
15
|
+
search-hint: "katana node graph inspect nodes selection save project"
|
|
16
|
+
tags: "katana, lookdev, nodegraph"
|
|
17
|
+
tools: tools.yaml
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
# Katana Node Graph
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"""Inspect the active Katana node graph."""
|
|
2
|
+
|
|
3
|
+
from dcc_mcp_core.skill import skill_entry, skill_success
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@skill_entry
|
|
7
|
+
def main(**_kwargs):
|
|
8
|
+
import NodegraphAPI # Lazy import: requires Katana.
|
|
9
|
+
|
|
10
|
+
root = NodegraphAPI.GetRootNode()
|
|
11
|
+
selected = NodegraphAPI.GetAllSelectedNodes()
|
|
12
|
+
viewed = NodegraphAPI.GetViewNode()
|
|
13
|
+
return skill_success(
|
|
14
|
+
"Katana node graph inspected.",
|
|
15
|
+
root_node=root.getName(),
|
|
16
|
+
node_count=len(NodegraphAPI.GetAllNodes()),
|
|
17
|
+
selected_nodes=[node.getName() for node in selected],
|
|
18
|
+
viewed_node=viewed.getName() if viewed else None,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
if __name__ == "__main__":
|
|
23
|
+
from dcc_mcp_core.skill import run_main
|
|
24
|
+
|
|
25
|
+
run_main(main)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""List nodes in the active Katana node graph."""
|
|
2
|
+
|
|
3
|
+
from dcc_mcp_core.skill import skill_entry, skill_success
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@skill_entry
|
|
7
|
+
def main(**_kwargs):
|
|
8
|
+
import NodegraphAPI # Lazy import: requires Katana.
|
|
9
|
+
|
|
10
|
+
nodes = [
|
|
11
|
+
{"name": node.getName(), "type": node.getType()} for node in NodegraphAPI.GetAllNodes()
|
|
12
|
+
]
|
|
13
|
+
return skill_success("Katana nodes listed.", nodes=nodes, node_count=len(nodes))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
if __name__ == "__main__":
|
|
17
|
+
from dcc_mcp_core.skill import run_main
|
|
18
|
+
|
|
19
|
+
run_main(main)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"""Save the active Katana project."""
|
|
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, **_kwargs):
|
|
10
|
+
target = Path(path).expanduser()
|
|
11
|
+
if not target.is_absolute():
|
|
12
|
+
return skill_error("path must be absolute")
|
|
13
|
+
if target.suffix.lower() != ".katana":
|
|
14
|
+
return skill_error("path must end with .katana")
|
|
15
|
+
|
|
16
|
+
import KatanaFile # Lazy import: requires Katana.
|
|
17
|
+
|
|
18
|
+
target.parent.mkdir(parents=True, exist_ok=True)
|
|
19
|
+
KatanaFile.Save(str(target))
|
|
20
|
+
return skill_success("Katana project saved.", path=str(target))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
if __name__ == "__main__":
|
|
24
|
+
from dcc_mcp_core.skill import run_main
|
|
25
|
+
|
|
26
|
+
run_main(main)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
tools:
|
|
2
|
+
- name: inspect_nodegraph
|
|
3
|
+
description: Return root, selected, and viewed node metadata without changing Katana.
|
|
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_nodegraph.py
|
|
12
|
+
- name: list_nodes
|
|
13
|
+
description: List nodes in the active Katana project without modifying it.
|
|
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_nodes.py
|
|
22
|
+
- name: save_project
|
|
23
|
+
description: Save the Katana project to an explicit absolute .katana path.
|
|
24
|
+
input_schema:
|
|
25
|
+
type: object
|
|
26
|
+
required: [path]
|
|
27
|
+
properties: {path: {type: string, description: Absolute .katana output path.}}
|
|
28
|
+
read_only: false
|
|
29
|
+
destructive: true
|
|
30
|
+
idempotent: false
|
|
31
|
+
execution: sync
|
|
32
|
+
affinity: main
|
|
33
|
+
timeout_hint_secs: 60
|
|
34
|
+
source_file: scripts/save_project.py
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
from dcc_mcp_katana 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_bundled_assets_exist():
|
|
15
|
+
package = Path(__file__).parents[1] / "src" / "dcc_mcp_katana"
|
|
16
|
+
assert (package / "katana_plugin" / "Plugins" / "dcc_mcp_katana.py").is_file()
|
|
17
|
+
assert (package / "skills" / "katana-nodegraph" / "tools.yaml").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_katana" / "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")
|