Skip to main content
Glama

Interactive Brokers MCP Server

by code-rabi
config-utils.ts1.39 kB
import { promises as fs } from 'fs'; import path from 'path'; export class ConfigUtils { static async createTempConfigWithPort(gatewayDir: string, port: number): Promise<void> { const originalConfigPath = path.join(gatewayDir, 'clientportal.gw/root/conf.yaml'); const tempConfigPath = path.join(gatewayDir, `clientportal.gw/root/conf-${port}.yaml`); try { // Read the original config const content = await fs.readFile(originalConfigPath, 'utf8'); // Replace the port const updatedContent = content.replace(/listenPort:\s*\d+/, `listenPort: ${port}`); // Write to temp config file await fs.writeFile(tempConfigPath, updatedContent, 'utf8'); } catch (error) { throw new Error(`Failed to create temporary config file: ${error}`); } } static async cleanupTempConfigFiles(gatewayDir: string): Promise<void> { try { const configDir = path.join(gatewayDir, 'clientportal.gw/root'); const files = await fs.readdir(configDir); for (const file of files) { if (file.match(/^conf-\d+\.yaml$/)) { const filePath = path.join(configDir, file); await fs.unlink(filePath); } } } catch (error) { // Don't throw errors for cleanup failures - just log them console.warn(`Warning: Could not clean up temporary config files: ${error}`); } } }

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/code-rabi/interactive-brokers-mcp'

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