This repository contains a Model Context Protocol (MCP) Server built using the FastMCP framework in Python. This server exposes functions (like getting prices or checking account balance) from the HyperLiquid Decentralized Exchange (DEX) Python SDK to be used by AI agents or clients like MCP Inspector.
You must have Python 3.10+ installed on your system
git clone https://github.com/Phoenix2066/HyperLiquidMCP
cd .\HyperLiquidMCP
To create a Python Virtual Environment:
python -m venv venv
To activate the virtual Environment:
Windows:
.\venv\bin\activate
Mac/Linux:
source myenv/bin/activate
Install the necessary Python packages:
pip install fastmcp hyperliquid-python-sdk python-dotenv eth-accountThis server uses your wallet's private key to sign requests for trading actions and view private account data.
โ ๏ธ Security Warning DO NOT use the private key for your main wallet with real funds. Always use a dedicated Testnet key or a small, segregated account for automated trading and testing.
- Create .env file: In the root directory of this project, create a new file named .env.
- Export Key: Export the 64-character private key from your MetaMask (or other EVM wallet) testing account.
- Add Configuration: Paste the key into the .env file and set the environment flags:
# Replace the placeholder with your 64-character private key
HYPERLIQUID_PRIVATE_KEY="YOUR_64_CHAR_PRIVATE_KEY_HERE"
# Set to 'true' to ensure connection to the Testnet environment
HYPERLIQUID_TESTNET="true"
You can run and test the server using the fastMCP INspector:
- Open MCP Inspector:
The command will launch a local server and print a URL (e.g., http://127.0.0.1:6274) to the console.
npx @modelcontextprotocol/inspector
- Open the URL in your web browser.
In the Inspector UI, the connection details should be pre-filled for STDIO transport. Click Connect. Go to the Tools tab. - You can now test the exposed functions directly via the tool tab.