Skip to main content

SharkQuant MCP Server

The MCP server is a thin, tenant-scoped wrapper over /api/agent/v1. It exposes research universes and factors, market data, chart-indicator authoring, Strategy API V2 deployment and backtesting, broker/execution observations, notification automation, bounded jobs, and safety-gated trading.

Install and run

pip install "sharkquant-mcp==0.6.3"
export QUANTDINGER_BASE_URL=http://localhost:5000
export QUANTDINGER_AGENT_TOKEN=qd_agent_xxx
sharkquant-mcp

pipx install sharkquant-mcp and uvx sharkquant-mcp are also supported. Use pip install -e ./mcp_server only when developing from a repository checkout.

Legacy compatibility: this package still provides the quantdinger-mcp console command and the quantdinger_mcp import alias. The old PyPI project quantdinger-mcp remains at 0.6.2; new installs should use sharkquant-mcp.

The default transport is stdio. Set QUANTDINGER_MCP_TRANSPORT to sse or streamable-http for a network transport. Optional limits include QUANTDINGER_TIMEOUT_S, QUANTDINGER_MCP_JOB_STREAM_MAX_EVENTS, QUANTDINGER_MCP_JOB_STREAM_MAX_SECONDS, and QUANTDINGER_MCP_JOB_POLL_MAX_SECONDS.

Network transports bound to a non-loopback host require a separate inbound bearer token. This token authenticates MCP clients and must not be the Agent Gateway token:

export QUANTDINGER_MCP_TRANSPORT=streamable-http
export QUANTDINGER_MCP_HOST=0.0.0.0
export QUANTDINGER_MCP_PORT=7800
export QUANTDINGER_MCP_PUBLIC_URL=https://mcp.example.com
export QUANTDINGER_MCP_AUTH_TOKEN=replace-with-a-random-32-plus-character-secret
sharkquant-mcp

Clients must send Authorization: Bearer <QUANTDINGER_MCP_AUTH_TOKEN> to /mcp or /sse. Authenticated non-loopback listeners require an HTTPS QUANTDINGER_MCP_PUBLIC_URL. QUANTDINGER_MCP_ALLOW_HTTP=true is only for a trusted private proxy that terminates TLS. For an unauthenticated private ingress that already authenticates every request, QUANTDINGER_MCP_ALLOW_INSECURE_HTTP=true remains a separate escape hatch; never use either setting on a directly reachable public listener.

Docker builds use the official PyPI index by default. In regions where it is slow, override it without editing the image definition: docker build --build-arg PIP_INDEX_URL=https://your-mirror.example/simple ..

Never place an agent token in prompts, logs, screenshots, source control, or MCP configuration that will be shared. Responses redact credential fields, and clients must not attempt to recover them.

Tool surface

Tool group Scope Purpose
whoami, check_health R/public Identity, allowlists, and liveness
list_markets, search_symbols, get_klines, get_price R Market discovery and data
Universe and factor tools, get_macro_liquidity R Point-in-time research inputs and compact USD liquidity regime (no chart history)
list_watchlist, add_watchlist, remove_watchlist R/W Watchlist workspace
Indicator authoring, validation, save, link, and read tools R/W Chart-only indicators
list_strategy_templates R Strategy API V2 system templates
compile_strategy_code W Compile Strategy API V2 code to its canonical manifest
list_strategy_sources, get_strategy_source, save_strategy_source R/W Private Strategy API V2 source library
list_strategy_source_versions, restore_strategy_source_version R/W Source history and explicitly confirmed restore
create_strategy, update_strategy, list_strategies, get_strategy R/W Strategy API V2 deployments
submit_backtest B Strategy API V2 backtest job
list_jobs, get_job, wait_for_job, stream_job_until_done, cancel_job R/B Bounded jobs and confirmed cancellation
runtime_overview, stop_strategy R/T Runtime inspection and confirmed stop
Broker account, strategy position/trade, and quick-trade observation tools R Secret-free execution observations
Signal-alert tools N Notification task lifecycle and confirmed delivery evaluation
place_quick_order T Confirmed order with token notional caps
list_portfolio_positions, list_paper_orders R Portfolio and paper-order reads
emergency_stop_trading, cancel_open_paper_orders T Emergency cancellation and T-token revocation

