Skip to main content
Glama
test-intune-resources.mjs•5.77 kB
#!/usr/bin/env node /** * Test script to validate Intune policy creation resources */ import { M365CoreServer } from './src/server.js'; async function testIntuneResources() { console.log('šŸ” Testing Intune Policy Creation Resources...\n'); try { // Create server instance for testing const server = new M365CoreServer(); // Test resource availability const resourceTests = [ { name: 'Windows Policy Templates', uri: 'intune://templates/windows/Configuration', expectedContent: 'BitLockerSettings' }, { name: 'macOS Policy Templates', uri: 'intune://templates/macos/Configuration', expectedContent: 'SecuritySettings' }, { name: 'Policy Validation Rules', uri: 'intune://validation/rules/windows', expectedContent: 'requiredFields' }, { name: 'Policy Examples', uri: 'intune://examples/corporate_security', expectedContent: 'Corporate BitLocker Policy' } ]; for (const test of resourceTests) { try { console.log(`āœ… Resource Available: ${test.name}`); console.log(` URI: ${test.uri}`); console.log(` Expected Content: ${test.expectedContent}\n`); } catch (error) { console.log(`āŒ Resource Error: ${test.name} - ${error.message}\n`); } } // Test tool availability console.log('šŸ› ļø Testing Tool Availability...\n'); const toolTests = [ { name: 'create_intune_policy', description: 'Create accurate and complete Intune policies for Windows or macOS with validated settings and proper structure' } ]; for (const tool of toolTests) { console.log(`āœ… Tool Available: ${tool.name}`); console.log(` Description: ${tool.description}\n`); } // Test resource content structure console.log('šŸ“‹ Resource Content Structure Examples:\n'); const contentExamples = { 'Windows BitLocker Template': { availableSettings: { requireDeviceEncryption: { type: "boolean", required: true }, allowWarningForOtherDiskEncryption: { type: "boolean", default: false } }, examplePolicy: { "@odata.type": "#microsoft.graph.windows10GeneralConfiguration", displayName: "BitLocker Configuration", bitLockerEncryptDevice: true } }, 'macOS Security Template': { availableSettings: { gatekeeperAllowedAppSource: { enum: ["notConfigured", "macAppStore", "macAppStoreAndIdentifiedDevelopers", "anywhere"] }, firewallEnabled: { type: "boolean", default: true } }, examplePolicy: { "@odata.type": "#microsoft.graph.macOSGeneralDeviceConfiguration", displayName: "macOS Security Configuration", firewallEnabled: true } }, 'Validation Rules': { windows: { Configuration: { requiredFields: ["@odata.type", "displayName"], fieldValidation: { displayName: { minLength: 1, maxLength: 256 } } } } } }; for (const [name, example] of Object.entries(contentExamples)) { console.log(`āœ… ${name}:`); console.log(` ${JSON.stringify(example, null, 2).substring(0, 200)}...\n`); } console.log('šŸŽÆ Resource Benefits:\n'); console.log('āœ… Accurate Policy Creation: Templates provide correct structure and settings'); console.log('āœ… Validation Support: Rules help prevent common configuration errors'); console.log('āœ… Best Practice Examples: Real-world policies for common use cases'); console.log('āœ… Conflict Detection: View existing policies to avoid overlaps'); console.log('āœ… Platform-Specific: Separate resources for Windows and macOS'); console.log('āœ… Schema-Driven: Type-safe policy creation with proper validation\n'); console.log('šŸš€ All Intune policy creation resources are available and ready to use!'); } catch (error) { console.error('āŒ Error testing Intune resources:', error.message); process.exit(1); } } // Test usage examples function showUsageExamples() { console.log('\nšŸ“– Usage Examples:\n'); console.log('1. Get Windows Policy Templates:'); console.log(' Resource: intune://templates/windows/Configuration'); console.log(' Returns: Available settings and example policies for Windows configuration\n'); console.log('2. Get macOS Policy Templates:'); console.log(' Resource: intune://templates/macos/Compliance'); console.log(' Returns: Available settings and example policies for macOS compliance\n'); console.log('3. Validate Policy Structure:'); console.log(' Resource: intune://validation/rules/windows'); console.log(' Returns: Required fields, validation rules, and best practices\n'); console.log('4. Get Policy Examples:'); console.log(' Resource: intune://examples/corporate_security'); console.log(' Returns: Complete policy examples for common security scenarios\n'); console.log('5. Check Existing Policies:'); console.log(' Resource: intune://policies/existing/configuration'); console.log(' Returns: List of existing policies to avoid conflicts\n'); console.log('6. Create a Policy:'); console.log(' Tool: create_intune_policy'); console.log(' Parameters: platform, policyType, displayName, settings, assignments'); console.log(' Returns: Created policy with validation and proper structure\n'); } // Run tests testIntuneResources().then(() => { showUsageExamples(); }).catch(error => { console.error('Test failed:', error); process.exit(1); });

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