@cgaspard/webappmcp
Version:
WebApp MCP - Model Context Protocol integration for web applications with server-side debugging tools
80 lines • 2.27 kB
TypeScript
import { Request, Response, NextFunction } from 'express';
import cors from 'cors';
export interface WebAppMCPConfig {
wsPort?: number;
wsHost?: string;
appPort?: number;
authentication?: {
enabled: boolean;
token?: string;
};
permissions?: {
read?: boolean;
write?: boolean;
screenshot?: boolean;
state?: boolean;
serverExec?: boolean;
};
cors?: cors.CorsOptions;
mcpEndpointPath?: string;
transport?: 'sse' | 'stdio' | 'socket' | 'none';
socketPath?: string;
debug?: boolean;
plugins?: WebAppMCPPlugin[];
screenshotDir?: string;
captureServerLogs?: boolean;
serverLogLimit?: number;
serverTools?: boolean;
}
export interface WebAppMCPPlugin {
name: string;
description?: string;
version?: string;
tools?: PluginTool[];
clientExtensions?: ClientExtension[];
initialize?: (context: PluginInitContext) => Promise<void>;
}
export interface PluginTool {
name: string;
description: string;
inputSchema?: {
type: 'object';
properties?: Record<string, any>;
required?: string[];
};
handler: (args: any, context: PluginContext) => Promise<any>;
}
export interface ClientExtension {
code: string;
timing?: 'onConnect' | 'onDemand';
dependencies?: string[];
}
export interface PluginContext {
executeClientTool: (toolName: string, args: any, clientId?: string) => Promise<any>;
getClients: () => {
id: string;
url: string;
connectedAt: Date;
type: string;
}[];
log: (...args: any[]) => void;
}
export interface PluginInitContext {
log: (...args: any[]) => void;
config: WebAppMCPConfig;
}
export interface ClientInfo {
id: string;
ws: any;
url: string;
connectedAt: Date;
}
export interface ServerLogEntry {
level: string;
timestamp: string;
args: string[];
}
export declare function webappMCP(config?: WebAppMCPConfig): (req: Request, res: Response, next: NextFunction) => Response<any, Record<string, any>> | Promise<Response<any, Record<string, any>> | undefined> | undefined;
export default webappMCP;
export { IntegratedMCPServer } from './mcp-server.js';
//# sourceMappingURL=index.d.ts.map