Spaces:
Sleeping
Sleeping
File size: 763 Bytes
2c6652e ab84d3f 2c6652e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | #!/bin/bash
set -e
# Ensure uv is in PATH
export PATH="/root/.local/bin:$PATH"
echo "Starting MCP Code Executor on Hugging Face Spaces..."
echo "Environment Type: ${ENV_TYPE:-venv-uv}"
echo "Code Storage Dir: ${CODE_STORAGE_DIR:-/app/code_storage}"
echo "Workers: ${WORKERS:-4}"
echo "Max Concurrent Executions: ${MAX_CONCURRENT_EXECUTIONS:-20}"
# Ensure code storage directory exists
mkdir -p "${CODE_STORAGE_DIR:-/app/code_storage}"
# Start uvicorn with optimal settings for HF Spaces
exec uvicorn app.main:app \
--host 0.0.0.0 \
--port 7860 \
--workers "${WORKERS:-4}" \
--loop uvloop \
--http httptools \
--limit-concurrency "${MAX_CONCURRENT_EXECUTIONS:-20}" \
--timeout-keep-alive 65 \
--access-log \
--log-level info |