8d7e2ca30f
Move get_instruments off the per-exchange Deribit router and onto the
unified interface, without losing the advanced Deribit filtering.
- /mcp/tools/get_instruments now accepts the Deribit-specific filters
(currency, kind, expiry_from/to, strike_min/max, min_open_interest) and
pagination (offset/limit). Venues that list everything (Hyperliquid)
ignore them. Response adds `meta: {deribit: {total, offset, limit,
has_more}}` surfacing per-source pagination.
- Remove /mcp-deribit/tools/get_instruments (endpoint + tool wrapper +
GetInstrumentsReq schema). The DeribitClient.get_instruments METHOD
stays — it's what the unified normalizer calls.
Tests: cover the enriched filters + meta passthrough; app-boot asserts
/mcp-deribit/tools/get_instruments is gone. Docs (API_REFERENCE/README/
CLAUDE) and smoke updated; also fixed the stale Hyperliquid tool count
(14 → 15) found during the doc check.
325 passed, ruff clean. Verified live: kind=option limit=5 → 5/940
has_more=true; /mcp-deribit/tools/get_instruments → 404.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
58 lines
2.2 KiB
Python
58 lines
2.2 KiB
Python
from __future__ import annotations
|
|
|
|
from fastapi.testclient import TestClient
|
|
|
|
|
|
def test_app_boots_and_health_responds(monkeypatch):
|
|
from tests.unit.test_settings import _minimal_env
|
|
for k, v in _minimal_env().items():
|
|
monkeypatch.setenv(k, v)
|
|
|
|
from cerbero_mcp.__main__ import _make_app
|
|
from cerbero_mcp.settings import Settings
|
|
|
|
app = _make_app(Settings())
|
|
c = TestClient(app)
|
|
|
|
r = c.get("/health")
|
|
assert r.status_code == 200
|
|
assert r.json()["status"] == "healthy"
|
|
|
|
r = c.get("/openapi.json")
|
|
assert r.status_code == 200
|
|
spec = r.json()
|
|
paths = spec["paths"].keys()
|
|
assert any(p.startswith("/mcp-deribit/") for p in paths)
|
|
assert any(p.startswith("/mcp-hyperliquid/") for p in paths)
|
|
assert any(p.startswith("/mcp-macro/") for p in paths)
|
|
assert any(p.startswith("/mcp-sentiment/") for p in paths)
|
|
# Unified common interface owns the cross-cutting data tools
|
|
assert "/mcp/tools/get_instruments" in paths
|
|
assert "/mcp/tools/get_historical" in paths
|
|
assert "/mcp/tools/get_indicators" in paths
|
|
# get_instruments / get_historical / get_indicators are common-only
|
|
assert "/mcp-deribit/tools/get_instruments" not in paths
|
|
assert "/mcp-deribit/tools/get_historical" not in paths
|
|
assert "/mcp-deribit/tools/get_technical_indicators" not in paths
|
|
assert "/mcp-hyperliquid/tools/get_historical" not in paths
|
|
assert "/mcp-hyperliquid/tools/get_indicators" not in paths
|
|
# The standalone consensus router has been folded into /mcp
|
|
assert not any(p.startswith("/mcp-cross/") for p in paths)
|
|
# Bybit and Alpaca have been retired from the API surface
|
|
assert not any(p.startswith("/mcp-bybit/") for p in paths)
|
|
assert not any(p.startswith("/mcp-alpaca/") for p in paths)
|
|
|
|
|
|
def test_apidocs_available_after_boot(monkeypatch):
|
|
from tests.unit.test_settings import _minimal_env
|
|
for k, v in _minimal_env().items():
|
|
monkeypatch.setenv(k, v)
|
|
|
|
from cerbero_mcp.__main__ import _make_app
|
|
from cerbero_mcp.settings import Settings
|
|
|
|
c = TestClient(_make_app(Settings()))
|
|
r = c.get("/apidocs")
|
|
assert r.status_code == 200
|
|
assert "Cerbero MCP" in r.text
|