Skip to content

Commit d87c126

Browse files
Merge pull request #23 from modelcontextprotocol/jerome/dev-scripts-and-fixes
Add dev scripts for mitmproxy debugging and fix JSON-RPC error responses
2 parents a02624c + e6f4377 commit d87c126

File tree

6 files changed

+848
-1211
lines changed

6 files changed

+848
-1211
lines changed

dev-with-mitm.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
# Easy script to run MCP server with mitmproxy intercepting client traffic
3+
4+
echo "🚀 Starting MCP server with mitmproxy..."
5+
echo ""
6+
echo "This will:"
7+
echo " 1. Start your MCP server on port 3232"
8+
echo " 2. Start mitmproxy reverse proxy on port 8080"
9+
echo " 3. Intercept all client → server traffic"
10+
echo ""
11+
echo "📡 Connect your MCP client to: http://localhost:8080/mcp"
12+
echo "🔍 View traffic in mitmproxy TUI"
13+
echo ""
14+
echo "Press Ctrl+C to stop both processes"
15+
echo ""
16+
17+
# Trap Ctrl+C to kill both processes
18+
trap 'kill 0' EXIT
19+
20+
# Start the MCP server in background
21+
npm run dev &
22+
SERVER_PID=$!
23+
24+
# Give server time to start
25+
sleep 3
26+
27+
# Start mitmproxy in reverse proxy mode (foreground so we see the TUI)
28+
mitmproxy --mode reverse:http://localhost:3232 --listen-port 8080
29+
30+
# This line won't be reached until mitmproxy exits
31+
wait

dev-with-mitmweb.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
# Easy script to run MCP server with mitmproxy web interface
3+
4+
echo "🚀 Starting MCP server with mitmproxy web UI..."
5+
echo ""
6+
echo "This will:"
7+
echo " 1. Start your MCP server on port 3232"
8+
echo " 2. Start mitmproxy with web UI on port 8081"
9+
echo " 3. Proxy client traffic through port 8080"
10+
echo ""
11+
echo "📡 Connect your MCP client to: http://localhost:8080/mcp"
12+
echo "🌐 View traffic in browser at: http://localhost:8081"
13+
echo ""
14+
echo "Press Ctrl+C to stop both processes"
15+
echo ""
16+
17+
# Trap Ctrl+C to kill both processes
18+
trap 'kill 0' EXIT
19+
20+
# Start the MCP server in background
21+
npm run dev &
22+
SERVER_PID=$!
23+
24+
# Give server time to start
25+
sleep 3
26+
27+
# Start mitmweb in reverse proxy mode
28+
mitmweb --mode reverse:http://localhost:3232 --listen-port 8080 --web-port 8081
29+
30+
# This line won't be reached until mitmweb exits
31+
wait

0 commit comments

Comments
 (0)