Skip to main content
Glama

Financial Modeling Prep MCP Server

Apache 2.0
17
59
  • Linux
  • Apple
loadModuleWithTimeout.ts1.16 kB
import type { ModuleLoader, ToolRegistrationFunction } from "../types/index.js"; /** * Helper function to create a timeout promise that rejects after a specified time * @param timeoutMs - Timeout in milliseconds * @param moduleName - Name of the module (for error message) * @returns Promise that rejects with timeout error */ function createTimeoutPromise(timeoutMs: number, moduleName: string): Promise<never> { return new Promise((_, reject) => setTimeout(() => reject(new Error(`Module loading timeout for ${moduleName}`)), timeoutMs) ); } /** * Loads a module with timeout protection * @param moduleLoader - The module loader function * @param moduleName - Name of the module being loaded * @param timeoutMs - Timeout in milliseconds (default: 10000) * @returns Promise that resolves to the registration function */ export async function loadModuleWithTimeout( moduleLoader: ModuleLoader, moduleName: string, timeoutMs: number = 10000 ): Promise<ToolRegistrationFunction> { return await Promise.race([ moduleLoader(), createTimeoutPromise(timeoutMs, moduleName) ]); }

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/imbenrabi/Financial-Modeling-Prep-MCP-Server'

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