# Test script to compare both MCP options
# Run after creating MCP Server in Azure Portal
$subscriptionKey = "80b6a6a2a02147b5b5c2f06c92bbd096"
$headers = @{
"Ocp-Apim-Subscription-Key" = $subscriptionKey
"Content-Type" = "application/json"
}
# Option 1: Custom MCP Backend (current implementation)
$option1Url = "https://apimmcp-apim-dev.azure-api.net/mcp"
# Option 2: APIM Native MCP Server (update this after portal setup)
# Check the MCP Servers blade in portal for the exact URL
$option2Url = "https://apimmcp-apim-dev.azure-api.net/mcp-servers/product-catalog-mcp"
Write-Host "========================================" -ForegroundColor Cyan
Write-Host " Testing Option 1: Custom MCP Backend " -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
# Test Option 1 - tools/list
Write-Host "Option 1 - tools/list:" -ForegroundColor Yellow
try {
$result1 = Invoke-RestMethod -Uri $option1Url -Method POST -Headers $headers -Body '{"jsonrpc":"2.0","method":"tools/list","id":1}'
Write-Host " Tools found: $($result1.result.tools.Count)" -ForegroundColor Green
$result1.result.tools | ForEach-Object { Write-Host " - $($_.name)" -ForegroundColor Gray }
} catch {
Write-Host " Error: $_" -ForegroundColor Red
}
Write-Host ""
# Test Option 1 - get products
Write-Host "Option 1 - get_products:" -ForegroundColor Yellow
try {
$result1 = Invoke-RestMethod -Uri $option1Url -Method POST -Headers $headers -Body '{"jsonrpc":"2.0","method":"tools/call","id":1,"params":{"name":"get_products"}}'
$products = $result1.result.content[0].text | ConvertFrom-Json
Write-Host " Products found: $($products.Count)" -ForegroundColor Green
} catch {
Write-Host " Error: $_" -ForegroundColor Red
}
Write-Host ""
Write-Host "========================================" -ForegroundColor Cyan
Write-Host " Testing Option 2: APIM Native MCP " -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
# Test Option 2 - tools/list
Write-Host "Option 2 - tools/list:" -ForegroundColor Yellow
try {
$result2 = Invoke-RestMethod -Uri $option2Url -Method POST -Headers $headers -Body '{"jsonrpc":"2.0","method":"tools/list","id":1}'
Write-Host " Tools found: $($result2.result.tools.Count)" -ForegroundColor Green
$result2.result.tools | ForEach-Object { Write-Host " - $($_.name)" -ForegroundColor Gray }
} catch {
Write-Host " Error: $($_.Exception.Message)" -ForegroundColor Red
Write-Host " (Create MCP Server in portal first!)" -ForegroundColor Yellow
}
Write-Host ""
# Test Option 2 - get products (note: tool name might be different)
Write-Host "Option 2 - getProducts:" -ForegroundColor Yellow
try {
$result2 = Invoke-RestMethod -Uri $option2Url -Method POST -Headers $headers -Body '{"jsonrpc":"2.0","method":"tools/call","id":1,"params":{"name":"getProducts"}}'
Write-Host " Result: $($result2.result | ConvertTo-Json -Compress)" -ForegroundColor Green
} catch {
Write-Host " Error: $($_.Exception.Message)" -ForegroundColor Red
}
Write-Host ""
Write-Host "========================================" -ForegroundColor Cyan
Write-Host " Comparison Summary " -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
Write-Host "Option 1 (Custom MCP):" -ForegroundColor White
Write-Host " URL: $option1Url" -ForegroundColor Gray
Write-Host " Tool names: get_products, get_product_by_id, search_products, etc." -ForegroundColor Gray
Write-Host ""
Write-Host "Option 2 (APIM Native):" -ForegroundColor White
Write-Host " URL: $option2Url" -ForegroundColor Gray
Write-Host " Tool names: getProducts, getProductById, searchProducts, etc." -ForegroundColor Gray
Write-Host " (auto-generated from OpenAPI operationId)" -ForegroundColor Gray