test-api.shβ’1.97 kB
#!/bin/bash
# BYOB MCP Server API Test Script
# Run this after starting the dev server with: npm run dev
BASE_URL="http://localhost:8787"
echo "π BYOB MCP Server API Test Suite"
echo "=================================="
echo ""
# Test 1: Health Check
echo "1οΈβ£ Testing health check..."
curl -s $BASE_URL | jq '.'
echo ""
# Test 2: List pre-registered tools
echo "2οΈβ£ Listing pre-registered tools..."
curl -s $BASE_URL/api/tools | jq '.tools[] | {name, description}'
echo ""
# Test 3: Test MCP list_tools
echo "3οΈβ£ Testing MCP tools/list (what Claude sees)..."
curl -s -X POST $BASE_URL/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list",
"params": {}
}' | jq '.result.tools[] | {name, description}'
echo ""
# Test 4: Register a new custom tool
echo "4οΈβ£ Registering new custom tool..."
curl -s -X POST $BASE_URL/api/register-tool \
-H "Content-Type: application/json" \
-d '{
"name": "whisper",
"description": "Echoes your message in lowercase whispers",
"containerClass": "toolrunner",
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "Message to whisper"
}
},
"required": ["message"]
}
}' | jq '.'
echo ""
# Test 5: List tools again to see the new one
echo "5οΈβ£ Listing tools (should now include 4 tools)..."
curl -s $BASE_URL/api/tools | jq '.tools[] | {name, description}'
echo ""
echo "β
API tests complete!"
echo ""
echo "π Summary:"
echo " β’ 3 pre-built tools: echo_message, why_are_we_yelling, query_json"
echo " β’ All tools use the same universal container"
echo " β’ Registered 1 new tool dynamically"
echo ""
echo "Next steps:"
echo "1. Connect Claude Desktop to http://localhost:8787/mcp"
echo "2. Ask Claude: 'What tools do you have?'"
echo "3. Try: 'Use why_are_we_yelling with text: hello world'"