Lighter MCP
This server provides tools to interact with Lighter, a zk-rollup perpetual DEX, enabling market data queries, account monitoring, and trade execution via the Model Context Protocol.
Market Data
List all tradeable perpetual markets and fetch metadata for a specific market
Retrieve OHLCV candlestick data with configurable intervals (1m, 5m, 15m, 1h, 4h, 1d)
Get real-time ticker data (bid/ask/last price), order book depth, and current funding rates
Account Management (requires account index)
Check balance details (collateral, margin-in-use, available, asset value)
View open positions and specific position details
Trading (requires private key)
Place USDC-notional market orders and base-amount limit orders
Set on-chain stop-loss and take-profit orders
Close open positions, cancel individual orders by ID, or cancel all open orders
Adjust leverage per market
Security & Safety
Three-tiered access levels (Public, Read, Trade) with sub-account isolation (API key cannot withdraw funds)
Configurable server-side safety caps for max trade size, slippage, and allowed symbols
Diagnostics & Info
Check server mode, active safety limits, and integrator fee configuration
Get Lighter sign-up info (includes a referral code for a 5% bonus for new users)
View instructions to opt into or revoke the transparent integrator fee (1 bp maker / 2 bps taker, requires on-chain approval, expires after 90 days)
Enables trading on Lighter, a zero-fee zk-rollup perpetual DEX on Ethereum, including market data queries, account management, and order placement with on-chain stop-loss/take-profit.
lighter-mcp
A Model Context Protocol server for Lighter — a zero-fee zk-rollup perpetual DEX on Ethereum.
Connect any MCP-aware client (Claude Desktop, Cursor, Hermes, custom Anthropic SDK apps) and trade Lighter perpetuals natively: place orders, manage positions, set on-chain stop-loss / take-profit, query markets and account state.
New to Lighter?
Sign up here for a 5% bonus on your first trades:
The bonus is applied automatically at account creation — the referral code only works during signup, not after. If you already have a Lighter account, skip this section.
Related MCP server: hyperliquid-mcp
Free + sustained by a small optional fee
This MCP is free and open-source. You can install it, run it, and trade through it without paying anyone.
If you find it useful, you can opt-in to a small fee that helps keep the project sustained — one on-chain transaction, no recurring action. The fee is 1 bp maker (0.01%) / 2 bps taker (0.02%) on your own trades:
Your trade volume | Per-trade cost (taker) | Yearly cost (50 trades/month) |
$1,000 | $0.20 | ~$120 |
$100 | $0.02 | ~$12 |
$50 (lighter sub-account default) | $0.01 | ~$6 |
The fee routes via Lighter's permissionless partner-integrator program to the maintainer's account 725426. No fees flow until you sign an on-chain ApproveIntegrator once. It's strictly opt-in: you can install + trade without ever approving.
Honest disclosure about Lighter's standard fees:
Lighter Standard Accounts (retail default) currently trade with 0 maker / 0 taker fees. Approving the integrator means you pay 1-2 bps that wouldn't otherwise apply.
Lighter Premium Accounts trade with 2/20 bps. Approving the integrator gives you 1/2 bps instead — you save money.
For Standard Accounts the approve is a small "thanks" contribution. For Premium Accounts it's a clear win-win.
How to opt in (or out)
Opt in (one-time, ~60 seconds, recommended browser flow):
lighter-mcp-approveA localhost web page opens; connect Metamask/Rabby; click Approve; sign the EIP-191 message in your wallet. Your L1 wallet key never leaves the wallet UI — only an EIP-191 personal signature passes back to the local script.
Revoke at any time:
lighter-mcp-approve --revokeSets the approval to zero fees. Or simpler — disable client-side without an on-chain change:
# In your MCP server env:
LIGHTER_NO_INTEGRATOR=trueWhen set, integrator params aren't even attached to your orders. Zero attribution, zero potential fee flow.
Approve expires after 90 days by default — you re-approve only if you want to keep contributing. No silent lock-in.
Features
17 trading tools +
get_status,get_signup_info, andhow_to_approve_integratordiagnosticsThree credential tiers — install + try with no credentials, opt in to more as you go
Native on-chain SL/TP — survives client restarts
USDC-notional market orders for simple sizing; base-amount limit orders for precision
Multi-market — symbols auto-discovered from the order-book API
Sub-account-first design — API key signs for a sub-account; your main wallet stays cold
Server-side safety caps — max trade size, slippage limit, symbol allowlist
Per-market price/size encoding — handles all listed perpetuals correctly (BTC 1-decimal, NEAR 5-decimal, etc.)
Modes
The server picks one of three modes at startup based on which env vars are set. Higher modes are strictly opt-in.
Mode | Required env | Tools available | Use for |
PUBLIC | (none) | 7 public market-data tools (markets, candles, orderbook, funding...) | Trying it out, exploring Lighter data, building analytics |
READ |
| + 3 account-state tools (balance, positions) | Monitoring your account from Claude/Cursor |
TRADE | + | + 8 trading tools | Autonomous / assisted trading |
In TRADE mode you can demote to read-only at any time with LIGHTER_READ_ONLY=true — order-placement tools are then not even registered.
Install
pip install 0xdegenmo-lighter-mcp
# For live trading you also need the git version of the Lighter SDK:
pip install --upgrade git+https://github.com/elliottech/lighter-python.git@mainConfigure
Claude Desktop
~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or
%APPDATA%\Claude\claude_desktop_config.json (Windows):
Minimal — PUBLIC mode (no Lighter account needed):
{
"mcpServers": {
"lighter": {
"command": "python",
"args": ["-m", "lighter_mcp"]
}
}
}Full — TRADE mode (sub-account API key required):
{
"mcpServers": {
"lighter": {
"command": "python",
"args": ["-m", "lighter_mcp"],
"env": {
"LIGHTER_URL": "https://mainnet.zklighter.elliot.ai",
"LIGHTER_ACCOUNT_INDEX": "<your-sub-account-index>",
"LIGHTER_PRIVATE_KEY": "<api-key-private-key>",
"LIGHTER_API_KEY_INDEX": "2",
"LIGHTER_MAX_QUOTE_USD": "100"
}
}
}
}Restart Claude Desktop. Try: "List my Lighter markets" (PUBLIC works) or "What's my balance?" (needs READ+).
Cursor / other MCP clients
Same command and args. Check your client's MCP server config for the exact format.
Hermes Agent
mcp_servers:
lighter:
command: "python"
args: ["-m", "lighter_mcp"]
env:
LIGHTER_URL: "https://mainnet.zklighter.elliot.ai"
LIGHTER_ACCOUNT_INDEX: "<sub>"
LIGHTER_PRIVATE_KEY: "<api-key-priv>"
LIGHTER_API_KEY_INDEX: "2"Tools
Always available (Tier 1 — PUBLIC)
get_status— current mode, safety policy, integrator config (no secrets)get_signup_info— Lighter signup URL + referral code (5% bonus for new users)how_to_approve_integrator— instructions for opt-in / opt-outlist_markets,get_market(symbol)— market discoveryget_candles,get_ticker,get_orderbook,get_funding_rate— market data
With LIGHTER_ACCOUNT_INDEX (Tier 2 — READ)
get_balance— collateral / margin-in-use / available / asset_valueget_positions,get_position(symbol)— open positions
With LIGHTER_PRIVATE_KEY (Tier 3 — TRADE)
set_leverage(symbol, leverage, cross)place_market_order(symbol, side, quote_amount_usd, reduce_only)place_limit_order(symbol, side, base_amount, price)place_stop_loss(symbol, side, base_amount, trigger_price)— on-chain, reduce-onlyplace_take_profit(symbol, side, base_amount, trigger_price)— on-chain, reduce-onlyclose_position(symbol)cancel_order(order_id, symbol)cancel_all_orders
Trust & Security
This server signs transactions with whatever key you put in LIGHTER_PRIVATE_KEY. Treat that as the most sensitive value in the whole config.
Why you can trust this MCP (or audit it):
Fully open-source — every line of code lives at github.com/0xDegenMo/lighter-mcp. ~800 lines of Python total, readable in under 30 minutes.
Sub-account isolation — the API key signs only for one Lighter sub-account; cannot withdraw funds, cannot touch your main wallet.
Three-tier separation — tools that need credentials are only registered when those credentials are present. A PUBLIC-mode server cannot place trades even if asked.
Integrator fees are Lighter-enforced — even if the maintainer ships malicious code that tries to skim, Lighter's protocol requires your on-chain
ApproveIntegratorfor fees to flow at all. Without your signature, integrator params are inert.Easy revoke —
lighter-mcp-approve --revokeorLIGHTER_NO_INTEGRATOR=trueenv, takes seconds.Approve expires — default 90-day expiry means you re-confirm intent, never silently locked in.
Wallet hygiene
Use a Lighter sub-account, not your main wallet. Create the sub-account in the Lighter UI, fund only what you're willing to risk, generate an API key with
apiKeyIndex >= 2for that sub-account. That key cannot withdraw — it can only sign trading transactions for that sub-account.Never put your main wallet seed or main signing key in env vars. This MCP doesn't need it.
Treat
LIGHTER_PRIVATE_KEYas a secret. Don't commit.env; don't paste into shared chats.
Server-side caps (enforced before the order leaves the process)
LIGHTER_MAX_QUOTE_USD(default 100) — opening trade size cap in USDC.reduce_only=Trueorders bypass the cap, so closing/trimming always works.LIGHTER_MAX_SLIPPAGE(default 0.005 = 0.5%) — applied to market orders.LIGHTER_ALLOWED_SYMBOLS(default: all markets) — comma-separated allowlist. If set, trades on any other symbol are refused server-side.LIGHTER_API_KEY_INDEX < 2— logged as a warning at startup. Indices 0/1 are typically reserved for the main account.
Operational notes
Logs (stderr) include the active mode and integrator config but never the private key (only first/last few chars in the rare case keys appear in error paths).
cancel_all_orderscancels across all markets in the sub-account. Use intentionally.Cross-margin: all positions in the sub-account share collateral; a bad trade can drain the whole sub-account but nothing else.
Forking for your own integrator
If you fork this project, you can route fees to your own account:
LIGHTER_INTEGRATOR_ACCOUNT_INDEX=<your-account-index>
LIGHTER_INTEGRATOR_MAKER_FEE=<raw> # 100 = 1 bp
LIGHTER_INTEGRATOR_TAKER_FEE=<raw> # 200 = 2 bpsThen each install needs its own ApproveIntegrator for your account before fees flow.
Environment
Var | Tier | Default | Description |
| all | mainnet | API base URL |
| READ+ | (unset) | Sub-account index |
| TRADE | (unset) | API-key private key (sub-account, not main wallet) |
| TRADE |
| Index of the API key |
| any | (unset) | If |
| TRADE |
| Cap on opening trade size in USDC |
| TRADE |
| Max slippage fraction on market orders |
| TRADE | (unset) | Comma-separated symbol allowlist |
| any | (unset) | If |
| any |
| Override integrator account (forks) |
| any |
| Override maker fee (raw int) |
| any |
| Override taker fee (raw int) |
| any |
| Log level on stderr |
License
MIT
Available Tools
8 toolsget_candlesA
OHLCV candles for a market.
Args: symbol: e.g. 'HYPE', 'ETH' interval: minutes per candle — 1, 5, 15, 60, 240, or 1440 (1d) limit: number of candles back from now (max ~500)
Inputs: symbol (required), interval, limit. Returns: result
get_funding_rateB
Current funding rate and next funding timestamp for a perp market.
Funding occurs every 8h. Positive rate = longs pay shorts.
Inputs: symbol (required).
get_marketA
Get metadata for a single market by symbol (e.g. 'HYPE', 'ETH').
Returns None if the symbol is not listed.
Inputs: symbol (required). Returns: result
get_orderbookC
Top-N order book levels.
Returns {"bids": [[price, size], ...], "asks": [[price, size], ...]}.
Inputs: symbol (required), depth.
get_statusA
Server diagnostics: current mode, safety policy, and integrator attribution.
Reveals no secrets — safe to call from any client. Use this to verify:
which tier the server is running in (PUBLIC / READ / TRADE)
active safety limits (max_quote_usd, max_slippage, allowed_symbols)
whether integrator/partner attribution is active and at what fee rates
Anyone curious about fees should call this tool — it's the authoritative answer.
Inputs: no named parameters.
get_tickerB
Current best bid / best ask / last price for a market.
Inputs: symbol (required).
how_to_approve_integratorA
How to opt in to sending integrator fees to the lighter-mcp maintainer.
Use this if a user asks how to support the project, how integrator attribution works in practice, or how to make fees actually flow.
Returns instructions for both the browser-based flow (recommended — wallet UI handles the L1 signature, no private key exposure) and the CLI fallback for power users. No call is made to Lighter from this tool.
Inputs: no named parameters.
list_marketsA
List all tradeable perpetual markets on Lighter.
Returns symbol, market_index, min_base_amount, min_quote_amount, price_tick, size_tick, max_leverage for each market.
Inputs: no named parameters. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Each tool targets a distinct piece of information or action: candles, funding rate, market metadata, order book, server status, ticker, integrator instructions, and market listing. No two tools have overlapping responsibilities.
Most tools follow a 'get_' prefix, but 'list_markets' uses 'list_' and 'how_to_approve_integrator' is a descriptive phrase rather than a standard verb-noun pattern. This mix of conventions reduces consistency.
With 8 tools, the set feels appropriately scoped for a market data and server information provider. It is neither too sparse nor bloated for its apparent purpose.
The server covers market data retrieval well (candles, orderbook, ticker, funding rate) and adds list/meta tools, but lacks any trading or account management tools. Given the 'TRADE' tier mentioned in get_status, this gap is notable.
Related MCP Connectors
Trade Papertrade BTC and ETH perps from Claude, ChatGPT, Codex, Cursor and any MCP client.
AI trading agents you own: plan, run and read any market from your AI, on Lighter and Hyperliquid.
Trading MCP server for AI agents, with live market data, account reads and controlled execution.
Live prices, perps, prediction markets and a paper trading desk over one MCP.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceMCP (Model Context Protocol) server for the MAIN DEX on Base. Provides AI agents (Claude, Cursor, etc.) with tools to interact with the protocol: swap tokens, manage liquidity, enter/exit ALM strategies(10% APY), and more.MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol (MCP) server for the Hyperliquid decentralized exchange, enabling AI assistants to perform trading operations, manage accounts, and retrieve market data.17 PyPI3MIT
- AlicenseNot gradedqualityDmaintenanceA portable MCP server that exposes Lighter trading to any MCP-capable agent with safety-first features like mode-based gating, two-step confirmations, and audit logging.2MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that lets Claude Code (and other MCP clients) trade crypto, read market data, and manage wallets across EVM chains and Solana.MIT