# crypto-api-fixer

Auto-repair middleware for crypto trading bots. Automatically detects and fixes 10 types of exchange API errors (rate limits, stale data, broken JSON, auth failures, price mismatches, endpoint downti…

## Quick Start

```bash
# Connect this server (installs CLI if needed)
npx -y @smithery/cli@latest mcp add aloryanirakan-cqmg/crypto-api-fixer

# Browse available tools
npx -y @smithery/cli@latest tool list aloryanirakan-cqmg/crypto-api-fixer

# Get full schema for a tool
npx -y @smithery/cli@latest tool get aloryanirakan-cqmg/crypto-api-fixer fix_stale_data

# Call a tool
npx -y @smithery/cli@latest tool call aloryanirakan-cqmg/crypto-api-fixer fix_stale_data '{}'
```

## Direct MCP Connection

Endpoint: `https://crypto-api-fixer--aloryanirakan-cqmg.run.tools`

## Tools (11)

- `fix_stale_data` — Detects and fixes stale/outdated API responses from crypto exchanges. Fetches fresh data from backup sources. Use when …
- `fix_rate_limit` — Handles 429 and 503 rate limit errors. Applies smart backoff and proxy rotation. Use when exchange returns Too Many Req…
- `fix_endpoint_down` — Auto-failover when exchange API is down (502/503/504). Routes to backup mirrors for Binance, Coinbase, Kraken, Bybit, O…
- `fix_unexpected_error` — Fixes unexpected 500 errors, null values, and wrong data types in API responses. Cost: $0.003/request.
- `fix_price_mismatch` — Cross-exchange price validation. Detects outliers over 3% deviation and computes median price. Use when prices differ s…
- `fix_json_broken` — Repairs malformed JSON, schema changes, and missing required fields. Auto-remaps Binance, Coinbase, Kraken schemas. Cos…
- `fix_auth_error` — Fixes 401/403 authentication errors. Rotates API keys, recalculates HMAC signatures, syncs timestamps. Cost: $0.007/req…
- `fix_financial_risk` — Real-time circuit breaker for price spikes over 3%, low liquidity, or API latency over 500ms. Pauses trading to prevent…
- `fix_websocket_dead` — Detects silent WebSocket disconnections and reconnects automatically. Use when no data received for over 30 seconds. Co…
- `fix_key_permission` — Validates API key permissions. Alerts on dangerous withdrawal permissions and switches to safe trading mode. Cost: $0.0…
- `auto_fix` — Auto-detects and fixes any crypto exchange API error. Use this when you are unsure of the error type. Handles all 10 er…

```bash
# Get full input/output schema for a tool
npx -y @smithery/cli@latest tool get aloryanirakan-cqmg/crypto-api-fixer <tool-name>
```
