Allows interaction with Futu's stock market API, providing tools for retrieving watchlists, checking client connection status, and configuring client parameters to access stock data from US, Hong Kong, and Chinese markets.
富途 MCP 服务器
将富途API客户端功能暴露为 MCP (Model Context Protocol) 工具,允许 AI 助手通过标准化接口访问富途的股票数据。
🚀 快速开始
1. 环境准备
2. 在 Cursor 中配置 MCP
方法一:使用 npx 命令(推荐)
在 Cursor 的 MCP 配置文件中添加以下配置:
方法二:使用 shell 脚本
🔧 配置选项
环境变量
变量名 | 描述 | 默认值 | 示例 |
---|---|---|---|
FUTU_API_HOST | 富途API主机地址 | 127.0.0.1 | 192.168.1.100 |
FUTU_API_PORT | 富途API端口 | 11111 | 22222 |
FUTU_UNLOCK_PASSWORD | 富途客户端解锁密码(可选) | - | your_password |
配置示例
本地默认配置
远程服务器配置
带解锁密码配置
🛠️ 可用工具
📈 行情数据工具
1. get_watchlist
获取富途用户的自选股列表
参数:
market
(可选): 市场类型,支持 "美股"、"港股"、"A股"
2. get_stock_quote
获取股票实时报价信息
参数:
stock_code
(必需): 股票代码,如 'AAPL', 'HK.00700', 'SZ.000001'market
(可选): 市场类型,支持 "US", "HK", "SH", "SZ"
3. get_stock_history
获取股票历史K线数据
参数:
stock_code
(必需): 股票代码period
(可选): K线周期,支持 "1min", "5min", "15min", "30min", "60min", "day", "week", "month"count
(可选): 获取数据条数,默认30条
4. search_stock
搜索股票,根据股票名称或代码查找相关股票
参数:
keyword
(必需): 搜索关键词,可以是股票名称或代码market
(可选): 搜索市场,支持 "US", "HK", "SH", "SZ", "ALL"limit
(可选): 返回结果数量限制,默认10条
5. get_market_snapshot
获取市场快照,包括主要指数和热门股票
参数:
market
(可选): 市场类型,支持 "US", "HK", "CN"
💰 交易相关工具(需要交易权限)
6. get_account_info
获取账户信息,包括资产、持仓等
参数:
account_type
(可选): 账户类型,支持 "REAL", "SIMULATE"
7. get_positions
获取持仓信息
参数:
account_type
(可选): 账户类型,支持 "REAL", "SIMULATE"
⚙️ 配置工具
8. configure_futu_client
动态配置富途API客户端连接参数
参数:
host
(必需): 富途API主机地址port
(必需): 富途API端口unlock_pwd
(可选): 解锁密码
9. get_client_status
获取富途客户端连接状态和配置信息
🧪 测试
命令行测试
在 Cursor 中测试
配置完成后,在 Cursor 中可以使用以下命令测试:
基础功能测试
- "请获取我的美股自选股列表"
- "请检查富途客户端连接状态"
- "请配置富途客户端连接到192.168.1.100:11111"
行情数据测试
- "请获取苹果公司(AAPL)的实时报价"
- "请获取腾讯(HK.00700)最近30天的日K线数据"
- "请搜索包含'特斯拉'的股票"
- "请获取美股市场快照"
交易功能测试(需要交易权限)
- "请获取我的模拟账户信息"
- "请查看我的持仓情况"
使用示例
获取股票报价:
获取历史数据:
搜索股票:
查看账户信息:
📁 项目结构
🔍 故障排除
常见问题
- 虚拟环境不存在
- 富途客户端连接失败
- 确保富途牛牛客户端已启动并登录
- 检查API接口是否已开启
- 验证主机和端口配置是否正确
- npx 命令找不到包
- 确保项目路径正确
- 检查 package.json 文件是否存在
- 确保 bin/futu-mcp.js 文件有执行权限
日志查看
启动时会显示富途API连接信息:
�� 许可证
MIT License
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Exposes Futu API client capabilities as an MCP (Model Context Protocol) tool, allowing AI assistants to access stock data from Futu through a standardized interface.
Related MCP Servers
- -securityAlicense-qualityMCP server that provides AI assistants access to stock market data including financial statements, stock prices, and market news through a Model Context Protocol interface.Last updated -253PythonMIT License
- -securityFlicense-qualityAn MCP server that enables AI models like Claude to interact with the Trading Simulator API for checking balances, viewing prices, and executing trades with automatic chain detection.Last updated -TypeScript
mcp-server-shioajiofficial
-securityFlicense-qualityA Model Context Protocol (MCP) server that provides AI assistants with access to Shioaji trading API for the Taiwanese financial market.Last updated -1Python- -securityAlicense-qualityA Model Context Protocol server that enables AI assistants like Claude to programmatically access financial data from Financial Modeling Prep API, including company profiles, financial statements, metrics, SEC filings, and market data.Last updated -5PythonMIT License