Skip to content

Commit 7ca4ef7

Browse files
committed
Add distributable tests for MCP
1 parent 2621045 commit 7ca4ef7

2 files changed

Lines changed: 28 additions & 1 deletion

File tree

test/distributables-test/unix.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,16 @@ echo "\nCan trigger update?"
4646
curl $CURL_OPTIONS "$WITH_ORIGIN" -X POST http://127.0.0.1:45457/update
4747

4848
# ^ This will fail if they receive anything but a 200 result.
49-
# This ensures that the server is startable, and has minimal functionality for launch.
49+
# This ensures that the server is startable, and has minimal functionality for launch.
50+
51+
echo "\nCan run ctl help?"
52+
./httptoolkit-server/bin/httptoolkit-server ctl help | grep -q "HTTP Toolkit Remote Control"
53+
54+
echo "\nCan run ctl status?"
55+
CTL_STATUS=$(./httptoolkit-server/bin/httptoolkit-server ctl status)
56+
echo "$CTL_STATUS" | grep -q '"running":true'
57+
58+
echo "\nCan run mcp initialize?"
59+
MCP_RESPONSE=$(echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}' \
60+
| ./httptoolkit-server/bin/httptoolkit-server mcp 2>/dev/null | head -1)
61+
echo "$MCP_RESPONSE" | grep -q '"protocolVersion"'

test/distributables-test/windows.bat

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,21 @@ curl %CURL_OPTIONS% %WITH_ORIGIN% -X POST http://127.0.0.1:45457/update || goto
6969
REM ^ This will fail if they receive anything but a 200 result.
7070
REM This ensures that the server is startable, and has minimal functionality for launch.
7171

72+
echo:
73+
echo:
74+
echo Can run ctl help?
75+
.\httptoolkit-server\bin\httptoolkit-server ctl help | findstr /C:"HTTP Toolkit Remote Control" >NUL || goto :error
76+
77+
echo:
78+
echo:
79+
echo Can run ctl status?
80+
.\httptoolkit-server\bin\httptoolkit-server ctl status | findstr /C:"\"running\":true" >NUL || goto :error
81+
82+
echo:
83+
echo:
84+
echo Can run mcp initialize?
85+
echo {"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}} | .\httptoolkit-server\bin\httptoolkit-server mcp | findstr /C:"protocolVersion" >NUL || goto :error
86+
7287
goto :success
7388

7489
:error

0 commit comments

Comments
 (0)