touchdesigner-mcp-server 1.4.8 → 1.4.10

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.
Files changed (50) hide show
  1. package/dist/api/customInstance.d.ts +5 -0
  2. package/dist/cli.d.ts +50 -0
  3. package/dist/core/compatibility.d.ts +102 -0
  4. package/dist/core/constants.d.ts +29 -0
  5. package/dist/core/errorHandling.d.ts +18 -0
  6. package/dist/core/logger.d.ts +24 -0
  7. package/dist/core/result.d.ts +25 -0
  8. package/dist/core/version.d.ts +21 -0
  9. package/dist/features/prompts/handlers/td_prompts.d.ts +6 -0
  10. package/dist/features/prompts/index.d.ts +1 -0
  11. package/dist/features/prompts/register.d.ts +6 -0
  12. package/dist/features/tools/handlers/tdTools.d.ts +4 -0
  13. package/dist/features/tools/handlers/tdTools.js +23 -256
  14. package/dist/features/tools/index.d.ts +3 -0
  15. package/dist/features/tools/metadata/touchDesignerToolMetadata.d.ts +29 -0
  16. package/dist/features/tools/metadata/touchDesignerToolMetadata.js +96 -474
  17. package/dist/features/tools/presenter/classListFormatter.d.ts +29 -0
  18. package/dist/features/tools/presenter/index.d.ts +18 -0
  19. package/dist/features/tools/presenter/markdownRenderer.d.ts +3 -0
  20. package/dist/features/tools/presenter/moduleHelpFormatter.d.ts +12 -0
  21. package/dist/features/tools/presenter/nodeDetailsFormatter.d.ts +16 -0
  22. package/dist/features/tools/presenter/nodeErrorsFormatter.d.ts +4 -0
  23. package/dist/features/tools/presenter/nodeListFormatter.d.ts +22 -0
  24. package/dist/features/tools/presenter/operationFormatter.d.ts +16 -0
  25. package/dist/features/tools/presenter/presenter.d.ts +10 -0
  26. package/dist/features/tools/presenter/responseFormatter.d.ts +83 -0
  27. package/dist/features/tools/presenter/scriptResultFormatter.d.ts +23 -0
  28. package/dist/features/tools/presenter/toolMetadataFormatter.d.ts +7 -0
  29. package/dist/features/tools/register.d.ts +7 -0
  30. package/dist/features/tools/toolDefinitions.d.ts +38 -0
  31. package/dist/features/tools/toolDefinitions.js +317 -0
  32. package/dist/features/tools/types.d.ts +43 -0
  33. package/dist/features/tools/utils/toolUtils.d.ts +0 -0
  34. package/dist/gen/endpoints/TouchDesignerAPI.d.ts +510 -0
  35. package/dist/gen/endpoints/TouchDesignerAPI.js +18 -18
  36. package/dist/gen/mcp/touchDesignerAPI.zod.d.ts +253 -0
  37. package/dist/gen/mcp/touchDesignerAPI.zod.js +27 -27
  38. package/dist/index.d.ts +3 -0
  39. package/dist/server/connectionManager.d.ts +25 -0
  40. package/dist/server/touchDesignerServer.d.ts +59 -0
  41. package/dist/tdClient/index.d.ts +7 -0
  42. package/dist/tdClient/touchDesignerClient.d.ts +167 -0
  43. package/dist/transport/config.d.ts +96 -0
  44. package/dist/transport/expressHttpManager.d.ts +86 -0
  45. package/dist/transport/factory.d.ts +81 -0
  46. package/dist/transport/index.d.ts +15 -0
  47. package/dist/transport/sessionManager.d.ts +180 -0
  48. package/dist/transport/transportRegistry.d.ts +92 -0
  49. package/dist/transport/validator.d.ts +43 -0
  50. package/package.json +6 -21
