Skip to main content
Glama

EuConquisto Composer MCP

by rkm097git
test-actual-api-access.js6.49 kB
#!/usr/bin/env node /** * Actual API Access Test - Verify authentication really works */ import fetch from 'node-fetch'; import { promises as fs } from 'fs'; import { fileURLToPath } from 'url'; import { dirname, join } from 'path'; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); async function loadEnvFile() { try { const envPath = join(__dirname, 'config', 'direct-api.env'); const envContent = await fs.readFile(envPath, 'utf-8'); const lines = envContent.split('\n'); for (const line of lines) { if (line.trim().startsWith('#') || !line.trim()) continue; const match = line.match(/^([^=]+)=(.*)$/); if (match) { const key = match[1].trim(); let value = match[2].trim(); // Handle quoted values if ((value.startsWith('"') && value.endsWith('"')) || (value.startsWith("'") && value.endsWith("'"))) { value = value.slice(1, -1); } process.env[key] = value; } } return true; } catch (error) { console.error('❌ Failed to load environment file:', error.message); return false; } } async function testActualAPIAccess() { console.log('🔍 ACTUAL API ACCESS TEST'); console.log('==========================\n'); console.log('This test will make real API calls to verify authentication\n'); // Load environment const loaded = await loadEnvFile(); if (!loaded) { console.log('❌ Could not load config/direct-api.env'); return; } const accessToken = process.env.EUCONQUISTO_ACCESS_TOKEN; const projectUid = process.env.EUCONQUISTO_PROJECT_UID; const tokenType = process.env.EUCONQUISTO_TOKEN_TYPE || 'Bearer'; if (!accessToken || !projectUid) { console.log('❌ Missing required authentication data'); return; } console.log('📊 Loaded Authentication:'); console.log(` Token Type: ${tokenType}`); console.log(` Token Length: ${accessToken.length} characters`); console.log(` Project UID: ${projectUid}\n`); // Test 1: User Profile console.log('🧪 Test 1: GET /auth/v1.0/user/me'); try { const response = await fetch('https://api.digitalpages.com.br/auth/v1.0/user/me', { method: 'GET', headers: { 'Authorization': `${tokenType} ${accessToken}`, 'Content-Type': 'application/json', 'Accept': 'application/json', 'Project-Key': 'e3894d14dbb743d78a7efc5819edc52e', 'Api-Env': 'prd' } }); console.log(` Response: ${response.status} ${response.statusText}`); if (response.ok) { const data = await response.json(); console.log(' ✅ SUCCESS - User authenticated!'); console.log(` User: ${data.name || 'Unknown'} (${data.email || 'Unknown'})`); console.log(` User UID: ${data.uid || 'Unknown'}`); } else { const text = await response.text(); console.log(' ❌ FAILED - Authentication rejected'); console.log(` Error: ${text.substring(0, 200)}`); } } catch (error) { console.log(' ❌ NETWORK ERROR:', error.message); } // Test 2: Project Info console.log('\n🧪 Test 2: GET /auth/v1.0/project/uid/{projectUid}'); try { const response = await fetch(`https://api.digitalpages.com.br/auth/v1.0/project/uid/${projectUid}`, { method: 'GET', headers: { 'Authorization': `${tokenType} ${accessToken}`, 'Content-Type': 'application/json', 'Accept': 'application/json', 'Project-Key': 'e3894d14dbb743d78a7efc5819edc52e', 'Api-Env': 'prd' } }); console.log(` Response: ${response.status} ${response.statusText}`); if (response.ok) { const data = await response.json(); console.log(' ✅ SUCCESS - Project access confirmed!'); console.log(` Project Name: ${data.name || 'Unknown'}`); console.log(` Connectors: ${data.connectors?.length || 0} available`); } else { const text = await response.text(); console.log(' ❌ FAILED - Cannot access project'); console.log(` Error: ${text.substring(0, 200)}`); } } catch (error) { console.log(' ❌ NETWORK ERROR:', error.message); } // Test 3: Simple composition save test console.log('\n🧪 Test 3: POST composition (simplified test)'); try { // Parse connectors from env let connectors = []; try { connectors = JSON.parse(process.env.EUCONQUISTO_CONNECTORS || '[]'); } catch (e) { console.log(' ⚠️ Could not parse connectors from env'); } if (connectors.length === 0) { console.log(' ⚠️ No connectors available, skipping composition test'); } else { const connector = connectors[0]; console.log(` Using connector: ${connector.name || connector.uid}`); // This is just a connectivity test, not actual save const testUrl = `https://api.digitalpages.com.br/storage/v1.0/content`; const response = await fetch(testUrl, { method: 'GET', headers: { 'Authorization': `${tokenType} ${accessToken}`, 'Accept': 'application/json', 'Project-Key': 'e3894d14dbb743d78a7efc5819edc52e', 'Api-Env': 'prd' } }); console.log(` Response: ${response.status} ${response.statusText}`); if (response.status === 200 || response.status === 404 || response.status === 400) { console.log(' ✅ Storage API endpoint is accessible'); } else if (response.status === 401 || response.status === 403) { console.log(' ❌ Storage API access denied - authentication issue'); } else { console.log(' ⚠️ Unexpected response from storage API'); } } } catch (error) { console.log(' ❌ NETWORK ERROR:', error.message); } // Summary console.log('\n' + '='.repeat(50)); console.log('📋 AUTHENTICATION TEST SUMMARY'); console.log('='.repeat(50)); console.log('\nBased on the API responses above:'); console.log('- If you see ✅ SUCCESS responses: Direct API authentication is working!'); console.log('- If you see ❌ FAILED responses: The token may be invalid or expired'); console.log('- If you see NETWORK ERRORs: Check your internet connection'); console.log('\n🔐 Current v5.2.0 system remains unchanged and fully operational'); console.log('='.repeat(50) + '\n'); } // Run the test testActualAPIAccess().catch(console.error);

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/rkm097git/euconquisto-composer-mcp-poc'

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