Testing the MCP Server¶
This guide covers how to test your AWS Logs MCP server to ensure it's working properly.
Testing with cURL¶
You can test the server using cURL commands:
Testing the Health Endpoint¶
curl http://localhost:3000/health
Expected response:
{
"status": "healthy",
"version": "1.0.0",
"timestamp": "2023-01-15T12:34:56.789Z",
"aws": {
"connectivity": true,
"region": "us-east-1"
}
}
Testing MCP Direct Endpoint¶
Test AWS connectivity:
curl -X POST http://localhost:3000/mcp \
-H "Content-Type: application/json" \
-d '{
"tool": "testAwsConnection",
"params": {}
}'
Get CloudWatch Log Groups:
curl -X POST http://localhost:3000/mcp \
-H "Content-Type: application/json" \
-d '{
"tool": "cloudWatchLogGroups",
"params": {
"prefix": "/aws/lambda/",
"limit": 10
}
}'
Query CloudWatch Logs:
curl -X POST http://localhost:3000/mcp \
-H "Content-Type: application/json" \
-d '{
"tool": "cloudWatchLogs",
"params": {
"logGroupName": "/aws/lambda/my-function",
"filterPattern": "ERROR",
"startTime": "-1h",
"limit": 50
}
}'
Query CloudTrail Events:
curl -X POST http://localhost:3000/mcp \
-H "Content-Type: application/json" \
-d '{
"tool": "cloudTrailEvents",
"params": {
"eventName": "CreateFunction",
"startTime": "-1d",
"limit": 25
}
}'
Testing Server-Sent Events (SSE)¶
To test SSE connection, you can use the curl
command with the -N
flag to disable buffering:
curl -N http://localhost:3000/sse
This will establish an SSE connection and print events as they arrive.
Troubleshooting Tests¶
If you encounter issues during testing:
- Connection refused: Ensure the MCP server is running and listening on the expected port
- AWS credential errors: Verify credentials are correctly set up with proper permissions
- Tool not found errors: Ensure you're using the correct tool name
- Parameter validation errors: Check that your parameters match the expected schema
For detailed error information, check the MCP server logs, which will provide information about the specific error and context.