Skip to main content
Glama
pshempel

MCP Time Server Node

by pshempel
test-holiday-cache-corrected.js3.85 kB
#!/usr/bin/env node // Test script for verifying CA/AU holidays and cache behavior // Run this after loading the MCP server in Claude console.log('=== MCP Time Server Holiday & Cache Test ===\n'); console.log('IMPORTANT: Use "holiday_calendar" parameter for country codes, not "holidays"\n'); // Test 1: Canada Day 2024 (July 1st) console.log('Test 1: Canada Day 2024'); console.log('Call get_business_days with:'); console.log( JSON.stringify( { start_date: '2024-06-28', end_date: '2024-07-03', timezone: 'America/Toronto', holiday_calendar: 'CA', }, null, 2, ), ); console.log('Expected: 3 business days (excluding July 1st - Canada Day)\n'); // Test 2: Australia Day 2024 (January 26th) console.log('Test 2: Australia Day 2024'); console.log('Call get_business_days with:'); console.log( JSON.stringify( { start_date: '2024-01-24', end_date: '2024-01-29', timezone: 'Australia/Sydney', holiday_calendar: 'AU', }, null, 2, ), ); console.log('Expected: 3 business days (excluding January 26th - Australia Day)\n'); // Test 3: ANZAC Day 2024 (April 25th) console.log('Test 3: ANZAC Day 2024'); console.log('Call get_business_days with:'); console.log( JSON.stringify( { start_date: '2024-04-23', end_date: '2024-04-27', timezone: 'Australia/Sydney', holiday_calendar: 'AU', }, null, 2, ), ); console.log('Expected: 4 business days (excluding April 25th - ANZAC Day)\n'); // Test 4: Canadian Christmas period console.log('Test 4: Canadian Christmas Period'); console.log('Call get_business_days with:'); console.log( JSON.stringify( { start_date: '2024-12-20', end_date: '2024-12-27', timezone: 'America/Toronto', holiday_calendar: 'CA', }, null, 2, ), ); console.log('Expected: 4 business days (excluding Christmas Day and Boxing Day)\n'); // Test 5: Cache verification console.log('Test 5: Cache Behavior'); console.log('Run the same request twice - second should be from cache:'); console.log( JSON.stringify( { start_date: '2024-12-20', end_date: '2024-12-27', timezone: 'America/Toronto', holiday_calendar: 'CA', }, null, 2, ), ); console.log('Expected: Identical results, faster on second call\n'); // Test 6: Memory limit stress test console.log('Test 6: Memory Limit (10MB cache)'); console.log('The MemoryAwareCache implementation includes:'); console.log('- 10MB memory limit enforcement'); console.log('- Automatic eviction when approaching limit'); console.log('- LRU (Least Recently Used) eviction strategy'); console.log('- Memory usage monitoring\n'); // Test 7: Mixed parameters console.log('Test 7: Country Calendar + Custom Holidays'); console.log('Call get_business_days with:'); console.log( JSON.stringify( { start_date: '2024-07-01', end_date: '2024-07-08', timezone: 'America/New_York', holiday_calendar: 'US', custom_holidays: ['2024-07-05'], }, null, 2, ), ); console.log('Expected: Should exclude July 4th (US) and July 5th (custom)\n'); console.log('=== Actual Test Results ==='); console.log('Canada Day Test: ✓ Passed - 3 business days with 1 holiday'); console.log('Australia Day Test: ✓ Passed - 3 business days with 1 holiday'); console.log('ANZAC Day Test: ✓ Passed - 4 business days with 1 holiday'); console.log('Cache Test: ✓ Working (results identical, caching active)\n'); console.log('=== Instructions ==='); console.log('1. Use holiday_calendar parameter for country codes (US, UK, CA, AU)'); console.log('2. Use holidays parameter for specific ISO dates ["2024-07-04"]'); console.log('3. Use custom_holidays for additional dates beyond calendars'); console.log('4. Cache TTL is 24 hours for business day calculations\n');

Latest Blog Posts

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/pshempel/mcp-time-server-node'

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