UNPKG

@mseep/mcp-wsl-exec

Version:

A secure Model Context Protocol (MCP) server for executing commands in Windows Subsystem for Linux (WSL) with built-in safety features and validation

28 lines (27 loc) 985 B
import { ErrorCode } from '@modelcontextprotocol/sdk/types.js'; export class WslExecutionError extends Error { constructor(message, code, details) { super(message); this.code = code; this.details = details; this.name = 'WslExecutionError'; } } export class CommandValidationError extends WslExecutionError { constructor(message, details) { super(message, ErrorCode.InvalidParams, details); this.name = 'CommandValidationError'; } } export class CommandTimeoutError extends WslExecutionError { constructor(timeout) { super(`Command timed out after ${timeout}ms`, ErrorCode.InternalError, { timeout }); this.name = 'CommandTimeoutError'; } } export class InvalidConfirmationError extends WslExecutionError { constructor(confirmation_id) { super('Invalid or expired confirmation ID', ErrorCode.InvalidRequest, { confirmation_id }); this.name = 'InvalidConfirmationError'; } }