import type { H3Event } from "h3"; import { createMCPServerForRequest, verifyAuth, getAccessTokens, resolveOrgIdFromDomain, buildLinkArtifacts, type MCPConfig, type MCPCallerIdentity, type MCPRequestMeta } from "./build-server.js"; export { createMCPServerForRequest, verifyAuth, getAccessTokens, resolveOrgIdFromDomain, buildLinkArtifacts, }; export type { MCPConfig, MCPCallerIdentity, MCPRequestMeta }; /** * Handle a single `{routePrefix}/mcp` request on either runtime. * * - **Default path:** build the SAME MCP `Server` * from the SAME config + identity, drive it through the SDK's * `WebStandardStreamableHTTPServerTransport` (which the Node transport is * itself just a thin wrapper around), and return the resulting Web * `Response` as a normal h3 return value. This is used for Nitro local dev * too; the direct Node writer can otherwise race h3 and double-write. * - **Opt-in Node fast-path:** set `AGENT_NATIVE_MCP_NODE_FAST_PATH=1` to * delegate directly to the SDK's `StreamableHTTPServerTransport`. * * Auth, the `runWithRequestContext` identity wrap, the deep-link `_meta` / * markdown append, `requestMeta` origin/target derivation and the stateless * semantics are IDENTICAL on both paths because both build the same server * via `createMCPServerForRequest` and both transports funnel into the same * `WebStandardStreamableHTTPServerTransport.handleRequest(webRequest, { * parsedBody })` with the same options. * * Returns: * - `undefined` when the request targets a sub-route (so management/status * routes mounted under `/_agent-native/mcp/*` handle it themselves) — the * h3 mount falls through to the next handler. * - a Web `Response` (web fallback) or a string/object (Node path / * auth-error path) otherwise. The Node path also sets `_handled` so h3 * doesn't double-write. */ export declare function handleMcpRequest(event: H3Event, config: MCPConfig): Promise | undefined>; /** * Mount an MCP remote server on an H3/Nitro app. * * Endpoints: `/mcp` (public) and `/_agent-native/mcp` (compatibility). * A custom route prefix only mounts that custom endpoint. * * Uses stateless Streamable HTTP transport — no in-memory sessions, JSON * request/response (no SSE), and no standalone GET stream, so it survives * serverless instances that freeze between invocations (SSE framing there * drops the result and clients report "session expired"). Runtime-agnostic: a real Node * server uses the SDK's Node transport; the web-standard runtime (Nitro 3 / * Netlify web runtime, Cloudflare, Deno, Bun) uses the SDK's web-standard * transport. Both build the same server and produce identical JSON-RPC * output. * * Auth: Bearer token matching ACCESS_TOKEN/ACCESS_TOKENS or JWT via A2A_SECRET. * No auth required when neither is configured (dev mode). */ export declare function mountMCP(nitroApp: any, config: MCPConfig, routePrefix?: string): void; //# sourceMappingURL=server.d.ts.map