touchdesigner-mcp-server
Version:
MCP server for TouchDesigner
97 lines (96 loc) • 2.8 kB
TypeScript
import { z } from "zod";
/**
* Transport types supported by the MCP server
*/
export type TransportType = "stdio" | "streamable-http";
/**
* Session configuration for Streamable HTTP transport
*/
export interface SessionConfig {
/**
* Enable session management (default: true)
*/
enabled: boolean;
/**
* Session TTL in milliseconds (default: 1 hour)
*/
ttl?: number;
/**
* Interval for session cleanup in milliseconds (default: 5 minutes)
*/
cleanupInterval?: number;
}
/**
* Configuration for stdio transport
*/
export interface StdioTransportConfig {
type: "stdio";
}
/**
* Configuration for Streamable HTTP transport
*/
export interface StreamableHttpTransportConfig {
type: "streamable-http";
/**
* Port to bind the HTTP server to
*/
port: number;
/**
* Host address to bind the HTTP server to (default: '127.0.0.1')
*/
host: string;
/**
* MCP endpoint path (default: '/mcp')
*/
endpoint: string;
/**
* Session management configuration
*/
sessionConfig?: SessionConfig;
/**
* Retry interval in milliseconds for SSE polling behavior (optional)
* When set, the server will send a retry field in SSE priming events
*/
retryInterval?: number;
}
/**
* Union type for all transport configurations
*/
export type TransportConfig = StdioTransportConfig | StreamableHttpTransportConfig;
/**
* Zod schema for TransportConfig validation (discriminated union)
*/
export declare const TransportConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
type: z.ZodLiteral<"stdio">;
}, z.core.$strict>, z.ZodObject<{
endpoint: z.ZodString;
host: z.ZodString;
port: z.ZodNumber;
retryInterval: z.ZodOptional<z.ZodNumber>;
sessionConfig: z.ZodOptional<z.ZodObject<{
cleanupInterval: z.ZodOptional<z.ZodNumber>;
enabled: z.ZodBoolean;
ttl: z.ZodOptional<z.ZodNumber>;
}, z.core.$strict>>;
type: z.ZodLiteral<"streamable-http">;
}, z.core.$strict>], "type">;
/**
* Type guard to check if config is StdioTransportConfig
*/
export declare function isStdioTransportConfig(config: TransportConfig): config is StdioTransportConfig;
/**
* Type guard to check if config is StreamableHttpTransportConfig
*/
export declare function isStreamableHttpTransportConfig(config: TransportConfig): config is StreamableHttpTransportConfig;
/**
* Default values for SessionConfig
*/
export declare const DEFAULT_SESSION_CONFIG: Required<SessionConfig>;
/**
* Default values for StreamableHttpTransportConfig (excluding required fields)
*/
export declare const DEFAULT_HTTP_CONFIG: {
readonly endpoint: "/mcp";
readonly host: "127.0.0.1";
readonly sessionConfig: Required<SessionConfig>;
};