Skip to main content
Glama

SAP Note Search MCP Server

by marianfoo
debug-container.shโ€ข6.4 kB
#!/bin/bash # Docker Container Debugging Script for SAP Notes MCP Server # This script helps debug Playwright and Chromium issues in Docker containers echo "๐Ÿณ SAP Notes MCP Server - Docker Debug Script" echo "==============================================" echo "" # Colors for output RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' BLUE='\033[0;34m' NC='\033[0m' # No Color # Function to run commands with error handling run_cmd() { local cmd="$1" local description="$2" echo -e "${BLUE}[DEBUG]${NC} $description" echo "Running: $cmd" if eval "$cmd"; then echo -e "${GREEN}โœ… Success${NC}" else echo -e "${RED}โŒ Failed${NC}" fi echo "" } # Check if we're in a Docker container if [ -f /.dockerenv ] || grep -q 'docker' /proc/self/cgroup 2>/dev/null; then echo -e "${GREEN}โœ… Running inside Docker container${NC}" else echo -e "${YELLOW}โš ๏ธ Not running in Docker container${NC}" fi echo "" # 1. System Information echo -e "${BLUE}๐Ÿ” SYSTEM INFORMATION${NC}" echo "Platform: $(uname -a)" echo "Memory: $(free -h | grep Mem: | awk '{print $2 " total, " $7 " available"}')" echo "Disk space: $(df -h / | tail -1 | awk '{print $2 " total, " $4 " available"}')" echo "" # 2. Package Manager and Browser Installation echo -e "${BLUE}๐Ÿ“ฆ CHECKING BROWSERS${NC}" # Check for browsers browsers=("/usr/bin/chromium" "/usr/bin/chromium-browser" "/usr/bin/google-chrome" "/usr/bin/firefox") found_browser=false for browser in "${browsers[@]}"; do if [ -f "$browser" ]; then echo -e "${GREEN}โœ… Found: $browser${NC}" echo " Version: $($browser --version 2>/dev/null || echo 'Unknown')" found_browser=true else echo -e "${RED}โŒ Not found: $browser${NC}" fi done if [ "$found_browser" = false ]; then echo -e "${YELLOW}โš ๏ธ No system browsers found${NC}" # Try to install chromium if we have apk (Alpine) if command -v apk >/dev/null 2>&1; then echo "Installing Chromium via APK..." run_cmd "apk update && apk add --no-cache chromium nss freetype harfbuzz ca-certificates fonts-noto" "Installing browser dependencies" elif command -v apt-get >/dev/null 2>&1; then echo "Installing Chromium via APT..." run_cmd "apt-get update && apt-get install -y chromium-browser" "Installing Chromium" fi fi echo "" # 3. Playwright Environment echo -e "${BLUE}๐ŸŽญ PLAYWRIGHT ENVIRONMENT${NC}" echo "PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: ${PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD:-NOT_SET}" echo "PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH: ${PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH:-NOT_SET}" echo "PLAYWRIGHT_BROWSERS_PATH: ${PLAYWRIGHT_BROWSERS_PATH:-NOT_SET}" # Check Playwright cache CACHE_DIR="${PLAYWRIGHT_BROWSERS_PATH:-$HOME/.cache/ms-playwright}" echo "Cache directory: $CACHE_DIR" if [ -d "$CACHE_DIR" ]; then echo -e "${GREEN}โœ… Cache directory exists${NC}" echo "Contents:" ls -la "$CACHE_DIR" | head -10 if [ $(ls -1 "$CACHE_DIR" | wc -l) -eq 0 ]; then echo -e "${YELLOW}โš ๏ธ Cache directory is empty${NC}" fi else echo -e "${RED}โŒ Cache directory does not exist${NC}" fi echo "" # 4. Install Playwright browsers if needed echo -e "${BLUE}๐Ÿ“ฅ PLAYWRIGHT BROWSERS${NC}" if [ ! -d "$CACHE_DIR" ] || [ $(ls -1 "$CACHE_DIR" 2>/dev/null | wc -l) -eq 0 ]; then echo "Installing Playwright browsers..." cd /app/mcp-servers/mcp-sap-notes || exit 1 run_cmd "npm run build" "Building SAP Notes server" run_cmd "npx playwright install chromium" "Installing Playwright Chromium" else echo -e "${GREEN}โœ… Playwright browsers appear to be installed${NC}" fi echo "" # 5. Run comprehensive debug test echo -e "${BLUE}๐Ÿงช RUNNING COMPREHENSIVE DEBUG TEST${NC}" cd /app/mcp-servers/mcp-sap-notes || exit 1 if [ -f "test/test-docker-debug.js" ]; then run_cmd "node test/test-docker-debug.js" "Running Docker debug test" else echo -e "${RED}โŒ Docker debug test not found${NC}" fi echo "" # 6. Run authentication test with debug echo -e "${BLUE}๐Ÿ” RUNNING AUTHENTICATION TEST${NC}" # Check for certificate and environment if [ -n "$PFX_PATH" ] && [ -f "$PFX_PATH" ]; then echo -e "${GREEN}โœ… Certificate found: $PFX_PATH${NC}" echo " File size: $(du -h "$PFX_PATH" | cut -f1)" echo " Permissions: $(ls -l "$PFX_PATH" | cut -d' ' -f1)" # Set debugging environment export HEADFUL=false export LOG_LEVEL=debug echo "Running authentication test with enhanced debugging..." run_cmd "npm run test:auth" "SAP authentication test" else echo -e "${YELLOW}โš ๏ธ Certificate not configured or not found${NC}" echo "PFX_PATH: ${PFX_PATH:-NOT_SET}" if [ -n "$PFX_PATH" ]; then echo "File exists: $([ -f "$PFX_PATH" ] && echo 'YES' || echo 'NO')" fi fi echo "" # 7. Manual browser test echo -e "${BLUE}๐ŸŒ MANUAL BROWSER TEST${NC}" if [ -f "/usr/bin/chromium" ]; then echo "Testing manual browser launch..." timeout 10s chromium --headless --disable-gpu --no-sandbox --dump-dom --virtual-time-budget=1000 data:text/html,"<h1>Test</h1>" 2>&1 | head -5 if [ $? -eq 0 ]; then echo -e "${GREEN}โœ… Manual browser test successful${NC}" else echo -e "${RED}โŒ Manual browser test failed${NC}" fi else echo -e "${YELLOW}โš ๏ธ No chromium executable found for manual test${NC}" fi echo "" # 8. Summary and recommendations echo -e "${BLUE}๐Ÿ“‹ SUMMARY AND RECOMMENDATIONS${NC}" if [ "$found_browser" = true ]; then echo -e "${GREEN}โœ… System browser available${NC}" else echo -e "${RED}โŒ No system browser found - install chromium${NC}" fi if [ -d "$CACHE_DIR" ] && [ $(ls -1 "$CACHE_DIR" 2>/dev/null | wc -l) -gt 0 ]; then echo -e "${GREEN}โœ… Playwright browsers installed${NC}" else echo -e "${RED}โŒ Playwright browsers missing - run 'npx playwright install'${NC}" fi if [ -n "$PFX_PATH" ] && [ -f "$PFX_PATH" ]; then echo -e "${GREEN}โœ… Certificate configured${NC}" else echo -e "${YELLOW}โš ๏ธ Certificate not configured${NC}" fi echo "" echo -e "${BLUE}๐ŸŽฏ Next steps:${NC}" echo "1. Fix any issues identified above" echo "2. Run: npm run test:auth" echo "3. If successful, the MCP server should work" echo "4. Check server logs: docker logs <container_name>" echo "" echo -e "${GREEN}Debug script completed!${NC}"

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/marianfoo/mcp-sap-notes'

If you have feedback or need assistance with the MCP directory API, please join our Discord server