This guide helps you debug MCP communication between Claude Desktop and your Shopware MCP server effectively.
The MCP server now includes comprehensive logging that captures:
- MCP Tool Calls: Every tool invocation with parameters and results
- API Requests: All HTTP requests to Shopware API with headers and body
- API Responses: Response status, data summaries, and error details
- Timestamps: All events are timestamped for correlation
- MCP Debug Log:
/tmp/mcp-shopware-debug.log - Claude Desktop Logs:
~/Library/Logs/Claude/
The server logs at different levels:
INFO: Key events (tool calls, API requests/responses)DEBUG: Detailed data (full request/response bodies)ERROR: Errors and exceptions
Use the provided debug script for easy log monitoring:
# Monitor live logs (default)
./debug_mcp.sh
./debug_mcp.sh tail
# Clear debug logs
./debug_mcp.sh clear
# Show recent activity summary
./debug_mcp.sh summary
# Search logs for specific terms
./debug_mcp.sh search "get_available_entities"
./debug_mcp.sh search "ERROR"
# Test server
./debug_mcp.sh test# Monitor live logs with colors
tail -f /tmp/mcp-shopware-debug.log
# Show only MCP tool calls
grep "🔧 MCP TOOL" /tmp/mcp-shopware-debug.log
# Show only API requests
grep "🌐 API REQUEST" /tmp/mcp-shopware-debug.log
# Show only errors
grep "❌\|ERROR" /tmp/mcp-shopware-debug.log2024-01-20 10:15:30 [INFO] MCP: 🔧 MCP TOOL CALLED: get_available_entities
2024-01-20 10:15:30 [INFO] MCP: 📥 INPUT ARGS: ()
2024-01-20 10:15:30 [INFO] MCP: 📥 INPUT KWARGS: {}
2024-01-20 10:15:31 [INFO] MCP: 📤 OUTPUT SUCCESS: get_available_entities
2024-01-20 10:15:30 [INFO] SHOPWARE_API: 🌐 API REQUEST: GET https://shop.example.com/api/_info/open-api-schema.json
2024-01-20 10:15:31 [INFO] SHOPWARE_API: 📡 API RESPONSE: GET https://shop.example.com/api/_info/open-api-schema.json -> 200
2024-01-20 10:15:31 [INFO] SHOPWARE_API: 📊 RESPONSE SUMMARY: 1 items (total: unknown)
2024-01-20 10:16:00 [INFO] MCP: 🔧 MCP TOOL CALLED: search_shopware_entities
2024-01-20 10:16:00 [INFO] MCP: 📥 INPUT KWARGS: {'entity': 'product', 'search_criteria': {'limit': 10}}
2024-01-20 10:16:00 [INFO] SHOPWARE_API: 🌐 API REQUEST: POST https://shop.example.com/api/search/product
2024-01-20 10:16:00 [DEBUG] SHOPWARE_API: 📋 REQUEST BODY: {"limit": 10}
2024-01-20 10:16:01 [INFO] SHOPWARE_API: 📡 API RESPONSE: POST https://shop.example.com/api/search/product -> 200
2024-01-20 10:16:01 [INFO] SHOPWARE_API: 📊 RESPONSE SUMMARY: 10 items (total: 156)
Symptoms: No "🔧 MCP TOOL CALLED" logs for expected tools
Debugging:
# Check if Claude Desktop can see the tools
./debug_mcp.sh summary
# Look for connection errors
grep "ERROR\|Exception" /tmp/mcp-shopware-debug.logSolutions:
- Verify Claude Desktop MCP configuration
- Check environment variables are set
- Restart Claude Desktop
Symptoms: "❌ ERROR RESPONSE" with 401 status codes
Debugging:
# Look for auth errors
./debug_mcp.sh search "401\|authentication\|token"Solutions:
- Verify STORE_URL, API_KEY, API_SECRET in environment
- Check Shopware integration is active
- Verify API credentials have correct permissions
Symptoms: Tools called but unexpected results
Debugging:
# Check specific tool calls
./debug_mcp.sh search "search_shopware_entities"
# Look at input parameters
grep "📥 INPUT" /tmp/mcp-shopware-debug.log | tail -10Solutions:
- Verify input parameter format (JSON vs dict)
- Check entity names are correct
- Validate search criteria structure
Symptoms: Slow responses or timeouts
Debugging:
# Monitor response times by looking at timestamp differences
grep "🌐 API REQUEST\|📡 API RESPONSE" /tmp/mcp-shopware-debug.log | tail -20Solutions:
- Add pagination to large queries
- Use
search_shopware_entity_idsfor lightweight searches - Optimize search criteria and associations
Ensure your Claude Desktop config includes debug settings:
{
"mcpServers": {
"mcp-shopware-api": {
"command": "uv",
"args": ["run", "python", "/path/to/server.py"],
"env": {
"STORE_URL": "https://your-shop.com",
"API_KEY": "your-key",
"API_SECRET": "your-secret",
"MCP_DEBUG": "1"
}
}
},
"debug": {
"enabled": true,
"level": "debug"
}
}# Extract timestamps for request/response pairs
grep "🌐 API REQUEST\|📡 API RESPONSE" /tmp/mcp-shopware-debug.log | \
tail -20 | \
awk '{print $1 " " $2 " " $0}'# Count API calls by endpoint
grep "🌐 API REQUEST" /tmp/mcp-shopware-debug.log | \
awk '{print $NF}' | \
sort | uniq -c | sort -nr# Show error percentage
total=$(grep "📡 API RESPONSE" /tmp/mcp-shopware-debug.log | wc -l)
errors=$(grep "📡 API RESPONSE.*[45][0-9][0-9]" /tmp/mcp-shopware-debug.log | wc -l)
echo "Error rate: $errors/$total"-
Environment Variables
- STORE_URL is set and accessible
- API_KEY and API_SECRET are valid
- No trailing slashes in STORE_URL
-
Shopware Configuration
- Integration is active in Shopware admin
- API credentials have required permissions
- Store is accessible from your network
-
MCP Configuration
- Claude Desktop config file is valid JSON
- Server path is correct
- uv/python environment is working
-
Network/Connectivity
- Can reach Shopware store from command line
- No firewall blocking connections
- SSL certificates are valid
-
Start Debugging:
./debug_mcp.sh clear # Clear old logs ./debug_mcp.sh tail # Start monitoring
-
Trigger Actions in Claude Desktop:
- Ask Claude to list available entities
- Request specific data (products, orders, etc.)
- Try complex searches with filters
-
Analyze Logs:
- Check tool call sequence
- Verify API request/response flow
- Look for errors or unexpected behavior
-
Iterate and Fix:
- Adjust queries based on findings
- Fix configuration issues
- Test edge cases