All files / src index.ts

0% Statements 0/9
0% Branches 0/8
100% Functions 0/0
0% Lines 0/9

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26                                                   
#!/usr/bin/env node
 
import dotenv from 'dotenv';
import { Crawl4AIServer } from './server.js';
 
// Load environment variables
dotenv.config();
 
const CRAWL4AI_BASE_URL = process.env.CRAWL4AI_BASE_URL;
const CRAWL4AI_API_KEY = process.env.CRAWL4AI_API_KEY || '';
const SERVER_NAME = process.env.SERVER_NAME || 'crawl4ai-mcp';
const SERVER_VERSION = process.env.SERVER_VERSION || '1.0.0';
 
if (!CRAWL4AI_BASE_URL) {
  console.error('Error: CRAWL4AI_BASE_URL environment variable is required');
  console.error('Please set it to your Crawl4AI server URL (e.g., http://localhost:8080)');
  process.exit(1);
}
 
/* istanbul ignore next */
// Start the server if run directly
if (import.meta.url === `file://${process.argv[1]}`) {
  const server = new Crawl4AIServer(CRAWL4AI_BASE_URL, CRAWL4AI_API_KEY, SERVER_NAME, SERVER_VERSION);
  server.start().catch(console.error);
}