Overview
lighter-mcp is an MCP (Model Context Protocol) server for Lighter. Lighter is a zero-fee zk-rollup perpetual futures decentralized exchange running on Ethereum. Through this server, any MCP-compatible client can natively trade Lighter perpetual futures: place orders, manage positions, set on-chain stop-loss/take-profit, and query market data and account status.
Main Capabilities
- Provides 17 trading tools, plus three diagnostic tools: get_status, get_signup_info, and how_to_approve_integrator.
- Three-tier credential model: install and try it out without credentials, and progressively unlock more permissions as needed.
- Native on-chain stop-loss/take-profit: remains effective after client restarts.
- Place market orders by USDC notional amount for simple sizing; place limit orders by base asset quantity for precise control.
- Multi-market support: trading pairs are automatically discovered from the order book API.
- Subaccount-first design: API keys sign for the subaccount, keeping the main wallet in cold storage.
- Server-side safety limits: maximum trade size, slippage limits, trading pair whitelist.
- Per-market price/quantity encoding, correctly handling all listed perpetual contracts (e.g., BTC 1 decimal place, NEAR 5 decimal places, etc.).
Usage
At startup, the server selects one of three modes based on the configured environment variables; higher-permission modes must be explicitly opted into. In TRADE mode, you can downgrade to read-only at any time via LIGHTER_READ_ONLY=true, in which case order placement tools will no longer be registered.
Config file paths: on macOS, ~/Library/Application Support/Claude/claude_desktop_config.json; on Windows, %APPDATA%\Claude\claude_desktop_config.json.
Minimal configuration (PUBLIC mode, no Lighter account required); full configuration (TRADE mode, requires a subaccount API key). After restarting Claude Desktop, you can try: "List my Lighter markets" (available in PUBLIC mode) or "What's my balance?" (requires READ or abovepermissions).
Cursor or other MCP clients use the same command and arguments; for the specific format, refer to the MCP server configuration instructions for the corresponding client.
Tool Tiers
Always available (Tier 1 — PUBLIC): get_status (current mode, safety policy, integrator configuration, excluding secrets); get_signup_info (Lighter signup link and referral code, new users get a 5% bonus); how_to_approve_integrator (opt-in/opt-out instructions); list_markets, get_market(symbol) (market discovery); get_candles, get_ticker, get_orderbook, get_funding_rate (market data).
After configuring LIGHTER_ACCOUNT_INDEX (Tier 2 — READ): get_balance (collateral/used margin/available/asset value); get_positions, get_position(symbol) (position queries).
After configuring 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-only); place_take_profit(symbol, side, base_amount, trigger_price) (on-chain, reduce-only); close_position(symbol); cancel_order(order_id, symbol); cancel_all_orders.
Fees and Opt-In
This MCP is free and open source; you can freely install, run, and trade without paying anyone. If you find it useful, you may opt in to a small fee to support the project's ongoing maintenance—just a one-time on-chainEasy, no recurring actions. The fee is 1 bp maker (0.01%) / 2 bps taker (0.02%) on your own trades. Fees are routed to maintainer account 725426 through Lighter's permissionless partner integrator program, and no fees are incurred until you sign an on-chain ApproveIntegrator once. This is entirely optional: installation and trading work without approving.
Honest disclosure about Lighter's standard fees: Lighter standard accounts (retail default) currently have 0 maker/0 taker fees, so approving the integrator means paying 1-2 bps that would not otherwise exist; Lighter premium accounts have 2/20 bps fees, and approving the integrator changes that to 1/2 bps, which actually saves money. For standard accounts, approval is a small "thank you" contribution, while for premium accounts it is a clear win-win.
Opt-in (one-time, about 60 seconds, browser flow recommended): a local web page opens, connects to Metamask/Rabby, you click Approve, and sign an EIP-191 message in your wallet. The L1 wallet key never leaves the wallet interface; only the EIP-191 personal signature is returned to the local script.
How to revoke: set the approval to a zero fee; or more simply disable it via the client without making any on-chain change (after setting this, the integrator parameters are not attached to orders at all, with zero attribution and zero potential fee flow). Approvals expire by default after 90 days, and re-approval is only needed if you want to continue contributing; there is no silent lock-in.
Trust and security
This server signs transactions with the key you put in LIGHTER_PRIVATE_KEY, which should be treated as the most sensitive value in the entire configuration. Reasons it can be trusted or audited: fully open source, with all code at github.com/0xDegenMo/lighter-mcp, about 800 lines of Python in total, readable in 30 minutes; subaccount isolation, where the API key signs for only one Lighter subaccount, cannot withdraw funds, and cannot touch the main wallet; three-level separation, where credential-requiring tools are registered only when credentials are present, and a PUBLIC mode server cannot place orders even if asked to; integrator fees are enforced by Lighter, so even if the maintainer publishes malicious code attempting to take a cut, the Lighter protocol requires your on-chain ApproveIntegrator for fees to be generated, and without your signature the integrator parameters are invalid; revocation is simple, lighter-mcp-approve --revoke or the LIGHTER_NO_INTEGRATOR=true environment variable, completing in seconds; approvals expire by default after 90 days, requiring intent to be reconfirmed, and never silently locking.
Security recommendations: use a Lighter sub-account rather than the main wallet, create the sub-account in the Lighter interface, deposit only funds you are willing to put at risk, and generate an API key with apiKeyIndex >= 2 for that sub-account; this key cannot withdraw and can only sign transactions for that sub-account; never put the main wallet mnemonic or main signing key into environment variables, as this MCP does not need them; treat LIGHTER_PRIVATE_KEY as confidential, do not commit .env, and do not paste it into shared chats.
Server-side limits (enforced before orders leave the process): LIGHTER_MAX_QUOTE_USD (default 100) is the upper limit on opening trade size (USDC); orders with reduce_only=True are not subject to this limit, so closing/reducing positions is always available; LIGHTER_MAX_SLIPPAGE (default 0.005, i.e. 0.5%) applies to market orders; LIGHTER_ALLOWED_SYMBOLS (default all markets) is a comma-separated whitelist; if set, server-side trading for other trading pairs will be rejected; LIGHTER_API_KEY_INDEX < 2 logs a warning at startup; indices 0/1 are usually reserved for the main account.
Operating Instructions
Logs (stderr) include the current mode and integrator configuration, but never include private keys (only the first and last few characters are shown in the rare cases where a key appears in an incorrect path). cancel_all_orders cancels orders across all markets in the sub-account, so use it with caution. Cross margin: all positions in the sub-account share collateral, and one bad trade can exhaust the entire sub-account, but will not affect other parts.
Forking and Custom Integrators
If you fork this project, you can route fees to your own account; after that, each installation requires separately signing ApproveIntegrator for your own account before fees will flow.