1 file changed
+54
.github/workflows/release-mcp-registry.yml
+54
@@ -44,6 +44,7 @@ jobs:
44
echo "server.json is missing the Streamable HTTP remote ${remote_url}." >&2
45
exit 1
46
fi
47
+ echo "MCP_REMOTE_URL=${remote_url}" >> "$GITHUB_ENV"
48
49
# npm proves ownership through `mcpName` in the published package.json,
50
# which is generated by this script at release time.
@@ -55,6 +56,59 @@ jobs:
56
xcrs_server_name="$(jq -r '.name' server-xcrs.json)"
57
grep -q "mcp-name: ${xcrs_server_name}" crates/xcrs/README.md
58
59
+ - name: Verify the hosted MCP endpoint
60
+ shell: bash
61
+ run: |
62
+ remote_url="${MCP_REMOTE_URL}"
63
+ response_headers="$(mktemp)"
64
+ response_body="$(mktemp)"
65
+ trap 'rm -f "${response_headers}" "${response_body}"' EXIT
66
+
67
+ request_body='{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"smbcloud-registry-release-check","version":"1"}}}'
68
+ if ! http_status="$(curl --http1.1 --silent --show-error \
69
+ --connect-timeout 10 \
70
+ --max-time 20 \
71
+ --retry 2 \
72
+ --retry-all-errors \
73
+ --retry-delay 2 \
74
+ --dump-header "${response_headers}" \
75
+ --output "${response_body}" \
76
+ --write-out '%{http_code}' \
77
+ --header 'Accept: application/json, text/event-stream' \
78
+ --header 'Content-Type: application/json' \
79
+ --data "${request_body}" \
80
+ "${remote_url}")"; then
81
+ echo "Failed to reach the hosted MCP endpoint ${remote_url}." >&2
82
+ exit 1
83
+ fi
84
+
85
+ if [ "${http_status}" = "401" ]; then
86
+ if ! grep -Eiq '^www-authenticate:[[:space:]]*Bearer([[:space:]]|$)' "${response_headers}"; then
87
+ echo "The hosted MCP endpoint returned 401 without a Bearer challenge." >&2
88
+ cat "${response_headers}" >&2
89
+ exit 1
90
+ fi
91
+ echo "The hosted MCP endpoint returned the expected authentication challenge."
92
+ elif [ "${http_status}" = "200" ]; then
93
+ if jq -e \
94
+ '.jsonrpc == "2.0" and .id == 1 and (has("result") or has("error"))' \
95
+ "${response_body}" >/dev/null 2>&1 || \
96
+ sed -n 's/^data:[[:space:]]*//p' "${response_body}" | \
97
+ jq -se 'any(.[]; .jsonrpc == "2.0" and .id == 1 and (has("result") or has("error")))' \
98
+ >/dev/null; then
99
+ echo "The hosted MCP endpoint returned a valid initialize response."
100
+ else
101
+ echo "The hosted MCP endpoint returned HTTP 200 without a valid MCP response." >&2
102
+ cat "${response_body}" >&2
103
+ exit 1
104
+ fi
105
+ else
106
+ echo "The hosted MCP endpoint returned unexpected HTTP status ${http_status}." >&2
107
+ cat "${response_headers}" >&2
108
+ cat "${response_body}" >&2
109
+ exit 1
110
+ fi
111
+
112
- name: Set release versions in server metadata
113
shell: bash
114
run: |