Skip to main content

bizonquant-mcp

BizonQuant 量化平台的 MCP server(客户端形态):跑在你本机,把平台能力面开放给外部 agent(Claude Code / Cursor / Codex / 自写 agent),服务器零常驻进程、不开前端。

能力(首期 15 工具)

组 工具 说明
锚点 get_me_tool 当前用户;凭证探针
锚点 get_trading_day_info_tool 交易日判断 + 上/下一交易日
锚点 get_data_coverage_tool 数据覆盖/因子数/股票池——回测日期边界来源
行情 search_stocks_tool 模糊名 → 规范代码
行情 get_daily_klines_tool K 线 + 区间摘要(涨跌/高低/MA20/MA60/站上均线)
选股 list_factors_tool 因子目录 + 取值语义(防条件翻译错)
选股 screen_stocks_tool 即时截面选股,附因子值
选股 list_presets_tool / save_preset_tool 方案列表 / 存方案
回测 submit_backtest_tool 提交多因子回测(异步)
回测 wait_backtest_tool 有界等待(≤50s),done:false 续调
回测 get_backtest_status_tool / get_backtest_result_tool / list_backtests_tool 状态 / 结果(曲线抽样)/ 历史
总览 list_my_strategies_tool 全部策略与运行状态

安装与运行

# 从仓库根
cd mcp-server && uv sync
uv run bizonquant-mcp init     # 录入 key 并自检(写入 ~/.config/bizonquant-mcp/config.json,0600)
uv run bizonquant-mcp doctor   # 探链路:health / token / whoami / 数据面

接入 Claude Code(stdio)

// ~/.claude.json 的 mcpServers
"bizonquant": {
  "command": "uv",
  "args": ["--directory", "<仓库路径>/mcp-server", "run", "bizonquant-mcp"],
  "env": {
    "BIZONQUANT_ACCESS_KEY": "qm_live_xxx",
    "BIZONQUANT_SECRET_KEY": "sk_yyy",
    "BIZONQUANT_BASE_URL": "https://bizon.naiyu.xyz:8443"
  }
}

也支持单变量 BIZONQUANT_API_KEY=access_key.secret_key。

拿凭证(三选一)

  1. 桌面端:API 密钥页建 key,permissions 勾 mcp.read(只读)或 mcp.*(含 save_preset / submit_backtest 写点)
  2. 过渡 curl:登录(注意 device_type)→ POST /api/v1/api-keys({"name":"mcp","permissions":["mcp.*"]},secret 只显示一次)
  3. 桌面端「Agent 接入」UI(待建,阶段 2)

客户端纪律(内置,无需配置)

  • 默认拒绝 http:// 明文网关(BIZONQUANT_ALLOW_INSECURE=1 可解锁内网场景)
  • token 只走 Authorization 头;401 自动换发一次,仍 401 即停(key 撤销后不打风暴)
  • UA 带 bizonquant-mcp/{version},服务端可审计

安全模型

  • 凭证是 API Key(access_key + bcrypt secret),不是账号密码——泄漏面仅限该 key 的能力面
  • 服务端对 agent token 施加 scope 硬闸:GET 全放,非 GET 只放 5 条写白名单(选股/存方案/回测提交),/admin 与 /api-keys 一律 403
  • 交易/资金类端点不在能力面内;删 key / 停用 / 轮换 secret 即时全链失效
  • revoke 命令 = 同 key 再换发一次(互踢规则下旧会话全灭);永久吊销请在桌面端删 key

开发

uv run pytest -q        # 全量测试(含与网关 scope 闸、TS 工具表的 (method,path) 对拍)
uv run bizonquant-mcp --version

对拍闸:tests/test_conformance.py 断言本包工具的 (method, path) ⊆ 网关 AGENT_WRITE_ALLOWLIST ∪ GET——网关收窄或工具新增写路径而网关未放行时,测试立即红。

Release files for bizonquant-mcp 0.1.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 bizonquant-mcp 0.1.3
File Size Uploaded
bizonquant_mcp-0.1.3.tar.gz 71.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bizonquant-mcp 0.1.3
File Interpreter ABI Platform
bizonquant_mcp-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 96.3 kB

Release files / bizonquant_mcp-0.1.3.tar.gz

Download URL bizonquant_mcp-0.1.3.tar.gz
Size 71.3 kB
Tags Source
SHA-256 checksum
How to use checksums
849c3a633055cb3b7d390dfdac325347972422b1ed462d5e0561ba96159d3052
BLAKE2b-256 checksum
How to use checksums
4267e5675881903041fe4a5cf8e591a6c411a9582cd25d1c2b41bc2fff25e950
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

Release files / bizonquant_mcp-0.1.3-py3-none-any.whl

Download URL bizonquant_mcp-0.1.3-py3-none-any.whl
Size 25.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
97414069db767f806a9c1da76c05defcbfb956bd9fafc4ea67ab083fbe88f2e4
BLAKE2b-256 checksum
How to use checksums
7864173c78b495fd4b218e9445850d436f79eb624408581c21ced9119e0ec64c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

Release history Release notifications | RSS feed

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.5

2 release files

0.1.4

2 release files

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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