/** * @name NativeHttpX402Adapter * @description Native Node.js HTTP adapter and request utilities for x402-gated MCP traffic. */ import * as http from 'http'; import type { HTTPAdapter } from '@x402/core/server'; /** * @name getHttpHeader * @description Return the first value for an HTTP header using case-insensitive lookup. * * Node normalizes incoming headers to lowercase, but MCP clients, test * harnesses, and replayed requests may preserve original casing. x402 prepaid * and payment headers must work across all of them. */ export declare function getHttpHeader(headers: http.IncomingHttpHeaders, name: string): string | undefined; /** * @name NativeHttpAdapterOptions * @description Adapter inputs required by x402's framework-agnostic HTTP server. */ export interface NativeHttpAdapterOptions { request: http.IncomingMessage; path: string; body: unknown; } /** * @name NativeHttpAdapter * @description Implements x402's HTTPAdapter over Node's native IncomingMessage. */ export declare class NativeHttpAdapter implements HTTPAdapter { private readonly request; private readonly path; private readonly body; constructor(options: NativeHttpAdapterOptions); /** * @name getHeader * @description Returns a case-insensitive HTTP header value. */ getHeader(name: string): string | undefined; /** * @name getMethod * @description Returns the HTTP method. */ getMethod(): string; /** * @name getPath * @description Returns the x402 virtual path used for payment route matching. */ getPath(): string; /** * @name getUrl * @description Returns an absolute URL for the x402 protected virtual resource. */ getUrl(): string; /** * @name getAcceptHeader * @description Returns the request Accept header. */ getAcceptHeader(): string; /** * @name getUserAgent * @description Returns the request User-Agent header. */ getUserAgent(): string; /** * @name getBody * @description Returns the parsed JSON-RPC body for dynamic x402 pricing. */ getBody(): unknown; } /** * @name readRequestBody * @description Reads and bounds a Node HTTP request body before replaying it to MCP. */ export declare function readRequestBody(request: http.IncomingMessage, maxBytes?: number): Promise; /** * @name replayRequest * @description Recreates a readable request stream after the monetization gate has consumed the original body. */ export declare function replayRequest(original: http.IncomingMessage, body: Buffer): http.IncomingMessage; /** * @name parseJsonBody * @description Parses a JSON request body and returns undefined for empty bodies. */ export declare function parseJsonBody(body: Buffer): unknown; //# sourceMappingURL=http-adapter.d.ts.map