-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdebug_mcp.sh
More file actions
executable file
·114 lines (102 loc) · 3.17 KB
/
debug_mcp.sh
File metadata and controls
executable file
·114 lines (102 loc) · 3.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/bin/bash
# MCP Shopware API Debug Script
# This script helps debug MCP communication by tailing logs and providing useful commands
echo "🔧 MCP Shopware API Debug Helper"
echo "================================"
echo ""
# Function to show log locations
show_logs() {
echo "📁 Log file locations:"
echo " - MCP Debug Log: /tmp/mcp-shopware-debug.log"
echo " - Claude Desktop Logs: ~/Library/Logs/Claude/"
echo ""
}
# Function to tail logs
tail_logs() {
echo "📊 Starting live log monitoring..."
echo "Press Ctrl+C to stop"
echo ""
# Create log file if it doesn't exist
touch /tmp/mcp-shopware-debug.log
# Tail the debug log with colors
tail -f /tmp/mcp-shopware-debug.log | sed \
-e 's/🔧 MCP TOOL CALLED/\x1b[32m🔧 MCP TOOL CALLED\x1b[0m/g' \
-e 's/📥 INPUT/\x1b[34m📥 INPUT\x1b[0m/g' \
-e 's/📤 OUTPUT SUCCESS/\x1b[32m📤 OUTPUT SUCCESS\x1b[0m/g' \
-e 's/❌ OUTPUT ERROR/\x1b[31m❌ OUTPUT ERROR\x1b[0m/g' \
-e 's/🌐 API REQUEST/\x1b[36m🌐 API REQUEST\x1b[0m/g' \
-e 's/📡 API RESPONSE/\x1b[35m📡 API RESPONSE\x1b[0m/g' \
-e 's/📊 RESPONSE SUMMARY/\x1b[33m📊 RESPONSE SUMMARY\x1b[0m/g'
}
# Function to clear logs
clear_logs() {
echo "🗑️ Clearing debug logs..."
> /tmp/mcp-shopware-debug.log
echo "✅ Logs cleared"
}
# Function to test MCP server
test_server() {
echo "🧪 Testing MCP server..."
cd /opt/homebrew/var/www/mcp/mcp-shopware-api
uv run python src/mcp_shopware_api/server.py --help 2>&1 | head -10
}
# Function to show recent log summary
show_summary() {
echo "📋 Recent log summary (last 50 lines):"
echo "======================================="
if [ -f /tmp/mcp-shopware-debug.log ]; then
tail -50 /tmp/mcp-shopware-debug.log | grep -E "(🔧|📤|❌|🌐|📡)" | tail -20
else
echo "No debug log found yet. Start Claude Desktop and make some requests."
fi
}
# Function to search logs
search_logs() {
if [ -z "$1" ]; then
echo "Usage: $0 search <search_term>"
echo "Example: $0 search \"get_available_entities\""
return 1
fi
echo "🔍 Searching logs for: $1"
echo "========================"
if [ -f /tmp/mcp-shopware-debug.log ]; then
grep -n --color=always "$1" /tmp/mcp-shopware-debug.log | tail -20
else
echo "No debug log found yet."
fi
}
# Main script logic
case "$1" in
"tail"|"")
show_logs
tail_logs
;;
"clear")
clear_logs
;;
"test")
test_server
;;
"summary")
show_summary
;;
"search")
search_logs "$2"
;;
"help")
echo "Usage: $0 [command]"
echo ""
echo "Commands:"
echo " tail - Monitor live logs (default)"
echo " clear - Clear debug logs"
echo " test - Test MCP server"
echo " summary - Show recent log summary"
echo " search - Search logs for term"
echo " help - Show this help"
;;
*)
echo "Unknown command: $1"
echo "Use '$0 help' for available commands"
exit 1
;;
esac