Files
hive/scripts/test-mcp-integration.js
anthonyrawlins 268214d971 Major WHOOSH system refactoring and feature enhancements
- Migrated from HIVE branding to WHOOSH across all components
- Enhanced backend API with new services: AI models, BZZZ integration, templates, members
- Added comprehensive testing suite with security, performance, and integration tests
- Improved frontend with new components for project setup, AI models, and team management
- Updated MCP server implementation with WHOOSH-specific tools and resources
- Enhanced deployment configurations with production-ready Docker setups
- Added comprehensive documentation and setup guides
- Implemented age encryption service and UCXL integration

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-27 08:34:48 +10:00

110 lines
4.0 KiB
JavaScript

#!/usr/bin/env node
/**
* Test MCP Server CLI Agent Integration
*/
const { WHOOSHClient } = require('../../mcp-server/dist/whoosh-client.js');
const { WHOOSHTools } = require('../../mcp-server/dist/whoosh-tools.js');
async function testMCPIntegration() {
console.log('🧪 Testing MCP Server CLI Agent Integration...\n');
try {
// Initialize WHOOSH client
const whooshClient = new WHOOSHClient({
baseUrl: 'https://whoosh.home.deepblack.cloud/api',
wsUrl: 'wss://whoosh.home.deepblack.cloud/socket.io',
timeout: 15000
});
console.log('✅ WHOOSHClient initialized');
// Test connection
try {
await whooshClient.testConnection();
console.log('✅ Connection to WHOOSH backend successful');
} catch (error) {
console.log('⚠️ Connection test failed (backend may be offline):', error.message);
console.log(' Continuing with tool definition tests...\n');
}
// Initialize tools
const whooshTools = new WHOOSHTools(whooshClient);
console.log('✅ WHOOSHTools initialized');
// Test tool definitions
const tools = whooshTools.getAllTools();
console.log(`✅ Loaded ${tools.length} MCP tools\n`);
// Check for CLI agent tools
const cliTools = tools.filter(tool =>
tool.name.includes('cli') ||
tool.name.includes('predefined')
);
console.log('🔍 CLI Agent Tools Available:');
cliTools.forEach(tool => {
console.log(`${tool.name}: ${tool.description}`);
});
// Test tool schema validation
const registerCliTool = tools.find(t => t.name === 'whoosh_register_cli_agent');
if (registerCliTool) {
console.log('\n✅ whoosh_register_cli_agent tool found');
console.log(' Required fields:', registerCliTool.inputSchema.required);
const properties = registerCliTool.inputSchema.properties;
if (properties.host && properties.node_version && properties.specialization) {
console.log('✅ CLI agent tool schema validated');
} else {
console.log('❌ CLI agent tool schema missing required properties');
}
} else {
console.log('❌ whoosh_register_cli_agent tool not found');
}
// Test agent enumeration
const agentEnums = tools
.filter(t => t.inputSchema.properties &&
(t.inputSchema.properties.specialization ||
t.inputSchema.properties.type))
.map(t => {
const spec = t.inputSchema.properties.specialization;
const type = t.inputSchema.properties.type;
return { tool: t.name, enum: spec?.enum || type?.enum };
})
.filter(t => t.enum);
console.log('\n🔍 Agent Type Enumerations:');
agentEnums.forEach(({ tool, enum: enumValues }) => {
const cliTypes = enumValues.filter(e =>
e.includes('cli') || e.includes('general') || e.includes('reasoning')
);
if (cliTypes.length > 0) {
console.log(`${tool}: includes CLI types [${cliTypes.join(', ')}]`);
}
});
console.log('\n🎉 MCP Integration Test Complete!');
console.log('✅ CLI agent tools are properly integrated');
console.log('✅ Schema validation passed');
console.log('✅ Mixed agent type support confirmed');
return true;
} catch (error) {
console.error('❌ MCP Integration test failed:', error.message);
return false;
}
}
// Run the test
testMCPIntegration()
.then(success => {
process.exit(success ? 0 : 1);
})
.catch(error => {
console.error('❌ Test execution failed:', error);
process.exit(1);
});