Skip to main content
Testnet Only — All integration surfaces connect to Ethereum Sepolia (L1, chainId 11155111) or Arbitrum Sepolia (L2, chainId 421614). Token balances and positions have no real-world value. Select the target chain via --network (CLI), ?network= (x402), or the network tool parameter (MCP).
Unstable API (v0.3.2) — Tool schemas, endpoint paths, and response formats may change without notice during the M2 milestone.

Integration Surfaces

Six surfaces expose the same protocol operations with different transports, auth models, and target audiences.

Which Surface Should You Use?

Building an AI agent that trades or queries positions? Start with the MCP Server. It has the richest tool set, works with every major AI platform, and requires no auth. Connect in one command:
Building a traditional API integration? Use the x402 API. Standard REST with JSON responses — reads are free, writes cost $0.01 USDC via the x402 micropayment protocol. Automating from a shell or CI pipeline? Use the CLI in agent mode. The nile binary outputs structured JSON with --output json and works zero-config; pass --network arbitrumSepolia or --network sepolia to select the chain.

Choosing a network for agent flows

A typical 5-transaction agent task (approve USDC → deposit margin → open position → poll fixings → close) plays out differently on the two testnets: Neither is “wrong” — they validate the protocol under different confirmation regimes. Lead with Arbitrum Sepolia when your integration benchmarks throughput or relies on rapid iteration; lead with Ethereum Sepolia when you’re validating L1-fidelity behavior. Both surfaces accept the same operations with the same response shapes. Using Claude Code for protocol development? Install the Claude Code Plugin for four specialized skills that understand protocol internals. Want raw subgraph access? The Graph MCP shim exposes the protocol’s subgraph directly for custom GraphQL queries beyond what the MCP tools provide.

Two MCP Servers

Nile Markets operates two separate MCP servers: You can connect both simultaneously. They serve different purposes and do not overlap.

Surface Pages

MCP Server

23 tools via Streamable HTTP — connect from Claude, ChatGPT, Cursor, VS Code, and more

x402 API

REST API with free reads and $0.01 micropayment writes via the x402 protocol

CLI Agent Mode

30+ commands with JSON output for shell-based agents and CI pipelines

Claude Code Plugin

4 skills for querying, executing, explaining, and integrating with the protocol

OpenClaw Skill

One-command install via ClawhHub for OpenClaw-compatible agents

Graph MCP

Direct subgraph access for custom GraphQL queries over indexed protocol data

Shared Conventions

All surfaces share these conventions regardless of transport:
  • Amounts: Strings in smallest unit — "1000000000" = 1,000 USDC (6 decimals), "1085000000000000000" = 1.085 (18 decimals for prices)
  • Write operations: Return unsigned transaction calldata (to, data, value, chainId) — signing and broadcasting happen externally via your wallet
  • Response metadata: Every response includes protocol (name + version), network, and optionally blockNumber and source ("rpc", "subgraph", or "rpc+subgraph")
  • Pagination: List endpoints support first (page size, default 25, max 1000) and skip (offset)
  • Rate limits: 100 requests/minute per IP (MCP and x402 free endpoints)