moomoo-api
MCP Server for AI Agents to use Moomoo OpenAPI (https://www.moomoo.com/OpenAPI)
claude mcp add --transport stdio litash-moomoo-api-mcp uvx --refresh moomoo-api-mcp \ --env MOOMOO_SECURITY_FIRM="FUTUSG" \ --env MOOMOO_TRADE_PASSWORD="your_trading_password"
How to use
The Moomoo API MCP Server exposes a comprehensive set of tools to access market data, manage accounts, and perform trading via the moomoo-api Python SDK. Built on FastMCP, it exposes system, account, market data, and trading operations that AI agents can invoke to retrieve quotes, historical data, portfolio details, and to place or modify orders. By default, tools operate on REAL accounts, but simulation mode is available when credentials are not provided. The server connects to Moomoo OpenD locally to access the brokerage gateway.
You can interact with tools such as get_stock_quote for real-time quotes, get_historical_klines for candlestick data, get_account_summary and get_assets for portfolio insights, and a full suite of trading actions including place_order, modify_order, cancel_order, and get_orders for today’s activities. The AI agent should follow the guidance to unlock REAL account access when necessary and clearly communicate when transitioning to SIMULATE mode. The configuration notes provide examples of how to wire this MCP server into Claude Desktop or other clients.
How to install
Prerequisites
- A running Python environment with uv (uvx) from the uv toolkit installed.
- Moomoo OpenD gateway installed and running locally (default port 11111).
- Internet access to install Python packages from PyPI if needed.
-
Install Moomoo OpenD and ensure it is listening on 127.0.0.1:11111 as documented in the README.
-
Install uvx and the moomoo-api-mcp package (as part of the Quick Start flow):
# Quick Start: run directly with uvx and refresh latest version of the MCP
uvx --refresh moomoo-api-mcp
- For permanent usage, install the MCP as a persistent tool in your shell (example shown in README):
uv tool install moomoo-api-mcp
# Then run:
moomoo-api-mcp
- Development setup (optional):
# Clone the repository
git clone https://github.com/Litash/moomoo-api-mcp.git
cd moomoo-api-mcp
# Install dependencies and sync with uv
uv sync
# Run locally
uv run moomoo-api-mcp
- Configure environment variables for REAL access (in your environment or config):
- MOOMOO_TRADE_PASSWORD: your trading password
- MOOMOO_SECURITY_FIRM: your broker region (e.g., FUTUSG, FUTUINC)
Note: Without REAL credentials the server runs in SIMULATE mode by default.
Additional notes
Environment variables for REAL accounts should be kept secure and never committed to version control. If you encounter connectivity issues, verify that Moomoo OpenD is running and listening on port 11111, and that the MCP server is configured to connect to 127.0.0.1:11111. The CLI examples show how to enable --refresh to ensure you’re using the latest MCP version. When using Claude Desktop or other agents, ensure you pass explicit trd_env parameters to switch between REAL and SIMULATE modes and follow the unlock_trade workflow for REAL accounts. The server supports a wide range of tools; consult the README Tools section for a full list and parameter behavior (e.g., status_filter_list formatting for orders).
Related MCP Servers
mcp-aktools
📈 提供股票、加密货币的数据查询和分析功能MCP服务器
TradingAgents mode
TradingAgents-MCPmode 是一个创新的多智能体交易分析系统,集成了 Model Context Protocol (MCP) 工具,实现了智能化的股票分析和交易决策流程。系统通过多个专业化智能体的协作,提供全面的市场分析、投资建议和风险管理。
metatrader
Model Context Protocol (MCP) to enable AI LLMs to trade using MetaTrader platform
yfinance
MCP server from narumiruna/yfinance-mcp
tradingview-chart
MCP server that captures TradingView chart images via Selenium — supports any ticker/interval with browser pooling for concurrent performance
TWSEMCPServer
台灣證交所OpenAPI 的 MCP Server