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
JavaScript
/**
* 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);