Skip to main content
Glama
index.ts2.31 kB
/** * Capture engine module * * Provides platform-specific screenshot capture capabilities for Linux, macOS, and Windows. * * @module capture */ export * from "./base-capture-engine"; export * from "./linux-capture-engine"; export * from "./macos-capture-engine"; export * from "./windows-capture-engine"; export * from "./wsl-capture-engine"; export * from "./region-validator"; import * as fs from "fs"; import { BaseCaptureEngine } from "./base-capture-engine"; import { LinuxCaptureEngine } from "./linux-capture-engine"; import { MacOSCaptureEngine } from "./macos-capture-engine"; import { WindowsCaptureEngine } from "./windows-capture-engine"; import { WSLCaptureEngine } from "./wsl-capture-engine"; /** * Check if running in WSL */ function isWSL(): boolean { try { if (process.platform !== "linux") return false; const version = fs.readFileSync("/proc/version", "utf8").toLowerCase(); return version.includes("microsoft") || version.includes("wsl"); } catch { return false; } } /** * Create a platform-specific capture engine * * Factory function that returns the appropriate capture engine implementation * based on the current operating system platform. * * @returns {BaseCaptureEngine} Platform-specific capture engine instance * @throws {Error} If the current platform is not supported * * @example * ```typescript * import { createCaptureEngine } from '@ai-capabilities-suite/mcp-screenshot'; * * const engine = createCaptureEngine(); * const buffer = await engine.captureScreen(); * ``` * * @remarks * Platform-specific behavior: * - **Linux**: Uses X11 (import/xwd) or Wayland (grim) depending on display server. Supports WSL via PowerShell. * - **macOS**: Uses native screencapture command with Retina display support * - **Windows**: Uses screenshot-desktop library with high-DPI support */ export function createCaptureEngine(): BaseCaptureEngine { const platform = process.platform; switch (platform) { case "linux": if (isWSL()) { return new WSLCaptureEngine(); } return new LinuxCaptureEngine(); case "darwin": return new MacOSCaptureEngine(); case "win32": return new WindowsCaptureEngine(); default: throw new Error(`Unsupported platform: ${platform}`); } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Digital-Defiance/mcp-screenshot'

If you have feedback or need assistance with the MCP directory API, please join our Discord server