// Check what MCP transports the agent supports
NegotiatedCapabilities agentCaps = client.getAgentCapabilities();
System.out.println("HTTP: " + agentCaps.supportsMcpHttp());
System.out.println("SSE: " + agentCaps.supportsMcpSse());
// Session with STDIO MCP server
var session1 = client.newSession(new NewSessionRequest(cwd, List.of(
new McpServerStdio(
"filesystem",
"npx",
List.of("-y", "@modelcontextprotocol/server-filesystem", "/tmp"),
List.of())
)));
// Session with multiple server types
var session2 = client.newSession(new NewSessionRequest(cwd, List.of(
new McpServerStdio("git", "npx",
List.of("-y", "@modelcontextprotocol/server-git"), List.of()),
new McpServerHttp("weather-api",
"https://api.weather.example.com/mcp", List.of()),
new McpServerSse("live-data",
"https://stream.example.com/mcp/events", List.of())
)));