@@ -0,0 +1,253 @@
1
+ /**
2
+ * Generated by orval v8.17.0 🍺
3
+ * Do not edit manually.
4
+ * TouchDesigner API
5
+ * OpenAPI schema for generating TouchDesigner API client code
6
+ * OpenAPI spec version: 1.4.3
7
+ */
8
+ import * as zod from 'zod';
9
+ /**
10
+ * @summary Get nodes in the path
11
+ */
12
+ export declare const getNodesQueryPatternDefault = "*";
13
+ export declare const getNodesQueryIncludePropertiesDefault = false;
14
+ export declare const GetNodesQueryParams: zod.ZodObject<{
15
+ parentPath: zod.ZodString;
16
+ pattern: zod.ZodDefault<zod.ZodString>;
17
+ includeProperties: zod.ZodDefault<zod.ZodBoolean>;
18
+ }, zod.z.core.$strip>;
19
+ export declare const GetNodesResponse: zod.ZodObject<{
20
+ success: zod.ZodBoolean;
21
+ data: zod.ZodNullable<zod.ZodObject<{
22
+ nodes: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
23
+ id: zod.ZodNumber;
24
+ opType: zod.ZodString;
25
+ name: zod.ZodString;
26
+ path: zod.ZodString;
27
+ properties: zod.ZodRecord<zod.ZodString, zod.ZodUnknown>;
28
+ }, zod.z.core.$strip>>>;
29
+ }, zod.z.core.$strip>>;
30
+ error: zod.ZodNullable<zod.ZodString>;
31
+ }, zod.z.core.$strip>;
32
+ /**
33
+ * @summary Create a new node
34
+ */
35
+ export declare const CreateNodeBody: zod.ZodObject<{
36
+ parentPath: zod.ZodString;
37
+ nodeType: zod.ZodString;
38
+ nodeName: zod.ZodOptional<zod.ZodString>;
39
+ }, zod.z.core.$strip>;
40
+ export declare const CreateNodeResponse: zod.ZodObject<{
41
+ success: zod.ZodBoolean;
42
+ data: zod.ZodNullable<zod.ZodObject<{
43
+ result: zod.ZodOptional<zod.ZodObject<{
44
+ id: zod.ZodNumber;
45
+ opType: zod.ZodString;
46
+ name: zod.ZodString;
47
+ path: zod.ZodString;
48
+ properties: zod.ZodRecord<zod.ZodString, zod.ZodUnknown>;
49
+ }, zod.z.core.$strip>>;
50
+ }, zod.z.core.$strip>>;
51
+ error: zod.ZodNullable<zod.ZodString>;
52
+ }, zod.z.core.$strip>;
53
+ /**
54
+ * @summary Delete an existing node
55
+ */
56
+ export declare const DeleteNodeQueryParams: zod.ZodObject<{
57
+ nodePath: zod.ZodString;
58
+ }, zod.z.core.$strip>;
59
+ export declare const DeleteNodeResponse: zod.ZodObject<{
60
+ success: zod.ZodBoolean;
61
+ data: zod.ZodNullable<zod.ZodObject<{
62
+ deleted: zod.ZodOptional<zod.ZodBoolean>;
63
+ node: zod.ZodOptional<zod.ZodObject<{
64
+ id: zod.ZodNumber;
65
+ opType: zod.ZodString;
66
+ name: zod.ZodString;
67
+ path: zod.ZodString;
68
+ properties: zod.ZodRecord<zod.ZodString, zod.ZodUnknown>;
69
+ }, zod.z.core.$strip>>;
70
+ }, zod.z.core.$strip>>;
71
+ error: zod.ZodNullable<zod.ZodString>;
72
+ }, zod.z.core.$strip>;
73
+ /**
74
+ * Retrieves detailed information about a specific node including its properties, parameters and connections
75
+ * @summary Get node detail
76
+ */
77
+ export declare const GetNodeDetailQueryParams: zod.ZodObject<{
78
+ nodePath: zod.ZodString;
79
+ }, zod.z.core.$strip>;
80
+ export declare const GetNodeDetailResponse: zod.ZodObject<{
81
+ success: zod.ZodBoolean;
82
+ data: zod.ZodNullable<zod.ZodObject<{
83
+ id: zod.ZodNumber;
84
+ opType: zod.ZodString;
85
+ name: zod.ZodString;
86
+ path: zod.ZodString;
87
+ properties: zod.ZodRecord<zod.ZodString, zod.ZodUnknown>;
88
+ }, zod.z.core.$strip>>;
89
+ error: zod.ZodNullable<zod.ZodString>;
90
+ }, zod.z.core.$strip>;
91
+ /**
92
+ * @summary Update node properties
93
+ */
94
+ export declare const UpdateNodeBody: zod.ZodObject<{
95
+ nodePath: zod.ZodString;
96
+ properties: zod.ZodRecord<zod.ZodString, zod.ZodUnknown>;
97
+ }, zod.z.core.$strip>;
98
+ export declare const UpdateNodeResponse: zod.ZodObject<{
99
+ success: zod.ZodBoolean;
100
+ data: zod.ZodNullable<zod.ZodObject<{
101
+ path: zod.ZodOptional<zod.ZodString>;
102
+ updated: zod.ZodOptional<zod.ZodArray<zod.ZodString>>;
103
+ failed: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
104
+ name: zod.ZodOptional<zod.ZodString>;
105
+ reason: zod.ZodOptional<zod.ZodString>;
106
+ }, zod.z.core.$strip>>>;
107
+ message: zod.ZodOptional<zod.ZodString>;
108
+ }, zod.z.core.$strip>>;
109
+ error: zod.ZodNullable<zod.ZodString>;
110
+ }, zod.z.core.$strip>;
111
+ /**
112
+ * Collects TouchDesigner error messages for a node and its children
113
+ * @summary Get node errors
114
+ */
115
+ export declare const GetNodeErrorsQueryParams: zod.ZodObject<{
116
+ nodePath: zod.ZodString;
117
+ }, zod.z.core.$strip>;
118
+ export declare const GetNodeErrorsResponse: zod.ZodObject<{
119
+ success: zod.ZodBoolean;
120
+ data: zod.ZodObject<{
121
+ nodePath: zod.ZodString;
122
+ nodeName: zod.ZodString;
123
+ opType: zod.ZodString;
124
+ errorCount: zod.ZodNumber;
125
+ hasErrors: zod.ZodBoolean;
126
+ errors: zod.ZodArray<zod.ZodObject<{
127
+ nodePath: zod.ZodString;
128
+ nodeName: zod.ZodString;
129
+ opType: zod.ZodString;
130
+ message: zod.ZodString;
131
+ }, zod.z.core.$strip>>;
132
+ }, zod.z.core.$strip>;
133
+ error: zod.ZodNullable<zod.ZodString>;
134
+ }, zod.z.core.$strip>;
135
+ /**
136
+ * Returns a list of Python classes, modules, and functions available in TouchDesigner
137
+ * @summary Get a list of Python classes and modules
138
+ */
139
+ export declare const GetTdPythonClassesResponse: zod.ZodObject<{
140
+ success: zod.ZodBoolean;
141
+ data: zod.ZodNullable<zod.ZodObject<{
142
+ classes: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
143
+ name: zod.ZodString;
144
+ type: zod.ZodEnum<{
145
+ object: "object";
146
+ function: "function";
147
+ class: "class";
148
+ module: "module";
149
+ }>;
150
+ description: zod.ZodOptional<zod.ZodString>;
151
+ }, zod.z.core.$strip>>>;
152
+ }, zod.z.core.$strip>>;
153
+ error: zod.ZodNullable<zod.ZodString>;
154
+ }, zod.z.core.$strip>;
155
+ /**
156
+ * Returns detailed information about a specific Python class, module, or function including methods, properties, and documentation
157
+ * @summary Get details of a specific Python class or module
158
+ */
159
+ export declare const GetTdPythonClassDetailsParams: zod.ZodObject<{
160
+ className: zod.ZodString;
161
+ }, zod.z.core.$strip>;
162
+ export declare const GetTdPythonClassDetailsResponse: zod.ZodObject<{
163
+ success: zod.ZodBoolean;
164
+ data: zod.ZodNullable<zod.ZodObject<{
165
+ name: zod.ZodString;
166
+ type: zod.ZodEnum<{
167
+ object: "object";
168
+ function: "function";
169
+ class: "class";
170
+ module: "module";
171
+ }>;
172
+ description: zod.ZodOptional<zod.ZodString>;
173
+ methods: zod.ZodArray<zod.ZodObject<{
174
+ name: zod.ZodString;
175
+ signature: zod.ZodOptional<zod.ZodString>;
176
+ description: zod.ZodOptional<zod.ZodString>;
177
+ }, zod.z.core.$strip>>;
178
+ properties: zod.ZodArray<zod.ZodObject<{
179
+ name: zod.ZodString;
180
+ type: zod.ZodString;
181
+ value: zod.ZodOptional<zod.ZodNullable<zod.ZodObject<{}, zod.z.core.$loose>>>;
182
+ }, zod.z.core.$strip>>;
183
+ }, zod.z.core.$strip>>;
184
+ error: zod.ZodNullable<zod.ZodString>;
185
+ }, zod.z.core.$strip>;
186
+ /**
187
+ * Retrieve Python help() documentation for TouchDesigner modules, classes, or utilities like tdu.
188
+ * @summary Get module/class Python help documentation
189
+ */
190
+ export declare const GetModuleHelpQueryParams: zod.ZodObject<{
191
+ moduleName: zod.ZodString;
192
+ }, zod.z.core.$strip>;
193
+ export declare const GetModuleHelpResponse: zod.ZodObject<{
194
+ success: zod.ZodBoolean;
195
+ data: zod.ZodNullable<zod.ZodObject<{
196
+ moduleName: zod.ZodString;
197
+ helpText: zod.ZodString;
198
+ }, zod.z.core.$strip>>;
199
+ error: zod.ZodNullable<zod.ZodString>;
200
+ }, zod.z.core.$strip>;
201
+ /**
202
+ * Call a method on the node at the specified path (e.g., /project1).
203
+ * This allows operations equivalent to TouchDesigner's Python API such as
204
+ * `parent_comp = op('/project1')` and `parent_comp.create('textTOP', 'myText')`.
205
+ * @summary Call a method of the specified node
206
+ */
207
+ export declare const ExecNodeMethodBody: zod.ZodObject<{
208
+ nodePath: zod.ZodString;
209
+ method: zod.ZodString;
210
+ args: zod.ZodOptional<zod.ZodArray<zod.ZodUnion<readonly [zod.ZodString, zod.ZodNumber, zod.ZodBoolean]>>>;
211
+ kwargs: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodUnknown>>;
212
+ }, zod.z.core.$strip>;
213
+ export declare const ExecNodeMethodResponse: zod.ZodObject<{
214
+ success: zod.ZodBoolean;
215
+ data: zod.ZodNullable<zod.ZodObject<{
216
+ result: zod.ZodUnknown;
217
+ }, zod.z.core.$strip>>;
218
+ error: zod.ZodNullable<zod.ZodString>;
219
+ }, zod.z.core.$strip>;
220
+ /**
221
+ * Execute a Python script directly in TouchDesigner.
222
+ * Multiline scripts and scripts containing comments are supported.
223
+ * The script can optionally set a `result` variable to explicitly return a value.
224
+ * This endpoint allows you to interact with TouchDesigner nodes programmatically.
225
+ * @summary Execute python code on the server
226
+ */
227
+ export declare const ExecPythonScriptBody: zod.ZodObject<{
228
+ script: zod.ZodString;
229
+ }, zod.z.core.$strip>;
230
+ export declare const ExecPythonScriptResponse: zod.ZodObject<{
231
+ success: zod.ZodBoolean;
232
+ data: zod.ZodNullable<zod.ZodObject<{
233
+ result: zod.ZodObject<{
234
+ value: zod.ZodOptional<zod.ZodUnknown>;
235
+ }, zod.z.core.$strip>;
236
+ }, zod.z.core.$strip>>;
237
+ error: zod.ZodNullable<zod.ZodString>;
238
+ }, zod.z.core.$strip>;
239
+ /**
240
+ * Returns information about the TouchDesigner
241
+ * @summary Get TouchDesigner information
242
+ */
243
+ export declare const GetTdInfoResponse: zod.ZodObject<{
244
+ success: zod.ZodBoolean;
245
+ data: zod.ZodNullable<zod.ZodObject<{
246
+ mcpApiVersion: zod.ZodString;
247
+ osName: zod.ZodString;
248
+ osVersion: zod.ZodString;
249
+ server: zod.ZodString;
250
+ version: zod.ZodString;
251
+ }, zod.z.core.$strip>>;
252
+ error: zod.ZodNullable<zod.ZodString>;
253
+ }, zod.z.core.$strip>;
@@ -1,31 +1,11 @@
1
1
  /**
2
- * Generated by orval v8.16.0 🍺
2
+ * Generated by orval v8.17.0 🍺
3
3
  * Do not edit manually.
4
4
  * TouchDesigner API
5
5
  * OpenAPI schema for generating TouchDesigner API client code
6
6
  * OpenAPI spec version: 1.4.3
7
7
  */
