Environment:8beeeaaat Touchdesigner mcp TouchDesigner Runtime
| Knowledge Sources | |
|---|---|
| Domains | Real_Time_Graphics, Node_Graph, Python_Runtime |
| Last Updated | 2026-10-28 22:13 GMT |
Overview
TouchDesigner application (Windows/macOS) with the `mcp_webserver_base.tox` component imported, providing a Python 3.x runtime with the `td` module, WebServer DAT on port 9981, and access to all TouchDesigner Python APIs.
Description
This environment is the live TouchDesigner application instance that hosts the MCP WebServer component. The `mcp_webserver_base.tox` component is imported into a TouchDesigner project, which bootstraps the Python module path (`import_modules.py`), loads the OpenAPI schema, and starts a WebServer DAT listening on port 9981. The Python code runs inside TouchDesigner's embedded CPython interpreter with full access to the `td` module, `op()`, `me`, `parent`, `project`, and all operator type globals (`noiseTOP`, `resolutionTOP`, `ParMode`, `tdu`, `ui`, etc.).
Key characteristics:
- The `td` module is a built-in provided by TouchDesigner — it is not pip-installable and cannot be imported outside the application.
- TouchDesigner's Python defaults to ASCII encoding; the OpenAPI schema is read with explicit `encoding="utf-8"` to avoid crashes on non-ASCII characters.
- The `__main__` module namespace holds TD globals (absTime, OP type names, tdu, ui) which are merged into the script execution namespace so scripts behave identically to Textport/DAT code.
- Module path shadowing: if a same-named package (e.g. PyPI `mcp` or `utils`) is pip-installed into TD's interpreter, it shadows the project's local `modules/mcp` / `modules/utils` packages. `import_modules.setup()` mitigates this by dropping cached `mcp*` / `utils*` modules from `sys.modules` and inserting project paths at the front of `sys.path`.
= Usage
Use this environment for all TD-side API operations: node introspection, node creation, parameter binding, error reporting, Python class/module lookup, remote code execution, and TOP image capture. The Node.js MCP server communicates with this environment via HTTP requests to the WebServer DAT on port 9981.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Windows 10+ or macOS 11+ | TouchDesigner does not run on Linux |
| Software | TouchDesigner 2022.x+ (build 99.2025.x tested) | Non-commercial or Commercial license |
| Hardware | GPU with OpenGL support | TouchDesigner requires a GPU for TOP rendering |
| Network | WebServer DAT on port 9981 | Default port; configurable via `--port` CLI argument on the MCP server side |
Dependencies
System Packages
- TouchDesigner application (installed or portable)
- `mcp_webserver_base.tox` component (imported into the TD project)
Python Packages (TD-embedded interpreter)
- `PyYAML` >= 6.0 (for loading the OpenAPI schema)
- Python >= 3.9 (TouchDesigner's embedded CPython; `pyproject.toml` declares `requires-python = ">=3.9"`)
Node.js Packages (MCP server side, communicates with this environment)
- `@modelcontextprotocol/server` ^2.0.0
- `axios` 1.20.0 (HTTP client to the WebServer DAT)
- `semver` 7.8.5 (API version compatibility checking)
- Node.js >= 22.18.0 (odd-numbered majors not supported)
Credentials
No API keys or tokens required. Communication is over local HTTP (`http://127.0.0.1:9981` by default). The WebServer DAT does not enforce authentication.
Quick Install
# 1. Install TouchDesigner from https://derivative.ca/
# 2. Import the mcp_webserver_base.tox component into your TD project
# 3. The WebServer DAT starts automatically on port 9981
# 4. On the MCP server side:
npm install touchdesigner-mcp-server
npx touchdesigner-mcp-server --host=http://127.0.0.1 --port=9981
Code Evidence
The `td` module is imported directly in the API service — it is only available inside TouchDesigner:
From `td/modules/mcp/services/api_service.py:17`:
import td
Server info reads from the `td.app` global:
From `td/modules/mcp/services/api_service.py:44-56`:
def get_td_info(self) -> Result:
version = td.app.version
build = td.app.build
server_info = {
"server": f"TouchDesigner {version}.{build}",
"version": f"{version}.{build}",
"osName": td.app.osName,
"osVersion": td.app.osVersion,
"mcpApiVersion": get_mcp_api_version(),
}
return success_result(server_info)
Script execution merges TD's `__main__` globals into the namespace:
From `td/modules/mcp/services/api_service.py:492-504`:
# Mirror the Textport/DAT execution environment: TouchDesigner keeps
# all of its globals (absTime, OP type names such as noiseTOP, ParMode,
# tdu, ui, ...) in the __main__ module namespace.
td_globals = {
name: value
for name, value in vars(sys.modules["__main__"]).items()
if not name.startswith("_")
}
namespace = dict(globals())
namespace.update(td_globals)
namespace.update(local_vars)
Module path shadowing mitigation in `td/import_modules.py:22-32`:
shadowed_roots = ("mcp", "utils")
for mod_name in list(sys.modules.keys()):
if mod_name.split(".", 1)[0] in shadowed_roots:
del sys.modules[mod_name]
for path in [td_server_path, modules_path]:
while path in sys.path:
sys.path.remove(path)
sys.path.insert(0, path)
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `ModuleNotFoundError: No module named 'mcp.controllers'` | A same-named PyPI package (e.g. Anthropic MCP SDK) shadows the local `modules/mcp` package | `import_modules.setup()` drops cached `mcp*` modules; ensure the component is re-imported |
| `OpenAPI schema file not found` | The `openapi.yaml` is missing from the `td_server` directory | Re-import `mcp_webserver_base.tox` or run `npm run gen:openapi` to regenerate |
| `Connection refused on port 9981` | WebServer DAT not started or wrong port | Verify the WebServer DAT is running in TouchDesigner; check port configuration |
| `encoding errors when loading schema` | TouchDesigner's Python defaults to ASCII | `import_modules.py` opens the schema with `encoding="utf-8"` explicitly |
| `Version Information Missing` | Old `.tox` file from before v1.3.0 or incorrect TD setup | Update to the latest `mcp_webserver_base.tox` release |
Compatibility Notes
- Windows vs macOS: TouchDesigner runs on both; the MCP server communicates over HTTP so the OS does not matter to the Node.js side.
- Linux: TouchDesigner does not run natively on Linux. Docker deployment (`docker-compose.yml`) runs the Node.js MCP server in a container and connects to a TouchDesigner instance on the host via `host.docker.internal`.
- Python version: TouchDesigner's embedded CPython varies by TD build; `pyproject.toml` targets `py39` for Ruff linting.
- Module shadowing: If the Anthropic MCP SDK (`pip install mcp`) is installed in TD's interpreter, it shadows the project's `modules/mcp` package. `import_modules.setup()` mitigates this but it must run before any `import mcp` statement.
Related Pages
- Implementation:8beeeaaat_Touchdesigner_mcp_get_node_errors
- Implementation:8beeeaaat_Touchdesigner_mcp_get_node_detail
- Implementation:8beeeaaat_Touchdesigner_mcp_get_nodes
- Implementation:8beeeaaat_Touchdesigner_mcp_exec_node_method
- Implementation:8beeeaaat_Touchdesigner_mcp_exec_python_script
- Implementation:8beeeaaat_Touchdesigner_mcp_create_node
- Implementation:8beeeaaat_Touchdesigner_mcp_update_node
- Implementation:8beeeaaat_Touchdesigner_mcp_get_td_python_classes
- Implementation:8beeeaaat_Touchdesigner_mcp_get_td_python_class_details
- Implementation:8beeeaaat_Touchdesigner_mcp_get_module_help
- Implementation:8beeeaaat_Touchdesigner_mcp_buildGetTopImageScript
- Implementation:8beeeaaat_Touchdesigner_mcp_TouchDesignerClient
- Implementation:8beeeaaat_Touchdesigner_mcp_APIControllerOpenAPI
- Implementation:8beeeaaat_Touchdesigner_mcp_Safe_Serialize