Futu Stock MCP Server

by shuizhengqi1

76 649 downloads Not rated yet MIT
GitHub

About

Futu Stock MCP Server is a Python server that wraps the Futu OpenAPI (for Futu securities) into the Model Context Protocol (MCP 2.0) standard. It allows AI models to subscribe to real-time market data and query stock information across Hong Kong, US, and A-share markets.

Details

License
MIT

Explore

- Standard MCP 2.0 protocol compliance
- Comprehensive Futu API coverage
- Real-time data subscription support
- Market data access
- Derivatives information
- Account query capabilities
- Resource-based data access
- Interactive prompts for analysis

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Futu Stock MCP Server
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

- Python 3.10+
- Futu OpenAPI SDK
- Model Context Protocol SDK
- uv (recommended)

uv venv

uv pip install -e .


5. (可选) 如需从源码直接运行,通过环境变量配置服务:
bash
export FUTU_HOST=127.0.0.1
export FUTU_PORT=11111
``

> 推荐方式:在 MCP 客户端配置文件中使用 env 字段注入,无需创建 .env` 文件,见下方 MCP Server 配置 章节。

get_stock_quote

Get stock quote data

get_market_snapshot

Get market snapshot

get_cur_kline

Get current K-line data

get_history_kline

Get historical K-line data

get_rt_data

Get real-time data

get_ticker

Get ticker data

get_order_book

Get order book data

get_broker_queue

Get broker queue data

subscribe

Subscribe to real-time data

unsubscribe

Unsubscribe from real-time data

get_option_chain

Get option chain data

get_option_expiration_date

Get option expiration dates

get_option_condor

Get option condor strategy data

get_option_butterfly

Get option butterfly strategy data

get_account_list

Get account list

get_funds

Get account funds information

get_positions

Get account positions

get_position_list

Get account positions with filters

get_max_power

Get account buying power

get_margin_ratio

Get margin ratio for a security

unlock_trade

Unlock trade operations

place_order

Place order

modify_order

Modify order

cancel_order

Cancel one order

cancel_all_orders

Cancel all cancellable orders

get_order_list

Query current order list

get_history_order_list

Query historical orders

get_deal_list

Query current deals

get_history_deal_list

Query historical deals

get_order_fee

Query order fee details

get_acc_cash_flow

Query cash flow details

get_acc_trading_info

Query trade capability/pre-check

get_market_state

Get market state

get_security_info

Get security information

get_security_list

Get security list

tools = await session.list_tools()
print("Available tools:", [tool.name for tool in tools.tools])


result = await session.call_tool(
"get_stock_quote",
arguments={"symbols": ["HK.00700"]}
)

- get_stock_quote: Get stock quote data
- get_market_snapshot: Get market snapshot
- get_cur_kline: Get current K-line data
- get_history_kline: Get historical K-line data
- get_rt_data: Get real-time data
- get_ticker: Get ticker data
- get_order_book: Get order book data
- get_broker_queue: Get broker queue data

- subscribe: Subscribe to real-time data
- unsubscribe: Unsubscribe from real-time data

- get_option_chain: Get option chain data
- get_option_expiration_date: Get option expiration dates
- get_option_condor: Get option condor strategy data
- get_option_butterfly: Get option butterfly strategy data

- get_account_list: Get account list
- get_funds: Get account funds information
- get_positions: Get account positions
- get_position_list: Get account positions with filters
- get_max_power: Get account buying power
- get_margin_ratio: Get margin ratio for a security

- unlock_trade: Unlock trade operations
- place_order: Place order
- modify_order: Modify order
- cancel_order: Cancel one order
- cancel_all_orders: Cancel all cancellable orders
- get_order_list: Query current order list
- get_history_order_list: Query historical orders
- get_deal_list: Query current deals
- get_history_deal_list: Query historical deals
- get_order_fee: Query order fee details
- get_acc_cash_flow: Query cash flow details
- get_acc_trading_info: Query trade capability/pre-check

- get_market_state: Get market state
- get_security_info: Get security information
- get_security_list: Get security list

To add a new tool, use the @mcp.tool() decorator:

python
@mcp.tool()
async def new_tool(param1: str, param2: int) -> Dict[str, Any]:
"""Tool description"""

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "futu stock mcp server": {
            "futu-stocp-mcp-server": {
                "command": "uv",
                "args": [
                    "venv"
                ]
            }
        }
    }
}

McpServers

{
    "futu-stocp-mcp-server": {
        "command": "uv",
        "args": [
            "venv"
        ]
    }
}

Python Version
License
OpenAPI

基于模型上下文协议(MCP)的富途证券行情交易接口服务器。将富途OpenAPI功能以标准化的MCP协议提供给AI模型使用,支持行情订阅、数据查询等功能。

🌟 特性

- 🔌 完全兼容 MCP 2.0 协议标准
- 📊 支持港股、美股、A股等市场的实时行情
- 🔄 支持实时数据订阅和推送
- 📈 支持K线、逐笔、买卖盘等多维度数据
- 🔒 安全的API调用和数据访问机制
- 🛠 提供完整的开发工具和示例代码

⚠️ 前置要求

在使用本项目之前,您需要:

1. 拥有富途证券账户并开通OpenAPI权限
2. 安装并运行富途的OpenD网关程序(官方文档)
3. 根据您的需求订阅相应的行情权限

🔒 安全提示

- 请勿在代码中硬编码任何账号密码信息
- 确保.env文件已添加到.gitignore中
- 妥善保管您的API访问凭证
- 遵守富途OpenAPI的使用条款和限制

📝 免责声明

本项目是一个开源工具,旨在简化富途OpenAPI的接入流程。使用本项目时请注意:

1. 遵守相关法律法规和富途OpenAPI的使用条款
2. 自行承担使用本项目进行交易的风险
3. 本项目不提供任何投资建议
4. 使用本项目前请确保您已获得所需的行情权限

Features

- Standard MCP 2.0 protocol compliance
- Comprehensive Futu API coverage
- Real-time data subscription support
- Market data access
- Derivatives information
- Account query capabilities
- Resource-based data access
- Interactive prompts for analysis

Prerequisites

- Python 3.10+
- Futu OpenAPI SDK
- Model Context Protocol SDK
- uv (recommended)

🚀 快速开始

方式一:通过 pipx 安装(推荐)

```bash

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.