/** * HTTP API Server * * REST API for browser-based clients to query the local .gitnexus/ index. * Also hosts the MCP server over StreamableHTTP for remote AI tool access. * * Security: binds to localhost by default (use --host to override). * CORS is restricted to localhost, private/LAN networks, and the deployed site. */ import express from 'express'; import { type GraphNode, type GraphRelationship } from '../_shared/index.js'; /** * Determine whether an HTTP Origin header value is allowed by CORS policy. * * Permitted origins: * - No origin (non-browser requests such as curl or server-to-server calls) * - http://localhost: — local development * - http://127.0.0.1: — loopback alias * - RFC 1918 private/LAN networks (any port): * 10.0.0.0/8 → 10.x.x.x * 172.16.0.0/12 → 172.16.x.x – 172.31.x.x * 192.168.0.0/16 → 192.168.x.x * - https://gitnexus.vercel.app — the deployed GitNexus web UI * * @param origin - The value of the HTTP `Origin` request header, or `undefined` * when the header is absent (non-browser request). * @returns `true` if the origin is allowed, `false` otherwise. */ export declare const isAllowedOrigin: (origin: string | undefined) => boolean; type GraphStreamRecord = { type: 'node'; data: GraphNode; } | { type: 'relationship'; data: GraphRelationship; } | { type: 'error'; error: string; }; export declare class ClientDisconnectedError extends Error { constructor(); } export declare const isIgnorableGraphQueryError: (err: unknown) => boolean; export declare const writeNdjsonRecord: (res: express.Response, record: GraphStreamRecord, signal?: AbortSignal) => Promise; export declare const streamGraphNdjson: (res: express.Response, includeContent?: boolean, signal?: AbortSignal) => Promise; export declare const createServer: (port: number, host?: string) => Promise; export {};