@debugmcp/mcp-debugger
Version:
Run-time step-through debugging for LLM agents.
46 lines (37 loc) • 1.42 kB
text/typescript
import { Command } from 'commander';
export interface StdioOptions {
logLevel?: string;
logFile?: string;
}
export interface SSEOptions {
port: string;
logLevel?: string;
logFile?: string;
}
export type StdioHandler = (options: StdioOptions, command?: Command) => Promise<void>;
export type SSEHandler = (options: SSEOptions, command?: Command) => Promise<void>;
export function createCLI(name: string, description: string, version: string): Command {
const program = new Command();
program
.name(name)
.description(description)
.version(version);
return program;
}
export function setupStdioCommand(program: Command, handler: StdioHandler): void {
program
.command('stdio', { isDefault: true })
.description('Start the server using stdio as transport')
.option('-l, --log-level <level>', 'Set log level (error, warn, info, debug)', 'info')
.option('--log-file <path>', 'Log to file instead of console')
.action(handler);
}
export function setupSSECommand(program: Command, handler: SSEHandler): void {
program
.command('sse')
.description('Start the server using SSE (Server-Sent Events) transport')
.option('-p, --port <number>', 'Port to listen on', '3001')
.option('-l, --log-level <level>', 'Set log level (error, warn, info, debug)', 'info')
.option('--log-file <path>', 'Log to file instead of console')
.action(handler);
}