A Model Context Protocol (MCP) server providing documentation and SDK patterns for Orderly Network - an omnichain perpetual futures trading infrastructure.
Quick Start
Install the MCP server with one command for your AI client:
Create the appropriate configuration file for your AI client
Install @orderly.network/mcp-server as a dev dependency
Guide you through the next steps
After installation: Restart your AI client and try asking: "How do I connect to Orderly Network?"
What This Server Provides
This MCP server enables AI assistants to answer questions about Orderly Network and guide developers in building React components using the Orderly SDK v2.
Features
Documentation Search: Query Orderly docs for architecture, APIs, and concepts
SDK Patterns: Get code examples for all v2 hooks (useOrderEntry, usePositionStream, etc.)
Contract Addresses: Lookup smart contract addresses for all supported chains
Workflow Guides: Step-by-step explanations of common development tasks
Component Guides: Patterns for building trading UI components
API Reference: REST and WebSocket endpoint documentation
Indexer API: Trading metrics, account events, trades, and volume statistics
Installation
Quick Install (Recommended)
Use the CLI to automatically configure your AI client:
Get step-by-step explanation of common development workflows.
Parameters:
workflow (string, required): Workflow name
Available workflows:
wallet-connection: Connect wallet and create Orderly key
place-first-order: Complete flow for placing first trade
deposit-funds: Deposit USDC/tokens to Orderly
set-tp-sl: Set Take Profit and Stop Loss
subaccount-management: Create and manage subaccounts
4. get_api_info
Get information about Orderly REST API or WebSocket streams.
Parameters:
type (string, required): 'rest', 'websocket', or 'auth'
endpoint (string, optional): Specific endpoint or stream name
5. get_indexer_api_info
Get information about Orderly Indexer API for trading metrics, account events, trades, and volume statistics (rankings endpoints available via endpoint search).
Parameters:
endpoint (string, optional): Specific endpoint path or name (e.g., '/events_v2', 'daily_volume', 'ranking/positions')
category (string, optional): Filter by category (e.g., 'trading_metrics', 'events::events_api', 'trades::trades_api')
# Get all indexer API endpoints
get_indexer_api_info
# Get specific endpoint details
get_indexer_api_info endpoint="/events_v2"
# Get all endpoints in a category
get_indexer_api_info category="trading_metrics"
6. get_component_guide
Get guidance on building React UI components using Orderly SDK.
Parameters:
component (string, required): Component type
complexity (string, optional): 'minimal', 'standard', or 'advanced' (default: 'standard')
Available components:
order-entry: Order placement form
orderbook: Market depth display
positions: Position management table
wallet-connector: Wallet connection UI
7. get_orderly_one_api_info
Get information about Orderly One API for DEX creation, graduation, and management.
Parameters:
endpoint (string, optional): Specific endpoint path or name (e.g., '/dex', 'verify-tx', '/theme/modify')
graduation: Graduation system - upgrade from demo to full broker with fee splits
theme: AI-powered theme generation and CSS customization
stats: Platform-wide statistics and analytics
leaderboard: DEX rankings, performance metrics, and leaderboards
admin: Administrative operations for platform management
Example:
# Get overview and authentication flow
get_orderly_one_api_info
# Get all endpoints in a category
get_orderly_one_api_info category="dex"
get_orderly_one_api_info category="graduation"
# Get specific endpoint details
get_orderly_one_api_info endpoint="verify-tx"
get_orderly_one_api_info endpoint="/theme/modify"
Available Resources
Access comprehensive documentation via resource URIs. All resources support fuzzy search with pagination:
Query Parameters:
search (required) - Fuzzy search query
page (optional) - Page number (default: 1)
limit (optional) - Results per page, max 10 (default: 10)
Resources:
orderly://overview - High-level protocol architecture (no search required)
orderly://sdk/hooks?search=orderEntry - Search SDK hooks by name, description, or category
orderly://sdk/components?search=Checkbox - Search components by name or description
orderly://contracts?search=arbitrum - Search contracts by chain or name
orderly://workflows?search=wallet - Search workflows by name or steps
orderly://api/rest?search=position - Search REST API endpoints
User: "How does Orderly's vault system work?"
AI uses search_orderly_docs with query "vault system"
→ Returns explanation of cross-chain vault architecture
Searching SDK Symbols
User: "Show me how to use useOrderEntry"
AI uses search_orderly_docs with query "useOrderEntry"
→ Returns inline SDK hook record: signature, params, returns, source path
Looking Up Contracts
User: "What's the USDC address on Arbitrum?"
AI uses get_contract_addresses with chain "arbitrum", contractType "USDC"
→ Returns contract address
Explaining Workflows
User: "How do I place my first order?"
AI uses explain_workflow with workflow "place-first-order"
→ Returns step-by-step guide
Component Building Guide
User: "How do I build an order entry component?"
AI uses get_component_guide with component "order-entry"
→ Returns complete implementation guide
Data Sources
This MCP server includes embedded data from:
Orderly Documentation: Architecture, concepts, and guides
SDK Patterns: v2 hook examples and patterns from @orderly.network/hooks
DEX Examples: Complete working components from the example-dex repository
Contract Addresses: All deployed contracts across supported chains
API Specifications: REST and WebSocket endpoints
Indexer API: Trading metrics, account events, trades, and volume statistics
Orderly One API: DEX creation, graduation, and management API documentation
Workflow Guides: Common development task explanations
All data files in src/data/ are auto-generated via scripts in the scripts/ folder. Do not edit JSON files manually - they will be overwritten when regeneration scripts run.
Quick Free Refresh
Refresh all OpenAPI-sourced data (no AI calls, no API keys, internet only):
yarn update:free
This runs: generate_api_from_openapi, generate_indexer_api, generate_sv_api, generate_contracts, and generate_orderly_one_api, then builds and tests.
Prerequisites
NEAR AI API key in .env file: NEAR_AI_API_KEY=your_key