Implementation:8beeeaaat Touchdesigner mcp TouchDesignerServer
| Knowledge Sources | |
|---|---|
| Domains | MCP_Server, Dependency_Injection |
| Last Updated | 2026-10-28 00:00 GMT |
Overview
Concrete tool for creating MCP server instances that register all TouchDesigner tools and prompts with a dependency-injected client and logger.
Description
The TouchDesignerServer class wraps the SDK v2 McpServer with TouchDesigner-specific feature registration. Its constructor creates an McpServer with the "TouchDesigner" name and version, a ConsoleLogger, a TouchDesignerClient (injectable), and a ConnectionManager. It then calls registerAllFeatures which registers all MCP prompts and tools against the server. The static create factory returns the inner McpServer instance ready for connection to a transport — used per-request in HTTP mode and per-connection in stdio mode.
Usage
Use TouchDesignerServer.create() as the server factory passed to serveStdio or ExpressHttpManager. Inject a custom tdClient when you need to share a single client across requests (HTTP mode).
Code Reference
Source Location
- Repository: 8beeeaaat_Touchdesigner_mcp
- File: src/server/touchDesignerServer.ts
- Lines: 1-112
Signature
export class TouchDesignerServer {
readonly server: McpServer;
readonly logger: ILogger;
readonly tdClient: TouchDesignerClient;
constructor(params?: TouchDesignerServerParams);
static create(params?: TouchDesignerServerParams): McpServer;
async connect(transport: Transport): Promise<Result<void, Error>>;
async disconnect(): Promise<Result<void, Error>>;
isConnectedToMCP(): boolean;
}
Import
import { TouchDesignerServer } from "./server/touchDesignerServer.js";
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| tdClient | TouchDesignerClient | No | Injected client (defaults to createTouchDesignerClient) |
Outputs
| Name | Type | Description |
|---|---|---|
| server | McpServer | SDK server with tools+prompts registered |
| connect() | Result<void, Error> | Connects to a Transport via ConnectionManager |
Usage Examples
Stdio mode factory
import { serveStdio } from "@modelcontextprotocol/server/stdio";
import { TouchDesignerServer } from "./server/touchDesignerServer.js";
// Each connection gets a fresh server instance.
serveStdio(() => TouchDesignerServer.create());
import { TouchDesignerServer } from "./server/touchDesignerServer.js";
import { createTouchDesignerClient } from "./tdClient/index.js";
import { ConsoleLogger } from "./core/logger.js";
const logger = new ConsoleLogger();
const tdClient = createTouchDesignerClient({ logger });
// Reuse one tdClient (with cached compatibility) across requests.
const factory = () => TouchDesignerServer.create({ tdClient });