Compare commits

..
1 Commits
3 changed files with 55 additions and 4 deletions

No files matched your search

+7 -1
View File
@@ -81,7 +81,13 @@ hyperstitionstud.io {
}
redir /ci /ci/ permanent
# 6. Repo Install Dir: hyperstitionstudio-core -> /schemas/* and Root Portal Homepage (/)
# 6. Stateless Read-Only Model Context Protocol (MCP) Streamable HTTP Endpoint -> /mcp & /mcp/*
@mcp_route path /mcp /mcp/*
handle @mcp_route {
reverse_proxy 127.0.0.1:8095
}
# 7. Repo Install Dir: hyperstitionstudio-core -> /schemas/*, /learn/*, /gallery/* & Root Portal Homepage (/)
handle_path /schemas/* {
root * /var/www/hyperstitionstud.io/repos/hyperstitionstudio-core/schemas
file_server {
+20
View File
@@ -0,0 +1,20 @@
# /etc/systemd/system/hyperstition-mcp.service
[Unit]
Description=Stateless Read-Only Model Context Protocol (MCP) HTTP Server for hyperstitionstud.io (127.0.0.1:8095)
After=network.target local-fs.target hyperstition-tmpfs-sync.service
Before=caddy.service
[Service]
Type=simple
WorkingDirectory=/srv/hyperstitionstud.io/repos
Environment="HYPERSTITIONSTUDIO_CONFIG=/srv/hyperstitionstud.io/repos/workspace.toml"
Environment="PYTHONPATH=/srv/hyperstitionstud.io/repos/hyperstitionstudio-core/src"
ExecStart=/srv/hyperstitionstud.io/repos/.venv/bin/python3 /srv/hyperstitionstud.io/repos/hyperstitionstudio-core/src/hyperstitionstud_io/mcp/server.py --transport http --host 127.0.0.1 --port 8095
Restart=always
RestartSec=2
NoNewPrivileges=true
ProtectSystem=strict
ReadOnlyPaths=/srv/hyperstitionstud.io/repos
[Install]
WantedBy=multi-user.target
+28 -3
View File
@@ -14,26 +14,36 @@ set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
TARGET_BASE_URL="${1:-}"
SERVER_PID=""
MCP_PID=""
cleanup() {
if [[ -n "${SERVER_PID}" ]] && kill -0 "${SERVER_PID}" 2>/dev/null; then
kill "${SERVER_PID}" 2>/dev/null || true
fi
if [[ -n "${MCP_PID}" ]] && kill -0 "${MCP_PID}" 2>/dev/null; then
kill "${MCP_PID}" 2>/dev/null || true
fi
}
trap cleanup EXIT
if [[ -z "${TARGET_BASE_URL}" ]]; then
export LIVE_REPOS="${LIVE_REPOS:-/tmp/hyperstition-live-repos}"
rm -rf "${LIVE_REPOS}"
echo "[1/3] Hydrating per-repository webroot at ${LIVE_REPOS} via sync-vps-repos.sh --no-pull..."
echo "[1/4] Hydrating per-repository webroot at ${LIVE_REPOS} via sync-vps-repos.sh --no-pull..."
"${SCRIPT_DIR}/sync-vps-repos.sh" --no-pull
PORT="${TEST_PORT:-18090}"
echo "[2/3] Starting local HTTP server on http://127.0.0.1:${PORT} serving ${LIVE_REPOS}..."
MCP_PORT="${TEST_MCP_PORT:-18095}"
echo "[2/4] Starting local HTTP server on http://127.0.0.1:${PORT} and MCP HTTP server on http://127.0.0.1:${MCP_PORT}/mcp..."
python3 -m http.server "${PORT}" --bind 127.0.0.1 --directory "${LIVE_REPOS}" >/dev/null 2>&1 &
SERVER_PID="$!"
PYTHONPATH="${SCRIPT_DIR}/../src" python3 "${SCRIPT_DIR}/../src/hyperstitionstud_io/mcp/server.py" --transport http --host 127.0.0.1 --port "${MCP_PORT}" >/dev/null 2>&1 &
MCP_PID="$!"
sleep 0.6
TARGET_BASE_URL="http://127.0.0.1:${PORT}"
MCP_URL="http://127.0.0.1:${MCP_PORT}/mcp"
else
MCP_URL="${TARGET_BASE_URL%/}/mcp"
fi
echo "[3/3] Verifying all 35 portal, /learn/, /gallery/, graph, encyclopedia, haiperdohp-jemaytreeah (.gitignore artifacts), CI & schema routes against ${TARGET_BASE_URL}..."
@@ -89,4 +99,19 @@ for route in "${ROUTES[@]}"; do
fi
done
echo "[OK] All ${PASS_COUNT}/${#ROUTES[@]} deployment routes verified (HTTP 200 OK)."
echo "[4/4] Verifying stateless read-only MCP Streamable HTTP endpoint (${MCP_URL})..."
mcp_get_code="$(curl -s -o /dev/null -w "%{http_code}" "${MCP_URL}")"
if [[ "${mcp_get_code}" != "200" ]]; then
echo " [FAIL ${mcp_get_code}] GET ${MCP_URL}" >&2
exit 1
fi
echo " [200 OK] GET ${MCP_URL} (MCP capability manifest)"
mcp_post_out="$(curl -s -X POST "${MCP_URL}" -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"hs_evaluate_aq_and_ingglish","arguments":{"terms":["capital","capture","folds"]}}}')"
if ! grep -q 'exact_gen1_singularity.*true' <<<"${mcp_post_out}"; then
echo " [FAIL] POST ${MCP_URL} did not return exact_gen1_singularity=true" >&2
exit 1
fi
echo " [200 OK] POST ${MCP_URL} (JSON-RPC 2.0 tools/call hs_evaluate_aq_and_ingglish verified)"
echo "[OK] All ${PASS_COUNT}/${#ROUTES[@]} static routes + 2 MCP HTTP endpoints verified (HTTP 200 OK)."