UNPKG

@uplinq/mcp-vitest

Version:

MCP server for Vitest with watch-mode support for fast test feedback

39 lines 1.39 kB
/** * Detects and configures the appropriate transport based on environment variables * @returns TransportConfig with the detected transport type and configuration */ export async function detectTransport() { // Check environment variables for transport configuration const transport = process.env.VITEST_MCP_TRANSPORT; const port = parseInt(process.env.VITEST_MCP_PORT || '8080'); if (transport === 'sse') { return { transportType: 'sse', sse: { port, endpoint: '/sse' } }; } if (transport === 'httpStream') { return { transportType: 'httpStream', httpStream: { port, endpoint: '/stream' } }; } // Default to stdio for MCP clients like Claude Desktop return { transportType: 'stdio' }; } /** * Gets the transport type as a string for logging purposes */ export function getTransportDescription(config) { switch (config.transportType) { case 'sse': return `SSE on port ${config.sse?.port || 8080}${config.sse?.endpoint || '/sse'}`; case 'httpStream': return `HTTP Stream on port ${config.httpStream?.port || 8080}${config.httpStream?.endpoint || '/stream'}`; case 'stdio': return 'Standard I/O'; default: return 'Unknown transport'; } } //# sourceMappingURL=transport-detector.js.map