TouchDesigner MCP Server

1.4.7 · active · verified Tue Apr 21

The `touchdesigner-mcp-server` package provides an implementation of a Model Context Protocol (MCP) server designed to enable AI agents to control and operate TouchDesigner projects programmatically. Functioning as a bridge between AI models and the TouchDesigner WebServer DAT, it allows agents to create, modify, and delete nodes, query project structures, and execute Python scripts within TouchDesigner. The current stable version is 1.4.7, with frequent minor releases as indicated by the recent version history. Key differentiators include its focus on AI agent integration via MCP, semantic versioning for compatibility with the TouchDesigner API server, and a comprehensive set of tools for granular control over TouchDesigner's visual programming environment, making it a powerful tool for generative art, interactive installations, and automated content creation. It ships with TypeScript types, facilitating robust development.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to programmatically start the `touchdesigner-mcp-server` as a Node.js process, configuring its port and the target TouchDesigner WebServer DAT connection details. It includes basic error handling and graceful shutdown.

import { startMCPServer } from 'touchdesigner-mcp-server';
import type { MCPServerOptions } from 'touchdesigner-mcp-server';

const serverOptions: MCPServerOptions = {
  port: process.env.MCP_SERVER_PORT ? parseInt(process.env.MCP_SERVER_PORT) : 8080,
  tdWebServerHost: process.env.TD_WEB_SERVER_HOST ?? '127.0.0.1',
  tdWebServerPort: process.env.TD_WEB_SERVER_PORT ? parseInt(process.env.TD_WEB_SERVER_PORT) : 9981,
  logLevel: process.env.NODE_ENV === 'production' ? 'info' : 'debug',
  // Add any other necessary configuration as per your environment
};

async function main() {
  try {
    console.log('Starting TouchDesigner MCP Server...');
    const server = await startMCPServer(serverOptions);
    console.log(`MCP Server running on port ${server.port}, connected to TouchDesigner at ${server.tdWebServerHost}:${server.tdWebServerPort}`);

    // Keep the server running
    process.on('SIGINT', () => {
      console.log('Shutting down MCP Server...');
      server.close();
      process.exit(0);
    });
    process.on('SIGTERM', () => {
      console.log('Shutting down MCP Server...');
      server.close();
      process.exit(0);
    });

  } catch (error) {
    console.error('Failed to start MCP Server:', error);
    process.exit(1);
  }
}

main();

view raw JSON →