Skip to main content
Glama
test-all-features.mjsโ€ข7.2 kB
#!/usr/bin/env node /** * Comprehensive Feature Test for M365 Core MCP Server * Tests both the enhanced Microsoft API capabilities and extended resources/prompts */ import { execSync } from 'child_process'; import fs from 'fs'; console.log('๐Ÿงช M365 Core MCP Server - Comprehensive Feature Test'); console.log('===================================================\n'); // Test categories const tests = { build: [], extendedResources: [], enhancedAPI: [], prompts: [], integration: [] }; // 1. Build and Compilation Tests console.log('๐Ÿ“ฆ 1. Testing Build and Compilation...'); try { execSync('npm run build', { stdio: 'pipe' }); tests.build.push('โœ… TypeScript compilation successful'); } catch (error) { tests.build.push('โŒ TypeScript compilation failed'); console.error('Build error:', error.message); } // 2. Extended Resources Verification console.log('๐Ÿ” 2. Verifying Extended Resources...'); // Check if extended-resources.ts exists and has the right content const extendedResourcesPath = './src/extended-resources.ts'; if (fs.existsSync(extendedResourcesPath)) { const content = fs.readFileSync(extendedResourcesPath, 'utf8'); // Check for key resources mentioned in EXTENDED_FEATURES.md const requiredResources = [ 'security_alerts', 'security_incidents', 'conditional_access_policies', 'applications', 'service_principals', 'directory_roles', 'intune_devices_extended', 'teams_list_extended', 'mail_folders_extended', 'calendar_events_extended' ]; requiredResources.forEach(resource => { if (content.includes(`"${resource}"`)) { tests.extendedResources.push(`โœ… Resource '${resource}' found`); } else { tests.extendedResources.push(`โŒ Resource '${resource}' missing`); } }); // Count total resources const resourceCount = (content.match(/server\.resource\(/g) || []).length; tests.extendedResources.push(`๐Ÿ“Š Total resources defined: ${resourceCount}`); } else { tests.extendedResources.push('โŒ extended-resources.ts file not found'); } // 3. Enhanced Microsoft API Features Verification console.log('๐Ÿš€ 3. Verifying Enhanced Microsoft API Features...'); // Check enhanced tool schema const toolDefinitionsPath = './src/tool-definitions.ts'; if (fs.existsSync(toolDefinitionsPath)) { const content = fs.readFileSync(toolDefinitionsPath, 'utf8'); const enhancedFeatures = [ 'maxRetries', 'retryDelay', 'timeout', 'customHeaders', 'responseFormat', 'selectFields', 'expandFields', 'batchSize' ]; enhancedFeatures.forEach(feature => { if (content.includes(feature)) { tests.enhancedAPI.push(`โœ… Enhanced feature '${feature}' found in schema`); } else { tests.enhancedAPI.push(`โŒ Enhanced feature '${feature}' missing from schema`); } }); } else { tests.enhancedAPI.push('โŒ tool-definitions.ts file not found'); } // Check enhanced handler implementation const handlersPath = './src/handlers.ts'; if (fs.existsSync(handlersPath)) { const content = fs.readFileSync(handlersPath, 'utf8'); const handlerFeatures = [ 'executeWithRetry', 'TokenCache', 'RateLimiter', 'exponential backoff', 'responseFormat', 'selectFields', 'expandFields' ]; handlerFeatures.forEach(feature => { if (content.includes(feature)) { tests.enhancedAPI.push(`โœ… Handler feature '${feature}' implemented`); } else { tests.enhancedAPI.push(`โš ๏ธ Handler feature '${feature}' not found (may use different naming)`); } }); } else { tests.enhancedAPI.push('โŒ handlers.ts file not found'); } // 4. Prompts Verification console.log('๐Ÿ“ 4. Verifying Comprehensive Prompts...'); if (fs.existsSync(extendedResourcesPath)) { const content = fs.readFileSync(extendedResourcesPath, 'utf8'); const requiredPrompts = [ 'security_assessment', 'compliance_review', 'user_access_review', 'device_compliance_analysis', 'collaboration_governance' ]; requiredPrompts.forEach(prompt => { if (content.includes(`"${prompt}"`)) { tests.prompts.push(`โœ… Prompt '${prompt}' found`); } else { tests.prompts.push(`โŒ Prompt '${prompt}' missing`); } }); // Count total prompts const promptCount = (content.match(/server\.prompt\(/g) || []).length; tests.prompts.push(`๐Ÿ“Š Total prompts defined: ${promptCount}`); } // 5. Integration Tests console.log('๐Ÿ”— 5. Verifying Integration...'); // Check if server.ts imports and uses extended resources const serverPath = './src/server.ts'; if (fs.existsSync(serverPath)) { const content = fs.readFileSync(serverPath, 'utf8'); if (content.includes('setupExtendedResources')) { tests.integration.push('โœ… Extended resources integrated into server'); } else { tests.integration.push('โŒ Extended resources not integrated'); } if (content.includes('TokenCache') || content.includes('RateLimiter')) { tests.integration.push('โœ… Enhanced utility classes integrated'); } else { tests.integration.push('โŒ Enhanced utility classes not integrated'); } if (content.includes('version: \'1.1.0\'')) { tests.integration.push('โœ… Server version updated to reflect enhancements'); } else { tests.integration.push('โš ๏ธ Server version not updated (may still be 1.0.0)'); } } else { tests.integration.push('โŒ server.ts file not found'); } // Check if index.ts reflects enhanced version const indexPath = './src/index.ts'; if (fs.existsSync(indexPath)) { const content = fs.readFileSync(indexPath, 'utf8'); if (content.includes('1.1.0')) { tests.integration.push('โœ… Index version updated to reflect enhancements'); } else { tests.integration.push('โš ๏ธ Index version not updated'); } } // Display Results console.log('\n๐Ÿ“Š TEST RESULTS SUMMARY'); console.log('=======================\n'); Object.entries(tests).forEach(([category, results]) => { console.log(`${category.toUpperCase()}:`); results.forEach(result => console.log(` ${result}`)); console.log(''); }); // Overall Assessment const allTests = Object.values(tests).flat(); const passedTests = allTests.filter(test => test.includes('โœ…')).length; const failedTests = allTests.filter(test => test.includes('โŒ')).length; const warningTests = allTests.filter(test => test.includes('โš ๏ธ')).length; console.log('OVERALL ASSESSMENT:'); console.log(`โœ… Passed: ${passedTests}`); console.log(`โŒ Failed: ${failedTests}`); console.log(`โš ๏ธ Warnings: ${warningTests}`); console.log(`๐Ÿ“Š Total: ${allTests.length}`); const successRate = (passedTests / allTests.length) * 100; console.log(`\n๐ŸŽฏ Success Rate: ${successRate.toFixed(1)}%`); if (successRate >= 90) { console.log('๐ŸŽ‰ Excellent! All major features are implemented and working.'); } else if (successRate >= 75) { console.log('๐Ÿ‘ Good! Most features are working, some minor issues to address.'); } else if (successRate >= 50) { console.log('โš ๏ธ Fair! Several features need attention.'); } else { console.log('๐Ÿšจ Poor! Major issues need to be resolved.'); } console.log('\nโœจ Feature Test Complete!\n');

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/DynamicEndpoints/m365-core-mcp'

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