Cli

Struct Cli 

Source
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) enable_trading: bool,
    pub(crate) allow_real_trading: bool,
    pub(crate) audit_log: Option<PathBuf>,
    pub(crate) http_listen: Option<String>,
}
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 输出)。

§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

Trait Implementations§

Source§

impl Args for Cli

Source§

fn group_id() -> Option<Id>

Report the [ArgGroup::id][crate::ArgGroup::id] for this set of arguments
Source§

fn augment_args<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate Self via [FromArgMatches::from_arg_matches_mut] Read more
Source§

fn augment_args_for_update<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate self via [FromArgMatches::update_from_arg_matches_mut] Read more
Source§

impl CommandFactory for Cli

Source§

fn command<'b>() -> Command

Build a [Command] that can instantiate Self. Read more
Source§

fn command_for_update<'b>() -> Command

Build a [Command] that can update self. Read more
Source§

impl FromArgMatches for Cli

Source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
Source§

fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
Source§

fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

impl Parser for Cli

§

fn parse() -> Self

Parse from std::env::args_os(), [exit][Error::exit] on error.
§

fn try_parse() -> Result<Self, Error>

Parse from std::env::args_os(), return Err on error.
§

fn parse_from<I, T>(itr: I) -> Self
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Parse from iterator, [exit][Error::exit] on error.
§

fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Parse from iterator, return Err on error.
§

fn update_from<I, T>(&mut self, itr: I)
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Update from iterator, [exit][Error::exit] on error. Read more
§

fn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error>
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Update from iterator, return Err on 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 UnwindSafe for Cli

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more