Every mutating W/B/N/T tool requires a caller-generated idempotency_key; retries of the same request must reuse it. stop_strategy requires confirm_stop=true. place_quick_order requires confirm_order=true; a live-capable token also requires confirm_live_trading=true. Optional tp_price and sl_price protection are forwarded to the shared Quick Trade execution path. Server-side trading flags, allowlists, and per-order/per-day notional caps still apply.

Strategy API V2 workflow

Executable strategy code must define initialize(context) and declare its universe and subscriptions. It must provide handle_data, on_rebalance, or a scheduled callback. The manifest owns instruments, markets, frequencies, factor dependencies, warmup, and leverage policy.

Compile and save a source before creating a stopped deployment:

compile_strategy_code(code="...Strategy API V2 Python...", idempotency_key="compile-btc-momentum-v1")
save_strategy_source(name="btc-momentum", code="...Strategy API V2 Python...", idempotency_key="save-btc-momentum-v1")

Use the returned source id:

create_strategy(
  name="btc-momentum",
  source_id=12,
  initial_capital=10000,
  execution_mode="signal",
  params={"lookback": 40},
  idempotency_key="deploy-btc-momentum-v1"
)

Run a backtest directly from V2 code:

submit_backtest(
  code="...Strategy API V2 Python...",
  start_date="2025-01-01",
  end_date="2025-12-31",
  initial_capital=10000,
  params={"lookback": 40},
  idempotency_key="btc-momentum-2025"
)

Market, symbol, and timeframe are not backtest parameters. They come from the compiled strategy manifest. Use wait_for_job or stream_job_until_done to obtain the result.

Indicators are chart-only. Validate and save them through the indicator tools, then convert the idea into Strategy API V2 code before using submit_backtest or create_strategy.

Restoring a source snapshot requires confirm_restore=true. The emergency stop requires confirmation, attempts to cancel agent-originated live orders, cancels paper orders, revokes every active tenant T token, and reports exchange cancellations needing human follow-up.

The optional Docker network service is enabled explicitly:

QUANTDINGER_AGENT_TOKEN=qd_agent_xxx \
QUANTDINGER_MCP_AUTH_TOKEN="$(openssl rand -hex 32)" \
docker compose --profile mcp up -d --build mcp

Development

pip install -e './mcp_server[dev]'
pytest mcp_server/tests

Metadata

Release files for sharkquant-mcp 0.6.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sharkquant-mcp 0.6.3
File Size Uploaded Provenance Actions
sharkquant_mcp-0.6.3.tar.gz 28.8 kB Without provenance Details for sharkquant_mcp-0.6.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sharkquant-mcp 0.6.3
File Interpreter ABI Platform Actions
sharkquant_mcp-0.6.3-py3-none-any.whl Python 3 none any Details for sharkquant_mcp-0.6.3-py3-none-any.whl

Total release size: 51.8 kB

Release files / sharkquant_mcp-0.6.3.tar.gz

Download URL sharkquant_mcp-0.6.3.tar.gz
Size 28.8 kB
Tags Source
SHA-256 checksum
How to use checksums
fa430ba0acf058e0c3e107df8947891e7952e561840aa6913506874aab0dbd5c
BLAKE2b-256 checksum
How to use checksums
29bfac79eeafac3fbcf85956c6bd59001cb484fdb584003b17109c08787c08a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.0

Release files / sharkquant_mcp-0.6.3-py3-none-any.whl

Download URL sharkquant_mcp-0.6.3-py3-none-any.whl
Size 23.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5026f8866adc0f50d4ada8449d9e47a087ec4b92ff6b0db2f75413a38a7b17e9
BLAKE2b-256 checksum
How to use checksums
d1b1fff5d3447b08beeb390e4c729464c4f5fec4484da60352ffab5e85c02a5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.0

Security for sharkquant-mcp 0.6.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.6.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page