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

    Function createTypedClient

    • Create a typed client from an App instance.

      Convenience function that automatically extracts client types from your App instance, eliminating manual type exports.

      Type Parameters

      • T extends ToolDefs

      Parameters

      • _app: { clientTypes: T }
      • Optionaloptions: CreateClientOptions

        Optional client configuration (forceAdapter, autoResize)

      Returns Promise<AppsClient<T>>

      Fully typed AppsClient

      // server.ts
      import { createApp, defineTool } from "@mcp-apps-kit/core";
      const app = createApp({
      tools: { greet: defineTool({ ... }) }
      });
      export { app };

      // ui.tsx
      import { createTypedClient } from "@mcp-apps-kit/ui";
      import { app } from "./server";
      const client = await createTypedClient(app);
      client.tools.callGreet({ name: "Alice" }); // Fully typed!
      // server.ts
      const app = createApp({
      versions: {
      v1: { version: "1.0.0", tools: { ... } },
      v2: { version: "2.0.0", tools: { ... } }
      }
      });
      export const v1 = app.getVersion("v1")!;
      export const v2 = app.getVersion("v2")!;

      // ui.tsx
      const client = await createTypedClient(v1);