Skip to main content
Glama

Textwell MCP Server

by worldnine
url-scheme-executor.ts1.49 kB
import { exec } from 'child_process'; import { McpError, ErrorCode } from '@modelcontextprotocol/sdk/types.js'; export class UrlSchemeExecutionError extends McpError { constructor(message: string) { super(ErrorCode.InternalError, `URL scheme execution failed: ${message}`); } } export class UrlSchemeTimeoutError extends McpError { constructor(timeout: number) { super( ErrorCode.InternalError, `URL scheme execution timed out after ${timeout}ms` ); } } interface ExecuteOptions { timeout?: number; onLog?: (level: 'info' | 'warning' | 'error', message: string) => void; } /** * TextwellのURLスキームを実行する * macOS専用の実装 */ export async function executeUrlScheme( url: string, options: ExecuteOptions = {} ): Promise<void> { const { timeout = 5000, onLog } = options; const log = (level: 'info' | 'warning' | 'error', message: string) => { onLog?.(level, message); }; log('info', `Executing URL scheme: ${url}`); return new Promise<void>((resolve, reject) => { const timer = setTimeout(() => { reject(new UrlSchemeTimeoutError(timeout)); }, timeout); exec(`open "${url}"`, (error) => { clearTimeout(timer); if (error) { log('error', `Failed to execute URL scheme: ${error.message}`); reject(new UrlSchemeExecutionError(error.message)); } else { log('info', 'URL scheme executed successfully'); resolve(); } }); }); }

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/worldnine/textwell-mcp'

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