@buildappolis/sharex-mcp-server
Version:
Model Context Protocol server for seamless ShareX integration with Claude Code - view screenshots and GIFs instantly
38 lines • 1.22 kB
JavaScript
import * as fs from "fs/promises";
import * as path from "path";
import { getShareXConfigPath } from "./paths.js";
export async function detectShareX() {
try {
const configPath = getShareXConfigPath();
const stats = await fs.stat(configPath);
return stats.isDirectory();
}
catch {
return false;
}
}
export async function getShareXScreenshotPath() {
try {
const configDir = getShareXConfigPath();
const settingsPath = path.join(configDir, "ApplicationConfig.json");
const content = await fs.readFile(settingsPath, "utf-8");
const config = JSON.parse(content);
if (config.UseCustomScreenshotsPath && config.CustomScreenshotsPath) {
return config.CustomScreenshotsPath;
}
return path.join(configDir, "Screenshots");
}
catch {
return null;
}
}
export async function getShareXInfo() {
const screenshotPath = await getShareXScreenshotPath();
const configDir = getShareXConfigPath();
const defaultPath = path.join(configDir, "Screenshots");
return {
path: screenshotPath,
isDefault: screenshotPath === defaultPath
};
}
//# sourceMappingURL=sharex.js.map