Skip to content

Commit 18a0ee3

Browse files
HanSur94claude
andcommitted
fix(ci): bind server to 0.0.0.0 in Docker and use Python healthcheck
Server must bind to 0.0.0.0 inside Docker for client container to reach it over the Docker network. Also replaced curl healthcheck with Python urllib since the image doesn't have curl installed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 271906c commit 18a0ee3

1 file changed

Lines changed: 19 additions & 10 deletions

File tree

docker-compose.test.yml

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,32 @@ services:
1414
environment:
1515
- MATLAB_MCP_AUTH_TOKEN=test-token-for-ci
1616
- MATLAB_MCP_POOL_MIN_ENGINES=0
17+
- MATLAB_MCP_SERVER_HOST=0.0.0.0
1718
networks:
1819
- mcp-test-net
1920
healthcheck:
2021
test:
2122
- "CMD"
22-
- "sh"
23+
- "python"
2324
- "-c"
2425
- |
25-
curl -sf -X POST http://localhost:8765/mcp \
26-
-H "Content-Type: application/json" \
27-
-H "Authorization: Bearer test-token-for-ci" \
28-
-d '{"jsonrpc":"2.0","method":"initialize","id":0,"params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"healthcheck","version":"0.1"}}}' \
29-
--max-time 3 | grep -q '"result"'
30-
interval: 2s
31-
timeout: 3s
32-
retries: 10
33-
start_period: 5s
26+
import urllib.request, json, sys
27+
req = urllib.request.Request(
28+
"http://localhost:8765/mcp",
29+
data=json.dumps({"jsonrpc":"2.0","method":"initialize","id":0,
30+
"params":{"protocolVersion":"2024-11-05","capabilities":{},
31+
"clientInfo":{"name":"hc","version":"0.1"}}}).encode(),
32+
headers={"Content-Type":"application/json",
33+
"Authorization":"Bearer test-token-for-ci"})
34+
try:
35+
r = urllib.request.urlopen(req, timeout=3)
36+
sys.exit(0 if r.status < 500 else 1)
37+
except Exception:
38+
sys.exit(1)
39+
interval: 3s
40+
timeout: 5s
41+
retries: 15
42+
start_period: 10s
3443

3544
client:
3645
build: .

0 commit comments

Comments
 (0)