UNPKG

@bloopai/debugger-mcp

Version:

An MCP server that provides interactive debugging capabilities to AI coding agents

63 lines (62 loc) 2.78 kB
#!/usr/bin/env node import { Server } from '@modelcontextprotocol/sdk/server/index.js'; import { SessionInfo as ModelSessionInfo } from './types'; import { McpAsyncEvent, McpAsyncEventType } from './types/mcp_protocol_extensions'; import { SessionManager, DebugSession, DAPSessionHandler, LoggerInterface } from '@bloopai/ergonomic-debugger-client'; import { SessionProvider } from './tools'; /** * AI Debugger MCP Server * * Provides debugging capabilities to AI agents through the Model Context Protocol (MCP) */ export declare class InteractiveDebuggerMcpServer implements SessionProvider { private server; private readonly serverInfo; private edcSessionManager; private logger; private activeSessions; private asyncEventQueue; private readonly MAX_ASYNC_EVENT_QUEUE_SIZE; constructor(); private _createLogger; private _loadAdapterConfigurations; private _processCliArgumentsAndMergeConfigs; private _initializeServerComponents; private handleShutdown; getServerInstance(): Server; getSessionManager(): SessionManager; getDebugSession(sessionId: string): DebugSession | undefined; getDAPSessionHandler(sessionId: string): DAPSessionHandler | undefined; createDebugSession(dapHandler: DAPSessionHandler, targetType: string, targetPath: string, logger: LoggerInterface): DebugSession; storeDebugSession(mcpSessionId: string, session: DebugSession, startTime: Date, targetType: string, targetPath: string): void; private _queueAsyncEvent; queueAsyncEvent(sessionId: string, eventType: McpAsyncEventType, data: unknown): void; drainAsyncEventQueue(): McpAsyncEvent[]; /** * Finds and optionally removes the first occurrence of a specific event type for a given session ID. * @param sessionId The session ID to check for. * @param eventType The type of event to look for. * @param removeIfFound If true, removes the event from the queue. * @returns The found McpAsyncEvent or undefined. */ findAndConsumeSessionEvent(sessionId: string, eventType: McpAsyncEventType, removeIfFound?: boolean): McpAsyncEvent | undefined; getEventsForSession(sessionId: string): McpAsyncEvent[]; removeDebugSession(sessionId: string): void; getLogger(): LoggerInterface; private mapStatusToSessionState; getAllSessionInfo(): ModelSessionInfo[]; private initializeTools; private formatToolResponse; private handleToolError; private setupToolHandlers; private _parseRequestBody; /** * Handles incoming HTTP requests for the MCP server. * This method is called by the HTTP server created in the `run` method. */ private _handleHttpRequest; /** * Runs the MCP server */ run(): Promise<void>; }