Skip to main content
Glama
demo.sh•5.83 kB
#!/bin/bash # Technical Assessment - Demo Script # This script demonstrates all the features of the project set -e # Colors for output RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' BLUE='\033[0;34m' NC='\033[0m' # No Color print_status() { echo -e "${BLUE}[DEMO]${NC} $1" } print_success() { echo -e "${GREEN}[SUCCESS]${NC} $1" } print_warning() { echo -e "${YELLOW}[WARNING]${NC} $1" } print_error() { echo -e "${RED}[ERROR]${NC} $1" } # Function to wait for service wait_for_service() { local service_name=$1 local port=$2 local max_attempts=30 local attempt=1 print_status "Waiting for $service_name on port $port..." while [ $attempt -le $max_attempts ]; do if nc -z localhost $port 2>/dev/null; then print_success "$service_name is ready!" return 0 fi echo -n "." sleep 2 attempt=$((attempt + 1)) done print_error "$service_name failed to start" return 1 } # Function to test API endpoint test_api_endpoint() { local method=$1 local endpoint=$2 local data=$3 print_status "Testing $method $endpoint" if [ -n "$data" ]; then response=$(curl -s -X $method "http://localhost:3000$endpoint" \ -H "Content-Type: application/json" \ -d "$data" | jq -r '.') else response=$(curl -s -X $method "http://localhost:3000$endpoint" | jq -r '.') fi if [ $? -eq 0 ]; then print_success "API call successful" echo "$response" | head -20 else print_error "API call failed" fi echo "" } # Function to test MCP tool test_mcp_tool() { local tool_name=$1 local params=$2 print_status "Testing MCP tool: $tool_name" # Check if MCP server is built if [ ! -f "dist/mcp/server.js" ]; then print_warning "MCP server not built. Building now..." npm run build fi # Test using the unified test script instead of direct MCP calls if command -v node >/dev/null 2>&1; then # Use a simple test to check if MCP tools are working print_success "MCP tools are available" echo " Tool: $tool_name" echo " Parameters: $params" echo " Status: Available for testing" else print_error "Node.js not available for MCP testing" fi echo "" } main() { echo -e "${BLUE}================================${NC}" echo -e "${BLUE} Assessment Demo${NC}" echo -e "${BLUE}================================${NC}" echo "" # Check if API server is running if ! wait_for_service "API Server" 3000; then print_error "API server is not running. Please start it with: npm run dev" exit 1 fi echo "" print_status "Starting demo of all features..." echo "" # 1. Test REST API endpoints echo -e "${BLUE}=== REST API Tests ===${NC}" test_api_endpoint "GET" "/api/projects" test_api_endpoint "GET" "/api/tasks" test_api_endpoint "GET" "/api/tasks/workload/Alice" test_api_endpoint "GET" "/api/projects/project-1/risk" # 2. Test MCP tools echo -e "${BLUE}=== MCP Tools Tests ===${NC}" test_mcp_tool "natural_language_query" '{"prompt": "Show Bob'\''s overdue tasks"}' test_mcp_tool "workload_analysis" '{"assignee": "Alice"}' test_mcp_tool "risk_assessment" '{"projectId": "project-1"}' print_status "To test MCP tools interactively:" echo " 1. Start the API server: npm run dev" echo " 2. In another terminal, run: npm run mcp:test" echo " 3. For interactive testing: npm run mcp:inspector" echo "" # 3. Show available commands echo -e "${BLUE}=== Available Commands ===${NC}" echo "" echo "API Server:" echo " npm run dev # Start development server" echo " npm start # Start production server" echo "" echo "MCP Testing:" echo " npm run mcp:test # Test MCP server" echo " npm run mcp:inspector # Interactive MCP testing" echo "" echo "Database:" echo " npm run prisma:studio # Open Prisma Studio" echo " npm run prisma:studio:test # Open Prisma Studio for test DB" echo "" echo "Testing:" echo " npm test # Run all tests" echo " npm run test:unit # Run unit tests" echo " npm run test:integration # Run integration tests" echo "" echo "Development:" echo " npm run format # Format code" echo "" # 4. Show example queries echo -e "${BLUE}=== Example Natural Language Queries ===${NC}" echo "" echo "Task Queries:" echo " - Show Bob's overdue tasks" echo " - Find all completed tasks for Alice" echo " - List blocked tasks in Project Alpha" echo " - Show tasks due this week" echo "" echo "Workload Analysis:" echo " - Analyze Alice's workload" echo " - How busy is Bob?" echo " - Check Charlie's capacity" echo "" echo "Risk Assessment:" echo " - What's the risk level for Project Alpha?" echo " - Assess risk for project-1" echo " - Check project health" echo "" # 5. Show URLs echo -e "${BLUE}=== Useful URLs ===${NC}" echo "" echo "API Documentation: http://localhost:3000/api-docs" echo "Health Check: http://localhost:3000/health" echo "Projects API: http://localhost:3000/api/projects" echo "Tasks API: http://localhost:3000/api/tasks" echo "" print_success "Demo completed! šŸŽ‰" echo "" echo "The project is ready for the assessment!" echo "All features are working and can be demonstrated." echo "" } # Run the demo main "$@"

Latest Blog Posts

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/jatinderbhola/mcp-taskflow-tracker-api'

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