interface NextHeader { key: string; value: string; } interface NextHeaderRule { source: string; headers: NextHeader[]; } type TurbopackAliasTarget = string | string[] | Record; interface TurbopackConfig { /** Preserve arbitrary Turbopack settings supplied by the application. */ [key: string]: unknown; /** Module aliases augmented for the server runtime. */ resolveAlias?: Record; } /** Minimal structural Next.js config type, avoiding a runtime Next dependency. */ export interface NextConfigLike { /** Preserve arbitrary Next.js settings while augmenting the fields we use. */ [key: string]: unknown; /** Next.js response-header callback augmented with MCP CORS headers. */ headers?: () => NextHeaderRule[] | Promise; /** Next.js output tracing globs augmented with compiled MCP view assets. */ outputFileTracingIncludes?: Record; /** Turbopack configuration augmented with mcp-use runtime aliases. */ turbopack?: TurbopackConfig; } /** Options for {@link withMcpUse}. */ export interface WithMcpUseOptions { /** * Authored MCP server entry, relative to `projectRoot`. * * @defaultValue Conventional discovery in `mcpDir`, or in `projectRoot` * when `mcpDir` is omitted: `src/index.ts`, `src/index.tsx`, * `src/server.ts`, `src/server.tsx`, `index.ts`, `index.tsx`, `server.ts`, * `server.tsx` — first hit wins. */ entry?: string; /** * Conventional MCP source directory containing the entry and `views/`. * * @defaultValue None: the entry is discovered in `projectRoot` and views * are read from `views/`. */ mcpDir?: string; /** Explicit views directory, relative to `projectRoot`. */ viewsDir?: string; /** * MCP route mounted by the application. * * @defaultValue `"/api/mcp"` */ basePath?: string; /** * Next.js project root. * * @defaultValue `process.cwd()` */ projectRoot?: string; } /** @internal Exported for focused composition tests, not from `mcp-use/next`. */ export declare function composeNextConfig(nextConfig: T, basePath: string): T & NextConfigLike; /** * Add mcp-use build, CORS, and serverless tracing to a Next.js config. * * The MCP build runs when Next evaluates `next.config`, for both development * and production builds. This removes the need for a separate prebuild script. * * @param nextConfig - Existing Next.js configuration to augment. * @param options - MCP source, route, and project-root settings. * @returns The augmented configuration after the MCP project is built. * * @example * ```ts * import { withMcpUse } from "mcp-use/next"; * * export default withMcpUse(); * ``` */ export declare function withMcpUse(nextConfig?: T, options?: WithMcpUseOptions): Promise; export {};