Optionaloptions: CreateClientOptionsOptional configuration
Connected client instance
// Auto-detect platform
const client = await createClient();
// Force a specific adapter (for testing)
const mockClient = await createClient({ forceAdapter: "mock" });
// Disable auto-resize for MCP adapter
const client = await createClient({ autoResize: false });
// With typed tools
import type { app } from "./server";
const typedClient = await createClient<typeof app.tools>();
Create a unified client for UI code
Automatically detects the host platform (MCP Apps vs ChatGPT) and returns a client with the appropriate adapter.