- Implemented `run-server.ps1` for setting up the Zen MCP server environment, including virtual environment creation, dependency installation, and Docker cleanup. - Added logging and error handling throughout the setup process. - Included functions for validating API keys and configuring integration with Claude Desktop and Gemini CLI. - Created `run_integration_tests.ps1` to execute integration tests with real API calls, including checks for API key availability and environment setup. - Enhanced output with color-coded messages for better user experience. Patch directory added for cross-platform patching support (`patch_crossplatform.py`).
2.7 KiB
2.7 KiB
Cross-Platform Compatibility Patches
This directory contains patch scripts to improve the cross-platform compatibility of the zen-mcp server.
Files
patch_crossplatform.py
Main script that automatically applies all necessary fixes to resolve cross-platform compatibility issues.
Usage:
# From the patch/ directory
python patch_crossplatform.py [--dry-run] [--backup] [--validate-only]
Options:
--dry-run: Show changes without applying them--backup: Create a backup before modifying files--validate-only: Only check if the fixes are already applied
validation_crossplatform.py
Validation script that tests whether all fixes work correctly.
Usage:
# From the patch/ directory
python validation_crossplatform.py
Applied Fixes
-
HOME DIRECTORY DETECTION ON WINDOWS:
- Linux tests (/home/ubuntu) failed on Windows
- Unix patterns were not detected due to backslashes
- Solution: Added Windows patterns + double path check
-
UNIX PATH VALIDATION ON WINDOWS:
- Unix paths (/etc/passwd) were rejected as relative paths
- Solution: Accept Unix paths as absolute on Windows
-
CROSS-PLATFORM TESTS:
- Assertions used OS-specific separators
- The safe_files test used a non-existent file on Windows
- Solution: Use Path.parts + temporary files on Windows
-
SHELL SCRIPT COMPATIBILITY ON WINDOWS:
- Shell scripts did not detect Windows virtual environment paths
- Solution: Added detection for .zen_venv/Scripts/ paths
-
COMMUNICATION SIMULATOR LOGGER BUG:
- AttributeError: logger used before initialization
- Solution: Initialize logger before calling _get_python_path()
-
PYTHON PATH DETECTION ON WINDOWS:
- The simulator could not find the Windows Python executable
- Solution: Added Windows-specific detection
How to Use
-
Apply all fixes:
cd patch/ python patch_crossplatform.py -
Test in dry-run mode (preview):
cd patch/ python patch_crossplatform.py --dry-run -
Validate the fixes:
cd patch/ python validation_crossplatform.py -
Check if fixes are already applied:
cd patch/ python patch_crossplatform.py --validate-only
Modified Files
utils/file_utils.py: Home patterns + Unix path validationtests/test_file_protection.py: Cross-platform assertionstests/test_utils.py: Safe_files test with temporary filerun_integration_tests.sh: Windows venv detectioncode_quality_checks.sh: venv and Windows tools detectioncommunication_simulator_test.py: Logger initialization order + Windows paths
Tests should now pass on Windows, macOS, and Linux!