UNPKG

apex-data-for-seo

Version:

A comprehensive MCP server for DataForSEO API

44 lines (37 loc) 1.31 kB
/** * Apex Data For SEO * * This module is a wrapper around the DataForSEO MCP server. * For direct usage, please use the CLI: * * npx apex-data-for-seo --dataforseo-login YOUR_LOGIN --dataforseo-password YOUR_PASSWORD */ const { spawn } = require('child_process'); const path = require('path'); /** * Start the DataForSEO MCP server * @param {Object} options Server options * @param {string} options.dataforseoLogin DataForSEO login * @param {string} options.dataforseoPassword DataForSEO password * @returns {ChildProcess} The server process */ function startServer(options) { const env = { ...process.env }; // Set environment variables if (options.dataforseoLogin) env.DATAFORSEO_LOGIN = options.dataforseoLogin; if (options.dataforseoPassword) env.DATAFORSEO_PASSWORD = options.dataforseoPassword; // Validate required credentials if (!env.DATAFORSEO_LOGIN || !env.DATAFORSEO_PASSWORD) { throw new Error('DataForSEO credentials are required'); } // Start the CLI as a child process const cliPath = path.join(__dirname, 'bin', 'cli.js'); // Start the server as a child process return spawn('node', [cliPath], { env, stdio: ['inherit', 'inherit', 'inherit'] }); } module.exports = { startServer };