ioMcpTransportFactory function
The process-capable McpTransportFactory for CLI/desktop hosts: spawns
command args... in the workspace root. Remote (HTTP) servers are pure
Dart and never come through here — the manager routes them itself.
Implementation
Future<McpTransport> ioMcpTransportFactory(
McpServerConfig server,
String cwd,
) async {
if (server is! McpStdioServerConfig) {
throw McpServerUnavailableException(
'ioMcpTransportFactory only spawns stdio servers, got ${server.name}',
);
}
final channel = await IoMcpByteChannel.spawn(
command: server.command,
args: server.args,
env: server.env,
cwd: cwd,
);
return McpStdioTransport(channel);
}