Skip to main content
Glama
test.shโ€ข5.44 kB
#!/bin/bash # ACI MCP Server Test Runner # This script provides multiple ways to test the ACI MCP server set -e echo "๐Ÿงช ACI MCP Server Test Suite" 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 print colored output print_color() { echo -e "${1}${2}${NC}" } # Check if dependencies are installed check_dependencies() { print_color $BLUE "๐Ÿ“ฆ Checking dependencies..." if [ ! -d "node_modules" ]; then print_color $YELLOW "โš ๏ธ Node modules not found, installing..." npm install fi if [ ! -d "build" ]; then print_color $YELLOW "๐Ÿ”จ Build directory not found, building project..." npm run build fi } # Show usage show_usage() { echo "Usage: $0 [OPTIONS] [TEST_TYPE]" echo "" echo "Test Types:" echo " unit - Run unit tests (requires Jest installation)" echo " integration - Run integration tests against mock or real APIC" echo " manual - Start interactive manual testing tool" echo " mock - Start mock APIC server for development" echo " coverage - Run tests with coverage report" echo " all - Run all automated tests" echo "" echo "Options:" echo " --real - Use real APIC instead of mock server" echo " --mock - Force use of mock server (default)" echo " --help, -h - Show this help" echo "" echo "Examples:" echo " $0 unit # Run unit tests" echo " $0 integration --mock # Integration tests with mock" echo " $0 integration --real # Integration tests with real APIC" echo " $0 manual # Interactive testing" echo " $0 mock # Start mock server" } # Run unit tests run_unit_tests() { print_color $BLUE "๐Ÿงฉ Running Unit Tests..." if command -v jest >/dev/null 2>&1; then npm test else print_color $YELLOW "โš ๏ธ Jest not installed. Installing test dependencies..." npm install --save-dev npm test fi } # Run integration tests run_integration_tests() { local use_mock=${1:-true} print_color $BLUE "๐Ÿ”— Running Integration Tests..." if [ "$use_mock" = "true" ]; then print_color $BLUE "๐Ÿ“ก Using Mock APIC Server" node build/test/integration.test.js --mock else print_color $BLUE "๐ŸŒ Using Real APIC (ensure ACI_* environment variables are set)" # Check if real APIC configuration exists if [ -z "$ACI_APIC_URL" ] && [ ! -f "aci-config.json" ]; then print_color $RED "โŒ No APIC configuration found!" print_color $YELLOW "Set ACI_APIC_URL and other environment variables, or create aci-config.json" exit 1 fi node build/test/integration.test.js fi } # Start manual testing tool run_manual_tests() { local use_mock=${1:-true} print_color $BLUE "๐ŸŽฎ Starting Manual Testing Tool..." if [ "$use_mock" = "true" ]; then print_color $BLUE "๐Ÿ“ก Using Mock APIC Server" node build/test/manual-test.js --mock else print_color $BLUE "๐ŸŒ Using Real APIC" node build/test/manual-test.js fi } # Start mock server start_mock_server() { print_color $BLUE "๐Ÿ“ก Starting Mock APIC Server..." print_color $YELLOW "Press Ctrl+C to stop" node build/test/mock-server.js } # Run coverage tests run_coverage_tests() { print_color $BLUE "๐Ÿ“Š Running Tests with Coverage..." npm run test:coverage } # Main script logic main() { local test_type="" local use_mock="true" # Parse arguments while [[ $# -gt 0 ]]; do case $1 in --help|-h) show_usage exit 0 ;; --real) use_mock="false" shift ;; --mock) use_mock="true" shift ;; unit|integration|manual|mock|coverage|all) test_type="$1" shift ;; *) print_color $RED "โŒ Unknown option: $1" show_usage exit 1 ;; esac done # If no test type specified, show usage if [ -z "$test_type" ]; then show_usage exit 1 fi # Check dependencies check_dependencies # Run the specified test type case $test_type in unit) run_unit_tests ;; integration) run_integration_tests "$use_mock" ;; manual) run_manual_tests "$use_mock" ;; mock) start_mock_server ;; coverage) run_coverage_tests ;; all) print_color $BLUE "๐Ÿš€ Running All Automated Tests..." echo "" run_unit_tests echo "" run_integration_tests "$use_mock" echo "" run_coverage_tests ;; esac print_color $GREEN "โœ… Test execution completed!" } # Trap Ctrl+C trap 'print_color $YELLOW "\n๐Ÿ›‘ Test execution interrupted"; exit 130' INT # Run main function main "$@"

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/jim-coyne/ACI_MCP'

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