UNPKG

mcpay

Version:

SDK and CLI for MCPay functionality - MCP servers with payment capabilities

39 lines 1.53 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const dotenv_1 = require("dotenv"); const accounts_1 = require("viem/accounts"); const start_stdio_server_js_1 = require("./start-stdio-server.js"); (0, dotenv_1.config)(); // Load environment variables const privateKey = process.env.PRIVATE_KEY; const serverUrls = process.env.SERVER_URLS?.split(','); if (!privateKey || !serverUrls || serverUrls.length === 0) { throw new Error("Missing environment variables: PRIVATE_KEY and SERVER_URLS are required"); } const account = (0, accounts_1.privateKeyToAccount)(privateKey); /** * Main function to start the MCP stdio server * This connects to multiple remote MCP servers and exposes them via a stdio interface */ async function main() { try { console.log(`Connecting to ${serverUrls.length} server(s)...`); // Multi-server approach using PaymentTransport const serverConnections = (0, start_stdio_server_js_1.createServerConnections)(serverUrls, start_stdio_server_js_1.ServerType.Payment); await (0, start_stdio_server_js_1.startStdioServer)({ serverConnections, account, }); console.log(`Connected to ${serverUrls.length} servers using payment transport`); } catch (error) { console.error("Failed to start server:", error); process.exit(1); } } // Run the main function main().catch(err => { console.error("Fatal error:", err); process.exit(1); }); //# sourceMappingURL=index.js.map