MCP Apps Kit - v0.5.0
    Preparing search index...

    Function createClient

    • Create a unified client for UI code

      Automatically detects the host platform (MCP Apps vs ChatGPT) and returns a client with the appropriate adapter.

      Type Parameters

      • T extends ToolDefs = ToolDefs

      Parameters

      Returns Promise<AppsClient<T>>

      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>();