UNPKG

@pinkpixel/prysm-mcp

Version:

MCP server for the Prysm web scraper - enabling AI assistants to scrape web content

48 lines (39 loc) 1.53 kB
import * as mcp from '../dist/index.js'; async function testMCP() { try { console.log('MCP tools available:', mcp.config.tools.map(t => t.name).join(', ')); // Find the scrapeBalanced tool const scrapeBalancedTool = mcp.config.tools.find(t => t.name === 'scrapeBalanced'); if (scrapeBalancedTool) { console.log('\nTesting scrapeBalanced tool:'); console.log('Description:', scrapeBalancedTool.description); try { console.log('\nScraping example.com...'); const result = await scrapeBalancedTool.handler({ url: 'https://example.com', maxScrolls: 5 }); // Test JSON serialization to see if it works correctly const jsonString = JSON.stringify(result, null, 2); console.log('JSON serialization successful'); console.log('\nSample of scraped content:'); if (result.title) { console.log('Title:', result.title); } if (result.content && result.content.length > 0) { console.log('Content excerpt:', result.content[0].substring(0, 100) + '...'); } if (result.images && result.images.length > 0) { console.log('First image URL:', result.images[0].url); } } catch (error) { console.error('Error during scraping:', error); } } else { console.error('scrapeBalanced tool not found!'); } } catch (error) { console.error('Test error:', error); } } testMCP();