mcp-web-ui
Version:
Ultra-lightweight vanilla JavaScript framework for MCP servers - Zero dependencies, perfect security, 2-3KB bundle size
90 lines • 2.29 kB
TypeScript
import { TokenRegistry } from './TokenRegistry.js';
export interface GatewayProxyConfig {
port: number;
host?: string;
mongoUrl: string;
mongoDbName?: string;
jwtSecret?: string;
corsOrigins?: string[];
proxyPrefix?: string;
ssl?: {
cert: string;
key: string;
};
logger?: (level: string, message: string, data?: any) => void;
enableLogging?: boolean;
}
/**
* Gateway Proxy Server for ephemeral MCP Web UIs
*
* Provides a single stable endpoint that proxies requests to ephemeral backends
* based on secure tokens. Supports HTTP, WebSocket, and SSE connections.
*
* URL Pattern: /mcp/:token/*
* - Validates token against MongoDB registry
* - Routes to appropriate ephemeral backend
* - Supports real-time bidirectional communication
*/
export declare class GatewayProxyServer {
private app;
private server?;
private wss?;
private mongoClient?;
private tokenRegistry?;
private config;
constructor(config: GatewayProxyConfig);
/**
* Setup Express middleware
*/
private setupMiddleware;
/**
* Setup Express routes
*/
private setupRoutes;
/**
* Token validation middleware
*/
private createTokenValidationMiddleware;
/**
* Create static resource proxy middleware
*/
private createStaticProxyMiddleware;
/**
* Create API-specific proxy middleware
*/
private createApiProxyMiddleware;
/**
* Create dynamic proxy middleware
*/
private createProxyMiddleware;
/**
* Initialize MongoDB connection and token registry
*/
private initializeDatabase;
/**
* Start the gateway proxy server
*/
start(): Promise<void>;
/**
* Stop the gateway proxy server
*/
stop(): Promise<void>;
/**
* Get the token registry instance
*/
getTokenRegistry(): TokenRegistry | undefined;
/**
* Get server stats
*/
getStats(): Promise<any>;
/**
* Simple logging utility
*/
private log;
/**
* Helper to check if a string is valid JSON.
* This is a simplified check and might not be perfect for all JSON structures.
*/
private isValidJSON;
}
//# sourceMappingURL=GatewayProxyServer.d.ts.map