@rhofkens/mcp-quotes-server
Version:
A Model Context Protocol (MCP) server that provides quotes based on user requests
48 lines (47 loc) • 1.39 kB
TypeScript
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
export interface HttpServerConfig {
enabled: boolean;
port: number;
host: string;
https: {
enabled: boolean;
certPath?: string;
keyPath?: string;
};
security: {
allowedHosts: string[];
allowedOrigins: string[];
};
}
export interface HttpTransportSession {
sessionId: string;
transport: StreamableHTTPServerTransport;
createdAt: Date;
lastActivity: Date;
}
export interface HttpServerOptions {
jsonLimit?: string;
enableLogging?: boolean;
middleware?: Array<(req: any, res: any, next: any) => void>;
sessionTimeout?: number;
}
export interface SessionStats {
activeSessions: number;
totalSessionsCreated: number;
totalSessionsTerminated: number;
averageSessionDuration: number;
}
export declare enum HttpTransportErrorType {
INVALID_SESSION = "INVALID_SESSION",
SESSION_NOT_FOUND = "SESSION_NOT_FOUND",
HTTPS_CONFIG_ERROR = "HTTPS_CONFIG_ERROR",
SERVER_STARTUP_ERROR = "SERVER_STARTUP_ERROR",
TRANSPORT_INIT_ERROR = "TRANSPORT_INIT_ERROR",
SESSION_TIMEOUT = "SESSION_TIMEOUT"
}
export interface HttpTransportError extends Error {
type: HttpTransportErrorType;
statusCode: number;
context?: Record<string, any>;
sessionId?: string;
}