test-simple-integration.shโข2.14 kB
#!/bin/bash
# Simple Integration Test for MCP Self-Learning Server
echo "๐งช MCP Self-Learning Server - Simple Integration Test"
echo "===================================================="
# Test 1: CLI Installation
echo -n "1. Global CLI Installation... "
if mcp-learn --version > /dev/null 2>&1; then
echo "โ
PASS"
else
echo "โ FAIL"
exit 1
fi
# Test 2: Service Running
echo -n "2. Service Health Check... "
if curl -s http://localhost:8765/health | grep -q "healthy"; then
echo "โ
PASS"
else
echo "โ FAIL"
exit 1
fi
# Test 3: API Functionality
echo -n "3. API Analysis Endpoint... "
if curl -s -X POST http://localhost:8765/analyze \
-H "Content-Type: application/json" \
-d '{"interaction":{"type":"test","input":"hello","output":"world","success":true}}' | grep -q "success"; then
echo "โ
PASS"
else
echo "โ FAIL"
exit 1
fi
# Test 4: CLI with Service
echo -n "4. CLI Status Command... "
if mcp-learn status | grep -q "Server"; then
echo "โ
PASS"
else
echo "โ FAIL"
exit 1
fi
# Test 5: Node.js Client
echo -n "5. Node.js Client Test... "
cat > temp-test.js << 'EOF'
import SelfLearningClient from './lib/self-learning-client.js';
const client = new SelfLearningClient({ port: 8765 });
try {
const connected = await client.connect();
process.exit(connected ? 0 : 1);
} catch (e) {
process.exit(1);
}
EOF
if timeout 10 node temp-test.js > /dev/null 2>&1; then
echo "โ
PASS"
rm -f temp-test.js
else
echo "โ FAIL"
rm -f temp-test.js
exit 1
fi
# Test 6: Systemd Service
echo -n "6. Systemd Service Status... "
if systemctl --user is-active mcp-self-learning.service | grep -q "active"; then
echo "โ
PASS"
else
echo "โ FAIL"
exit 1
fi
echo
echo "๐ All Integration Tests Passed!"
echo
echo "โ
System Status:"
echo " โข Global CLI: mcp-learn (installed)"
echo " โข REST API: http://localhost:8765 (running)"
echo " โข Systemd Service: active"
echo " โข Node.js Client: functional"
echo " โข Data Persistence: enabled"
echo
echo "๐ MCP Self-Learning Server is ready for Claudio and Claudia integration!"