from __future__ import annotations from mcp_common.app_factory import ExchangeAppSpec, run_exchange_main from mcp_hyperliquid.client import HyperliquidClient from mcp_hyperliquid.server import create_app SPEC = ExchangeAppSpec( exchange="hyperliquid", creds_env_var="HYPERLIQUID_WALLET_FILE", env_var="HYPERLIQUID_TESTNET", flag_key="testnet", default_base_url_live="https://api.hyperliquid.xyz", default_base_url_testnet="https://api.hyperliquid-testnet.xyz", default_port=9012, build_client=lambda creds, env_info: HyperliquidClient( wallet_address=creds["wallet_address"], private_key=creds["private_key"], testnet=(env_info.environment == "testnet"), api_wallet_address=creds.get("api_wallet_address"), ), build_app=create_app, ) def main(): run_exchange_main(SPEC) if __name__ == "__main__": main()