Skip to main content

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

PyPI Python License

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 scoped T token 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_done caps event count and duration; wait_for_job caps poll time. Tune via env vars below.
  • LLM cost guard: submit_ai_optimize requires confirm_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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quantdinger_mcp-0.2.0.tar.gz (20.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

quantdinger_mcp-0.2.0-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

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

Hashes for quantdinger_mcp-0.2.0.tar.gz
Algorithm Hash digest
SHA256 115d019e8c0963e0ef9dde05b6db26b67204958831b5af3edd74b98ccb237cb4
MD5 41fef8a919ef96ec72ec5125b021bd55
BLAKE2b-256 cef0b2511c917f51213afd7e780d368b4477c469378285d04512a31a834fde54

See more details on using hashes here.

File details

Details for the file quantdinger_mcp-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for quantdinger_mcp-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 93953567763e7d848c9d10fc060b657263e5e8918c47f64ba2ba45f4c34f3a17
MD5 ded5347d32714ace0bec903f8774972b
BLAKE2b-256 861966e91d7a3d3da2ada0cf41376c0a6fecd9b25831f73c304a505305ddc2d5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page