papertrade-sdk

TypeScript SDK and MCP server

Quote, stream and sign Papertrade perps. From code or from any AI.

A typed client for every public endpoint, the live wallet stream, EIP-712 signing and settlement math checked against mainnet. A hosted read-only MCP server lets Claude, ChatGPT, Codex, Gemini and Cursor quote a position exactly before anyone trades.

Get started Connect your AI npm install papertrade-sdk viem

Unofficial. An independent community project, not affiliated with Papertrade. 1000x leverage can lose your whole margin in seconds. Not financial advice.

Works with

Loading live data

Protocol stats

TVL
LP pool
All-time volume
PAPER per $1 lost

Markets

MarketMidMax leverageOpen interest (long / short)Status

Playground

This runs estimateClose and liquidationPriceRaw from the SDK in your browser, using live instrument parameters and the current mid as entry.

Waiting for a live price.

What is inside

Typed read client

Every public endpoint with canonical queries, retries that honor Retry-After, and decoded bigint state.

Live wallet stream

Server-sent events with revision-checked patches, backoff reconnects and automatic resync.

EIP-712 signing

Every intent, session keys that can trade but never withdraw, and the exact intent ids the relayer computes.

Settlement math

Bust prices, impact haircuts, win fees, the PAPER mint curve and staking rewards, exact to the wei.

Read-only MCP server

Seven tools at /mcp. Stateless Streamable HTTP, no login, no keys, no signing.

Agent-ready docs

Markdown twins, llms-full.txt, OpenAPI 3.1, a server card and an A2A agent card.

Connect your AI

One URL, no API key: https://papertrade-sdk.pages.dev/mcp

claude mcp add --transport http papertrade-sdk https://papertrade-sdk.pages.dev/mcp

Setup for Claude API, ChatGPT, Windsurf, Zed, Cline, Goose, Continue and more

Install the SDK

npm install papertrade-sdk viem
import { PapertradeClient, streamWallet } from 'papertrade-sdk';

const client = new PapertradeClient();
const { instruments } = await client.tradingState();

streamWallet({
  wallet: '0x...',
  onState: (state) => console.log(state.positions.length, 'open positions'),
});

Verified against mainnet

The Papertrade toolkit