bull-milker-mcp
This read-only MCP server provides access to moomoo market data, stock screening, portfolio risk analysis, and tax estimation tools. All tools are strictly read-only — no order placement or modification.
Health & Connectivity:
check_healthverifies moomoo OpenD connection and login status.Market Snapshot:
get_market_snapshotretrieves live price, volume, percentage change, and other data for specified symbols.Account Positions:
get_account_positionslists current holdings in paper or live trading accounts.Stock Screening:
run_bull_milker_screenerfilters stocks by turnover, volume, and % change across US, HK, SH, SZ markets.run_bull_milker_extended_screeneradds PE ratio filtering and enriches results with short-interest data (short sell rate, short available volume). Institutional ownership is alwaysNone.
Portfolio Concentration:
get_portfolio_sector_exposuregroups holdings by moomoo industry sectors, flags any position exceeding 25% concentration.Technical Outlook:
get_sector_technical_outlook_toolaggregates RSI/SMA signals per sector based on holdings (proxy, not real index quotes).Trade History & Tax:
get_quarterly_transaction_summary_toolsummarizes trades by quarter with counts, buy/sell splits, gross notional, and symbols traded (no cost-basis matching).get_quarterly_tax_summary_toolcomputes realized short-term and long-term capital gains/losses per quarter using FIFO cost basis. Requires live account and explicit opt-in (TAX_AUDIT_ENABLE_LIVE=true). Not tax advice — reconcile with official 1099-B.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@bull-milker-mcp Run the Bull Milker screener with default settings."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
bull-milker-mcp
A read-only MCP server exposing moomoo market data, the Bull Milker screener, and portfolio risk/exposure tools to Claude Desktop.
What it exposes
Tool | What it does |
| Confirms OpenD is reachable |
| Current paper/live positions |
| Live price/volume/change for given codes |
| Screener: turnover, volume, and % change filters, configurable via |
| Bull Milker + PE ratio and short-interest enrichment (see caveats below) |
| Deterministic concentration calc across your current positions, grouped by real moomoo industry-plate sectors |
| RSI/SMA technical signals aggregated per sector, holdings-weighted (see below) |
| Trade counts by quarter (Q126 format), no cost-basis matching |
| Realized gain/loss by quarter, FIFO cost basis, LIVE account only (opt-in) |
Related MCP server: Atlas MCP Server
Important caveats — read before wiring up the "suggest investments" agent
Sector grouping:
get_portfolio_sector_exposureandget_sector_technical_outlook_toolgroup holdings by moomoo's real industry-type plates (viaget_owner_plate), not GICS. Concept/thematic plates are excluded. A symbol with no industry-plate match is grouped under an explicitly-labeled"Unknown (no industry plate mapping)"bucket — never silently folded into a real sector.Sector technical signals are a proxy, not an index quote:
get_sector_technical_outlook_tool'sweighted_rsi_14and SMA figures are a market-value-weighted average of each holding's own locally computed RSI/SMA, not a real sector-index feed — moomoo doesn't expose one through this API. Daily kline history is cached underdata/kline_cache/because moomoo's historical-kline quota takes 7 days to release per symbol; don't delete that cache casually or you'll burn quota re-fetching it.PE ratio: available directly from moomoo (
pe_ttm_ratioon snapshots, or as aFinancialFilterin the screener). Included and working.Short volume / short interest: moomoo's snapshot endpoint exposes
short_sell_rateandshort_available_volumeper symbol. These are fetched as an enrichment step after the screener runs (not filterable insideget_stock_filteritself, since it's not one of the screenableStockFieldoptions as far as the public API docs show).Institutional investment %: moomoo's app has an "Institutional Tracker" based on 13F filings, but as of writing this doesn't appear to be exposed through the public OpenAPI — 13F data is also inherently quarterly and reported with up to a 45-day lag, so even where available it's a lagging indicator, not real-time.
indicators.pyhas a stubbedget_institutional_ownership()that raisesNotImplementedErrorwith a clear TODO — plug in a third-party data provider there (e.g. a paid fundamentals API) if you want this metric. Don't let the agent silently treat a missing/stubbed value as "0% institutional ownership" — the tool returnsNoneexplicitly so that distinction is visible upstream.
Setup
./setup.shCreates the venv, installs dependencies, copies .env.example to .env if
missing, and prints the exact mcpServers block to paste into Claude
Desktop's config. Safe to re-run — skips steps already done. Edit .env
afterward to fill in your values (e.g. MOOMOO_SECURITY_FIRM).
Manual equivalent, if you'd rather not run the script:
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e .
cp .env.example .env # fill in valuesRequires moomoo OpenD running and logged in (see the main Bull Milker
project's opend/README.md if you have it, or
https://openapi.moomoo.com/moomoo-api-doc/en/intro/). The server now checks
OpenD is reachable at startup and exits with a clear message if not, rather
than failing opaquely on the first tool call.
Developing in VS Code
Open this folder in VS Code.
.vscode/launch.jsonis set up to runsrc/bull_milker_mcp/server.pydirectly under the debugger — set breakpoints in any tool function and step through a call.For a protocol-level test without any client, use the MCP Inspector:
npx @modelcontextprotocol/inspector python -m bull_milker_mcp.serverRun
python -m bull_milker_mcp.screenerfor a quick manual smoke test of the screener logic alone, without going through MCP at all.
Wiring into Claude Desktop
Copy the relevant block from claude_desktop_config.example.json into your
Claude Desktop MCP config, updating the cwd path. Restart Claude Desktop,
then confirm the tools show up (Claude Desktop's MCP tool picker, or just
ask "what tools do you have from bull-milker-mcp?").
Shutting down
./stop.shStops the bull_milker_mcp server process and moomoo OpenD, so neither
keeps running (or holding a live account connection) between sessions.
Quit Claude Desktop first — it respawns the MCP server on demand, so
killing it while Claude Desktop is still open just makes tool calls fail
until the next call or a Desktop restart.
Suggested build/test order
check_health— confirm the OpenD round trip works at all.get_market_snapshot— one real symbol, verify data shape.get_account_positions— paper account.run_bull_milker_screener— verify against the existing Bull Milker project's results.get_portfolio_sector_exposure— test with a small known portfolio, check the math by hand.run_bull_milker_extended_screener— add PE + short interest enrichment.get_sector_technical_outlook_tool— first call will be slow (fetches ~380 days of daily klines per holding); re-run it and confirm the second call is fast, using the cache instead of re-fetching.Wire into Claude Desktop, test each tool interactively in chat.
Only then: build the standing prompt and set up a Cowork scheduled task.
Safety
See SAFETY.md for the full threat model and user stories. In short:
this server is read-only by design and by enforcement — guardrails.py
checks for trade-execution symbols at startup, and
tests/test_no_trading_capability.py fails the build if any creep in.
Every tool call is logged to data/audit_log.jsonl (see audit.py).
Before adding any new tool, ask: does this need to place, modify, or cancel an order? If yes, stop and read SAFETY.md US-2 first.
Run the safety test any time: pytest tests/test_no_trading_capability.py -v
MCP SDK version note
This project targets mcp v2 (MCPServer, not the older FastMCP class
— the official SDK renamed it in its July 2026 v2 release; v1 is now
maintenance-only). If you're following older MCP tutorials that show
from mcp.server.fastmcp import FastMCP, that's the v1 API — this repo
uses from mcp.server import MCPServer instead. If your installed mcp
resolves to <2.0, either upgrade (pip install "mcp[cli]>=2.0") or pin
your own project to mcp>=1.28,<2 and revert this file's import — don't
mix the two.
Tax reporting (live account)
get_quarterly_tax_summary computes realized capital gains/losses by
quarter (Q126 format) using FIFO cost-basis matching against your LIVE
account's deal history — genuinely different from
get_quarterly_transaction_summary, which just counts trades on whichever
account (paper by default) and does no cost-basis matching at all.
This is gated behind TAX_AUDIT_ENABLE_LIVE=true in .env — it's off by
default and raises a clear PermissionError if you call it without
enabling it first. See SAFETY.md US-8/US-9/US-10 before turning this on.
Not tax advice. FIFO cost basis, no wash-sale handling, no corporate actions, no dividends. Reconcile against your broker's 1099-B and talk to an actual tax professional before filing anything.
Available Tools
8 toolscheck_healthA
Check whether moomoo OpenD is reachable and logged in. Read-only — cannot place, modify, or cancel orders.
Inputs: no named parameters.
get_account_positionsA
Get current positions in the connected moomoo account. Read-only — cannot place, modify, or cancel orders. Does not by itself confirm whether the connected account is paper or live; cross-check with check_health if that matters for the current task.
Inputs: no named parameters. Returns: result
get_market_snapshotA
Get current price, volume, % change, and other live data for one or more stock codes (e.g. 'US.AAPL', 'US.TSLA'). Read-only — cannot place, modify, or cancel orders.
Inputs: codes (required). Returns: result
get_portfolio_sector_exposureA
Compute sector/symbol concentration for the current portfolio. Returns total market value, breakdown by sector and symbol, and a list of concentration_flags for any position exceeding a 25% threshold. This is a deterministic calculation, not a model estimate. Read-only.
Inputs: no named parameters.
get_quarterly_tax_summary_toolA
Realized capital gain/loss by quarter (Q126 format), split into short-term and long-term, using FIFO cost-basis matching against your LIVE trading account's deal history.
IMPORTANT — LIVE ACCOUNT, NOT TAX ADVICE:
Reads your real account's historical deals. Read-only — cannot place, modify, or cancel orders. Requires TAX_AUDIT_ENABLE_LIVE=true in the server's .env; if that's not set, this raises a clear error rather than silently failing or falling back to paper data.
Cost basis uses FIFO (IRS default absent another election). If your broker uses average-cost or specific-lot-ID, these figures won't match your official 1099-B exactly.
Does not account for wash sales, dividends, or corporate actions (splits/mergers) affecting cost basis.
Present any numbers from this tool as a planning estimate to reconcile against the broker's 1099-B, never as a final tax figure.
start/end are 'YYYY-MM-DD' strings — for a full tax year, pass an explicit start (e.g. start='2026-01-01'), since the ~90-day default lookback will otherwise silently miss earlier quarters.
Inputs: end, start.
get_quarterly_transaction_summary_toolA
Compiles filled trades into quarterly buckets labeled Q126, Q226, Q326, Q426, etc. (Q<2-digit year>). Each quarter includes trade count, buy/sell split, gross notional traded, and symbols traded. No cost-basis matching — for realized gains/losses use get_quarterly_tax_summary instead.
start/end are 'YYYY-MM-DD' strings. If start is omitted, moomoo's default lookback (~90 days) applies and older quarters will be incomplete — the response includes a '_lookback_warning' field in that case. Read-only, works on paper trading (defaults to SIMULATE).
Inputs: end, start.
run_bull_milker_extended_screenerA
Bull Milker screener plus PE ratio filtering and short-interest enrichment (short_sell_rate, short_available_volume) per result.
Each result includes an institutional_pct field that is always None —
moomoo's public OpenAPI does not expose institutional ownership data.
Treat None as "unknown, not available," never as "0%." Read-only —
returns candidates for you to evaluate, never places any order.
Inputs: market, pe_max, pe_min. Returns: result
run_bull_milker_screenerA
Run the Bull Milker screener: turnover ratio, volume, and % change filters. Defaults are turnover 2-10%, volume 500k-5M, change 1-8% — override any bound to widen or narrow the scan. market is 'US', 'HK', 'SH', or 'SZ'. Read-only — returns candidates for you to evaluate, never places any order.
Inputs: market, change_max, change_min, volume_max, +3 more. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Each tool has a clearly distinct purpose: health check, market snapshot, account positions, portfolio exposure, two screeners (basic vs extended), and two quarterly summaries (transactions vs tax). The screeners and summaries are differentiated by their specific scope and outputs, so an agent should have no trouble selecting the right tool.
Most tools follow a consistent verb_noun pattern with lowercase and underscores (check_, get_, run_). However, the two quarterly summary tools end with '_tool', which breaks the pattern slightly, and the use of 'run_' for screeners versus 'get_' for others is a minor deviation. Overall, the naming is predictable and readable.
With 8 tools, the server is well-scoped for its apparent purpose of trading analysis and portfolio monitoring. Each tool serves a distinct function without redundancy, and the count falls comfortably within the typical range for a focused MCP server.
The server covers the core workflows: health check, market data, position reading, portfolio concentration, screening (basic and advanced), and quarterly reporting. Minor gaps exist, such as no historical price data or individual order lookup, but these are not critical given the server's explicit read-only and analysis-oriented focus. The tax summary's caveats are well-documented, and the presence of both screeners adds flexibility.
Maintenance
Related MCP Connectors
Real SEC, 13F, insider, congress & macro data your AI agent can cite. Hosted MCP, 24 tools.
Market reports, earnings history, research, portfolio analysis and read-only Workspace tools.
Agentic brokerage access to a US brokerage account: quotes, orders, positions, cash and documents.
Stock, earnings and macro research with scheduled agents. FN2 account and OAuth required.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to access real-time market data, manage Moomoo trading accounts, and execute trades via the Moomoo platform.28 PyPI42Apache 2.0
- FlicenseNot gradedqualityBmaintenanceConnects AI agents to real-time market data, options analysis, broker order staging, and automated alerts and workflows.-
- FlicenseNot gradedqualityDmaintenanceA read-only MCP server that exposes Interactive Brokers and Moomoo brokerage accounts as tools, enabling natural-language queries across positions, trade history, realized P&L, and sector exposure in one merged view.-
- AlicenseNot gradedqualityDmaintenanceEnables MCP clients to read Webull account balances, positions, orders, stock quotes, historical bars, and US option market data, with live equity trading available only as an explicitly enabled opt-in.MIT