earth2-mcp-server
Version:
Earth2 MCP Server for Claude integration - Access your Earth2 account data through Claude
70 lines (56 loc) • 2.23 kB
JavaScript
const fs = require('fs');
// Parse the API log
const apiLog = JSON.parse(fs.readFileSync('earth2_api_log_smart.json', 'utf8'));
// Extract unique base endpoints (without query params)
const endpoints = new Set();
apiLog.forEach(item => {
try {
const url = new URL(item.url);
if (url.hostname.includes('earth2.io') && !url.hostname.includes('mapbox') && !url.hostname.includes('rollbar')) {
// Get base path without IDs
let path = url.pathname;
// Normalize paths by removing UUIDs and specific IDs
path = path.replace(/\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi, '/{id}');
path = path.replace(/\/[0-9a-f]{32,}/gi, '/{id}');
endpoints.add(`${item.method} ${path}`);
}
} catch(e) {}
});
// Read current earth2-client.mjs to see what's implemented
const clientCode = fs.readFileSync('src/earth2-client.mjs', 'utf8');
// Check coverage
const sorted = Array.from(endpoints).sort();
const implemented = [];
const missing = [];
sorted.forEach(endpoint => {
const [method, path] = endpoint.split(' ');
const pathKey = path.replace(/\{id\}/g, '').replace(/\//g, '_').replace(/_+/g, '_');
// Check if endpoint appears to be implemented
const hasPath = clientCode.includes(path) || clientCode.includes(path.replace('/{id}', ''));
if (hasPath) {
implemented.push(endpoint);
} else {
missing.push(endpoint);
}
});
console.log('=== ENDPOINT COVERAGE ANALYSIS ===\n');
console.log(`Total unique endpoints found: ${sorted.length}`);
console.log(`Implemented: ${implemented.length}`);
console.log(`Missing: ${missing.length}`);
console.log(`Coverage: ${((implemented.length / sorted.length) * 100).toFixed(1)}%\n`);
console.log('=== MISSING ENDPOINTS ===\n');
missing.forEach(ep => console.log(ep));
// Write detailed report
const report = {
summary: {
total: sorted.length,
implemented: implemented.length,
missing: missing.length,
coverage: `${((implemented.length / sorted.length) * 100).toFixed(1)}%`
},
allEndpoints: sorted,
implemented,
missing
};
fs.writeFileSync('coverage_report.json', JSON.stringify(report, null, 2));
console.log('\n=== Report saved to coverage_report.json ===');