chore: initial commit

This commit is contained in:
你的用户名
2025-11-01 21:58:03 +08:00
commit a05a7dd40e
65 changed files with 16590 additions and 0 deletions

58
core/start_sse_prod.sh Executable file
View File

@@ -0,0 +1,58 @@
#!/bin/bash
# Funstat MCP SSE 服务器 - 生产启动脚本
set -e
cd "$(dirname "$0")"
# 停止旧实例
echo "🛑 停止旧服务器..."
pkill -f "funstat_mcp/server.py" 2>/dev/null || true
sleep 2
# 确保 session 文件没有被锁定
if lsof /Users/lucas/telegram_sessions/funstat_bot.session 2>/dev/null; then
echo "⚠️ Session 文件被占用,强制终止..."
pkill -9 -f "funstat_mcp/server.py" || true
sleep 2
fi
# 启动新服务器
echo "🚀 启动新服务器..."
python3 server.py > /tmp/funstat_sse.log 2>&1 &
SERVER_PID=$!
# 等待启动
sleep 3
# 验证启动
if ps -p $SERVER_PID > /dev/null; then
echo "✅ 服务器已启动 (PID: $SERVER_PID)"
echo "📡 SSE 端点: http://127.0.0.1:8091/sse"
echo "📋 日志文件: /tmp/funstat_sse.log"
# 测试端点
echo ""
echo "🧪 测试端点..."
if curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:8091/sse | grep -q "200"; then
echo "✅ GET /sse 测试通过"
else
echo "❌ GET /sse 测试失败"
fi
if curl -s -o /dev/null -w "%{http_code}" -X POST http://127.0.0.1:8091/sse -H 'Content-Type: application/json' -d '{}' | grep -q "200"; then
echo "✅ POST /sse 测试通过"
else
echo "❌ POST /sse 测试失败"
fi
echo ""
echo "📊 服务器状态:"
echo " 进程ID: $SERVER_PID"
echo " 监听地址: http://127.0.0.1:8091"
echo " 日志: tail -f /tmp/funstat_sse.log"
else
echo "❌ 服务器启动失败!"
echo "查看日志: tail -50 /tmp/funstat_sse.log"
exit 1
fi