Skip to main content

aster-agent-gateway

CI PyPI License: MIT Python 3.11+

An MCP (Model Context Protocol) server that gives AI agents read-only, keyless access to Aster DEX public data - ~580 futures symbols (including 24/7 TradFi perps: metals, equity indices, energy, treasuries), ~68 spot pairs, funding, order books, klines, vault deposit flows and tapi account views. No API keys, no auth, no signing, no writes: every tool reads public endpoints only (fapi.asterdex.com/fapi/v3, sapi.asterdex.com/api/v3, tapi.asterdex.com/info, api.mainnet-beta.solana.com, plus optional EVM RPCs), cached and rate-limited so an enthusiastic agent cannot hammer the upstream.

Use cases

  • Screen 731 funding rates in one call — ranked by annualized rate with funding regime and mark/index spread; the 793% outliers are visible instantly
  • Trade TradFi 24/7 — metals, equity indices, energy, treasuries perps next to crypto, one consistent API
  • Follow the vault money — deposit flows per vault: who is parking capital where
  • Spot index dislocations — mark vs index divergence ranking across the whole board
  • Morning scan — market overview + funding overview + OI snapshot, three cheap calls

Full walkthroughs: examples/use-cases.md.

Quickstart

stdio (default, for local agents):

uvx aster-agent-gateway

or from a checkout:

git clone https://github.com/alekskram/aster-agent-gateway
cd aster-agent-gateway
uv sync
uv run aster-agent-gateway

Claude Desktop / Cursor config:

{
  "mcpServers": {
    "aster": {
      "command": "uvx",
      "args": ["--from",
               "git+https://github.com/alekskram/aster-agent-gateway",
               "aster-agent-gateway"]
    }
  }
}

Hosted form - streamable HTTP on port 8904:

uv run aster-agent-gateway --http            # 127.0.0.1:8904
curl http://127.0.0.1:8904/health   # -> {"ok": true, "service": "aster-agent-gateway", ...}
Codex (~/.codex/config.toml)
[mcp_servers.aster]
command = "uvx"
args = ["aster-agent-gateway"]
ZCode — register the server (copy-paste)
# 1) start the gateway (keep it running)
uvx aster-agent-gateway --http --port 8904 &

# 2) register it (merges into ~/.zcode/cli/config.json)
python3 - <<'PY'
import json, os
p = os.path.expanduser("~/.zcode/cli/config.json")
os.makedirs(os.path.dirname(p), exist_ok=True)
cfg = json.load(open(p)) if os.path.exists(p) else {}
cfg.setdefault("mcp", {}).setdefault("servers", {})["aster"] = {
    "type": "http", "url": "http://127.0.0.1:8904/mcp"}
json.dump(cfg, open(p, "w"), indent=2)
print("aster-agent-gateway registered:", p)
PY

Hosted form — streamable HTTP on port 8904:

uvx aster-agent-gateway --http

Tools

All 13 tools are read-only (annotated readOnlyHint: true, destructiveHint: false).

