Skip to content

Update documentation #9

Update documentation

Update documentation #9

name: MCP Integration Tests
on:
push:
branches: [ main, master, develop ]
paths:
- 'vibecode_pkg/**'
- '.github/workflows/mcp-integration-tests.yml'
pull_request:
branches: [ main, master ]
paths:
- 'vibecode_pkg/**'
- '.github/workflows/mcp-integration-tests.yml'
workflow_dispatch:
inputs:
debug_mode:
description: 'Enable debug logging'
required: false
default: 'false'
type: boolean
env:
PYTHON_VERSION: '3.11'
PYTEST_TIMEOUT: 300
jobs:
mcp-integration-tests:
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y curl jq netcat-openbsd
- name: Install Python dependencies
working-directory: ./vibecode_pkg
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -e ".[dev]"
pip install pytest-asyncio pytest-timeout pytest-xdist requests
- name: Verify installation
working-directory: ./vibecode_pkg
run: |
python -c "import vibecode; print('✅ VibeCode imported successfully')"
python -m vibecode.cli --help
- name: Set up test environment
run: |
# Create test directories
mkdir -p /tmp/mcp-test-logs
mkdir -p /tmp/mcp-test-artifacts
# Set environment variables for testing
echo "MCP_TEST_LOG_DIR=/tmp/mcp-test-logs" >> $GITHUB_ENV
echo "MCP_TEST_ARTIFACT_DIR=/tmp/mcp-test-artifacts" >> $GITHUB_ENV
echo "PYTHONPATH=${GITHUB_WORKSPACE}/vibecode_pkg:$PYTHONPATH" >> $GITHUB_ENV
- name: Run OAuth endpoint tests
working-directory: ./vibecode_pkg
run: |
echo "🔐 Testing OAuth 2.1 endpoints..."
python -m pytest tests/test_mcp_auth_integration.py::test_oauth_server_metadata -v --tb=short --timeout=60
python -m pytest tests/test_mcp_auth_integration.py::test_dynamic_client_registration -v --tb=short --timeout=60
python -m pytest tests/test_mcp_auth_integration.py::test_health_endpoint -v --tb=short --timeout=60
- name: Run MCP protocol compliance tests
working-directory: ./vibecode_pkg
run: |
echo "📡 Testing MCP protocol compliance..."
python -m pytest tests/test_mcp_auth_integration.py::test_mcp_protocol_without_auth -v --tb=short --timeout=90
python -m pytest tests/test_mcp_auth_integration.py::test_cors_headers -v --tb=short --timeout=60
- name: Run server startup tests
working-directory: ./vibecode_pkg
run: |
echo "🚀 Testing server startup and connectivity..."
python -m pytest tests/test_mcp_auth_integration.py::test_server_startup_local_mode -v --tb=short --timeout=120
- name: Run full OAuth flow integration test
working-directory: ./vibecode_pkg
continue-on-error: true # OAuth flow might be complex in CI
run: |
echo "🔄 Testing complete OAuth authorization flow..."
python -m pytest tests/test_mcp_auth_integration.py::test_oauth_authorization_flow -v --tb=short --timeout=120
- name: Run authenticated MCP tests
working-directory: ./vibecode_pkg
continue-on-error: true # Authentication might be complex in CI
run: |
echo "🔒 Testing authenticated MCP protocol..."
python -m pytest tests/test_mcp_auth_integration.py::test_mcp_protocol_with_auth -v --tb=short --timeout=120
- name: Run all existing tests
working-directory: ./vibecode_pkg
run: |
echo "✅ Running existing test suite..."
python -m pytest tests/ -v --tb=short --timeout=180 --ignore=tests/test_mcp_auth_integration.py
- name: Test CLI functionality
working-directory: ./vibecode_pkg
run: |
echo "⚙️ Testing CLI commands..."
timeout 10s python -m vibecode.cli start --no-tunnel --no-auth --port 8303 &
CLI_PID=$!
sleep 3
# Test health endpoint
if curl -f http://localhost:8303/health; then
echo "✅ CLI health check passed"
else
echo "❌ CLI health check failed"
fi
kill $CLI_PID 2>/dev/null || true
- name: Collect server logs
if: always()
run: |
echo "📋 Collecting test artifacts..."
# Collect any server logs
find /tmp -name "*.log" -type f 2>/dev/null | head -10 | while read logfile; do
echo "=== $logfile ==="
tail -50 "$logfile" || true
echo
done
# Collect pytest logs
if [ -f pytest.log ]; then
echo "=== pytest.log ==="
cat pytest.log
fi
# Show running processes (for debugging)
echo "=== Running processes ==="
ps aux | grep -E "(python|vibecode|uvicorn)" || true
# Show network connections
echo "=== Network connections ==="
netstat -tlpn 2>/dev/null | grep -E ":(83[0-9][0-9]|8300)" || true
- name: Upload test artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: mcp-test-artifacts-py${{ matrix.python-version }}
path: |
/tmp/mcp-test-logs/
/tmp/mcp-test-artifacts/
vibecode_pkg/pytest.log
retention-days: 7
- name: Generate test summary
if: always()
run: |
echo "## 🧪 MCP Integration Test Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "- **Python Version**: ${{ matrix.python-version }}" >> $GITHUB_STEP_SUMMARY
echo "- **Test Environment**: Ubuntu Latest" >> $GITHUB_STEP_SUMMARY
echo "- **Timestamp**: $(date -u '+%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ "${{ job.status }}" = "success" ]; then
echo "✅ **Status**: All tests passed successfully" >> $GITHUB_STEP_SUMMARY
else
echo "❌ **Status**: Some tests failed (check logs above)" >> $GITHUB_STEP_SUMMARY
fi
echo "" >> $GITHUB_STEP_SUMMARY
echo "### 📊 Test Categories" >> $GITHUB_STEP_SUMMARY
echo "- OAuth 2.1 endpoints and metadata" >> $GITHUB_STEP_SUMMARY
echo "- Dynamic Client Registration (DCR)" >> $GITHUB_STEP_SUMMARY
echo "- MCP protocol compliance" >> $GITHUB_STEP_SUMMARY
echo "- Server startup and health checks" >> $GITHUB_STEP_SUMMARY
echo "- CORS configuration" >> $GITHUB_STEP_SUMMARY
echo "- CLI functionality" >> $GITHUB_STEP_SUMMARY
test-cloudflare-tunnel:
runs-on: ubuntu-latest
timeout-minutes: 10
if: github.event_name == 'workflow_dispatch' && github.event.inputs.debug_mode == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install cloudflared
run: |
curl -L https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb -o cloudflared.deb
sudo dpkg -i cloudflared.deb
cloudflared --version
- name: Test tunnel creation (dry run)
run: |
echo "🌐 Testing Cloudflare tunnel capabilities..."
# Test that cloudflared is working
cloudflared tunnel --help
# Test quick tunnel (without authentication)
timeout 30s cloudflared tunnel --url http://localhost:8080 &
TUNNEL_PID=$!
sleep 5
# Check if tunnel process is running
if ps -p $TUNNEL_PID > /dev/null; then
echo "✅ Cloudflared tunnel process started successfully"
else
echo "❌ Cloudflared tunnel failed to start"
fi
kill $TUNNEL_PID 2>/dev/null || true
debug-environment:
runs-on: ubuntu-latest
if: failure() || github.event.inputs.debug_mode == 'true'
needs: [mcp-integration-tests]
steps:
- name: Debug environment
run: |
echo "🔍 Environment debugging information"
echo "======================================"
echo "System Info:"
uname -a
cat /etc/os-release
echo -e "\nPython Info:"
which python3
python3 --version
echo -e "\nNetwork Info:"
ip addr show || ifconfig
netstat -tlpn | head -20
echo -e "\nProcess Info:"
ps aux | head -20
echo -e "\nDisk Usage:"
df -h
echo -e "\nMemory Usage:"
free -h