start.sh 802 B

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env bash
  2. # 小智AI MCP Server 启动脚本(macOS/Linux)
  3. set -e
  4. cd "$(dirname "$0")"
  5. if [ ! -f .env ]; then
  6. echo "⚠️ 未发现 .env,已复制 .env.example 为 .env,请填入 MCP_ENDPOINT 后再启动"
  7. cp .env.example .env
  8. fi
  9. # 加载 .env
  10. set -a
  11. # shellcheck disable=SC1091
  12. source .env
  13. set +a
  14. if [ -z "${MCP_ENDPOINT:-}" ] || [[ "$MCP_ENDPOINT" == *"your_token_here"* ]]; then
  15. echo "❌ 请先在 .env 中填入真实的 MCP_ENDPOINT"
  16. exit 1
  17. fi
  18. # 安装依赖(首次)
  19. if [ ! -d .venv ]; then
  20. echo "🔧 创建虚拟环境并安装依赖..."
  21. python3 -m venv .venv
  22. .venv/bin/pip install -r requirements.txt
  23. fi
  24. # shellcheck disable=SC1091
  25. source .venv/bin/activate
  26. echo "🚀 启动 MCP Server,桥接到小智AI..."
  27. exec python mcp_pipe.py audio_server.py