This document provides comprehensive information about testing the Lunar MCP Server, including test scripts, coverage, and methodologies.
The Lunar MCP Server includes a comprehensive test suite that validates:
- MCP protocol compliance and STDIO communication
- All 15 available tools across multiple categories
- Error handling and edge cases
- Multi-cultural support (Chinese, Islamic, Hindu, Western)
- Real-world usage scenarios
All test scripts are located in the ./scripts/ directory and are designed to test the MCP server in STDIO mode without requiring external dependencies.
Comprehensive test suite with full coverage
./scripts/test_mcp_final.shFeatures:
- ✅ Server startup and STDIO handling verification
- ✅ MCP protocol initialization testing
- ✅ Complete tool listing with categorization
- ✅ All 15 tools tested with realistic parameters
- ✅ Error handling validation (invalid tools, missing parameters)
- ✅ Multi-cultural context testing
- ✅ Detailed reporting with color-coded output
Test Categories:
-
Auspicious/Fortune Tools (4 tools)
check_auspicious_date- Wedding date validationfind_good_dates- Business opening date searchget_daily_fortune- Daily fortune informationcheck_zodiac_compatibility- Zodiac compatibility analysis
-
Festival Tools (4 tools)
get_lunar_festivals- Festival lookup for specific datesget_next_festival- Upcoming festival discoveryget_festival_details- Detailed festival informationget_annual_festivals- Complete yearly festival calendar
-
Moon/Lunar Tools (4 tools)
get_moon_phase- Current moon phase calculationget_moon_calendar- Monthly moon phase calendarget_moon_influence- Moon's influence on activitiespredict_moon_phases- Future moon phase predictions
-
Calendar Conversion Tools (3 tools)
solar_to_lunar- Solar to lunar date conversionlunar_to_solar- Lunar to solar date conversionget_zodiac_info- Zodiac information retrieval
Basic functionality test
./scripts/test_mcp_simple.shFeatures:
- Quick server startup verification
- Basic tool execution testing
- Minimal dependency validation
- Fast execution (< 30 seconds)
Advanced FIFO-based testing
./scripts/test_mcp_server.shFeatures:
- FIFO-based server communication
- Background server process management
- Concurrent request handling
- Advanced cleanup mechanisms
Python-based test implementation
uv run python ./scripts/test_mcp_comprehensive.pyFeatures:
- Native Python MCP client implementation
- Asynchronous server communication
- Detailed response validation
- Object-oriented test structure
✅ Server handles STDIO correctly
✅ Server responds to initialization
✅ Server can list tools
✅ All comprehensive tests passed!=== Comprehensive Test Summary ===
Total comprehensive tests: 15/15
Cultural contexts tested: 4/4
Category breakdown:
- Auspicious/Fortune: 4/4
- Festival: 4/4
- Moon/Lunar: 4/4
- Calendar Conversion: 3/3✅ Server correctly handles invalid tool name
✅ Server correctly handles missing parameters
✅ chinese culture works
✅ islamic culture works
✅ hindu culture works
✅ western culture worksThe test suite validates tools with realistic parameters:
// Auspicious date checking
{
"date": "2024-01-01",
"activity": "wedding",
"culture": "chinese"
}
// Moon phase analysis
{
"date": "2024-01-01",
"location": "0,0"
}
// Festival lookup
{
"date": "2024-02-10",
"culture": "chinese"
}Tests verify proper error handling for:
- Invalid tool names: Returns structured error with tool name
- Missing required parameters: Validates input schema
- Malformed requests: Proper JSON-RPC error responses
Each cultural tradition is tested:
- Chinese: Traditional lunar calendar and zodiac
- Islamic: Hijri calendar system
- Hindu: Panchang calendar system
- Western: Modern astrological system
- Complete suite: ~2-3 minutes
- Simple test: ~30 seconds
- Individual tool: ~5-10 seconds per tool
- Memory: Minimal (< 50MB during testing)
- CPU: Light (server startup and JSON processing)
- Network: None (local STDIO communication)
❌ Server failed to start (exit code: 1)Solutions:
- Verify
uvinstallation:uv --version - Check dependencies:
uv sync --dev - Validate environment:
uv run python --version
❌ tool_name failed
Response: {"error": "...", "tool": "tool_name"}Solutions:
- Check parameter format and required fields
- Validate date formats (YYYY-MM-DD)
- Ensure cultural context is supported
❌ No response receivedSolutions:
- Increase timeout values in test script
- Check system resources
- Verify server process isn't hanging
For detailed debugging, modify test scripts to show full responses:
# Add debug output to test scripts
echo "Full response: $RESPONSE"Or run individual tools manually:
echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_moon_phase","arguments":{"date":"2024-01-01"}}}' | uv run lunar-mcp-server- Identify test category (Auspicious, Festival, Moon, Conversion)
- Define realistic parameters based on tool schema
- Add to appropriate test section in
test_mcp_final.sh - Verify with manual testing before committing
# Test function template
test_single_tool() {
local tool_name="$1"
local args="$2"
local desc="$3"
# Create MCP request
cat > test.json << EOF
{"jsonrpc":"2.0","id":1,"method":"initialize",...}
{"jsonrpc":"2.0","method":"notifications/initialized"}
{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"$tool_name","arguments":$args}}
EOF
# Execute and validate
response=$(cat test.json | timeout 15s uv run lunar-mcp-server 2>/dev/null | tail -1)
if echo "$response" | grep -q '"result"'; then
echo "✅ $tool_name works"
return 0
else
echo "❌ $tool_name failed"
return 1
fi
}name: MCP Server Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v2
- name: Install dependencies
run: uv sync --dev
- name: Run MCP tests
run: ./scripts/test_mcp_final.shFor automated testing environments:
# Run tests with machine-readable output
./scripts/test_mcp_final.sh 2>&1 | tee test_results.log
# Parse results
if grep -q "All comprehensive tests passed" test_results.log; then
echo "Tests passed"
exit 0
else
echo "Tests failed"
exit 1
fiThis comprehensive testing approach ensures the Lunar MCP Server maintains high quality and reliability across all supported features and cultural contexts.