Implementation:8beeeaaat Touchdesigner mcp CLI Entry
| Knowledge Sources | |
|---|---|
| Domains | CLI, Transport_Selection |
| Last Updated | 2026-10-28 00:00 GMT |
Overview
Concrete tool for parsing command-line arguments and bootstrapping the TouchDesigner MCP server in either stdio or Streamable HTTP transport mode.
Description
The CLI entry module (src/cli.ts) is the user-facing entry point of the npm package. It exports parseArgs (TouchDesigner host/port), parseTransportConfig (stdio vs HTTP via `--mcp-http-port`), and startServer, which wires the chosen transport to a TouchDesignerServer factory. Argument parsing is deliberately strict: ports must be all decimal digits in range 1-65535, flag values preserve everything after the first `=`, and unrecognized flags emit a warning rather than being silently dropped. Both transports serve protocol revision 2026-07-28 with 2025-era fallback handled by the SDK.
Usage
Run the packaged CLI directly. Default mode is stdio; pass `--mcp-http-port` to switch to HTTP.
Code Reference
Source Location
- Repository: 8beeeaaat_Touchdesigner_mcp
- File: src/cli.ts
- Lines: 1-257
Signature
export function parseArgs(args?: string[]): { host: string; port: number };
export function parseTransportConfig(args?: string[]): TransportConfig;
export async function startServer(params?: {
nodeEnv?: string;
argv?: string[];
}): Promise<void>;
Import
import { startServer, parseArgs, parseTransportConfig } from "./cli.js";
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| argv | string[] | No | CLI args (defaults to process.argv) |
| --host= | string | No | TD WebServer base URL (default http://127.0.0.1) |
| --port= | number | No | TD WebServer port (default 9981) |
| --mcp-http-port= | number | No | Enables HTTP mode on this port |
| --mcp-http-host= | string | No | HTTP bind host (default 127.0.0.1) |
Outputs
| Name | Type | Description |
|---|---|---|
| side effect | running server | stdio via serveStdio or HTTP via ExpressHttpManager |
| process.env | TD_WEB_SERVER_HOST/PORT | Set from parsed args |
Usage Examples
Stdio mode (default)
# Run the MCP server over stdio (default), TD on localhost:9981
node dist/cli.js --host=http://localhost --port=9981
HTTP mode
# Serve MCP over Streamable HTTP on 127.0.0.1:6280
node dist/cli.js --mcp-http-port=6280 --host=http://localhost --port=9981
Programmatic startup
import { startServer } from "./cli.js";
await startServer({
argv: ["--mcp-http-port=6280", "--host=http://localhost", "--port=9981"],
});