8
8
  import * as zod from 'zod';
9
- /**
10
- * @summary Delete an existing node
11
- */
12
- export const DeleteNodeQueryParams = zod.object({
13
- "nodePath": zod.string().describe('Path to the node to delete. e.g., \"\/project1\/geo1\"')
14
- });
15
- export const DeleteNodeResponse = zod.object({
16
- "success": zod.boolean().describe('Whether the operation was successful'),
17
- "data": zod.object({
18
- "deleted": zod.boolean().optional().describe('Whether the node was successfully deleted'),
19
- "node": zod.object({
20
- "id": zod.number(),
21
- "opType": zod.string(),
22
- "name": zod.string(),
23
- "path": zod.string(),
24
- "properties": zod.record(zod.string(), zod.unknown())
25
- }).optional().describe('Information about a TouchDesigner node')
26
- }).nullable(),
27
- "error": zod.string().nullable().describe('Error message if the operation was not successful')
28
- });
29
9
  /**
30
10
  * @summary Get nodes in the path
31
11
  */
@@ -66,7 +46,27 @@ export const CreateNodeResponse = zod.object({
66
46
  "name": zod.string(),
67
47
  "path": zod.string(),
68
48
  "properties": zod.record(zod.string(), zod.unknown())
69
- }).optional().describe('Information about a TouchDesigner node')
49
+ }).optional().describe('Result of the execution')
50
+ }).nullable(),
51
+ "error": zod.string().nullable().describe('Error message if the operation was not successful')
52
+ });
53
+ /**
54
+ * @summary Delete an existing node
55
+ */
56
+ export const DeleteNodeQueryParams = zod.object({
57
+ "nodePath": zod.string().describe('Path to the node to delete. e.g., \"\/project1\/geo1\"')
58
+ });
59
+ export const DeleteNodeResponse = zod.object({
60
+ "success": zod.boolean().describe('Whether the operation was successful'),
61
+ "data": zod.object({
62
+ "deleted": zod.boolean().optional().describe('Whether the node was successfully deleted'),
63
+ "node": zod.object({
64
+ "id": zod.number(),
65
+ "opType": zod.string(),
66
+ "name": zod.string(),
67
+ "path": zod.string(),
68
+ "properties": zod.record(zod.string(), zod.unknown())
69
+ }).optional().describe('Information about the deleted node')
70
70
  }).nullable(),
71
71
  "error": zod.string().nullable().describe('Error message if the operation was not successful')
72
72
  });
