UNPKG

cognitive-framework-mcp-server

Version:

MCP Server for Advanced Cognitive Framework - Provides sophisticated AI reasoning capabilities through standardized protocol

96 lines (79 loc) โ€ข 3.68 kB
#!/usr/bin/env node /** * Simple test script to verify MCP server functionality */ import { FrameworkParser } from './dist/src/parsers/framework-parser.js'; import { CognitiveReasoningEngine } from './dist/src/engines/cognitive-reasoning-engine.js'; async function testServer() { console.log('๐Ÿง  Testing Cognitive Framework MCP Server\n'); try { // Test framework parsing console.log('๐Ÿ“– Testing framework parser...'); const frameworkPath = process.env.FRAMEWORK_PATH || '/home/zrald/test/improve context'; console.log(` Framework path: ${frameworkPath}`); const parser = new FrameworkParser(frameworkPath); // Parse the framework const framework = await parser.parseFramework(); console.log('โœ… Framework parsed successfully'); // Validate the framework const isValid = parser.validateFramework(); console.log(`๐Ÿ” Framework validation: ${isValid ? 'PASSED' : 'FAILED'}`); if (!isValid) { console.error('โŒ Framework validation failed'); return; } // Get framework statistics const stats = parser.getFrameworkStats(); console.log('\n๐Ÿ“Š Framework Statistics:'); Object.entries(stats).forEach(([key, value]) => { console.log(` โ€ข ${key}: ${value}`); }); // Test reasoning engine console.log('\n๐Ÿš€ Testing cognitive reasoning engine...'); const reasoningEngine = new CognitiveReasoningEngine(framework); console.log('โœ… Reasoning engine initialized'); // Test basic reasoning console.log('\n๐Ÿงช Testing basic reasoning...'); const request = { type: 'reasoning', input: 'Test cognitive reasoning functionality', context: { test: true }, options: { workflow: 'express', biasChecking: false, creativityLevel: 'low' } }; const response = await reasoningEngine.processRequest(request); console.log('๐Ÿ“ Response received:'); console.log(` โ€ข Result length: ${response.result.length} characters`); console.log(` โ€ข Confidence: ${(response.confidence * 100).toFixed(1)}%`); console.log(` โ€ข Reasoning steps: ${response.reasoning.length}`); console.log(` โ€ข Processing time: ${response.metadata.processingTime}ms`); console.log(` โ€ข Cognitive load: ${response.metadata.cognitiveLoad}`); // Test framework info console.log('\n๐Ÿ“‹ Testing framework info...'); const frameworkInfo = reasoningEngine.getFrameworkInfo(); console.log('โœ… Framework info retrieved:'); Object.entries(frameworkInfo).forEach(([key, value]) => { console.log(` โ€ข ${key}: ${value}`); }); console.log('\n๐ŸŽ‰ All tests passed! MCP server is working correctly.'); console.log('\n๐Ÿ“š The server provides:'); console.log(' โ€ข Advanced cognitive reasoning capabilities'); console.log(' โ€ข Meta-cognitive awareness and bias detection'); console.log(' โ€ข Uncertainty quantification and confidence modeling'); console.log(' โ€ข Adaptive workflows and performance optimization'); console.log(' โ€ข MCP protocol compliance for easy integration'); } catch (error) { console.error('โŒ Test failed:', error.message); console.error('\n๐Ÿ”ง Troubleshooting:'); console.error(' โ€ข Ensure the framework file exists at the specified path'); console.error(' โ€ข Check that the framework file has valid XML structure'); console.error(' โ€ข Verify all dependencies are installed (npm install)'); console.error(' โ€ข Make sure the project is built (npm run build)'); process.exit(1); } } // Run the test testServer().catch(console.error);