Skip to main content
Glama

MCP Standards

by airmcp-com
test_agentdb_direct.cjsโ€ข3.47 kB
#!/usr/bin/env node /** * Test Direct AgentDB Integration * * Test the AgentDB library directly to understand its API */ const fs = require('fs'); const path = require('path'); async function testAgentDB() { console.log('๐Ÿ” Testing AgentDB Direct Integration'); console.log('=' * 50); try { // Try to import AgentDB console.log('๐Ÿ“ฆ Importing AgentDB...'); // First, let's see what's available const agentdbPackagePath = path.join(__dirname, 'node_modules/agentdb'); if (fs.existsSync(agentdbPackagePath)) { const packageJson = JSON.parse(fs.readFileSync(path.join(agentdbPackagePath, 'package.json'), 'utf8')); console.log(` Package: ${packageJson.name}@${packageJson.version}`); console.log(` Main: ${packageJson.main}`); console.log(` Exports:`, packageJson.exports); } // Try different import methods let AgentDB; try { AgentDB = require('agentdb'); console.log('โœ… AgentDB imported successfully'); console.log(' Available exports:', Object.keys(AgentDB)); } catch (e) { console.log('โŒ Direct import failed:', e.message); // Try specific imports try { const { SQLiteVectorDB } = require('agentdb'); console.log('โœ… SQLiteVectorDB imported successfully'); AgentDB = { SQLiteVectorDB }; } catch (e2) { console.log('โŒ SQLiteVectorDB import failed:', e2.message); } } if (AgentDB && AgentDB.SQLiteVectorDB) { console.log('\n๐Ÿงช Testing SQLiteVectorDB...'); // Test database connection const dbPath = '.agentdb/v2_patterns.db'; console.log(` Connecting to: ${dbPath}`); const db = new AgentDB.SQLiteVectorDB(dbPath); console.log('โœ… Database connected'); // Test basic operations console.log('\n๐Ÿ”ฌ Testing basic operations...'); // Create a test vector const testVector = Array.from({length: 1536}, (_, i) => Math.random()); const testMetadata = { pattern_type: 'test', description: 'test pattern', category: 'testing' }; console.log(' Inserting test vector...'); const insertResult = await db.insert({ embedding: testVector, metadata: testMetadata }); console.log('โœ… Test vector inserted:', insertResult); // Test search console.log(' Testing search...'); const searchResults = await db.search(testVector, 5, 'cosine', 0.0); console.log('โœ… Search completed:', searchResults.length, 'results'); // Test query functionality console.log('\n๐Ÿ“Š Database statistics...'); try { const stats = await db.stats(); console.log(' Stats:', stats); } catch (e) { console.log(' Stats not available:', e.message); } } else { console.log('โŒ No usable AgentDB exports found'); } } catch (error) { console.log('โŒ Error testing AgentDB:', error.message); console.log(' Stack:', error.stack); } } testAgentDB().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/airmcp-com/mcp-standards'

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