UNPKG

@tanstack/ai-mcp

Version:

Host-side Model Context Protocol client for TanStack AI: discover and run MCP server tools, resources, and prompts in any adapter's chat() loop, with generated end-to-end types.

26 lines (25 loc) • 823 B
import { MCPEventWebhookOptions } from './types.js'; /** * Framework-agnostic MCP Events webhook receiver. * * Pass a Web `Request`. It verifies the Standard Webhooks signature on the * raw body, then calls `onEvent` / `onGap` / `onTerminated`. * * @experimental * * @example * ```ts * import { createMCPEventWebhook, inMemoryMCPEventStore } from '@tanstack/ai-mcp/events' * * const store = inMemoryMCPEventStore() * const webhook = createMCPEventWebhook({ * store, * onEvent: async ({ event }) => { * await queue.send({ eventId: event.eventId, data: event.data }) * }, * }) * * export const POST = async ({ request }: { request: Request }) => webhook(request) * ``` */ export declare function createMCPEventWebhook(options: MCPEventWebhookOptions): (request: Request) => Promise<Response>;