touchdesigner-mcp
CLAUDE.md563 starsChanged 2 months agoMITView on GitHub
HTTP Mode Configuration: - Default port: 3000 - Default host: 127.0.0.1 - Endpoint: /mcp - Health check: GET /health The project uses multiple formatters and linters for different languages: All languages: TypeScript/JavaScript (Biome): Python (Ruff): YAML (Prettier): Communication flows: AI Agent ↔ Node.js MCP Server ↔ HTTP API ↔ Python WebServer (in TouchDesigner)
- Reads credentials
In this repository5 other files it gives its agents.
- AGENTS.mdAGENTS.md
- integration-test-guardSkill
- prepare-releaseSkill
- release-test-auditSkill
- touchdesigner-self-debugSkill
The file
We split this CLAUDE.md into the rules it gives an agent
6 rules. About 0 are common, 1 is distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 115
All generation must run after schema changes
- Very specific: line 119
Default TouchDesigner WebServer runs on localhost:9981
- Very specific: line 125
Setting up TouchDesigner: Import td/mcp_webserver_base.tox into your TD project
- Very specific: line 127
API changes: Update src/api/index.yml then run npm run gen to regenerate all code
- Very specific: line 128
Building: Run npm run build for full build or make build for Docker-based build
- Very specific: line 129
Testing: Always run npm test before committing changes
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Development Commands
Building and Development
npm run build- Full build process including code generation and TypeScript compilation (recommended for development)npm run dev- Start MCP inspector for debugging (@modelcontextprotocol/inspector)make build- Docker-based build that copies bothdist/andtd/modules/from container (for CI/CD)npm run build:mcpb- Build MCP Bundle package for distributionmake clean- Remove all generated files (dist,td/modules,node_modules)
Code Generation Workflow
The project uses OpenAPI 3.0.0 schema-based code generation with a three-step process:
npm run gen:openapi- Bundle OpenAPI schema files into single YAML using@redocly/clinpm run gen:handlers- Generate Python handlers using custom Node.js script with Mustache templatesnpm run gen:mcp- Generate TypeScript client code and Zod schemas using Orval v8npm run gen- Run all generation steps in sequence
Testing and Quality
npm test- Run all tests (e2e, integration, unit, and TouchDesigner-side Python)npm run test:e2e- E2E tests: buildsdist/and drives the builtdist/cli.jswith the real MCP SDK v2 client over stdio and Streamable HTTP (both protocol eras; no TouchDesigner required)npm run test:integration- Integration tests with TouchDesigner WebServernpm run test:unit- Unit tests for MCP server componentsnpm run test:python- TouchDesigner-side Python tests against a stubbedtdmodule (no TouchDesigner needed; requires Python 3.9+ with pytest, oruv)npm run ci:test:integration- The integration suites that need no live TouchDesignernpm run coverage- Generate test coverage report
HTTP Transport Mode
npm run http- Build and start the MCP server in HTTP mode (port 6280, TD on 9981)npm run test:integration- Includes the HTTP transport suite (tests/integration/httpTransport.test.ts)
HTTP Mode Configuration:
- Default port:
3000 - Default host:
127.0.0.1 - Endpoint:
/mcp - Health check:
GET /health
Linting and Formatting
The project uses multiple formatters and linters for different languages:
All languages:
npm run lint- Run all linters (Biome, TypeScript, Ruff, Prettier)npm run format- Auto-fix formatting for all languages
TypeScript/JavaScript (Biome):
npm run lint:biome- Lint TypeScript/JavaScript filesnpm run format:biome- Format and fix TypeScript/JavaScript files- Sorts imports and object keys automatically via Biome Assist
Python (Ruff):
npm run lint:python- Lint Python files intd/directorynpm run format:python- Format and fix Python files (includes import sorting)- Configuration in
pyproject.toml - Note: Only
td/modules/td_server/openapi_server/openapi/openapi.yamlis auto-generated
YAML (Prettier):
npm run lint:yaml- Check YAML file formattingnpm run format:yaml- Format YAML files (uses Prettier)- Configuration in
.prettierrc.json
Important:
- Python (Ruff) must be installed separately via pip/pipx/uv for formatting to work
Architecture Overview
Dual-Process Architecture
This MCP server operates as a bridge between AI agents and TouchDesigner through a dual-process architecture:
- Node.js MCP Server (
src/) - Implements MCP protocol, handles AI agent communication - Python WebServer (
td/modules/) - Runs inside TouchDesigner via WebServer DAT, controls TD directly
Communication flows: AI Agent ↔ Node.js MCP Server ↔ HTTP API ↔ Python WebServer (in TouchDesigner)
Key Components
MCP Server (Node.js)
TouchDesignerServerclass insrc/server/touchDesignerServer.ts- Main MCP server implementationTouchDesignerClientinsrc/tdClient/- HTTP client for communicating with TD WebServer- Tool definitions in
src/features/tools/toolDefinitions.ts-TOOL_DEFINITIONSis the single source of truth for each MCP tool (name, description, input schema, handler).handlers/tdTools.tsregisters them in a loop, and thedescribe_td_toolsmanifest derives its parameter metadata from each tool's Zod schema via introspection - Code generation outputs in
src/gen/- Auto-generated API client and Zod schemas
TouchDesigner Integration (Python)
mcp_webserver_base.tox- Main TouchDesigner component to importapi_controller.py- Routes HTTP requests using OpenAPI schemaapi_service.py- Business logic for TouchDesigner operationsgenerated_handlers.py- Auto-generated handler stubs (connects controller to service)
Transport Architecture
Both transports serve MCP protocol revision 2026-07-28 and transparently fall back to the 2025-era protocol for older clients, from the same server factory (TouchDesignerServer.create()):
- stdio –
serveStdio(factory)from@modelcontextprotocol/server/stdio, wired insrc/cli.ts; the opening exchange selects the protocol era per connection src/transport/expressHttpManager.ts– MountscreateMcpHandler(factory)(stateless per-request serving for both eras) on the SDK Express app (createMcpExpressApp, DNS-rebinding protection) viatoNodeHandler, wiring/mcpand/health, plus graceful shutdownsrc/transport/config.ts– Type definitions and Zod validators forTransportConfig
Protocol-level sessions were removed by spec revision 2026-07-28: there is no Mcp-Session-Id header, and GET/DELETE /mcp answer 405. The MCP logging capability is no longer declared (deprecated by SEP-2577); logs go to stderr via ConsoleLogger.
Design references: .doc/streamable-http-implementation-plan.md and .doc/refactor_sdk_first.md cover the SDK-first approach and HTTP rollout plan.
Code Generation System
The project uses OpenAPI 3.0.0 schema (src/api/index.yml) for maintaining consistency:
- OpenAPI schema bundled via
@redocly/clitotd/modules/td_server/openapi_server/openapi/openapi.yaml - TypeScript API client and Zod schemas generated via Orval v8
- Python handler stubs generated using Mustache templates
- All generation must run after schema changes
Environment Configuration
- Server accepts
--hostand--portCLI arguments instead of using .env files - Default TouchDesigner WebServer runs on
localhost:9981 - CLI arguments:
--host=http://localhost --port=9981 - Environment variables are set programmatically from CLI arguments at runtime
Development Workflow
- Setting up TouchDesigner: Import
td/mcp_webserver_base.toxinto your TD project - Code changes: Modify source files in
src/or TouchDesigner modules intd/modules/ - API changes: Update
src/api/index.ymlthen runnpm run gento regenerate all code - Building: Run
npm run buildfor full build ormake buildfor Docker-based build - Testing: Always run
npm testbefore committing changes
TouchDesigner-Specific Patterns
Node Operations
- Node paths use TouchDesigner's
/project1/container/nodeformat - Family types include
COMP,TOP,SOP,CHOP,DAT,MAT - Parameter updates use TouchDesigner's parameter system via Python API
Python Execution
- Scripts execute in TouchDesigner's Python environment via
execute_python_scripttool - Access to
tdmodule,me,op(), and all TouchDesigner Python APIs - Results serialized as JSON for transmission back to MCP client
Error Handling
- Uses Result pattern for error propagation between Node.js and Python layers
- TouchDesigner errors captured and formatted for MCP protocol
- Logging available in both TouchDesigner Textport and MCP client
Current Development Tasks
Recent Update: MCP protocol revision 2026-07-28
- Migrated from
@modelcontextprotocol/sdk1.x to the SDK v2 packages (@modelcontextprotocol/server/node/express/core2.0.0) - Both transports serve protocol revision 2026-07-28 with transparent 2025-era fallback (
serveStdio/createMcpHandler) - Streamable HTTP is stateless:
TransportFactory/TransportRegistry/SessionManagerwere deleted - Tools use
registerTool, prompts useregisterPrompt(Zod schemas); the deprecated MCPloggingcapability was dropped (stderr logging instead) - Node.js 22.18+, 24.x, or 26+ required (odd-numbered releases are not supported by the toolchain)
Previous Update: Generation pipeline simplification
- Replaced
@openapitools/openapi-generator-cli(Java-based python-flask generator) with@redocly/clibundle — only the bundledopenapi.yamlwas ever consumed downstream gen:webserverscript renamed togen:openapi; Java runtime removed from Dockerfiletd/modules/td_server/now contains onlyopenapi_server/openapi/openapi.yaml(the Flask skeleton, models, and CI artifacts were dead code)- Removed stale
src/gen/models/(old Orval output), unusedmswdependency, andpublic/mockServiceWorker.js - Generated type names follow source schema names (e.g.
CreateNode200Data,CreateNodeBody) instead of generator-normalized names (CreateNode200ResponseData,CreateNodeRequest)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

