lighter-mcp
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
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:
> **app.lighter.xyz/?referral=0XDEGENMO**
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.
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):**
A 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:**
Sets the approval to zero fees. Or simpler — disable client-side without an on-chain change:
When 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, and how_to_approve_integrator diagnostics
- **Three 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** | LIGHTER_ACCOUNT_INDEX | + 3 account-state tools (balance, positions) | Monitoring your account from Claude/Cursor |