MCP server for the Liquid trading API
Project description
liquidtrading-mcp
MCP server for the Liquid trading API. Enables AI agents to trade, read market data, and manage positions through any MCP-compatible client.
Installation
Prerequisites
- Python 3.10+
- uv (recommended) or pip
- A Liquid API key and secret (optional — public market data tools work without credentials)
Install from PyPI
pip install liquidtrading-mcp
Or with uv:
uv pip install liquidtrading-mcp
Install from Source
git clone https://github.com/your-org/liquidtrading-mcp.git
cd liquidtrading-mcp
uv sync --no-sources
For local development with sibling checkouts, plain uv sync will use the sibling ../liquidtrading-python checkout via tool.uv.sources. If you are developing liquidtrading-mcp by itself, use uv sync --no-sources so uv resolves liquidtrading-python from PyPI instead.
Configuration
Claude Code
Run this command to add the MCP server to Claude Code:
claude mcp add liquid -- liquidtrading-mcp
Or with environment variables:
claude mcp add liquid \
-e LIQUID_API_KEY=lq_... \
-e LIQUID_API_SECRET=sk_... \
-e MAX_ORDER_USD=1000 \
-e DAILY_LOSS_LIMIT=5000 \
-- liquidtrading-mcp
If running from source:
claude mcp add liquid \
-e LIQUID_API_KEY=lq_... \
-e LIQUID_API_SECRET=sk_... \
-- uv run --directory /path/to/liquidtrading-mcp liquidtrading-mcp
Claude Desktop
Open Settings > Developer > Edit Config and add to claude_desktop_config.json:
{
"mcpServers": {
"liquid": {
"command": "liquidtrading-mcp",
"env": {
"LIQUID_API_KEY": "lq_...",
"LIQUID_API_SECRET": "sk_...",
"MAX_ORDER_USD": "1000",
"DAILY_LOSS_LIMIT": "5000"
}
}
}
}
If running from source:
{
"mcpServers": {
"liquid": {
"command": "uv",
"args": ["run", "--directory", "/path/to/liquidtrading-mcp", "liquidtrading-mcp"],
"env": {
"LIQUID_API_KEY": "lq_...",
"LIQUID_API_SECRET": "sk_..."
}
}
}
}
Cursor
Open Settings > MCP Servers > Add Server and use the same JSON format as Claude Desktop above.
Windsurf
Add to ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"liquid": {
"command": "liquidtrading-mcp",
"env": {
"LIQUID_API_KEY": "lq_...",
"LIQUID_API_SECRET": "sk_..."
}
}
}
}
Verify Installation
After configuring, verify the server is working:
- Claude Code: Run
claude mcp listto see the server, then ask Claude to callget_markets - Claude Desktop: The tools icon (hammer) should show 22 tools from "Liquid Trading"
- MCP Inspector (standalone debugging):
npx @modelcontextprotocol/inspector liquidtrading-mcp
Or from source:npx @modelcontextprotocol/inspector uv run --directory /path/to/liquidtrading-mcp liquidtrading-mcp
This opens a web UI where you can list tools, call them interactively, and inspect schemas.
Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
LIQUID_API_KEY |
No | None | API key (public tools work without) |
LIQUID_API_SECRET |
No | None | API secret (must pair with key) |
LIQUID_BASE_URL |
No | SDK default | API base URL (must be valid HTTP/S) |
MAX_ORDER_USD |
No | 1000 | Max single order size in USD |
DAILY_LOSS_LIMIT |
No | 5000 | Daily cumulative loss cap in USD |
LIQUID_MCP_AUDIT_PATH |
No | ~/.liquidtrading-mcp/trades.jsonl | Audit log path |
Notes:
LIQUID_API_KEYandLIQUID_API_SECRETmust both be set or both absent- If
MAX_ORDER_USDexceedsDAILY_LOSS_LIMIT, a warning is logged at startup - The audit log directory is created automatically if it doesn't exist
Tools (22)
Market Data (public — no API key needed)
get_markets— List all tradeable marketsget_ticker— 24h ticker (price, volume, funding)get_orderbook— L2 order bookget_candles— OHLCV candle data
Account (read scope)
get_account— Equity, margin, balance overviewget_balances— Detailed balance breakdownget_positions— Open positions with PnL
Orders (trade scope)
place_order— Place market/limit order (size in USD notional)place_bracket_order— Order with mandatory TP/SL (atomic)get_open_orders— List open ordersget_order— Get order by IDcancel_order— Cancel an ordercancel_all_orders— Cancel all orders
Positions (trade scope)
close_position— Close full/partial positionset_tp_sl— Set take-profit / stop-lossupdate_leverage— Change leverage (warns on >20x)update_margin— Adjust isolated margin
Transfers
Helpers
calculate_token_amount— USD to token conversioncalculate_position_size— % of equity to USD sizevalidate_trade— Pre-flight risk check
Resources
liquid://portfolio— Current positions, equity, marginliquid://risk— Daily loss state, limits, exposure
Prompt Templates
scalp— Scalp trading strategyswing— Swing trading strategydca— Dollar-cost averaging
Safety
- Max order size: Rejects orders exceeding
MAX_ORDER_USD - Daily loss limit: Tracks cumulative losses per UTC day, blocks when exceeded
- Dry run: All trade tools accept
dry_run=Truefor preview without executing - Audit log: All trades logged to JSONL file (including dry runs)
- High leverage warnings: Orders and leverage changes above 20x trigger warnings
- Error recovery: All tools return structured errors with
hintandnext_stepsfor the agent to recover gracefully
Transport
- Default: stdio (for Claude Desktop / Claude Code / Cursor)
liquidtrading-mcp --http: Streamable HTTP on port 4243
Troubleshooting
SSL errors (TLSV1_UNRECOGNIZED_NAME)
Set LIQUID_BASE_URL to the correct API endpoint. The default URL may not resolve in all environments.
Tools not appearing
- Restart the MCP client after config changes
- Check that
liquidtrading-mcpis on your PATH:which liquidtrading-mcp - If installed from source, ensure the
--directorypath is correct - Check logs: Claude Code shows MCP errors in the output, Claude Desktop logs to
~/Library/Logs/Claude/
Authentication errors
- Verify both
LIQUID_API_KEYandLIQUID_API_SECRETare set - Public tools (
get_markets,get_ticker,get_orderbook,get_candles) work without credentials - The error response will include a
hintfield with recovery guidance
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file liquidtrading_mcp-0.1.1.tar.gz.
File metadata
- Download URL: liquidtrading_mcp-0.1.1.tar.gz
- Upload date:
- Size: 79.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88d34ae5493d03babdb879fcc02b21e64447f62812a3c7c44998d6d46f0da453
|
|
| MD5 |
c4bbb899ae0d234f8c2e519cc1adbbc2
|
|
| BLAKE2b-256 |
69679fc24ddb84bf40e34a625b53b65753e45531973189915e1d474fb24efcd7
|
File details
Details for the file liquidtrading_mcp-0.1.1-py3-none-any.whl.
File metadata
- Download URL: liquidtrading_mcp-0.1.1-py3-none-any.whl
- Upload date:
- Size: 21.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
678a5dfc70014ed9687e8d1fa70c30bf9b6ff31c552ae270d6e4f4af0bacc271
|
|
| MD5 |
3c2ca029dc007cee70eca1ebad0dcc8f
|
|
| BLAKE2b-256 |
7bf7de31a091ebf9aeed6596fd278de76aac0f6b2965d9e83c0169e186d56161
|