forked from modelcontextprotocol/example-remote-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev-with-mitm.sh
More file actions
executable file
·31 lines (25 loc) · 848 Bytes
/
Copy pathdev-with-mitm.sh
File metadata and controls
executable file
·31 lines (25 loc) · 848 Bytes
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
#!/bin/bash
# Easy script to run MCP server with mitmproxy intercepting client traffic
echo "🚀 Starting MCP server with mitmproxy..."
echo ""
echo "This will:"
echo " 1. Start your MCP server on port 3232"
echo " 2. Start mitmproxy reverse proxy on port 8080"
echo " 3. Intercept all client → server traffic"
echo ""
echo "📡 Connect your MCP client to: http://localhost:8080/mcp"
echo "🔍 View traffic in mitmproxy TUI"
echo ""
echo "Press Ctrl+C to stop both processes"
echo ""
# Trap Ctrl+C to kill both processes
trap 'kill 0' EXIT
# Start the MCP server in background
npm run dev &
SERVER_PID=$!
# Give server time to start
sleep 3
# Start mitmproxy in reverse proxy mode (foreground so we see the TUI)
mitmproxy --mode reverse:http://localhost:3232 --listen-port 8080
# This line won't be reached until mitmproxy exits
wait