/** * Navidrome MCP Server - Web UI HTTP Server * Copyright (C) 2025 * SPDX-License-Identifier: AGPL-3.0-or-later */ import { type IncomingMessage, type Server, type ServerResponse } from 'node:http'; import type { Socket } from 'node:net'; import type { NavidromeClient } from '../client/navidrome-client.js'; import type { Config } from '../config.js'; import type { SseBroadcaster } from './broadcaster.js'; import { type AuthService } from './auth/auth-service.js'; import { type Principal } from './auth/principal.js'; import type { Permission } from './auth/roles.js'; import type { GuestQueue } from './jukebox/guest-queue.js'; import { type McpLeaseCounter, type SettingsPageOpener } from './routes/player.js'; import { StreamLimiter } from './stream-limiter.js'; import type { VisualizerHub } from './visualizer-hub.js'; interface ServerDeps { config: Config; client: NavidromeClient; broadcaster: SseBroadcaster; visualizer: Pick; shutdown: () => void; leases: McpLeaseCounter; settingsPage: SettingsPageOpener; auth: AuthService; guests: GuestQueue; } interface ConnectionLimits { lan: number; perPeer: number; public: number; perPublicNetwork: number; } type InternetAccess = Pick; export declare function connectionLimitsFor(auth: InternetAccess): ConnectionLimits; /** The server is returned unstarted, so `acquireOrAttach` decides whether it binds. */ export declare function createServer(deps: ServerDeps): Server; export declare function createConnectionLimiter(limitsFor: () => ConnectionLimits): (socket: Socket) => void; interface RouteContext { req: IncomingMessage; res: ServerResponse; deps: ServerDeps; streams: StreamLimiter; url: URL; principal: Principal; } /** `public` routes skip the principal check. `/healthz` and the MCP lease keep their own loopback rule. */ type RouteAccess = Permission | 'public'; interface Route { method: 'GET' | 'POST'; path: string; /** Matches every path under `path`, whose remainder the handler decodes. */ prefix?: true; access: RouteAccess; handle: (ctx: RouteContext) => void | Promise; } /** Lets the route test prove it covers every route, so a route added later without a case fails it. */ export declare function listRoutes(): Array & { prefix: boolean; }>; export {}; //# sourceMappingURL=server.d.ts.map