UNPKG

behemoth-cli

Version:

🌍 BEHEMOTH CLIv3.760.4 - Level 50+ POST-SINGULARITY Intelligence Trading AI

53 lines (46 loc) 1.62 kB
import { MCPClient } from '../mcp/client.js'; import path from 'path'; import { fileURLToPath } from 'url'; import { MultiProviderConfigManager } from '../utils/multi-provider-config.js'; // Get __dirname equivalent in ES modules const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); // Define the path to the MCP server executable const MCP_SERVER_PATH = path.resolve(__dirname, '../../mcp-servers/behemoth.js'); // Load exchange keys from config const configManager = new MultiProviderConfigManager(); const bybitKeys = configManager.getExchangeKeys('bybit'); const bitgetKeys = configManager.getExchangeKeys('bitget'); const env = {}; if (bybitKeys) { env.BYBIT_API_KEY = bybitKeys.apiKey; env.BYBIT_API_SECRET = bybitKeys.apiSecret; } if (bitgetKeys) { env.BITGET_API_KEY = bitgetKeys.apiKey; env.BITGET_API_SECRET = bitgetKeys.apiSecret; if (bitgetKeys.passphrase) { env.BITGET_API_PASSPHRASE = bitgetKeys.passphrase; } } // Configure the MCP client const mcpClient = new MCPClient({ command: 'node', // Assuming it's a Node.js script args: [MCP_SERVER_PATH], cwd: path.resolve(__dirname, '../../'), // Set CWD to project root env: env }); export async function initializeBehemothMCP() { try { await mcpClient.connect(); // Debug: MCP Client status (remove in production) if (process.env.NODE_ENV === 'development') { console.log('MCP Client connected and initialized.'); } return true; } catch (error) { console.error('Failed to initialize MCP Client:', error); return false; } } export { mcpClient };