test-tools.sh•1.69 kB
#!/bin/bash
# Test script for MCP server tools
BASE_URL="http://localhost:3001"
echo "=== Testing MCP Server ==="
echo ""
# Test 1: Check server status
echo "1. Testing server status endpoint..."
curl -s "$BASE_URL/mcp/status" | jq .
echo ""
echo ""
# Test 2: List available tools
echo "2. Listing available tools..."
curl -s -X POST "$BASE_URL/mcp" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "tools/list",
"id": 1
}' | jq .
echo ""
echo ""
# Test 3: Test mark_attendance tool
echo "3. Testing mark_attendance tool..."
curl -s -X POST "$BASE_URL/mcp" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "mark_attendance",
"arguments": {
"studentId": "12345",
"date": "2024-01-15",
"status": "present"
}
},
"id": 2
}' | jq .
echo ""
echo ""
# Test 4: Test commit_changes tool (requires valid GitHub token and repo)
echo "4. Testing commit_changes tool..."
echo "Note: This requires a valid GitHub token and repository access"
curl -s -X POST "$BASE_URL/mcp" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "commit_changes",
"arguments": {
"repoOwner": "your-username",
"repoName": "test-repo",
"branchName": "main",
"commitMessage": "Test commit from MCP server",
"filesToCommit": [
{
"path": "test.txt",
"content": "Hello from MCP server!"
}
]
}
},
"id": 3
}' | jq .
echo ""
echo ""
echo "=== Testing Complete ==="