Skip to main content
Glama

Curupira

by drzln
test-cdp-connection.jsโ€ข2.53 kB
#!/usr/bin/env node /** * Test script to verify CDP connection from Curupira to Chrome * This script tests the complete flow from Curupira to the browserless Chrome instance */ const http = require('http'); const CHROME_SERVICE_URL = process.env.CHROME_SERVICE_URL || 'chrome-headless.shared-services.svc.cluster.local'; const CHROME_SERVICE_PORT = process.env.CHROME_SERVICE_PORT || 3000; function httpGet(hostname, port, path) { return new Promise((resolve, reject) => { const options = { hostname, port, path, method: 'GET' }; const req = http.request(options, (res) => { let data = ''; res.on('data', (chunk) => { data += chunk; }); res.on('end', () => { if (res.statusCode === 200) { resolve(JSON.parse(data)); } else { reject(new Error(`HTTP ${res.statusCode}: ${data}`)); } }); }); req.on('error', reject); req.end(); }); } async function testCDPConnection() { console.log('๐Ÿงช Testing CDP connection to Chrome...'); console.log(`Chrome service: ${CHROME_SERVICE_URL}:${CHROME_SERVICE_PORT}`); try { // Step 1: Test HTTP endpoint console.log('\n1๏ธโƒฃ Testing HTTP endpoint /json/version...'); const versionData = await httpGet(CHROME_SERVICE_URL, CHROME_SERVICE_PORT, '/json/version'); console.log('โœ… HTTP endpoint working'); console.log(`Browser: ${versionData.Browser}`); console.log(`Protocol Version: ${versionData['Protocol-Version']}`); console.log(`WebSocket URL: ${versionData.webSocketDebuggerUrl}`); // Step 2: Test browser targets endpoint console.log('\n2๏ธโƒฃ Testing browser targets endpoint /json...'); const targets = await httpGet(CHROME_SERVICE_URL, CHROME_SERVICE_PORT, '/json'); console.log('โœ… Browser targets endpoint working'); console.log(`Active targets: ${targets.length}`); console.log('\nโœ… All tests passed! CDP connection is working.'); console.log('\n๐Ÿ“ Summary:'); console.log(`- Chrome is accessible at: http://${CHROME_SERVICE_URL}:${CHROME_SERVICE_PORT}`); console.log(`- WebSocket endpoint: ws://${CHROME_SERVICE_URL}:${CHROME_SERVICE_PORT}`); console.log('- Chrome DevTools Protocol is functioning correctly'); console.log('- Ready for Curupira MCP server integration'); process.exit(0); } catch (error) { console.error('\nโŒ Test failed:', error.message); process.exit(1); } } // Run the test testCDPConnection();

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/drzln/curupira'

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