Skip to main content
Glama
index.js910 B
import process from 'node:process'; import {promisify} from 'node:util'; import {execFile, execFileSync} from 'node:child_process'; const execFileAsync = promisify(execFile); export async function runAppleScript(script, {humanReadableOutput = true} = {}) { if (process.platform !== 'darwin') { throw new Error('macOS only'); } const outputArguments = humanReadableOutput ? [] : ['-ss']; const {stdout} = await execFileAsync('osascript', ['-e', script, outputArguments]); return stdout.trim(); } export function runAppleScriptSync(script, {humanReadableOutput = true} = {}) { if (process.platform !== 'darwin') { throw new Error('macOS only'); } const outputArguments = humanReadableOutput ? [] : ['-ss']; const stdout = execFileSync('osascript', ['-e', script, ...outputArguments], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'], timeout: 500, }); return stdout.trim(); }

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/madebyaris/rakitui-ai'

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