@@ -85,7 +85,7 @@ export const GetNodeDetailResponse = zod.object({
85
85
  "name": zod.string(),
86
86
  "path": zod.string(),
87
87
  "properties": zod.record(zod.string(), zod.unknown())
88
- }).describe('Information about a TouchDesigner node'),
88
+ }).nullable().describe('Information about a TouchDesigner node'),
89
89
  "error": zod.string().nullable().describe('Error message if the operation was not successful')
90
90
  });
91
91
  /**
@@ -170,7 +170,7 @@ export const GetTdPythonClassDetailsResponse = zod.object({
170
170
  "type": zod.string().describe('Type of the property'),
171
171
  "value": zod.looseObject({}).nullish().describe('Current value of the property (if serializable)')
172
172
  }).describe('Information about a Python property')).describe('List of properties available in the class or module')
173
- }).describe('Detailed information about a Python class or module'),
173
+ }).nullable().describe('Detailed information about a Python class or module'),
174
174
  "error": zod.string().nullable().describe('Error message if the operation was not successful')
175
175
  });
176
176
  /**
@@ -185,7 +185,7 @@ export const GetModuleHelpResponse = zod.object({
185
185
  "data": zod.object({
186
186
  "moduleName": zod.string().describe('Normalized module\/class name the help text was generated for'),
187
187
  "helpText": zod.string().describe('Captured output from Python\'s help() function')
188
- }).describe('Raw Python help() output for a TouchDesigner module or class'),
188
+ }).nullable().describe('Raw Python help() output for a TouchDesigner module or class'),
189
189
  "error": zod.string().nullable().describe('Error message if the operation was not successful')
190
190
  });
191
191
  /**
@@ -203,7 +203,7 @@ export const ExecNodeMethodBody = zod.object({
203
203
  export const ExecNodeMethodResponse = zod.object({
204
204
  "success": zod.boolean().describe('Whether the operation was successful'),
205
205
  "data": zod.object({
206
- "result": zod.looseObject({}).describe('Result of the method call. Can be any type (equivalent to unknown in TypeScript).')
206
+ "result": zod.unknown().describe('Result of the method call. Can be any type (equivalent to unknown in TypeScript).')
207
207
  }).nullable(),
208
208
  "error": zod.string().nullable().describe('Error message if the operation was not successful')
209
209
  });
@@ -221,7 +221,7 @@ export const ExecPythonScriptResponse = zod.object({
221
221
  "success": zod.boolean().describe('Whether the operation was successful'),
222
222
  "data": zod.object({
223
223
  "result": zod.object({
224
- "value": zod.looseObject({}).optional().describe('Return value of the executed script, can be any serializable value')
224
+ "value": zod.unknown().optional().describe('Return value of the executed script, can be any serializable value')
225
225
  }).describe('Result of the executed script')
226
226
  }).nullable(),
227
227
  "error": zod.string().nullable().describe('Error message if the operation was not successful')
@@ -0,0 +1,3 @@
1
+ export { startServer } from "./cli.js";
2
+ export { TouchDesignerServer } from "./server/touchDesignerServer.js";
3
+ export { createTouchDesignerClient, TouchDesignerClient, } from "./tdClient/index.js";
@@ -0,0 +1,25 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import type { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
3
+ import type { ILogger } from "../core/logger.js";
4
+ import type { Result } from "../core/result.js";
5
+ /**
6
+ * Manages the connection between TouchDesignerServer and MCP transport
7
+ */
8
+ export declare class ConnectionManager {
9
+ private readonly server;
10
+ private readonly logger;
11
+ private transport;
12
+ constructor(server: McpServer, logger: ILogger);
13
+ /**
14
+ * Connect to MCP transport
15
+ */
16
+ connect(transport: Transport): Promise<Result<void, Error>>;
17
+ /**
18
+ * Disconnect from MCP transport
19
+ */
20
+ disconnect(): Promise<Result<void, Error>>;
21
+ /**
22
+ * Check if connected to MCP transport
23
+ */
24
+ isConnected(): boolean;
25
+ }
@@ -0,0 +1,59 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import type { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
3
+ import type { ILogger } from "../core/logger.js";
4
+ import type { Result } from "../core/result.js";
5
+ import type { TouchDesignerClient } from "../tdClient/touchDesignerClient.js";
6
+ /**
7
+ * Capabilities supported by TouchDesigner MCP Server
8
+ */
9
+ export interface TouchDesignerCapabilities {
10
+ logging: Record<string, never>;
11
+ prompts: Record<string, never>;
12
+ tools: Record<string, never>;
13
+ }
14
+ /**
15
+ * TouchDesigner MCP Server implementation
16
+ */
17
+ export declare class TouchDesignerServer {
18
+ readonly server: McpServer;
19
+ readonly logger: ILogger;
20
+ readonly tdClient: TouchDesignerClient;
21
+ private readonly connectionManager;
22
+ /**
23
+ * Initialize TouchDesignerServer with proper dependency injection
24
+ */
25
+ constructor();
26
+ /**
27
+ * Create a new TouchDesignerServer instance
28
+ *
29
+ * Factory method for creating server instances in multi-session scenarios.
30
+ * Each session should have its own server instance to maintain independent MCP protocol state.
31
+ *
32
+ * @returns McpServer instance ready for connection to a transport
33
+ *
34
+ * @example
35
+ * ```typescript
36
+ * // In TransportRegistry
37
+ * const serverFactory = () => TouchDesignerServer.create();
38
+ * const transport = await registry.getOrCreate(sessionId, body, serverFactory);
39
+ * ```
40
+ */
41
+ static create(): McpServer;
42
+ /**
43
+ * Connect to MCP transport
44
+ */
45
+ connect(transport: Transport): Promise<Result<void, Error>>;
46
+ /**
47
+ * Disconnect from MCP transport
48
+ */
49
+ disconnect(): Promise<Result<void, Error>>;
50
+ /**
51
+ * Check if connected to MCP transport
52
+ */
53
+ isConnectedToMCP(): boolean;
54
+ /**
55
+ * Register all features with the server
56
+ * Only called after all dependencies are initialized
57
+ */
58
+ private registerAllFeatures;
59
+ }
@@ -0,0 +1,7 @@
1
+ import type { ILogger } from "../core/logger.js";
2
+ import { TouchDesignerClient } from "./touchDesignerClient.js";
3
+ export interface CreateTouchDesignerClientParams {
4
+ logger: ILogger;
5
+ }
6
+ export declare function createTouchDesignerClient(params: CreateTouchDesignerClientParams): TouchDesignerClient;
7
+ export { TouchDesignerClient } from "./touchDesignerClient.js";
@@ -0,0 +1,167 @@
1
+ import type { CallToolResultSchema } from "@modelcontextprotocol/sdk/types.js";
2
+ import type { z } from "zod";
3
+ import type { ILogger } from "../core/logger.js";
4
+ import { createNode as apiCreateNode, deleteNode as apiDeleteNode, execNodeMethod as apiExecNodeMethod, execPythonScript as apiExecPythonScript, getModuleHelp as apiGetModuleHelp, getNodeDetail as apiGetNodeDetail, getNodeErrors as apiGetNodeErrors, getNodes as apiGetNodes, getTdInfo as apiGetTdInfo, getTdPythonClassDetails as apiGetTdPythonClassDetails, getTdPythonClasses as apiGetTdPythonClasses, updateNode as apiUpdateNode, type CreateNodeBody, type DeleteNodeParams, type ExecNodeMethodBody, type ExecPythonScriptBody, type GetModuleHelpParams, type GetNodeDetailParams, type GetNodeErrorsParams, type GetNodesParams, type UpdateNodeBody } from "../gen/endpoints/TouchDesignerAPI.js";
5
+ /**
6
+ * Interface for TouchDesignerClient HTTP operations
7
+ */
8
+ export interface ITouchDesignerApi {
9
+ execNodeMethod: typeof apiExecNodeMethod;
10
+ execPythonScript: typeof apiExecPythonScript;
11
+ getTdInfo: typeof apiGetTdInfo;
12
+ getNodes: typeof apiGetNodes;
13
+ getNodeDetail: typeof apiGetNodeDetail;
14
+ getNodeErrors: typeof apiGetNodeErrors;
15
+ createNode: typeof apiCreateNode;
16
+ updateNode: typeof apiUpdateNode;
17
+ deleteNode: typeof apiDeleteNode;
18
+ getTdPythonClasses: typeof apiGetTdPythonClasses;
19
+ getTdPythonClassDetails: typeof apiGetTdPythonClassDetails;
20
+ getModuleHelp: typeof apiGetModuleHelp;
21
+ }
22
+ export type TdResponse<T> = {
23
+ success: boolean;
24
+ data: T | null;
25
+ error: string | null;
26
+ };
27
+ export type ErrorResult<E = Error> = {
28
+ success: false;
29
+ error: E;
30
+ };
31
+ export type SuccessResult<T> = {
32
+ success: true;
33
+ data: NonNullable<T>;
34
+ };
35
+ export type Result<T, E = Error> = SuccessResult<T> | ErrorResult<E>;
36
+ export declare const ERROR_CACHE_TTL_MS: number;
37
+ export declare const SUCCESS_CACHE_TTL_MS: number;
38
+ export declare class TouchDesignerClient {
39
+ private readonly logger;
40
+ private readonly api;
41
+ private verifiedCompatibilityError;
42
+ private cachedCompatibilityCheck;
43
+ private errorCacheTimestamp;
44
+ private successCacheTimestamp;
45
+ private compatibilityNotice;
46
+ /**
47
+ * Initialize TouchDesigner client with optional dependencies
48
+ */
49
+ constructor(params?: {
50
+ logger?: ILogger;
51
+ httpClient?: ITouchDesignerApi;
52
+ });
53
+ /**
54
+ * Log debug message
55
+ */
56
+ private logDebug;
57
+ /**
58
+ * Check if the cached error should be cleared (TTL expired)
59
+ */
60
+ private shouldClearErrorCache;
61
+ /**
62
+ * Check whether the cached successful compatibility check is still valid
63
+ */
64
+ private hasValidSuccessCache;
65
+ /**
66
+ * Force the next API call to re-run compatibility verification.
67
+ * Useful when the user explicitly requests version information.
68
+ */
69
+ private invalidateCompatibilityCache;
70
+ getAdditionalToolResultContents(): z.infer<typeof CallToolResultSchema>["content"] | null;
71
+ /**
72
+ * Verify compatibility with the TouchDesigner server
73
+ */
74
+ private verifyCompatibility;
75
+ /**
76
+ * Wrapper for API calls that require compatibility verification
77
+ * @private
78
+ */
79
+ private apiCall;
80
+ /**
81
+ * Execute a node method
82
+ */
83
+ execNodeMethod<DATA extends NonNullable<{
84
+ result: unknown;
85
+ }>>(params: ExecNodeMethodBody): Promise<Result<DATA, Error>>;
86
+ /**
87
+ * Execute a script in TouchDesigner
88
+ */
89
+ execPythonScript<DATA extends {
90
+ result: unknown;
91
+ }>(params: ExecPythonScriptBody): Promise<Result<DATA, Error>>;
92
+ /**
93
+ * Get TouchDesigner server information
94
+ */
95
+ getTdInfo(): Promise<Result<{
96
+ mcpApiVersion: string;
97
+ osName: string;
98
+ osVersion: string;
99
+ server: string;
100
+ version: string;
101
+ }, Error>>;
102
+ /**
103
+ * Get list of nodes
104
+ */
105
+ getNodes(params: GetNodesParams): Promise<Result<{
106
+ nodes?: import("../gen/endpoints/TouchDesignerAPI.js").TdNode[];
107
+ }, Error>>;
108
+ /**
109
+ * Get node properties
110
+ */
111
+ getNodeDetail(params: GetNodeDetailParams): Promise<Result<import("../gen/endpoints/TouchDesignerAPI.js").TdNode, Error>>;
112
+ /**
113
+ * Get node error information
114
+ */
115
+ getNodeErrors(params: GetNodeErrorsParams): Promise<Result<import("../gen/endpoints/TouchDesignerAPI.js").TdNodeErrorReport, Error>>;
116
+ /**
117
+ * Create a new node
118
+ */
119
+ createNode(params: CreateNodeBody): Promise<Result<{
120
+ result?: import("../gen/endpoints/TouchDesignerAPI.js").TdNode;
121
+ }, Error>>;
122
+ /**
123
+ * Update node properties
124
+ */
125
+ updateNode(params: UpdateNodeBody): Promise<Result<{
126
+ path?: string;
127
+ updated?: string[];
128
+ failed?: import("../gen/endpoints/TouchDesignerAPI.js").UpdateNode200DataFailedItem[];
129
+ message?: string;
130
+ }, Error>>;
131
+ /**
132
+ * Delete a node
133
+ */
134
+ deleteNode(params: DeleteNodeParams): Promise<Result<{
135
+ deleted?: boolean;
136
+ node?: import("../gen/endpoints/TouchDesignerAPI.js").TdNode;
137
+ }, Error>>;
138
+ /**
139
+ * Get list of available Python classes/modules in TouchDesigner
140
+ */
141
+ getClasses(): Promise<Result<{
142
+ classes?: import("../gen/endpoints/TouchDesignerAPI.js").TdPythonClassInfo[];
143
+ }, Error>>;
144
+ /**
145
+ * Get details of a specific class/module
146
+ */
147
+ getClassDetails(className: string): Promise<Result<import("../gen/endpoints/TouchDesignerAPI.js").TdPythonClassDetails, Error>>;
148
+ /**
149
+ * Retrieve Python help() documentation for modules/classes
150
+ */
151
+ getModuleHelp(params: GetModuleHelpParams): Promise<Result<import("../gen/endpoints/TouchDesignerAPI.js").ModuleHelp, Error>>;
152
+ verifyVersionCompatibility(): Promise<{
153
+ success: false;
154
+ error: Error;
155
+ } | {
156
+ success: true;
157
+ data: {
158
+ level: "info" | "warning";
159
+ message: string;
160
+ };
161
+ }>;
162
+ /**
163
+ * Format connection errors with helpful messages
164
+ */
165
+ private formatConnectionError;
166
+ private checkVersionCompatibility;
167
+ }