@luxalgo/broker-mcp
Official@luxalgo/broker-mcp
[[](https://github.com/LuxAlgo/broker-mcp/actions/workflows/ci.yml) Actually because user perhaps line contains [](url), no need.
Need no in valid.
Let's write# @luxalgo/broker-mcp
让你的 AI 智能体读取你的真实券商账户——密钥永远不会离开你的机器。
一个本地 MCP 服务器,封装了 @luxalgo/broker-sdk。将 Claude(或任何 MCP 客户端)连接到 Alpaca、Binance、Kraken、Bybit、Hyperliquid、Interactive Brokers 等券商,然后只需提问:
“我的投资组合表现如何?” · “我这个月的胜率是多少?” · “我上周交易了什么?”
没有托管服务、没有遥测、无按连接收费。该服务器在你的机器上运行,密钥只存在于你自己的 MCP 配置中,而且底层 SDK 完全没有交易接口——智能体只能查看,不能操作。
设置
将服务器添加到你的 MCP 客户端配置中,并填入你要使用的券商的凭据环境变量。Claude Desktop(claude_desktop_config.json)或 Claude Code(.mcp.json`):
{
"mcpServers": {
"brokers": {
"command": "npx",
"args": ["-y", "@luxalgo/broker-mcp"],
"env": {
"BROKERS_ALPACA_API_KEY": "…",
"BROKERS_ALPACA_API_SECRET": "…",
"BROKERS_KRAKEN_API_KEY": "…",
"BROKERS_KRAKEN_API_SECRET": "…",
"BROKERS_HYPERLIQUID_WALLET_ADDRESS": "0x…"
}
}
}
}所有环境变量都设置好了的券商都会自动连接。请将每个密钥都设置为只读权限——这正是此服务器所需的全部权限;list_brokers 工具中包含每个券商的一行式只读配置说明。
环境变量
变量名由各券商的凭据派生而成:BROKERS_<BROKER>_<FIELD>。
Broker | 环境变量 |
Alpaca |
|
Coinbase(自带应用) |
|
Binance |
|
Bybit |
|
Crypto.com |
|
E*TRADE(自带应用) |
|
Hyperliquid |
|
Interactive Brokers(Flex) |
|
Kraken |
|
OKX |
|
Public.com |
|
Questrade |
|
Topstep |
|
Tradier |
|
Trading212 |
|
Webull |
|
Questrade 注意: 它的 refresh token 是一次性的,每次获取时都会轮换。服务器在运行期间会把轮换后的 token 保存在内存中,但重启之后,配置里的 token 就已经被消耗了——需要你手动重新粘贴一个新的。静态的环境变量配置与轮换的 token 并不匹配,这一点已经被列入改进路线图,并在后面有更好的方案。
Related MCP server: @y0exchange/mcp
工具
工具 | 智能体能获得的内容 |
| 所有支持的券商、它们的环境变量(已设置/未设置——绝不含密钥值)、配置状态、只读密钥配置指引 |
| 所有已连接的账户:券商、币种、权益、现金 |
| 当前持仓及其市场价值(负数量 = 空头);可按券商过滤 |
| 交易历史,最新在前;可按券商/symbol 过滤 |
| 总权益、各券商权益、最大持仓、FIFO 胜率、平均赢/亏、按 symbol 计的已实现盈亏 |
| 绕过 5 分钟缓存,立即重新获取全部数据 |
快照在内存中缓存 5 分钟;单个券商的错误会随结果一起报告,不会静默丢弃。
安全设计
设计上即只读。 底层 SDK 对任何券商都未实单、转账或提现接口。
密钥都在你的 MCP 配置中。 服务器只是从环境变量中读取它们,只报告每个变量是否设置,绝不在任何位置写密钥。
仅本地运行。 直接通过 HTTPS 与你的券商通信,并通过 stdio 与你的 MCP 客户端相连。没有任何 LuxAlgo 服务器参与,也没有遥测。
仍然要记住:在券商处把每个密钥权限设为只读,并把 MCP 配置当成真正的密钥库来保管。
开发
pnpm install && pnpm check && pnpm buildSDK 依赖会像其他任何包一样从公开 npm registry 安装。
免责声明
本软件只如实报告你的券商所返回的数据。它不是投资建议。重要数字请与券商给你自己的对账单核对。
许可证
MIT © LuxAlgo
Available Tools
6 toolsget_positionsA
Open positions across all accounts (symbol, quantity — negative means short — and market value in the account currency when the broker prices it). Optionally filter by broker id.
| Name | Required | Description | Default |
|---|---|---|---|
| broker | No | Broker id to filter by, e.g. 'alpaca' or 'kraken' |
get_statsA
Computed performance stats across the whole portfolio: total equity, equity by broker, top positions, and FIFO-matched trade stats (win rate, average win/loss, realized PnL, per-symbol breakdown). Amounts are in each account's native currency — mixed-currency totals are approximate.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
get_tradesA
Trade history across all accounts (the most recent window each broker exposes). Optionally filter by broker id and/or symbol; newest first.
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Max trades to return (default 100) | |
| broker | No | Broker id to filter by | |
| symbol | No | Symbol to filter by, e.g. 'BTC' or 'AAPL' |
list_accountsA
List all connected accounts across every configured broker: id, name, broker, currency, total equity, and cash when reported. Uses a short-lived cache; call refresh for live numbers.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
list_brokersA
List every supported broker, the environment variables its credentials go in, and whether it is configured in this server. Values are never shown, only whether each variable is set.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
refreshA
Bypass the cache and re-fetch every configured broker right now. Returns per-broker success/failure.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
6 tool updates
v0.1.0- First observed
get_positions - First observed
get_stats - First observed
get_trades - First observed
list_accounts - First observed
list_brokers - First observed
refresh
TDQS
Scored across 6 tools
Each tool targets a clearly distinct resource: brokers, accounts, positions, trades, and aggregate stats. The only non-query tool, refresh, is unambiguous and serves as a cache-busting action. There is no overlap or potential for misselection.
Tool names follow a consistent verb_noun pattern (list_brokers, get_positions) with the minor exception of 'refresh', which is a standard imperative verb. The mirroring of list/get for collections versus individual items is predictable and readable.
Six tools is an ideal scope for a broker aggregation server, covering configuration, account status, positions, trade history, and performance analytics. Every tool earns its place without bloat or unnecessary overlap.
The set covers the full read-only lifecycle of a trading portfolio: broker connectivity, account listing, positions, trade history, and aggregated stats. The refresh tool addresses the cache invalidation need, so there are no obvious dead ends or missing functions.
Related MCP Connectors
Trading MCP server for AI agents, with live market data, account reads and controlled execution.
Read-only finance MCP server. Connects your banks, cards, payment apps, books and payroll into one ledger for your AI. Can't move money. Open source (AGPL-3.0), free during beta.
Connect brokerage accounts to AI assistants: holdings, orders, asset lookup, and approved trading.
Research-only MCP server: your AI as a quant research desk. 90 tools, no trades, no brokers.
Related MCP Servers
- AlicenseAqualityDmaintenanceA read-only MCP server that provides access to Charles Schwab account data and market information, including portfolio positions, real-time quotes, options chains, price history, and account balances through AI assistants.9MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that gives AI agents real-time access to DeFi across multiple chains, enabling non-custodial crypto trading, portfolio queries, and transaction execution.7 npm7MIT
- AlicenseNot gradedqualityAmaintenanceRead-only MCP tools for Interactive Brokers: account, portfolio, market data, risk analysis and position sizing. Requires IBKR Pro and a local TWS or IB Gateway API session. Install the signed Canary binary or Claude Desktop MCPB bundle locally. Other local MCP clients launch the installed canary executable with the argument mcp. Setup: https://osauer.dev/canary/docs/start/install.html11MIT
- AlicenseAqualityBmaintenanceAn MCP server that gives AI assistants read access to real brokerage accounts and market data, with 39 tools for prices, technical analysis, SEC filings, and macro indicators, while order execution requires human approval via a separate dashboard.2832 PyPI3MIT