Model Context Protocol (MCP) server for the QuantDinger Agent Gateway — market data, indicator workspace, strategies, backtests, and experiments for AI agents (Cursor, Claude Code, Codex, OpenClaw, NanoBot, ...).
Project description
QuantDinger MCP server
Thin Model Context Protocol server that exposes a curated subset of the
QuantDinger Agent Gateway (/api/agent/v1) as MCP tools, so AI clients
that support MCP (Cursor, Claude-style desktop apps, OpenClaw, NanoBot, etc.)
can drive QuantDinger without writing custom HTTP code.
This package is an additive integration. The Agent Gateway REST API remains the source of truth.
Security model
- No live trading via MCP.
quick-trade/*endpoints are intentionally not wrapped. Use REST with an explicitly scopedTtoken if needed. - Scope gating stays on the server. The MCP layer forwards your agent token; it cannot bypass allowlists or scopes.
- Defense in depth: MCP redacts known credential fields (
api_key,secret,passphrase, …) in JSON responses. The Gateway also redacts strategy rows before returning them to agents. - Bounded long jobs:
stream_job_until_donecaps event count and duration;wait_for_jobcaps poll time. Tune via env vars below. - LLM cost guard:
submit_ai_optimizerequiresconfirm_llm_usage=true. - Payload limits: indicator Python source is capped at 512 KiB on both Gateway and MCP client.
What it exposes
Read-class (R), Workspace write (W), and Backtest-class (B) tools.
| Tool | Class | Purpose |
|---|---|---|
whoami |
R | Inspect the calling token |
check_health |
— | Public liveness (no token) |
list_markets |
R | Markets the token may query |
search_symbols |
R | Symbols within a market |
get_klines |
R | OHLCV bars |
get_price |
R | Latest price |
list_strategies |
R | Tenant's strategies (compact) |
get_strategy |
R | One strategy (secrets redacted) |
list_jobs |
R | Recent async jobs |
get_job |
R | Poll one job |
wait_for_job |
R | Poll until terminal or timeout |
stream_job_until_done |
R | Bounded SSE consumer |
get_indicator_authoring_contract |
R | Indicator I/O contract + starter template |
validate_indicator_code |
R | Sandbox validate without save |
save_indicator |
W | Persist to indicator library |
list_indicators |
R | Tenant indicator list |
get_indicator |
R | One indicator with code |
create_strategy |
W | Create stopped strategy (+ auto-save indicator) |
update_strategy |
W | Patch strategy fields (blocks status=running) |
submit_backtest |
B | Queue a backtest (strict_mode, strategy_config, indicator_params) |
regime_detect |
B | Synchronous regime detection |
submit_experiment_pipeline |
B | Queue legacy grid pipeline |
submit_structured_tune |
B | Queue grid/random tuning |
submit_ai_optimize |
B | Queue LLM optimization (requires confirm flag) |
list_portfolio_positions |
R | Manual portfolio positions |
list_paper_orders |
R | Recent paper orders |
Install
From PyPI (recommended — works on any machine without cloning the repo):
pipx install quantdinger-mcp
# or, no install at all (cached on first run):
uvx quantdinger-mcp
# or, into a venv:
pip install quantdinger-mcp
Editable install for hacking on the server itself:
cd mcp_server
pip install -e .
Run
Configuration is env-only so the same binary works in desktop and cloud.
| Variable | Required | Purpose |
|---|---|---|
QUANTDINGER_BASE_URL |
yes | e.g. http://localhost:8888 |
QUANTDINGER_AGENT_TOKEN |
yes | a token issued via /api/agent/v1/admin/tokens |
QUANTDINGER_MCP_TRANSPORT |
no | stdio (default), sse, or streamable-http |
QUANTDINGER_MCP_HOST |
no | bind host for HTTP transports (default 127.0.0.1) |
QUANTDINGER_MCP_PORT |
no | bind port for HTTP transports (default 8000) |
QUANTDINGER_TIMEOUT_S |
no | upstream HTTP timeout (default 60) |
QUANTDINGER_MCP_JOB_STREAM_MAX_EVENTS |
no | SSE cap (default 200) |
QUANTDINGER_MCP_JOB_STREAM_MAX_SECONDS |
no | SSE time cap (default 300) |
QUANTDINGER_MCP_JOB_POLL_MAX_SECONDS |
no | wait_for_job cap (default 300) |
stdio (desktop IDEs)
QUANTDINGER_BASE_URL=http://localhost:8888 \
QUANTDINGER_AGENT_TOKEN=qd_agent_xxxxx \
quantdinger-mcp
SSE / Streamable HTTP (cloud agents, remote IDEs)
QUANTDINGER_BASE_URL=http://localhost:8888 \
QUANTDINGER_AGENT_TOKEN=qd_agent_xxxxx \
QUANTDINGER_MCP_TRANSPORT=streamable-http \
QUANTDINGER_MCP_HOST=0.0.0.0 \
QUANTDINGER_MCP_PORT=7800 \
quantdinger-mcp
The server is then reachable at http://<host>:7800/. Use sse instead of
streamable-http for clients that only support the older SSE transport.
Wire into a client
Local stdio client config
{
"mcpServers": {
"quantdinger": {
"command": "quantdinger-mcp",
"env": {
"QUANTDINGER_BASE_URL": "http://localhost:8888",
"QUANTDINGER_AGENT_TOKEN": "qd_agent_xxxxxxxx"
}
}
}
}
Remote HTTP client config
For clients that connect to an MCP server over HTTP/SSE rather than spawning
a subprocess, point them at the URL the server is bound to (e.g.
http://your-host:7800) and let the client handle protocol negotiation.
Never put production exchange keys or admin JWTs in the MCP config — only agent tokens, scoped to the capabilities the client actually needs.
Recommended scopes for indicator authoring: R + W + B.
Project details
Release history Release notifications | RSS feed
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 quantdinger_mcp-0.2.0.tar.gz.
File metadata
- Download URL: quantdinger_mcp-0.2.0.tar.gz
- Upload date:
- Size: 20.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
115d019e8c0963e0ef9dde05b6db26b67204958831b5af3edd74b98ccb237cb4
|
|
| MD5 |
41fef8a919ef96ec72ec5125b021bd55
|
|
| BLAKE2b-256 |
cef0b2511c917f51213afd7e780d368b4477c469378285d04512a31a834fde54
|
File details
Details for the file quantdinger_mcp-0.2.0-py3-none-any.whl.
File metadata
- Download URL: quantdinger_mcp-0.2.0-py3-none-any.whl
- Upload date:
- Size: 17.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93953567763e7d848c9d10fc060b657263e5e8918c47f64ba2ba45f4c34f3a17
|
|
| MD5 |
ded5347d32714ace0bec903f8774972b
|
|
| BLAKE2b-256 |
861966e91d7a3d3da2ada0cf41376c0a6fecd9b25831f73c304a505305ddc2d5
|