import dotenv from 'dotenv';
dotenv.config();
import { BrowserScraper } from './build/scraper/browser_scraper.js';
console.log('π§ͺ Testing auto_scrape functionality directly');
console.log('ββββββββββββββββββββββββββββββββββββββ\n');
// Check if API key is loaded
const apiKey = process.env.OPENAI_API_KEY;
if (!apiKey) {
console.error('β OPENAI_API_KEY not found in environment!');
process.exit(1);
}
console.log(`β API Key loaded: ${apiKey.substring(0, 20)}...`);
try {
// This simulates what auto_scrape_financials does
console.log('\nπ€ Creating BrowserScraper with API key from environment...');
const scraper = new BrowserScraper(apiKey, '999059198');
console.log('β BrowserScraper created successfully!');
console.log(' The auto_scrape tool should now work properly.');
console.log('\nπ‘ To test in Claude:');
console.log(' 1. Restart Claude to reload the MCP server');
console.log(' 2. Try: "Auto-scrape financials for 999059198"');
} catch (error) {
console.error('β Failed to create BrowserScraper:', error.message);
console.error('\nThis is the same error you would get in auto_scrape.');
}