GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — mcpproxy-go/scripts/test-mcp.sh at main · DocSpring/mcpproxy-go Expand file tree/ Copy pathtest-mcp.shMore file actions executable file ·174 lines (152 loc) · 3.81 KB / Copy pathtest-mcp.shFile metadata and controlsexecutable file ·174 lines (152 loc) · 3.81 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 #!/bin/bash # # MCP Interface Test Script # # Tests the MCP protocol implementation using a real MCP client. # This ensures tool calls, discovery, and history tracking work correctly. # # Usage: # ./scripts/test-mcp.sh [simple|full] # # Arguments: # simple - Run basic connectivity test (default) # full - Run comprehensive test suite # set -e # Configuration MCPPROXY_PORT="${MCPPROXY_PORT:-18080}" MCPPROXY_URL="http://127.0.0.1:${MCPPROXY_PORT}" MCPPROXY_API_KEY="test-mcp-key-12345" DATA_DIR="/tmp/mcpproxy-mcp-test" CONFIG_FILE="$(mktemp /tmp/mcpproxy-test-config.XXXXXX.json)" # Determine test mode TEST_MODE="${1:-simple}" # Colors RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' BLUE='\033[0;34m' NC='\033[0m' # No Color log_info() { echo -e "${BLUE}ℹ${NC} $1" } log_success() { echo -e "${GREEN}✓${NC} $1" } log_warning() { echo -e "${YELLOW}⚠${NC} $1" } log_error() { echo -e "${RED}✗${NC} $1" } # Cleanup function cleanup() { log_info "Cleaning up..." pkill -f "mcpproxy serve" 2>/dev/null || true rm -f "$CONFIG_FILE" rm -rf "$DATA_DIR" } trap cleanup EXIT # Check dependencies log_info "Checking dependencies..." if ! command -v node &> /dev/null; then log_error "Node.js is not installed" exit 1 fi if ! command -v npx &> /dev/null; then log_error "npx is not available" exit 1 fi # Check if MCP SDK is installed, install if needed if ! node -e "import('@modelcontextprotocol/sdk/client/index.js')" 2>/dev/null; then log_info "Installing MCP SDK dependencies..." if [ ! -f "package.json" ]; then npm init -y > /dev/null 2>&1 fi npm install @modelcontextprotocol/sdk --save-dev > /dev/null 2>&1 log_success "MCP SDK installed" fi # Create test configuration log_info "Creating test configuration..." cat > "$CONFIG_FILE" <<EOF { "listen": "127.0.0.1:${MCPPROXY_PORT}", "data_dir": "${DATA_DIR}", "enable_tray": false, "mcpServers": [ { "name": "everything", "command": "npx", "args": ["-y", "@modelcontextprotocol/server-everything"], "protocol": "stdio", "enabled": true, "quarantined": false } ], "logging": { "level": "info", "enable_file": false, "enable_console": true }, "docker_isolation": { "enabled": false } } EOF # Build mcpproxy if needed if [ ! -f "./mcpproxy" ]; then log_info "Building mcpproxy..." CGO_ENABLED=0 go build -o mcpproxy ./cmd/mcpproxy log_success "Build complete" fi # Clean up old data rm -rf "$DATA_DIR" mkdir -p "$DATA_DIR" # Start mcpproxy in background log_info "Starting mcpproxy server..." MCPPROXY_API_KEY="$MCPPROXY_API_KEY" \ ./mcpproxy serve --config="$CONFIG_FILE" > /tmp/mcpproxy-mcp-test.log 2>&1 & MCPPROXY_PID=$! # Wait for server to be ready log_info "Waiting for server to be ready..." for i in {1..30}; do if curl -s -f "${MCPPROXY_URL}/healthz" > /dev/null 2>&1; then log_success "Server is ready" break fi if [ $i -eq 30 ]; then log_error "Server failed to start" cat /tmp/mcpproxy-mcp-test.log exit 1 fi sleep 0.5 done # Give it a moment for everything server to connect sleep 3 # Run tests log_info "Running MCP tests (mode: $TEST_MODE)..." export MCPPROXY_URL export MCPPROXY_API_KEY if [ "$TEST_MODE" = "full" ]; then # Run comprehensive test suite if [ ! -f "tests/mcp/test-suite.mjs" ]; then log_error "Test suite not found: tests/mcp/test-suite.mjs" exit 1 fi node tests/mcp/test-suite.mjs else # Run simple connectivity test if [ ! -f "test-mcp-simple.mjs" ]; then log_error "Test script not found: test-mcp-simple.mjs" exit 1 fi node test-mcp-simple.mjs fi # Check exit code if [ $? -eq 0 ]; then log_success "All tests passed!" exit 0 else log_error "Tests failed" exit 1 fi |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |