Skip to content

MCP Server

  • MCP Config integration with centralized server management
  • Load/Save server UI with Current Server dropdown
  • Auto-start functionality for configuration loading
  • Connection settings persistence and port management
  • Built-in server protection preventing disk saves
  • Improved dependency detection with importlib.metadata
  • Surgical venv path insertion resolving sys.path conflicts

The MCP Server LOP acts as a server that exposes Python functions from a DAT as “tools” that can be called by AI agents and other external applications using the Model Context Protocol (MCP). This allows you to create custom, remotely-callable APIs directly within your TouchDesigner project.

It leverages the fastmcp library to handle the server logic, simplifying the process of creating MCP-compatible tools. It can communicate over stdio or streamable-http, making your TouchDesigner functions accessible to a wide range of MCP clients.

  • Python Packages:
    • fastmcp: The core library for the MCP server.
    • aiohttp: Required for the streamable-http transport mode.
  • ChatTD Operator: Required for dependency management (installing packages) and asynchronous operations.
Status (Status) op('mcp_server').par.Status
Default:
"" (Empty String)
Start Server (Startserver) op('mcp_server').par.Startserver
Default:
None
Stop Server (Stopserver) op('mcp_server').par.Stopserver
Default:
None
Restart Server (Restartserver) op('mcp_server').par.Restartserver
Default:
None
Running (Running) op('mcp_server').par.Running
Default:
false
Transport (Transport) op('mcp_server').par.Transport
Default:
streamable-http
Host (Host) op('mcp_server').par.Host
Default:
0.0.0.0
Port (Port) op('mcp_server').par.Port
Default:
18555
Server Code DAT (Serverdat) op('mcp_server').par.Serverdat
Default:
None
Edit (open external) (Editserverdat) op('mcp_server').par.Editserverdat
Default:
None
View (View) op('mcp_server').par.View
Default:
docked
Copy Config (Copyconfig) op('mcp_server').par.Copyconfig
Default:
None
Current Server (Currentserver) op('mcp_server').par.Currentserver
Default:
Basic
Load Server (Loadserver) op('mcp_server').par.Loadserver
Default:
None
Auto Start on Load (Autostart) op('mcp_server').par.Autostart
Default:
True
Save Server (Saveserver) op('mcp_server').par.Saveserver
Default:
None
Status (Status2) op('mcp_server').par.Status2
Default:
"" (Empty String)
Install Dependencies (Installdeps) op('mcp_server').par.Installdeps
Default:
None
Check Dependencies (Checkdeps) op('mcp_server').par.Checkdeps
Default:
None
Bypass (Bypass) op('mcp_server').par.Bypass
Default:
false
Show Built-in Parameters (Showbuiltin) op('mcp_server').par.Showbuiltin
Default:
false
Version (Version) op('mcp_server').par.Version
Default:
"" (Empty String)
Last Updated (Lastupdated) op('mcp_server').par.Lastupdated
Default:
"" (Empty String)
Creator (Creator) op('mcp_server').par.Creator
Default:
"" (Empty String)
Website (Website) op('mcp_server').par.Website
Default:
"" (Empty String)
ChatTD Operator (Chattd) op('mcp_server').par.Chattd
Default:
None
  1. Create an mcp_server operator.
  2. On the Install / Debug page, pulse the Install Dependencies parameter to install fastmcp and aiohttp.
  3. On the MCP Server page, pulse the Start Server parameter.
  4. The Status parameter should change to indicate that the server is running.
  1. On the MCP Server page, pulse the Edit (open external) parameter to open the server_code DAT.
  2. In the server_code DAT, define a Python function that will be your tool.
  3. Use the @mcp.tool() decorator to expose the function as a tool.
  4. Restart the server by pulsing the Restart Server parameter.
from fastmcp import Mcp, Tool, tool
mcp = Mcp()
@mcp.tool()
def get_operator_info(name: str) -> str:
"""Get information about a TouchDesigner operator."""
op = op(name)
if op:
return f"Operator {name} is a {op.OPType} at {op.path}"
else:
return f"Operator {name} not found"
  1. Create an agent operator.
  2. On the Tools page of the agent, enable Use LOP Tools.
  3. Connect the mcp_server operator to the External Op Tools parameter on the agent.
  4. Start a conversation with the agent and ask it to use the tool you created (e.g., “Get information about the operator /project1/noise1”).