moa-mcp-server
Version:
MCP Server for Memory of Agents (MOA) API - Memory Management & Intelligent Memory endpoints only
53 lines (52 loc) โข 2.4 kB
JavaScript
import { ConfigManager } from './services/config.js';
import { MOAAPIService } from './services/moa-api.js';
async function testServer() {
console.log('๐งช Testing MOA MCP Server...\n');
try {
console.log('1. Testing configuration...');
const configManager = ConfigManager.getInstance();
const config = configManager.getConfig();
console.log(` Configuration loaded`);
console.log(` ๐ก MOA API: ${config.moa.baseUrl}`);
console.log(` ๐ API Key: ${config.moa.apiKey ? '***configured***' : 'NOT SET'}`);
if (!config.moa.apiKey) {
console.log('\nNo API key configured. Run: npm run setup');
process.exit(1);
}
console.log('\n2. Testing MOA API connection...');
const moaService = new MOAAPIService(config.moa);
const isConnected = await moaService.testConnection();
if (isConnected) {
console.log(' MOA API connection successful');
}
else {
console.log(' MOA API connection failed');
console.log(' ๐ก Check your API key and internet connection');
process.exit(1);
}
console.log('\n3. Testing tool schemas...');
const { storeMemoryTool } = await import('./tools/create-memory.js');
const { searchMemoriesTool } = await import('./tools/search-memories.js');
const { queryMemoriesTool } = await import('./tools/query-memories.js');
console.log(` ${storeMemoryTool.name} tool loaded`);
console.log(` ${searchMemoriesTool.name} tool loaded`);
console.log(` ${queryMemoriesTool.name} tool loaded`);
console.log('\n๐ All tests passed! Your MOA MCP Server is ready to use.\n');
console.log('๐ Next steps:');
console.log(' 1. Configure your MCP client (see SETUP.md)');
console.log(' 2. Start the server: npm start');
console.log(' 3. Test with your MCP client');
}
catch (error) {
console.error('\nTest failed:', error.message);
console.log('\n๐ก Troubleshooting:');
console.log(' 1. Run setup: npm run setup');
console.log(' 2. Check your .env file');
console.log(' 3. Verify your MOA API key');
process.exit(1);
}
}
if (import.meta.url === `file://${process.argv[1]}`) {
testServer();
}