Provides access to OKX account, trading actions, and market data through an MCP interface using either stdio or HTTP endpoints.
Configuration
View docs{
"mcpServers": {
"aahl-mcp-okx": {
"url": "http://0.0.0.0:8811/mcp",
"headers": {
"OKX_API_KEY": "your-okx-api-key",
"OKX_BASE_URL": "https://www.okx.com",
"MCP_AUTH_TOKEN": "your-custom-token",
"OKX_API_SECRET": "api-secret-key",
"OKX_PASSPHRASE": "api-passphrase",
"OKX_TRADE_FLAG": "1"
}
}
}
}You run an MCP server that connects to OKX to fetch market data, manage accounts, and execute trading actions through a unified, programmable interface. This server lets you use both local process execution and remote HTTP endpoints to interact with OKX, exposing a set of trading, market, and account tools you can drive from any MCP client.
You can access the OKX MCP server from an MCP client by using either a local, stdio-based process or a remote HTTP endpoint. The local option runs a background process that starts with a command and environment variables you provide. The HTTP option exposes a remote, streamable endpoint you can query with standard MCP requests.
Prerequisites: ensure you have a modern runtime and MCP client setup. You will configure either a local stdio server using uvx or a Docker-based HTTP server that exposes an MCP URL.
Environment variables you will typically set for the local stdio method include your OKX API credentials and trading mode. You can also specify a base URL and an optional authentication token. For the HTTP method, you will point to the MCP URL and provide an Authorization header that contains your API key or a custom token.
Available tools include Account Tools for querying your account state, Trading Tools for placing and managing orders, and Market Data tools for retrieving current market information. Use these tools to build high-level trading automations or dashboards that reflect your OKX trading activity.
Treat API keys and secrets as sensitive credentials. Use environment isolation for each deployment, rotate credentials regularly, and limit trading permissions to the minimum required by your automation.
Get account configuration
Get account balance
Get account positions
Get account position risk
Place a new order
Cancel an incomplete order
Get order details
Get incomplete order list
Get Order History
Liquidate all positions
Get cryptocurrency rankings