@dnb/eufemia
Version:
DNB Eufemia Design System UI Library
43 lines (42 loc) • 1.53 kB
TypeScript
/**
* Eufemia Docs MCP HTTP Server
*
* Exposes the Eufemia documentation MCP tools over HTTP with two transports:
*
* - Streamable HTTP (modern, default at `/mcp`) — recommended.
* - Legacy SSE (`GET /sse` for the stream and `POST /messages` for client → server)
* for compatibility with clients like Claude Desktop's "SSE" server type.
*
* Designed to be deployable behind any Node.js host (Fly.io, Render, Railway,
* a Claude flair / proxy server, etc.) by listening on `process.env.PORT`.
*
* Environment variables:
* - `PORT` HTTP port (default: 8787)
* - `HOST` Bind host (default: 0.0.0.0)
* - `EUFEMIA_DOCS_ROOT` Path to the Eufemia docs root (default: ./docs).
* - `MCP_ALLOWED_HOSTS` Comma-separated allowlist for the `Host` header
* (DNS-rebinding protection). Defaults to off.
* - `MCP_AUTH_TOKEN` If set, every request must send
* `Authorization: Bearer <token>`.
*/
type DocsToolsOptions = {
docsRoot?: string;
};
export type HttpServerOptions = DocsToolsOptions & {
port?: number;
host?: string;
allowedHosts?: string[];
authToken?: string;
/** Suppress console output (useful for tests). */
silent?: boolean;
};
export type RunningHttpServer = {
url: string;
port: number;
host: string;
docsRoot: string;
close: () => Promise<void>;
};
export declare function startHttpServer(options?: HttpServerOptions): Promise<RunningHttpServer>;
export {};