This directory contains all files related to creating standalone executable versions of the Sage MCP server using PyInstaller for Windows, macOS, and Linux.
build_executable.py- Main cross-platform Python build script (recommended)build_universal.py- Universal build script that detects platform and runs appropriate buildsage_mcp.spec- PyInstaller specification file with cross-platform support
build.sh- macOS build script wrapper 🍎build_linux.sh- Linux build script wrapper 🐧build.bat- Windows build script wrapper 🪟
hook-fastmcp.py- PyInstaller hook for fastmcp packagehook-sage_data_client.py- PyInstaller hook for sage_data_client packagehooks/- Directory containing PyInstaller hooks
BUILD_EXECUTABLE.md- Detailed build instructionsREADME-EXECUTABLE.md- Usage instructions for the executable
- Python 3.8+
- All project dependencies installed (
pip install -r requirements.txt) - PyInstaller will be automatically installed if needed
Option 1: Universal Python Script (Recommended)
# From the project root directory - works on all platforms
python bundling/build_executable.py
# Or use the universal wrapper
python bundling/build_universal.pyOption 2: Platform-Specific Scripts
# macOS/Linux
./bundling/build.sh # macOS
./bundling/build_linux.sh # Linux
# Windows (Command Prompt or PowerShell)
bundling\build.bat- Windows:
bundling/dist/sage_mcp.exe - macOS/Linux:
bundling/dist/sage_mcp
After building, the directory structure will be:
bundling/
├── build/ # Temporary build files (auto-generated)
├── dist/ # Final executable output
│ └── sage_mcp # The standalone executable
├── hooks/ # PyInstaller hooks
└── ... # Source files
# Run with defaults (binds to 0.0.0.0:8000)
./bundling/dist/sage_mcp
# Run with custom host/port
MCP_HOST=127.0.0.1 MCP_PORT=8080 ./bundling/dist/sage_mcp- The executable is self-contained and includes all Python dependencies
- No Python installation is required on target machines
- The executable size is typically 100-200MB due to included libraries
- Build artifacts in
build/anddist/are automatically cleaned before each build - Hooks ensure proper inclusion of fastmcp and sage_data_client packages
If the build fails:
- Ensure all dependencies are installed:
pip install -r ../requirements.txt - Check that PyInstaller is installed:
pip install pyinstaller - Run from the project root directory, not from the bundling directory
- Check the console output for specific error messages
For runtime issues with the executable:
- Test that the regular Python script works:
python ../sage_mcp.py - Check environment variables are set correctly
- Ensure network ports are available
- Run with verbose output to debug startup issues