/** * @maildev/api - Fastify API Server * * REST API and WebSocket server for MailDev. */ import { type FastifyInstance } from 'fastify'; import { EventEmitter } from 'node:events'; import type { APIServerOptions } from './types.js'; /** * MailDev API Server * * Provides REST API and WebSocket endpoints for the MailDev UI. */ export declare class APIServer extends EventEmitter { private app; private storage; private smtp; private io; private options; private mcpTransports; private pluginsRegistered; private boundAddress; constructor(options: APIServerOptions); /** * Register all plugins and routes (without starting the server) */ registerPlugins(): Promise; /** * Start listening on the configured port */ listen(): Promise; /** * Get the address the API server is bound to, or null before it listens * * After listen(), the port reflects the actual bound port — so a server * started with `port: 0` reports the OS-assigned ephemeral port here. */ getAddress(): { host: string; port: number; } | null; /** * Get the port the API server is bound to, or null before it listens * * After listen() with `port: 0`, this is the OS-assigned ephemeral port. */ getPort(): number | null; /** * Start the API server */ start(): Promise; /** * Stop the API server */ stop(): Promise; /** * Get the underlying Fastify instance (for testing) */ get server(): FastifyInstance; /** * Register HTTP Basic Auth hook */ private registerAuthHook; /** * Register all routes */ private registerRoutes; /** * Delete one email using SMTP when available so delete events are emitted. */ private deleteEmail; /** * Setup WebSocket (Socket.io) for real-time updates */ private setupWebSocket; /** * Setup MCP (Model Context Protocol) server for Claude integration */ /** * Best-effort public base URL of the web UI (no trailing slash), derived * from this server's own listen options. Used for MCP email deep links when * no explicit URL is configured. */ private defaultWebUrl; private setupMCP; /** * Filter emails by query parameters (supports dot notation) */ private filterEmails; /** * Get nested value from object using dot notation */ private getNestedValue; } /** * Create an API server instance */ export declare function createAPIServer(options: APIServerOptions): APIServer; //# sourceMappingURL=server.d.ts.map