Skip to main content

Installation

After installation, 22 MCP tools become available via natural language, and you can invoke any of the four skills explicitly using slash commands.

Skills

The plugin bundles four orchestration skills. Each skill provides structured guidance to Claude Code for a specific workflow pattern.
SkillSlash CommandPurpose
Query/nile-markets:queryQuery protocol data — pool state, positions, oracle prices, account balances
Integrate/nile-markets:integrateGenerate TypeScript or Rust integration code using the official SDK
Explain/nile-markets:explainExplain protocol concepts — margin, liquidation, modes, settlement, forward pricing
Execute/nile-markets:executeOrchestrate write operations with signing guidance (CLI, MCP, or external wallet)

/nile-markets:query

Queries live protocol data through MCP tools. Claude Code selects the appropriate tool based on your question. Example prompts:
  • “What’s the current pool utilization and TVL?”
  • “Show me all open positions for 0x1234…abcd”
  • “Is the protocol operating normally?”
  • “Get the EUR/USD 1-week forward price”

/nile-markets:integrate

Generates integration code using the @nile-markets/sdk (TypeScript) or fx-contracts crate (Rust). Produces working code with correct ABIs, contract addresses, and numeric precision handling. Example prompts:
  • “Write TypeScript code to read the current share price using viem”
  • “Generate a Rust function that opens a LONG 1M position using alloy-rs”
  • “Show me how to monitor position PnL in a Node.js script”
  • “Create a script that deposits USDC into the liquidity pool”

/nile-markets:explain

Explains protocol mechanics grounded in the documentation. Returns clear, accurate explanations with links to the relevant docs pages. Example prompts:
  • “How does liquidation work in Nile Markets?”
  • “What’s the difference between initial margin and maintenance margin?”
  • “Explain the four protocol modes and when they activate”
  • “How is PnL calculated for a SHORT position?”

/nile-markets:execute

Orchestrates onchain operations with step-by-step signing guidance. Supports three signing paths: Nile CLI with OWS wallet, MCP calldata with external signing, or direct contract interaction. Example prompts:
  • “Open a 1000 USDC long 1-week EUR/USD position”
  • “Deposit 500 USDC as margin collateral”
  • “Close position #42”
  • “Deposit 10,000 USDC into the liquidity pool”
The execute skill never handles private keys or passphrases. All key management and transaction signing happen outside the plugin, in your wallet tool of choice.

MCP Tools

Once the plugin is loaded, all 22 MCP tools are available through natural language — you do not need to call them explicitly. Claude Code automatically selects the right tool based on your question.

Read Tools (14)

ToolDescription
get_pool_statePool metrics: total assets, shares, share price, exposure, utilization, fees
get_protocol_modeOperating mode (NORMAL, DEGRADED, REDUCE_ONLY, PAUSED)
get_pool_transactionsHistorical vault deposits and withdrawals
get_daily_statsDaily volume, fees, position opens/closes
get_positionsPositions for a specific account
get_positionSingle position with real-time PnL
search_positionsSearch positions with side, tenor, status, notional filters
get_forward_priceForward price for one or all tenors
get_oracle_stateFull oracle state: spot, all forward prices, validity
get_accountAccount margin: collateral, locked, available, position count
get_fee_eventsFee event breakdown by type
get_token_balanceERC-20 token balance (defaults to USDC)
check_allowanceERC-20 allowance for an owner/spender pair
simulate_open_positionPreview margin, fee, and entry strike for a new position

Write Tools (8)

Write tools return unsigned transaction calldata. Your wallet signs and broadcasts.
ToolDescription
open_positionOpen a new FX forward position
close_positionClose a position via early termination
deposit_marginDeposit USDC as margin collateral
withdraw_marginWithdraw available USDC margin
vault_depositDeposit USDC into the liquidity pool
vault_withdrawWithdraw USDC from the liquidity pool
approve_tokenApprove a Nile contract to spend tokens
mint_test_tokenMint test tokens (Sepolia testnet only)

Natural Language Examples

You do not need to remember tool names. Ask questions naturally and Claude Code routes to the correct tool:
  • “What is the EUR/USD 1W forward price?” — calls get_forward_price with tenor: "1W"
  • “Show me all open positions for 0x1234…” — calls get_positions with account and status: "OPEN"
  • “How much margin do I need for a 5000 USDC short 1-month position?” — calls simulate_open_position
  • “What fees has the protocol collected today?” — calls get_daily_stats with days: 1
  • “Check my USDC balance” — calls get_token_balance with your address

Numeric Conventions

TypeDecimalsExample
USDC amounts61234567890 = 1,234.567890 USDC
Forward/spot prices181085000000000000000 = 1.085000
Utilization, feesBasis points4500 = 45%
The plugin connects to the Nile Markets MCP server on Ethereum Sepolia. All data and transactions are testnet-only with no real-world value.