Add MCP bridge local verification harness (TELE-WP-0002)
Introduce pytest smoke tests, run/verify scripts, and Makefile targets so the bridge can be developed and validated without a full cluster deploy. Document the local workflow and agent quickstart in README.
This commit is contained in:
22
mcp-telemetry-bridge/scripts/run-local.sh
Executable file
22
mcp-telemetry-bridge/scripts/run-local.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
# Run the MCP bridge locally (no Kubernetes required).
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$ROOT"
|
||||
|
||||
PORT="${PORT:-8080}"
|
||||
HOST="${HOST:-127.0.0.1}"
|
||||
|
||||
if [[ ! -d .venv ]]; then
|
||||
python3 -m venv .venv
|
||||
fi
|
||||
# shellcheck disable=SC1091
|
||||
source .venv/bin/activate
|
||||
|
||||
pip install -q -r requirements.txt
|
||||
|
||||
echo "Starting MCP bridge at http://${HOST}:${PORT}"
|
||||
echo "Health: curl http://${HOST}:${PORT}/healthz"
|
||||
echo "Schema: curl http://${HOST}:${PORT}/mcp/schema | jq ."
|
||||
exec uvicorn app.main:app --reload --host "$HOST" --port "$PORT"
|
||||
36
mcp-telemetry-bridge/scripts/verify-local.sh
Executable file
36
mcp-telemetry-bridge/scripts/verify-local.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
# Local verification harness: pytest smoke tests + optional live HTTP checks.
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$ROOT"
|
||||
|
||||
BASE_URL="${BASE_URL:-http://127.0.0.1:8080}"
|
||||
RUN_LIVE="${RUN_LIVE:-0}"
|
||||
|
||||
if [[ ! -d .venv ]]; then
|
||||
python3 -m venv .venv
|
||||
fi
|
||||
# shellcheck disable=SC1091
|
||||
source .venv/bin/activate
|
||||
|
||||
pip install -q -r requirements-dev.txt
|
||||
|
||||
echo "==> Running pytest smoke tests"
|
||||
pytest -q
|
||||
|
||||
if [[ "$RUN_LIVE" == "1" ]]; then
|
||||
echo "==> Live HTTP smoke against ${BASE_URL}"
|
||||
curl -fsS "${BASE_URL}/healthz" | python3 -m json.tool
|
||||
curl -fsS "${BASE_URL}/mcp/schema" | python3 -c "
|
||||
import json, sys
|
||||
schema = json.load(sys.stdin)
|
||||
assert 'tools' in schema and 'resources' in schema and 'prompts' in schema
|
||||
print(f\"tools={len(schema['tools'])} resources={len(schema['resources'])} prompts={len(schema['prompts'])}\")
|
||||
"
|
||||
echo "Live smoke passed."
|
||||
else
|
||||
echo "Skipping live HTTP checks (set RUN_LIVE=1 to curl a running server)."
|
||||
fi
|
||||
|
||||
echo "Local verification complete."
|
||||
Reference in New Issue
Block a user