touchdesigner-mcp-server
Version:
MCP server for TouchDesigner
37 lines (36 loc) • 1.64 kB
JavaScript
import { createRequire } from "node:module";
const requirePackage = createRequire(import.meta.url);
const packageJson = requirePackage("../../package.json");
/**
* Current MCP server version
*/
export const getMcpServerVersion = () => packageJson.version ?? "0.0.0";
export const MCP_SERVER_VERSION = getMcpServerVersion();
/**
* Minimum compatible TouchDesigner API Server version required by the MCP server
*
* Loaded from package.json's mcpCompatibility.minApiVersion field.
* Falls back to the current package version if undefined.
*
* API Server components below this version are rejected with an error.
*
* Update when:
* - Introducing breaking API changes
* - Making incompatible changes to OpenAPI schema
*/
export const getMinCompatibleApiVersion = () => packageJson.mcpCompatibility?.minApiVersion ?? MCP_SERVER_VERSION;
export const MIN_COMPATIBLE_API_VERSION = getMinCompatibleApiVersion();
/**
* TouchDesigner API Server version this MCP server release ships with
*
* Loaded from package.json's mcpCompatibility.expectedApiVersion field
* (kept in sync with the API version axis by scripts/syncApiServerVersions.ts).
* Falls back to the minimum compatible version if undefined.
*
* The compatibility check compares the connected component against THIS value,
* not against the npm package version — the two version axes are independent,
* so a package major bump alone must never invalidate deployed components.
*/
export const getExpectedApiVersion = () => packageJson.mcpCompatibility?.expectedApiVersion ??
getMinCompatibleApiVersion();
export const EXPECTED_API_VERSION = getExpectedApiVersion();