test(V2): add /mcp unified-interface smoke script

tests/smoke/run_unified.sh exercises the common interface against a live
server + real upstreams (Deribit/Hyperliquid public endpoints):
get_instruments (single + fan-out, asserting fees/history_start),
get_historical for both venues, and a 422 for an unsupported exchange.
Refresh tests/smoke/README.md (drop stale Bybit/Alpaca references).

Verified green end-to-end.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Adriano
2026-05-29 10:31:15 +00:00
parent 652e50ad99
commit 2272d5520b
2 changed files with 78 additions and 17 deletions
+18 -17
View File
@@ -1,25 +1,26 @@
# Smoke locale Cerbero_mcp
```bash
# da repo root Cerbero_mcp/
docker compose up -d
bash tests/smoke/run.sh
docker compose down
# da repo root, con il server attivo (docker compose up -d)
PORT=9000 TESTNET_TOKEN="$TESTNET_TOKEN" bash tests/smoke/run.sh
MAINNET_TOKEN="$MAINNET_TOKEN" bash tests/smoke/run_unified.sh
```
Il file `run.sh` verifica:
- `/health` di tutti i 6 MCP (atteso `200`)
- `environment_info` dei 4 exchange (atteso shape `{environment, source, env_value, base_url, max_leverage}`)
- live tool check read-only contro upstream testnet:
- deribit `get_ticker BTC-PERPETUAL`
- bybit `get_ticker BTCUSDT` (linear)
- hyperliquid `get_ticker BTC`
- alpaca `get_clock` (richiede credenziali paper valide)
- macro `get_treasury_yields`
- sentiment `get_funding_rates BTC`
## `run.sh` — endpoint pubblici + un tool per-exchange
Verifica `/health`, `/apidocs`, `/openapi.json` (schema bearer) e, se
`TESTNET_TOKEN` è settato, che un tool senza bearer dia `401` e con bearer
testnet venga instradato (deribit `get_ticker BTC-PERPETUAL`).
## `run_unified.sh` — interfaccia comune `/mcp` (upstream reali)
Verifica end-to-end contro Deribit/Hyperliquid (endpoint pubblici):
- `get_instruments exchange=deribit``fees` e `history_start` popolati live
- `get_instruments` fan-out → contribuiscono sia deribit sia hyperliquid
- `get_historical` deribit + hyperliquid → candele non vuote, schema uniforme
- `get_historical exchange=bybit``422` (rifiutato a livello schema)
Variabili di ambiente:
- `GATEWAY` URL base gateway (default `http://localhost`; in produzione `https://cerbero-mcp.tielogic.xyz`)
- `TOKEN_FILE` — path al token bearer di lettura (default `secrets/observer.token`)
- `PORT` (default `9000`) o `GATEWAY` (URL base, default `http://localhost:PORT`)
- `MAINNET_TOKEN` / `TESTNET_TOKEN` — bearer (uno dei due basta; mainnet per dati reali)
- `BOT_TAG` (default `smoke`) — header `X-Bot-Tag`
Exit code 0 = tutto OK, 1 = uno o più check falliti.
Exit code 0 = tutto OK, 1 = uno o più check falliti, 0 con skip se nessun token.