Files
funstat-mcp/test_connection.sh
你的用户名 c4be264ea5 Add deployment scripts and documentation
- Add deployment scripts (deploy.sh, test_connection.sh, core/start_server.sh)
- Add deployment documentation (DEPLOYMENT_INFO.md, DEPLOYMENT_SUCCESS.md)
- Add .env.example configuration template
- Add requirements.txt for Python dependencies
- Update README.md with latest information
- Update core/server.py with improvements

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-04 15:19:44 +08:00

46 lines
1.4 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# 测试 Funstat MCP 服务器连接
SERVER_HOST="${1:-172.16.74.159}"
SERVER_PORT="${2:-8091}"
echo "测试 Funstat MCP 服务器连接..."
echo "服务器: $SERVER_HOST:$SERVER_PORT"
echo ""
# 测试 1: TCP 连接
echo "1. 测试 TCP 连接..."
if timeout 3 bash -c "cat < /dev/null > /dev/tcp/$SERVER_HOST/$SERVER_PORT" 2>/dev/null; then
echo " ✅ TCP 连接成功"
else
echo " ❌ TCP 连接失败"
exit 1
fi
# 测试 2: HTTP GET 请求
echo ""
echo "2. 测试 HTTP GET 请求..."
HTTP_CODE=$(curl -s -o /dev/null -w '%{http_code}' --connect-timeout 5 http://$SERVER_HOST:$SERVER_PORT/sse)
if [ "$HTTP_CODE" = "406" ] || [ "$HTTP_CODE" = "200" ]; then
echo " ✅ HTTP 响应: $HTTP_CODE (服务器正常)"
else
echo " ❌ HTTP 响应: $HTTP_CODE"
fi
# 测试 3: SSE 端点
echo ""
echo "3. 测试 SSE 端点Accept: text/event-stream..."
RESPONSE=$(timeout 3 curl -s -H "Accept: text/event-stream" http://$SERVER_HOST:$SERVER_PORT/sse 2>&1 | head -1)
if [ -n "$RESPONSE" ]; then
echo " ✅ SSE 端点响应: $RESPONSE"
else
echo " ⚠️ SSE 端点正在等待连接(正常)"
fi
echo ""
echo "✅ 服务器 $SERVER_HOST:$SERVER_PORT 可以正常访问!"
echo ""
echo "访问地址:"
echo " - SSE 端点: http://$SERVER_HOST:$SERVER_PORT/sse"
echo " - 消息端点: http://$SERVER_HOST:$SERVER_PORT/messages"