Skip to main content

Crate futu_mcp

Crate futu_mcp 

Source
Expand description

FutuOpenD-rs MCP 服务器

通过 Model Context Protocol 把 Futu 行情/账户能力暴露给 Claude / LLM 客户端。

授权有两种模式:

  • Scope 模式--keys-file <path> 启用,客户端必须通过 FUTU_MCP_API_KEY 环境变量传入明文 key。服务器用 SHA-256 hash 比对 keys.json 中的记录, 按 scope + 限额放行。
  • Legacy 模式:未提供 keys-file 时回退到旧的 --enable-trading / --allow-real-trading 两级开关。

Modules§

card_num_expand 🔒
Standalone MCP allowed_card_nums expansion helpers.
guard 🔒
Scope 守卫 + 限额检查 + 审计日志
handlers 🔒
工具实现(按域拆分)
http 🔒
state 🔒
共享状态:网关连接 + 订阅状态 + 授权
tool_account 🔒
MCP account-locator helpers shared by thin tool wrappers.
tool_args 🔒
MCP tool request/parameter schemas.
tool_auth 🔒
MCP caller-auth helper types and pure policy decisions.
tool_enums 🔒
v1.4.84 §5 B2: 结构化 MCP tool enum 类型 + 泛型 int/string 双接 deserializer
tools 🔒
MCP 工具定义(#[tool] 薄封装,业务逻辑在 handlers/)
trade_pwd 🔒
交易密码来源封装
transport 🔒
Resilient stdio transport for MCP server (v1.4.90 P0-A).

Structs§

Cli 🔒
FutuOpenD-rs MCP server
FileConfig 🔒
TOML 配置文件映射——字段名与 CLI 参数完全一致

Functions§

is_cli_explicit 🔒
codex 0547 F5 (P3) fix: clap ValueSource 区分 “CLI 显式传” vs “默认值”.
main 🔒
serve_stdio 🔒
stdio 模式:MCP 客户端启动子进程,stdin/stdout 传协议帧
setup_logging 🔒
初始化 stderr 日志 + 可选 audit JSONL 层