# Tool Signature What it does
1 market_overview market_overview(limit=20, sort="volume") Futures panel from ONE ticker/24hr ALL call joined with exchangeInfo: TRADING markets, top volumes, status counts, fresh listings (onboardDate).
2 exchange_symbols exchange_symbols(venue="futures", symbol=None, include_junk=False) Symbol universe with filters/precisions incl. MIN_NOTIONAL, stepSize, leverageFilter; TEST*/SETTLING junk filtered by default.
3 order_book order_book(symbol, venue="futures", depth=10) fapi depth / sapi api/v3 depth; limit snapped to a priced tier (weight-aware).
4 klines klines(symbol, interval="1h", limit=100, market="futures", price_type="last") last/mark/index klines on fapi; spot via sapi.
5 trades trades(symbol, limit=20, venue="futures") Fresh keyless trades; spot path probed live (honest error dict if dead).
6 spot_overview spot_overview(limit=20) Spot pairs from sapi ticker/24hr + exchangeInfo; TEST* junk filtered.
7 funding_overview funding_overview(limit=20, sort="rate") All ~730 rates from premiumIndex + fundingInfo: mixed 1/2/4/8h intervals (flagged), cap/floor, interestRate, nextFundingTime.
8 tradfi_markets tradfi_markets(limit=20, window=None) TradFi-perp screener by asset class (metals/equity/energy/treasuries/forex) + tradfi_crypto_corr sub-block: local TradFi-vs-BTC correlation from klines.
9 funding_screener funding_screener(top=10, direction="both") One-call ranking by annualized funding, premium, mark-index spread + funding_regime headroom to cap/floor.
10 oi_snapshot oi_snapshot(symbols=None, top=10) Per-symbol openInterest (max 10 symbols/call). No keyless OI history (404) - stated honestly.
11 deposit_flows deposit_flows(chain="all", limit=20) Solana vault signatures (keyless) + EVM vault Transfers when ASTER_EVM_RPC_URL* set + deposit_stats hourly/chain buckets.
12 account_view account_view(address, data="balance") tapi aster_getBalance/openOrders/userFills keyless for any address; privacy-empty returns an honest error dict explaining why.
13 mark_index_divergence mark_index_divergence(limit=20) mark vs index spread screener from ONE premiumIndex call + markPriceKlines-vs-klines crosscheck on the top 3.

Rate limits

Two REST buckets, locally enforced and weight-aware:

  • fapi 2400 weight/min, sapi 6000/min (header X-MBX-USED-WEIGHT-1M read after every call). Above 80% of a bucket the client self-throttles; 429 backs off honoring Retry-After; a 418 (repeated 429 = IP ban) triggers a 60s refusal cooldown. Depth/kline limits snap to priced tiers so callers cannot accidentally burn weight.
  • Solana 10 req/min, tapi 30/min, EVM 20/min local budgets (separate ledgers, fail-fast honest errors).

TTL caches: exchangeInfo 3600s, fundingInfo 600s, premiumIndex and tickers 15s, depth 5s, klines 60s, trades 10s, openInterest 30s.

Data notes

  • Every numeric from the API is a STRING upstream; parsed with a never-raising helper - null always means "not available", never zero.
  • Every upstream failure returns an error dict {"error", "source", "reason"}, never a traceback.
  • No OI history exists keyless (/futures/data/openInterestHist 404s) - the gateway says so instead of inventing data.
  • EVM vault logs need ASTER_EVM_RPC_URL (or per-chain ASTER_EVM_RPC_URL_{BSC,ETH,ARB}); free public RPCs reject vault queries with -32005. Unset -> honest "no RPC configured".
  • tapi account privacy: most accounts are private; empty results are reported as privacy, not as data.
  • Cached responses carry age_seconds / fetched_at freshness fields.

License

MIT.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aster_agent_gateway-0.1.1.tar.gz (178.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aster_agent_gateway-0.1.1-py3-none-any.whl (32.4 kB view details)

Uploaded Python 3

File details

Details for the file aster_agent_gateway-0.1.1.tar.gz.

File metadata

  • Download URL: aster_agent_gateway-0.1.1.tar.gz
  • Upload date:
  • Size: 178.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for aster_agent_gateway-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5a8599e616dc249030eef43d1183e655286e61df598c2818e1c572fdf28670ee
MD5 4849d521b3816441430718d6a75838d2
BLAKE2b-256 1db985428722dc11f0fa3e49a35b493c624f748b0dedba5d8a853298f15008e7

See more details on using hashes here.

Provenance

The following attestation bundles were made for aster_agent_gateway-0.1.1.tar.gz:

Publisher: release.yml on alekskram/aster-agent-gateway

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aster_agent_gateway-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for aster_agent_gateway-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6368883bc6778b2722f51993ce00d4767761241d0a0eeeb0d59a2e921e3a57c9
MD5 2de8dcb6ba64e421e8dc5d7922b8c0a3
BLAKE2b-256 5c0380e72dbb03f84d687bb593642ca31a808e89ac80b67163af999f57781d27

See more details on using hashes here.

Provenance

The following attestation bundles were made for aster_agent_gateway-0.1.1-py3-none-any.whl:

Publisher: release.yml on alekskram/aster-agent-gateway

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page