Desic OKX Agent
An independent local OKX runtime, MCP server, CLI, and reusable agent skills for Codex, Claude Code, and other MCP clients, enabling market data access, trading operations, and analysis.
README
Desic OKX Agent
An independent local OKX runtime, MCP server, CLI, and reusable agent skills for Codex, Claude Code, and other MCP clients.
[!IMPORTANT] Desic OKX Agent is an independent community project. It is not affiliated with, endorsed by, or an official product of OKX.
What it provides
- A shared local Runtime reused by multiple MCP and CLI clients
- In-memory ticker, order book, trades, candles, funding, mark price, and open-interest data
- Time-aligned decision snapshots with freshness and consistency metadata
- Public market and derivatives tools that work without API credentials
- Named OKX accounts for balances, positions, orders, fills, bills, and risk summaries
- Direct ordinary-order, algo-order, leverage, amend, cancel, and close-position operations
- Experimental News and Smart Money intelligence with SQLite history fallback
- Seven reusable analysis and trading skills
- SQLite WAL persistence for closed candles, intelligence history, derived events, and execution records
The project does not expose withdrawal, deposit, transfer, asset-movement, or API-key-management tools.
Requirements
- Node.js 22.12 or newer
- npm
- Network access to OKX, or an HTTP/HTTPS proxy that can reach OKX
Install
Install the published package:
npm install --global desic-okx-agent
This registers the desic-okx command on the local machine.
Set up an AI client
Run the guided setup after installation:
desic-okx setup
The terminal guide lets you select Codex, Claude Code, Cursor, VS Code / GitHub Copilot, Cline, or all supported clients with the arrow keys and Space. It safely adds the desic-okx MCP entry without replacing other MCP servers.
For Codex and Claude Code, setup also installs all bundled Skills automatically. Cursor, VS Code / GitHub Copilot, and Cline receive MCP configuration only because they do not share a portable SKILL.md installation format.
Setup then checks both OKX REST and WebSocket connectivity. When direct and detected system-proxy connections fail, it offers to test and save an HTTP proxy URL, retry, or continue without network access.
For automation, choose explicit targets without opening the UI:
desic-okx setup --targets codex --yes
desic-okx setup --targets codex,claude-code --yes
desic-okx setup --all --yes
desic-okx setup --targets codex --yes --skip-network-check
Non-interactive setup exits with an error when the network check fails. Use --skip-network-check only when connectivity will be configured later.
Restart the selected client after setup. The MCP server starts the local Runtime automatically when it is first used.
Ask an AI to install it
Paste this into Codex, Claude Code, Cursor, VS Code / GitHub Copilot, or Cline. Replace codex with claude-code, cursor, vscode, cline, or all when appropriate.
Install Desic OKX Agent for me. Check that Node.js is at least 22.12, then run:
npm install --global desic-okx-agent
desic-okx setup --targets codex --yes
Verify the installation with `desic-okx status` and `desic-okx tools`. Do not ask for or configure any OKX API credentials. Confirm that public market tools are ready to use.
For development from source:
git clone https://github.com/xiazhi88/desic-okx-agent.git
cd desic-okx-agent
npm ci
npm run build
npm link
Quick start
Public market tools do not require an account:
desic-okx start
desic-okx call market_get_ticker --json '{"instId":"BTC-USDT-SWAP"}'
desic-okx call market_get_decision_snapshot --json '{"instId":"BTC-USDT-SWAP","bar":"1m"}'
The Runtime starts automatically when an MCP client or CLI call needs it. desic-okx start is optional.
Useful Runtime commands:
desic-okx status
desic-okx tools
desic-okx stop
Connect Codex
The recommended option is desic-okx setup, which also installs all Skills. To register only the local stdio MCP server manually:
codex mcp add desic-okx -- desic-okx mcp
Or add it to ~/.codex/config.toml:
[mcp_servers.desic-okx]
command = "desic-okx"
args = ["mcp"]
Connect Claude Code
The recommended option is desic-okx setup, which also installs all Skills. To register only the MCP server manually:
claude mcp add --transport stdio --scope user desic-okx -- desic-okx mcp
Verify the connection with:
claude mcp get desic-okx
A JSON example is available in examples/claude-code/mcp.json.
Skills
desic-okx setup automatically installs all seven Skills for Codex and Claude Code. The MCP server exposes the tools; Skills add reusable analysis and trading workflows.
To install selected Skills manually, copy their directories from the installed package:
Codex personal skills:
${CODEX_HOME:-~/.codex}/skills/<skill-name>/SKILL.md
Claude Code personal skills:
~/.claude/skills/<skill-name>/SKILL.md
Project-scoped alternatives are .agents/skills/ for Codex and .claude/skills/ for Claude Code.
Included skills:
okx-market-analysisokx-derivatives-analysisokx-news-intelligenceokx-smart-money-analysisokx-account-analysisokx-tradingtrading-philosophy
Restart the client if a newly installed skill does not appear.
Configure an OKX account
Public tools work without credentials. Account and trading tools use a named account alias and never accept credentials as tool arguments.
Add and verify an account interactively:
desic-okx account add --name demo --environment demo
desic-okx account verify --name demo
desic-okx account list
The credential prompts hide input. Credentials are stored in the system configuration directory in config.json; Unix permissions are set to 0600. The active path is shown by:
desic-okx config-path
Environment variables can override a named account:
OKX_ACCOUNT
OKX_API_KEY
OKX_API_SECRET
OKX_API_PASSPHRASE
OKX_ENVIRONMENT=demo|live
The three credential values must be provided together. Whether an account can trade is determined by the permissions assigned to its API key in OKX.
Proxy
REST and every public, business, and private WebSocket connection use the same proxy resolution order:
proxy.urlinconfig.jsonHTTPS_PROXY,HTTP_PROXY, orALL_PROXYenvironment variables, withNO_PROXYsupport- The enabled Windows or macOS HTTP/HTTPS system proxy
- Direct connection
Linux system-wide desktop proxy settings vary by distribution; use the standard environment variables or config.json. Only HTTP and HTTPS proxy URLs are supported. PAC-only and SOCKS-only system settings require an HTTP proxy endpoint.
Example explicit configuration:
{
"proxy": {
"url": "http://127.0.0.1:7890"
}
}
The guided desic-okx setup flow tests a manually entered proxy before saving it. See examples/config.example.json for a complete credential-free configuration template. Restart the Runtime after changing configuration.
Runtime behavior
- Binds a random port on
127.0.0.1 - Stores PID, port, and a random access token in private local state files
- Prewarms
BTC-USDT-SWAPandETH-USDT-SWAP - Subscribes to other instruments on demand and releases them after 15 minutes of inactivity
- Serves fresh data from memory and uses REST for cold or stale data
- Reconnects WebSockets automatically
- Rebuilds the order book after sequence gaps or checksum failures
- Restores persisted candle and intelligence history before live prewarming
market_get_decision_snapshot combines market components around one observation time. It reports every component's exchange timestamp, receive time, age, warnings, and maximum observed time skew. Trading prechecks reject inconsistent snapshots.
Trading behavior
Trading tools require a stable executionKey. Client order IDs are derived from that key, and execution state is recorded locally. When a write times out or returns an unclear result, the Runtime queries remote order state before deciding whether a retry is safe.
Supported order families include:
limitmarketpost_onlyiocfoktriggerconditionaltrailing
Ordinary and strategy orders are checked against instrument increments, minimum size, current account permission, and market snapshot consistency before submission.
Use an OKX Demo account first. Trading software can lose money, and the project provides no investment advice or guarantee of execution quality.
Experimental intelligence
News and Smart Money use upstream interfaces that may change without notice. Compatibility failures return CAPABILITY_UNAVAILABLE, or locally persisted history when available. A failure in these modules does not disable market, account, or trading tools.
Development
npm ci
npm run check
The check pipeline runs:
- TypeScript type checking
- Unit tests
- Skill validation
- Sensitive-information scanning
- Production build
- MCP SDK smoke tests
The optional end-to-end trading test is restricted to OKX Demo. Export the four environment variables listed in the account section, using demo as the environment, and then run:
npm run test:demo
Normal tests never submit orders.
Status
This repository is currently pre-release software at version 0.1.8. Unit, packaging, Skill, and MCP transport checks are automated. Real OKX Demo trading should be validated in the target network environment before a 1.0.0 release.
License
MIT. See LICENSE.
OKX and related marks belong to their respective owners.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.