Skip to main content
Glama
Replicant-Partners

Firecrawl Agent MCP Server

test.ts2.97 kB
/** * Simple test script to verify Firecrawl API connection */ import * as dotenv from 'dotenv'; import { FirecrawlClient } from './services/firecrawl-client.js'; dotenv.config(); async function testFirecrawlConnection() { console.log('🔥 Testing Firecrawl Agent MCP Server\n'); const apiKey = process.env.FIRECRAWL_API_KEY; if (!apiKey) { console.error('❌ Error: FIRECRAWL_API_KEY not found in environment'); process.exit(1); } console.log('✓ API Key loaded'); console.log(`✓ API Key: ${apiKey.substring(0, 10)}...${apiKey.substring(apiKey.length - 4)}\n`); const client = new FirecrawlClient({ apiKey, }); // Test 1: Simple scrape console.log('Test 1: Simple Scrape'); console.log('Scraping: https://www.firecrawl.dev/'); try { const scrapeResult = await client.scrape({ url: 'https://www.firecrawl.dev/', formats: ['markdown'], onlyMainContent: true, }); if (scrapeResult.success) { console.log('✓ Scrape successful!'); const contentPreview = scrapeResult.data?.markdown?.substring(0, 200) || 'No content'; console.log(`✓ Content preview: ${contentPreview}...\n`); } else { console.error('✗ Scrape failed:', scrapeResult.error); } } catch (error) { console.error('✗ Scrape error:', error); } // Test 2: Search console.log('Test 2: Web Search'); console.log('Searching for: "Firecrawl API"'); try { const searchResult = await client.search({ query: 'Firecrawl API', limit: 2, }); if (searchResult.success) { console.log('✓ Search successful!'); console.log(`✓ Found ${searchResult.data?.length || 0} results`); if (searchResult.data && searchResult.data.length > 0) { console.log(`✓ First result URL: ${searchResult.data[0].url}\n`); } } else { console.error('✗ Search failed:', searchResult.error); } } catch (error) { console.error('✗ Search error:', error); } // Test 3: Agent Execute (simple) console.log('Test 3: Agent Execute'); console.log('Prompt: "What is Firecrawl?"'); try { const agentResult = await client.executeAgent({ prompt: 'In one sentence, what is Firecrawl?', maxCredits: 10, // Limit to 10 credits for testing }); if (agentResult.success) { console.log('✓ Agent execution successful!'); console.log(`✓ Credits used: ${agentResult.creditsUsed || 'unknown'}`); console.log(`✓ Result:`, JSON.stringify(agentResult.data, null, 2)); } else { console.error('✗ Agent execution failed:', agentResult.error); } } catch (error) { console.error('✗ Agent error:', error); } console.log('\n✅ Tests completed!'); } // Run tests testFirecrawlConnection().catch((error) => { console.error('Fatal error:', error); process.exit(1); });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Replicant-Partners/Firecrawler-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server