createStdioServerTransport
Result<
Create stdio transport with default stdin/stdout.
Returns Success with the transport or Error with message on failure.
Implementation
Result<StdioServerTransport, String> createStdioServerTransport() {
try {
final sdkModule = requireModule(
'@modelcontextprotocol/sdk/server/stdio.js',
);
final transportClass = (sdkModule as JSObject)['StdioServerTransport'];
final jsTransportClass = transportClass as JSFunction;
final transport = jsTransportClass
.callAsConstructor<StdioServerTransport>();
return Success(transport);
} catch (e) {
return Error('Failed to create stdio transport: $e');
}
}