touchdesigner-mcp-server 1.3.1 → 1.4.1
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/README.ja.md +4 -307
- package/README.md +9 -308
- package/dist/cli.js +132 -16
- package/dist/core/logger.js +13 -0
- package/dist/gen/endpoints/TouchDesignerAPI.js +1 -1
- package/dist/gen/mcp/touchDesignerAPI.zod.js +1 -1
- package/dist/server/touchDesignerServer.js +19 -0
- package/dist/transport/config.js +75 -0
- package/dist/transport/expressHttpManager.js +235 -0
- package/dist/transport/factory.js +198 -0
- package/dist/transport/index.js +12 -0
- package/dist/transport/sessionManager.js +276 -0
- package/dist/transport/transportRegistry.js +272 -0
- package/dist/transport/validator.js +78 -0
- package/package.json +4 -1
package/README.ja.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
TouchDesignerのためのMCP(Model Context Protocol) サーバー実装です。AIエージェントがTouchDesignerプロジェクトを制御・操作できるようになることを目指しています。
|
|
4
4
|
|
|
5
|
-
[English](
|
|
5
|
+
[English](README.md) / [日本語](README.ja.md)
|
|
6
6
|
|
|
7
7
|
## 概要
|
|
8
8
|
|
|
@@ -14,227 +14,9 @@ TouchDesigner MCPは、AIモデルとTouchDesigner WebServer DAT 間のブリッ
|
|
|
14
14
|
- ノードプロパティやプロジェクト構造の照会
|
|
15
15
|
- PythonスクリプトによるTouchDesignerのプログラム的制御
|
|
16
16
|
|
|
17
|
-
##
|
|
17
|
+
## インストール方法
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
flowchart LR
|
|
21
|
-
A["🤖<br/>MCP client<br/>(Claude / Codex / ...)"]
|
|
22
|
-
|
|
23
|
-
subgraph S [Node.js MCP server]
|
|
24
|
-
B1["🧰<br/>Tools & prompts<br/>(src/features/tools)"]
|
|
25
|
-
B2["🖌️<br/>Presenters & formatters<br/>(markdown output)"]
|
|
26
|
-
B3["🌐<br/>OpenAPI HTTP client<br/>(src/tdClient)"]
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
subgraph T [TouchDesigner project]
|
|
30
|
-
C1["🧩<br/>WebServer DAT<br/>(mcp_webserver_base.tox)"]
|
|
31
|
-
C2["🐍<br/>Python controllers / services<br/>(td/modules/mcp)"]
|
|
32
|
-
C3["🎛️<br/>Project nodes & parameters<br/>(/project1/...)"]
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
A --> B1
|
|
36
|
-
B1 --> B2
|
|
37
|
-
B1 --> B3
|
|
38
|
-
B2 --> A
|
|
39
|
-
B3 <--> C1
|
|
40
|
-
C1 <--> C2
|
|
41
|
-
C2 <--> C3
|
|
42
|
-
|
|
43
|
-
%% Higher-contrast colors for readability
|
|
44
|
-
classDef client fill:#d8e8ff,stroke:#1f6feb,stroke-width:2px,color:#111,font-weight:bold
|
|
45
|
-
classDef server fill:#efe1ff,stroke:#8250df,stroke-width:2px,color:#111,font-weight:bold
|
|
46
|
-
classDef td fill:#d7f5e3,stroke:#2f9e44,stroke-width:2px,color:#111,font-weight:bold
|
|
47
|
-
class A client;
|
|
48
|
-
class B1,B2,B3 server;
|
|
49
|
-
class C1,C2,C3 td;
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
## 利用方法
|
|
53
|
-
|
|
54
|
-
<details>
|
|
55
|
-
<summary>方法1: Claude Desktop + MCP Bundle(推奨)</summary>
|
|
56
|
-
|
|
57
|
-
##### 1. ファイルをダウンロード
|
|
58
|
-
|
|
59
|
-
[リリースページ](https://github.com/8beeeaaat/touchdesigner-mcp/releases/latest)から以下をダウンロード:
|
|
60
|
-
|
|
61
|
-
- **TouchDesigner Components**: `touchdesigner-mcp-td.zip`
|
|
62
|
-
- **[MCP Bundle](https://github.com/modelcontextprotocol/mcpb) (.mcpb)**: `touchdesigner-mcp.mcpb`
|
|
63
|
-
|
|
64
|
-
##### 2. TouchDesignerコンポーネントを設置
|
|
65
|
-
|
|
66
|
-
1. `touchdesigner-mcp-td.zip`を展開
|
|
67
|
-
2. 展開したフォルダから`mcp_webserver_base.tox`を操作したいTouchDesignerプロジェクト直下にインポート
|
|
68
|
-
例: `/project1/mcp_webserver_base`となるように配置
|
|
69
|
-
|
|
70
|
-
<https://github.com/user-attachments/assets/215fb343-6ed8-421c-b948-2f45fb819ff4>
|
|
71
|
-
|
|
72
|
-
TouchDesignerのメニューからTextportを起動してサーバーの起動ログを確認できます。
|
|
73
|
-
|
|
74
|
-

|
|
75
|
-
|
|
76
|
-
##### 3. MCP Bundleをインストール
|
|
77
|
-
|
|
78
|
-
`touchdesigner-mcp.mcpb`ファイルをダブルクリックしてClaude DesktopにMCP Bundleをインストール
|
|
79
|
-
|
|
80
|
-
<https://github.com/user-attachments/assets/0786d244-8b82-4387-bbe4-9da048212854>
|
|
81
|
-
|
|
82
|
-
##### 4. MCP Bundleが自動的にTouchDesignerサーバー接続を処理
|
|
83
|
-
|
|
84
|
-
**⚠️ 重要:** TouchDesignerコンポーネントのディレクトリ構造は展開した状態を正確に保持してください。`mcp_webserver_base.tox`コンポーネントは`modules/`ディレクトリやその他のファイルへの相対パスを参照しています。
|
|
85
|
-
|
|
86
|
-
</details>
|
|
87
|
-
|
|
88
|
-
<details>
|
|
89
|
-
<summary>方法2: npxを利用する</summary>
|
|
90
|
-
|
|
91
|
-
*Node.jsがインストールされていることが前提となります*
|
|
92
|
-
|
|
93
|
-
##### 1. TouchDesignerコンポーネントを設置
|
|
94
|
-
|
|
95
|
-
1. [リリースページ](https://github.com/8beeeaaat/touchdesigner-mcp/releases/latest)から`touchdesigner-mcp-td.zip`をダウンロード
|
|
96
|
-
2. zipファイルを展開し、`mcp_webserver_base.tox`を操作したいTouchDesignerプロジェクト直下にインポート
|
|
97
|
-
例: `/project1/mcp_webserver_base`となるように配置
|
|
98
|
-
|
|
99
|
-
<https://github.com/user-attachments/assets/215fb343-6ed8-421c-b948-2f45fb819ff4>
|
|
100
|
-
|
|
101
|
-
TouchDesignerのメニューからTextportを起動してサーバーの起動ログを確認できます。
|
|
102
|
-
|
|
103
|
-

|
|
104
|
-
|
|
105
|
-
##### 2. MCPサーバー設定
|
|
106
|
-
|
|
107
|
-
*例 Claude Desktop*
|
|
108
|
-
|
|
109
|
-
```json
|
|
110
|
-
{
|
|
111
|
-
"mcpServers": {
|
|
112
|
-
"touchdesigner": {
|
|
113
|
-
"command": "npx",
|
|
114
|
-
"args": ["-y", "touchdesigner-mcp-server@latest", "--stdio"]
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
**カスタマイズ:** `--host`と`--port`引数を追加してTouchDesignerサーバー接続をカスタマイズできます:
|
|
121
|
-
|
|
122
|
-
```json
|
|
123
|
-
"args": [
|
|
124
|
-
"-y",
|
|
125
|
-
"touchdesigner-mcp-server@latest",
|
|
126
|
-
"--stdio",
|
|
127
|
-
"--host=http://custom_host",
|
|
128
|
-
"--port=9982"
|
|
129
|
-
]
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
</details>
|
|
133
|
-
|
|
134
|
-
<details>
|
|
135
|
-
<summary>方法3: Dockerイメージを利用</summary>
|
|
136
|
-
|
|
137
|
-
[](https://www.youtube.com/watch?v=BRWoIEVb0TU)
|
|
138
|
-
|
|
139
|
-
##### 1. リポジトリをクローン
|
|
140
|
-
|
|
141
|
-
```bash
|
|
142
|
-
git clone https://github.com/8beeeaaat/touchdesigner-mcp.git
|
|
143
|
-
cd touchdesigner-mcp
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
##### 2. Dockerイメージのビルド
|
|
147
|
-
|
|
148
|
-
```bash
|
|
149
|
-
git clone https://github.com/8beeeaaat/touchdesigner-mcp.git
|
|
150
|
-
cd touchdesigner-mcp
|
|
151
|
-
make build
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
##### 3. TouchDesignerプロジェクトにMCP連携用のAPIサーバーを設置
|
|
155
|
-
|
|
156
|
-
TouchDesignerを起動し、`td/mcp_webserver_base.tox`コンポーネントを操作したいTouchDesignerプロジェクト直下にインポートします。
|
|
157
|
-
例: `/project1/mcp_webserver_base`となるように配置
|
|
158
|
-
|
|
159
|
-
toxファイルのインポートにより`td/import_modules.py`スクリプトが実行され、APIサーバーのコントローラなどのモジュールがロードされます。
|
|
160
|
-
|
|
161
|
-
<https://github.com/user-attachments/assets/215fb343-6ed8-421c-b948-2f45fb819ff4>
|
|
162
|
-
|
|
163
|
-
TouchDesignerのメニューからTextportを起動してサーバーの起動ログを確認できます。
|
|
164
|
-
|
|
165
|
-

|
|
166
|
-
|
|
167
|
-
##### 4. MCPサーバーのコンテナを起動
|
|
168
|
-
|
|
169
|
-
```bash
|
|
170
|
-
docker-compose up -d
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
##### 5. AIエージェントがDockerコンテナを使用するように設定
|
|
174
|
-
|
|
175
|
-
*例 Claude Desktop*
|
|
176
|
-
|
|
177
|
-
```json
|
|
178
|
-
{
|
|
179
|
-
"mcpServers": {
|
|
180
|
-
"touchdesigner": {
|
|
181
|
-
"command": "docker",
|
|
182
|
-
"args": [
|
|
183
|
-
"compose",
|
|
184
|
-
"-f",
|
|
185
|
-
"/path/to/your/touchdesigner-mcp/docker-compose.yml",
|
|
186
|
-
"exec",
|
|
187
|
-
"-i",
|
|
188
|
-
"touchdesigner-mcp-server",
|
|
189
|
-
"node",
|
|
190
|
-
"dist/cli.js",
|
|
191
|
-
"--stdio",
|
|
192
|
-
"--host=http://host.docker.internal"
|
|
193
|
-
]
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
*Windows システムでは、ドライブレターを含めてください。例:`C:\\path\\to\\your\\touchdesigner-mcp\\docker-compose.yml`*
|
|
200
|
-
|
|
201
|
-
**カスタマイズ:** `--port`引数を追加してTouchDesignerサーバー接続をカスタマイズできます:
|
|
202
|
-
|
|
203
|
-
```json
|
|
204
|
-
"args": [
|
|
205
|
-
...,
|
|
206
|
-
"--stdio",
|
|
207
|
-
"--host=http://host.docker.internal",
|
|
208
|
-
"--port=9982"
|
|
209
|
-
]
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
</details>
|
|
213
|
-
|
|
214
|
-
## 接続確認
|
|
215
|
-
|
|
216
|
-
MCPサーバーが認識されていればセットアップは完了です。
|
|
217
|
-
認識されない場合は、AIエージェントを再起動してください。
|
|
218
|
-
起動時にエラーが表示される場合は、TouchDesignerを先に起動してからAIエージェントを再度起動してください。
|
|
219
|
-
TouchDesignerでAPIサーバーが実行されていれば、エージェントは提供されたツール等を通じてTouchDesignerを使用できます。
|
|
220
|
-
|
|
221
|
-
### ディレクトリ構造要件
|
|
222
|
-
|
|
223
|
-
**重要:** どの方法(Docker、npx)を使用する場合でも、正確なディレクトリ構造を維持してください:
|
|
224
|
-
|
|
225
|
-
```
|
|
226
|
-
td/
|
|
227
|
-
├── import_modules.py # モジュールローダースクリプト
|
|
228
|
-
├── mcp_webserver_base.tox # メインTouchDesignerコンポーネント
|
|
229
|
-
└── modules/ # Pythonモジュールディレクトリ
|
|
230
|
-
├── mcp/ # MCPコアロジック
|
|
231
|
-
├── utils/ # 共有ユーティリティ
|
|
232
|
-
└── td_server/ # 生成されたAPIサーバーコード
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
`mcp_webserver_base.tox` コンポーネントは相対パスを使用してPythonモジュールを検索します。これらのファイルを移動したり再編成したりすると、TouchDesignerでインポートエラーが発生します。
|
|
236
|
-
|
|
237
|
-

|
|
19
|
+
**[インストールガイド](docs/installation.ja.md)** を参照してください。
|
|
238
20
|
|
|
239
21
|
## MCPサーバーの機能
|
|
240
22
|
|
|
@@ -275,92 +57,7 @@ td/
|
|
|
275
57
|
|
|
276
58
|
## 開発者向け
|
|
277
59
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
1. **環境設定:**
|
|
281
|
-
|
|
282
|
-
```bash
|
|
283
|
-
# リポジトリをクローンして依存関係をインストール
|
|
284
|
-
git clone https://github.com/8beeeaaat/touchdesigner-mcp.git
|
|
285
|
-
cd touchdesigner-mcp
|
|
286
|
-
npm install
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
2. **プロジェクトをビルド:**
|
|
290
|
-
|
|
291
|
-
```bash
|
|
292
|
-
make build # Docker-based build(推奨)
|
|
293
|
-
# または
|
|
294
|
-
npm run build # Node.js-based build
|
|
295
|
-
```
|
|
296
|
-
|
|
297
|
-
3. **利用可能なコマンド:**
|
|
298
|
-
|
|
299
|
-
```bash
|
|
300
|
-
npm run test # ユニットテストと統合テストを実行
|
|
301
|
-
npm run dev # デバッグ用MCPインスペクターを起動
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
**注意:** コードを更新した場合は、MCPサーバーとTouchDesignerの両方を再起動して変更を反映してください。
|
|
305
|
-
|
|
306
|
-
### プロジェクト構造の概要
|
|
307
|
-
|
|
308
|
-
```
|
|
309
|
-
├── src/ # MCPサーバーソースコード
|
|
310
|
-
│ ├── api/ # TD WebServerに対するOpenAPI仕様
|
|
311
|
-
│ ├── core/ # コアユーティリティ(ロガー、エラーハンドリング)
|
|
312
|
-
│ ├── features/ # MCP機能実装
|
|
313
|
-
│ │ ├── prompts/ # プロンプトハンドラ
|
|
314
|
-
│ │ ├── resources/ # リソースハンドラ
|
|
315
|
-
│ │ └── tools/ # ツールハンドラ (例: tdTools.ts)
|
|
316
|
-
│ ├── gen/ # OpenAPIスキーマから生成されたMCPサーバー向けコード
|
|
317
|
-
│ ├── server/ # MCPサーバーロジック (接続, メインサーバークラス)
|
|
318
|
-
│ ├── tdClient/ # TD接続API用クライアント
|
|
319
|
-
│ ├── index.ts # Node.jsサーバーのメインエントリーポイント
|
|
320
|
-
│ └── ...
|
|
321
|
-
├── td/ # TouchDesigner関連ファイル
|
|
322
|
-
│ ├── modules/ # TouchDesigner用Pythonモジュール
|
|
323
|
-
│ │ ├── mcp/ # TD内でMCPからのリクエストを処理するコアロジック
|
|
324
|
-
│ │ │ ├── controllers/ # APIリクエストコントローラ (api_controller.py, generated_handlers.py)
|
|
325
|
-
│ │ │ └── services/ # ビジネスロジック (api_service.py)
|
|
326
|
-
│ │ ├── td_server/ # OpenAPIスキーマから生成されたPythonモデルコード
|
|
327
|
-
│ │ └── utils/ # 共有Pythonユーティリティ
|
|
328
|
-
│ ├── templates/ # Pythonコード生成用Mustacheテンプレート
|
|
329
|
-
│ ├── genHandlers.js # generated_handlers.py 生成用のNode.jsスクリプト
|
|
330
|
-
│ ├── import_modules.py # TDへ APIサーバ関連モジュールをインポートするヘルパースクリプト
|
|
331
|
-
│ └── mcp_webserver_base.tox # メインTouchDesignerコンポーネント
|
|
332
|
-
├── tests/ # テストコード
|
|
333
|
-
│ ├── integration/
|
|
334
|
-
│ └── unit/
|
|
335
|
-
└── orval.config.ts # Orval 設定 (TSクライアント生成)
|
|
336
|
-
```
|
|
337
|
-
|
|
338
|
-
### APIコード生成ワークフロー
|
|
339
|
-
|
|
340
|
-
このプロジェクトでは、OpenAPIによるコード生成ツール ( Orval / openapi-generator-cli )を使用しています:
|
|
341
|
-
|
|
342
|
-
**API定義:** Node.js MCPサーバーとTouchDesigner内で実行されるPythonサーバー間のAPI規約は `src/api/index.yml` で定義されます。
|
|
343
|
-
|
|
344
|
-
1. **Pythonサーバー生成 (`npm run gen:webserver`):**
|
|
345
|
-
- Docker経由で `openapi-generator-cli` を使用します。
|
|
346
|
-
- `src/api/index.yml` を読み取ります。
|
|
347
|
-
- API定義に基づいてPythonサーバーのスケルトン (`td/modules/td_server/`) を生成します。このコードはWebServer DATを介してTouchDesigner内で実行されます。
|
|
348
|
-
- **Dockerがインストールされ、実行されている必要があります。**
|
|
349
|
-
2. **Pythonハンドラ生成 (`npm run gen:handlers`):**
|
|
350
|
-
- カスタムNode.jsスクリプト (`td/genHandlers.js`) とMustacheテンプレート (`td/templates/`) を使用します。
|
|
351
|
-
- 生成されたPythonサーバーコードまたはOpenAPI仕様を読み取ります。
|
|
352
|
-
- `td/modules/mcp/services/api_service.py` にあるビジネスロジックに接続するハンドラ実装 (`td/modules/mcp/controllers/generated_handlers.py`) を生成します。
|
|
353
|
-
3. **TypeScriptクライアント生成 (`npm run gen:mcp`):**
|
|
354
|
-
- `Orval` を使用し `openapi-generator-cli` がバンドルしたスキーマYAMLからAPIクライアントコードとToolの検証に用いるZodスキーマを生成します。
|
|
355
|
-
- Node.jsサーバーが WebServerDAT にリクエストを行うために使用する、型付けされたTypeScriptクライアント (`src/tdClient/`) を生成します。
|
|
356
|
-
|
|
357
|
-
ビルドプロセス (`npm run build`) は、必要なすべての生成ステップ (`npm run gen`) を実行し、その後にTypeScriptコンパイル (`tsc`) を行います。
|
|
358
|
-
|
|
359
|
-
### バージョン管理
|
|
360
|
-
|
|
361
|
-
- `package.json` はすべてのコンポーネントバージョンの唯一の信頼できる情報源です(Node.js MCPサーバー、TouchDesigner Python API、MCPバンドル、および `server.json` メタデータ)。
|
|
362
|
-
- バージョンを更新する際は `npm version <patch|minor|major>`(または内部で使用される `npm run gen:version`)を実行してください。このスクリプトは `pyproject.toml`、`td/modules/utils/version.py`、`mcpb/manifest.json`、および `server.json` を書き換え、リリースワークフローがタグ値を信頼できるようにします。
|
|
363
|
-
- GitHubリリースワークフロー(`.github/workflows/release.yml`)はコミットを `v${version}` としてタグ付けし、同じバージョン番号から `touchdesigner-mcp-td.zip` / `touchdesigner-mcp.mcpb` を公開します。リリースをトリガーする前に必ず同期ステップを実行し、すべてのアーティファクトが整合するようにしてください。
|
|
60
|
+
ローカル環境構築やクライアント設定、コード生成ワークフローなどの詳細は **[開発者ガイド](docs/development.ja.md)** を参照してください。
|
|
364
61
|
|
|
365
62
|
## トラブルシューティング
|
|
366
63
|
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
This is an implementation of an MCP (Model Context Protocol) server for TouchDesigner. Its goal is to enable AI agents to control and operate TouchDesigner projects.
|
|
4
4
|
|
|
5
|
-
[English](
|
|
5
|
+
[English](README.md) / [日本語](README.ja.md)
|
|
6
6
|
|
|
7
7
|
## Overview
|
|
8
8
|
|
|
@@ -14,227 +14,12 @@ TouchDesigner MCP acts as a bridge between AI models and the TouchDesigner WebSe
|
|
|
14
14
|
- Query node properties and project structure
|
|
15
15
|
- Programmatically control TouchDesigner via Python scripts
|
|
16
16
|
|
|
17
|
-
##
|
|
17
|
+
## Installation
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
flowchart LR
|
|
21
|
-
A["🤖<br/>MCP client<br/>(Claude / Codex / ...)"]
|
|
19
|
+
Read the **[Installation Guide](docs/installation.md)**.
|
|
22
20
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
B2["🖌️<br/>Presenters & formatters<br/>(markdown output)"]
|
|
26
|
-
B3["🌐<br/>OpenAPI HTTP client<br/>(src/tdClient)"]
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
subgraph T [TouchDesigner project]
|
|
30
|
-
C1["🧩<br/>WebServer DAT<br/>(mcp_webserver_base.tox)"]
|
|
31
|
-
C2["🐍<br/>Python controllers / services<br/>(td/modules/mcp)"]
|
|
32
|
-
C3["🎛️<br/>Project nodes & parameters<br/>(/project1/...)"]
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
A --> B1
|
|
36
|
-
B1 --> B2
|
|
37
|
-
B1 --> B3
|
|
38
|
-
B2 --> A
|
|
39
|
-
B3 <--> C1
|
|
40
|
-
C1 <--> C2
|
|
41
|
-
C2 <--> C3
|
|
42
|
-
|
|
43
|
-
%% Higher-contrast colors for readability
|
|
44
|
-
classDef client fill:#d8e8ff,stroke:#1f6feb,stroke-width:2px,color:#111,font-weight:bold
|
|
45
|
-
classDef server fill:#efe1ff,stroke:#8250df,stroke-width:2px,color:#111,font-weight:bold
|
|
46
|
-
classDef td fill:#d7f5e3,stroke:#2f9e44,stroke-width:2px,color:#111,font-weight:bold
|
|
47
|
-
class A client;
|
|
48
|
-
class B1,B2,B3 server;
|
|
49
|
-
class C1,C2,C3 td;
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
## Usage
|
|
53
|
-
|
|
54
|
-
<details>
|
|
55
|
-
<summary>Method 1: Using Claude Desktop and MCP Bundle (Recommended)</summary>
|
|
56
|
-
|
|
57
|
-
### 1. Download Files
|
|
58
|
-
|
|
59
|
-
Download the following from the [releases page](https://github.com/8beeeaaat/touchdesigner-mcp/releases/latest):
|
|
60
|
-
|
|
61
|
-
- **TouchDesigner Components**: `touchdesigner-mcp-td.zip`
|
|
62
|
-
- **[MCP Bundle](https://github.com/modelcontextprotocol/mcpb) (.mcpb)**: `touchdesigner-mcp.mcpb`
|
|
63
|
-
|
|
64
|
-
### 2. Set up TouchDesigner Components
|
|
65
|
-
|
|
66
|
-
1. Extract the TouchDesigner components from `touchdesigner-mcp-td.zip`.
|
|
67
|
-
2. Import `mcp_webserver_base.tox` into your TouchDesigner project.
|
|
68
|
-
3. Place it at `/project1/mcp_webserver_base`.
|
|
69
|
-
|
|
70
|
-
<https://github.com/user-attachments/assets/215fb343-6ed8-421c-b948-2f45fb819ff4>
|
|
71
|
-
|
|
72
|
-
You can check the startup logs by opening the Textport from the TouchDesigner menu.
|
|
73
|
-
|
|
74
|
-

|
|
75
|
-
|
|
76
|
-
### 3. Install the MCP Bundle
|
|
77
|
-
|
|
78
|
-
Double-click the `touchdesigner-mcp.mcpb` file to install the bundle in Claude Desktop.
|
|
79
|
-
|
|
80
|
-
<https://github.com/user-attachments/assets/0786d244-8b82-4387-bbe4-9da048212854>
|
|
81
|
-
|
|
82
|
-
### 4. Connect to the Server
|
|
83
|
-
|
|
84
|
-
The MCP bundle will automatically handle the connection to the TouchDesigner server.
|
|
85
|
-
|
|
86
|
-
**⚠️ Important:** The directory structure must be preserved exactly as extracted. The `mcp_webserver_base.tox` component references relative paths to the `modules/` directory and other files.
|
|
87
|
-
|
|
88
|
-
</details>
|
|
89
|
-
|
|
90
|
-
<details>
|
|
91
|
-
<summary>Method 2: Using npx</summary>
|
|
92
|
-
|
|
93
|
-
*Requires Node.js to be installed.*
|
|
94
|
-
|
|
95
|
-
### 1. Set up TouchDesigner Components
|
|
96
|
-
|
|
97
|
-
1. Download and extract the TouchDesigner components from `touchdesigner-mcp-td.zip` ([releases page](https://github.com/8beeeaaat/touchdesigner-mcp/releases/latest)).
|
|
98
|
-
2. Import `mcp_webserver_base.tox` into your TouchDesigner project.
|
|
99
|
-
3. Place it at `/project1/mcp_webserver_base`.
|
|
100
|
-
|
|
101
|
-
<https://github.com/user-attachments/assets/215fb343-6ed8-421c-b948-2f45fb819ff4>
|
|
102
|
-
|
|
103
|
-
You can check the startup logs by opening the Textport from the TouchDesigner menu.
|
|
104
|
-
|
|
105
|
-

|
|
106
|
-
|
|
107
|
-
### 2. Set up the MCP Server Configuration
|
|
108
|
-
|
|
109
|
-
*Example for Claude Desktop:*
|
|
110
|
-
|
|
111
|
-
```json
|
|
112
|
-
{
|
|
113
|
-
"mcpServers": {
|
|
114
|
-
"touchdesigner": {
|
|
115
|
-
"command": "npx",
|
|
116
|
-
"args": ["-y", "touchdesigner-mcp-server@latest", "--stdio"]
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
**Customization:** You can customize the TouchDesigner server connection by adding `--host` and `--port` arguments:
|
|
123
|
-
|
|
124
|
-
```json
|
|
125
|
-
"args": [
|
|
126
|
-
"-y",
|
|
127
|
-
"touchdesigner-mcp-server@latest",
|
|
128
|
-
"--stdio",
|
|
129
|
-
"--host=http://custom_host",
|
|
130
|
-
"--port=9982"
|
|
131
|
-
]
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
</details>
|
|
135
|
-
|
|
136
|
-
<details>
|
|
137
|
-
<summary>Method 3: Using a Docker Image</summary>
|
|
138
|
-
|
|
139
|
-
[](https://www.youtube.com/watch?v=BRWoIEVb0TU)
|
|
140
|
-
|
|
141
|
-
### 1. Clone the repository
|
|
142
|
-
|
|
143
|
-
```bash
|
|
144
|
-
git clone https://github.com/8beeeaaat/touchdesigner-mcp.git
|
|
145
|
-
cd touchdesigner-mcp
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
### 2. Build the Docker image
|
|
149
|
-
|
|
150
|
-
```bash
|
|
151
|
-
make build
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
### 3. Install the API Server in Your TouchDesigner Project
|
|
155
|
-
|
|
156
|
-
Start TouchDesigner and import the `td/mcp_webserver_base.tox` component into the project you want to control.
|
|
157
|
-
Example: Place it at `/project1/mcp_webserver_base`.
|
|
158
|
-
|
|
159
|
-
Importing the `.tox` file will trigger the `td/import_modules.py` script, which loads the necessary modules for the API server.
|
|
160
|
-
|
|
161
|
-
<https://github.com/user-attachments/assets/215fb343-6ed8-421c-b948-2f45fb819ff4>
|
|
162
|
-
|
|
163
|
-
You can check the startup logs by opening the Textport from the TouchDesigner menu.
|
|
164
|
-
|
|
165
|
-

|
|
166
|
-
|
|
167
|
-
### 4. Start the MCP server container
|
|
168
|
-
|
|
169
|
-
```bash
|
|
170
|
-
docker-compose up -d
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
### 5. Configure your AI agent to use the Docker container
|
|
174
|
-
|
|
175
|
-
*Example for Claude Desktop:*
|
|
176
|
-
|
|
177
|
-
```json
|
|
178
|
-
{
|
|
179
|
-
"mcpServers": {
|
|
180
|
-
"touchdesigner": {
|
|
181
|
-
"command": "docker",
|
|
182
|
-
"args": [
|
|
183
|
-
"compose",
|
|
184
|
-
"-f",
|
|
185
|
-
"/path/to/your/touchdesigner-mcp/docker-compose.yml",
|
|
186
|
-
"exec",
|
|
187
|
-
"-i",
|
|
188
|
-
"touchdesigner-mcp-server",
|
|
189
|
-
"node",
|
|
190
|
-
"dist/cli.js",
|
|
191
|
-
"--stdio",
|
|
192
|
-
"--host=http://host.docker.internal"
|
|
193
|
-
]
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
*On Windows systems, include the drive letter, e.g., `C:\path\to\your\touchdesigner-mcp\docker-compose.yml`.*
|
|
200
|
-
|
|
201
|
-
**Note:** You can customize the TouchDesigner server connection by adding `--host` and `--port` arguments:
|
|
202
|
-
|
|
203
|
-
```json
|
|
204
|
-
"args": [
|
|
205
|
-
...,
|
|
206
|
-
"--stdio",
|
|
207
|
-
"--host=http://host.docker.internal",
|
|
208
|
-
"--port=9982"
|
|
209
|
-
]
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
</details>
|
|
213
|
-
|
|
214
|
-
## Verify Connection
|
|
215
|
-
|
|
216
|
-
If the MCP server is recognized, the setup is complete.
|
|
217
|
-
If it's not recognized, try restarting your AI agent.
|
|
218
|
-
If you see an error at startup, try launching the agent again after starting TouchDesigner.
|
|
219
|
-
When the API server is running properly in TouchDesigner, the agent can use the provided tools to operate it.
|
|
220
|
-
|
|
221
|
-
### Directory Structure Requirements
|
|
222
|
-
|
|
223
|
-
**Critical:** When using any method, you must maintain the original directory structure:
|
|
224
|
-
|
|
225
|
-
```
|
|
226
|
-
td/
|
|
227
|
-
├── import_modules.py # Module loader script
|
|
228
|
-
├── mcp_webserver_base.tox # Main TouchDesigner component
|
|
229
|
-
└── modules/ # Python modules directory
|
|
230
|
-
├── mcp/ # MCP core logic
|
|
231
|
-
├── utils/ # Shared utilities
|
|
232
|
-
└── td_server/ # Generated API server code
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
The `mcp_webserver_base.tox` component uses relative paths to locate Python modules. Moving or reorganizing these files will cause import errors in TouchDesigner.
|
|
236
|
-
|
|
237
|
-

|
|
21
|
+
The guide includes the required TouchDesigner preparation, per-agent setup, verification steps, and
|
|
22
|
+
troubleshooting tips.
|
|
238
23
|
|
|
239
24
|
## MCP Server Features
|
|
240
25
|
|
|
@@ -273,94 +58,10 @@ Prompts provide instructions for AI agents to perform specific actions in TouchD
|
|
|
273
58
|
|
|
274
59
|
Not implemented.
|
|
275
60
|
|
|
276
|
-
##
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
1. **Set up your environment:**
|
|
281
|
-
|
|
282
|
-
```bash
|
|
283
|
-
# Clone and install dependencies
|
|
284
|
-
git clone https://github.com/8beeeaaat/touchdesigner-mcp.git
|
|
285
|
-
cd touchdesigner-mcp
|
|
286
|
-
npm install
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
2. **Build the project:**
|
|
290
|
-
|
|
291
|
-
```bash
|
|
292
|
-
make build # Docker-based build (recommended)
|
|
293
|
-
# OR
|
|
294
|
-
npm run build # Node.js-based build
|
|
295
|
-
```
|
|
296
|
-
|
|
297
|
-
3. **Available commands:**
|
|
298
|
-
|
|
299
|
-
```bash
|
|
300
|
-
npm run test # Run unit and integration tests
|
|
301
|
-
npm run dev # Launch the MCP inspector for debugging
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
**Note:** When you update the code, you must restart both the MCP server and TouchDesigner to apply the changes.
|
|
305
|
-
|
|
306
|
-
### Project Structure Overview
|
|
307
|
-
|
|
308
|
-
```
|
|
309
|
-
├── src/ # MCP server source code
|
|
310
|
-
│ ├── api/ # OpenAPI spec for the TouchDesigner WebServer
|
|
311
|
-
│ ├── core/ # Core utilities (logger, error handling)
|
|
312
|
-
│ ├── features/ # MCP feature implementations
|
|
313
|
-
│ │ ├── prompts/ # Prompt handlers
|
|
314
|
-
│ │ ├── resources/ # Resource handlers
|
|
315
|
-
│ │ └── tools/ # Tool handlers (e.g., tdTools.ts)
|
|
316
|
-
│ ├── gen/ # Code generated from the OpenAPI schema for the MCP server
|
|
317
|
-
│ ├── server/ # MCP server logic (connections, main server class)
|
|
318
|
-
│ ├── tdClient/ # TouchDesigner connection API client
|
|
319
|
-
│ ├── index.ts # Main entry point for the Node.js server
|
|
320
|
-
│ └── ...
|
|
321
|
-
├── td/ # TouchDesigner-related files
|
|
322
|
-
│ ├── modules/ # Python modules for TouchDesigner
|
|
323
|
-
│ │ ├── mcp/ # Core logic for handling MCP requests in TouchDesigner
|
|
324
|
-
│ │ │ ├── controllers/ # API request controllers (api_controller.py, generated_handlers.py)
|
|
325
|
-
│ │ │ └── services/ # Business logic (api_service.py)
|
|
326
|
-
│ │ ├── td_server/ # Python model code generated from the OpenAPI schema
|
|
327
|
-
│ │ └── utils/ # Shared Python utilities
|
|
328
|
-
│ ├── templates/ # Mustache templates for Python code generation
|
|
329
|
-
│ ├── genHandlers.js # Node.js script for generating generated_handlers.py
|
|
330
|
-
│ ├── import_modules.py # Helper script to import API server modules into TouchDesigner
|
|
331
|
-
│ └── mcp_webserver_base.tox # Main TouchDesigner component
|
|
332
|
-
├── tests/ # Test code
|
|
333
|
-
│ ├── integration/
|
|
334
|
-
│ └── unit/
|
|
335
|
-
└── orval.config.ts # Orval config (TypeScript client generation)
|
|
336
|
-
```
|
|
337
|
-
|
|
338
|
-
### API Code Generation Workflow
|
|
339
|
-
|
|
340
|
-
This project uses OpenAPI-based code generation tools (Orval and openapi-generator-cli).
|
|
341
|
-
|
|
342
|
-
**API Definition:** The API contract between the Node.js MCP server and the Python server running inside TouchDesigner is defined in `src/api/index.yml`.
|
|
343
|
-
|
|
344
|
-
1. **Python server generation (`npm run gen:webserver`):**
|
|
345
|
-
- Uses `openapi-generator-cli` via Docker.
|
|
346
|
-
- Reads `src/api/index.yml`.
|
|
347
|
-
- Generates a Python server skeleton (`td/modules/td_server/`) based on the API definition. This code runs inside TouchDesigner's WebServer DAT.
|
|
348
|
-
- **Requires Docker to be installed and running.**
|
|
349
|
-
2. **Python handler generation (`npm run gen:handlers`):**
|
|
350
|
-
- Uses a custom Node.js script (`td/genHandlers.js`) and Mustache templates (`td/templates/`).
|
|
351
|
-
- Reads the generated Python server code or OpenAPI spec.
|
|
352
|
-
- Generates handler implementations (`td/modules/mcp/controllers/generated_handlers.py`) that connect to the business logic in `td/modules/mcp/services/api_service.py`.
|
|
353
|
-
3. **TypeScript client generation (`npm run gen:mcp`):**
|
|
354
|
-
- Uses `Orval` to generate an API client and Zod schemas for tool validation from the schema YAML, which is bundled by `openapi-generator-cli`.
|
|
355
|
-
- Generates a typed TypeScript client (`src/tdClient/`) used by the Node.js server to make requests to the WebServer DAT.
|
|
356
|
-
|
|
357
|
-
The build process (`npm run build`) runs all necessary generation steps (`npm run gen`), followed by TypeScript compilation (`tsc`).
|
|
358
|
-
|
|
359
|
-
### Version management
|
|
360
|
-
|
|
361
|
-
- `package.json` is the single source of truth for every component version (Node.js MCP server, TouchDesigner Python API, MCP bundle, and `server.json` metadata).
|
|
362
|
-
- Run `npm version <patch|minor|major>` (or the underlying `npm run gen:version`) whenever you bump the version. The script rewrites `pyproject.toml`, `td/modules/utils/version.py`, `mcpb/manifest.json`, and `server.json` so that the release workflow can trust the tag value.
|
|
363
|
-
- The GitHub release workflow (`.github/workflows/release.yml`) tags the commit as `v${version}` and publishes `touchdesigner-mcp-td.zip` / `touchdesigner-mcp.mcpb` from the exact same version number. Always run the sync step before triggering a release so that every artifact stays aligned.
|
|
61
|
+
## Developer Guide
|
|
62
|
+
|
|
63
|
+
Looking for local setup, client configuration, project structure, or release workflow notes?
|
|
64
|
+
See the **[Developer Guide](docs/development.md)** for all developer-facing documentation.
|
|
364
65
|
|
|
365
66
|
## Troubleshooting
|
|
366
67
|
|