pub(crate) struct Cli {
pub(crate) gateway: String,
pub(crate) verbose: bool,
pub(crate) keys_file: Option<PathBuf>,
pub(crate) api_key: Option<String>,
pub(crate) trade_pwd_account: Option<String>,
pub(crate) enable_trading: bool,
pub(crate) allow_real_trading: bool,
pub(crate) audit_log: Option<PathBuf>,
pub(crate) http_listen: Option<String>,
pub(crate) tls_cert: Option<PathBuf>,
pub(crate) tls_key: Option<PathBuf>,
pub(crate) config: Option<PathBuf>,
}Expand description
FutuOpenD-rs MCP server
Fields§
§gateway: String网关地址(可用 FUTU_GATEWAY 环境变量覆盖)
verbose: bool启用 debug 日志
keys_file: Option<PathBuf>Scope 模式:加载 keys.json 文件(API Key 授权)。
启用后所有工具调用必须带 FUTU_MCP_API_KEY 环境变量, scope / 限额由 keys.json 配置决定;此时 –enable-trading / –allow-real-trading 被忽略。
api_key: Option<String>调用方 API Key 明文(等价于 FUTU_MCP_API_KEY 环境变量)
生产环境强烈建议用环境变量而非命令行参数(后者会进 ps 输出)。
trade_pwd_account: Option<String>交易密码所属登录账号,用于读取账号级 keychain 条目。
对应 futucli set-trade-pwd --account <login-account> 写入的
trade-password.<login-account>。未设置时会尝试 FUTU_ACCOUNT,再兜底
旧全局 keychain 条目和 FUTU_TRADE_PWD。
enable_trading: bool[Legacy] 启用交易写工具(place / modify / cancel)。默认关闭。
开启后默认仅允许 simulate 环境;要操作真实账户需额外 –allow-real-trading。 注意:下单前网关必须已 unlock_trade(密码不经过 MCP / LLM)。 若提供了 –keys-file,此开关被忽略,改由 key 的 scope 决定。
allow_real_trading: bool[Legacy] 允许交易写工具对 real 环境执行。必须与 –enable-trading 搭配。
audit_log: Option<PathBuf>审计日志输出:JSONL 文件路径或目录
- 带扩展名(
/var/log/futu-mcp-audit.jsonl)→ 单文件 append - 不带扩展名 / 以
/结尾 → 每日滚动futu-audit.log+ 日期
只记录 auth / 交易 事件(target = futu_audit)。
http_listen: Option<String>以 HTTP transport 启动(streamable HTTP),监听该端口(格式 host:port 或 :port)
默认 stdio:LLM 客户端启子进程走 stdin/stdout。开 HTTP 后可以让多个
客户端连同一个 MCP 进程,并同时暴露 /metrics。per-call key 覆盖依然
走 tool args 的 api_key 字段;HTTP-layer 的 Authorization header 未来
版本再接(v1.0 先做传输层切换)。
例:--http-listen 127.0.0.1:3000 / --http-listen :3000
tls_cert: Option<PathBuf>TLS 证书文件路径(PEM 格式;需与 –tls-key 配合)
启用后 HTTP transport 走 HTTPS。若不设置,走纯 HTTP(建议前置 Caddy / Nginx 做 TLS 终止)。
tls_key: Option<PathBuf>TLS 私钥文件路径(PEM 格式;需与 –tls-cert 配合)
config: Option<PathBuf>TOML 配置文件路径(字段名与 CLI 参数一致,CLI 参数覆盖配置文件)
示例:
gateway = "10.0.0.1:11111"
http_listen = ":3000"
keys_file = "/etc/futu/keys.json"
audit_log = "/var/log/futu-mcp-audit.jsonl"
tls_cert = "/etc/futu/cert.pem"
tls_key = "/etc/futu/key.pem"Implementations§
Trait Implementations§
Source§impl Args for Cli
impl Args for Cli
Source§fn group_id() -> Option<Id>
fn group_id() -> Option<Id>
ArgGroup::id][crate::ArgGroup::id] for this set of argumentsSource§fn augment_args<'b>(__clap_app: Command) -> Command
fn augment_args<'b>(__clap_app: Command) -> Command
Source§fn augment_args_for_update<'b>(__clap_app: Command) -> Command
fn augment_args_for_update<'b>(__clap_app: Command) -> Command
Command] so it can instantiate self via
[FromArgMatches::update_from_arg_matches_mut] Read moreSource§impl FromArgMatches for Cli
impl FromArgMatches for Cli
Source§fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
Source§fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches,
) -> Result<Self, Error>
fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>
Source§fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>
ArgMatches to self.Source§fn update_from_arg_matches_mut(
&mut self,
__clap_arg_matches: &mut ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>
ArgMatches to self.Source§impl Parser for Cli
impl Parser for Cli
§fn parse_from<I, T>(itr: I) -> Self
fn parse_from<I, T>(itr: I) -> Self
§fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>
fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>
§fn update_from<I, T>(&mut self, itr: I)
fn update_from<I, T>(&mut self, itr: I)
§fn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error>
fn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error>
Auto Trait Implementations§
impl Freeze for Cli
impl RefUnwindSafe for Cli
impl Send for Cli
impl Sync for Cli
impl Unpin for Cli
impl UnsafeUnpin for Cli
impl UnwindSafe for Cli
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more