Skip to main content
Loss of provenance

A previous release had provenance metadata, but this release does not. View details.

hk-ipo-fee-mcp

PyPI License: MIT

An MCP server that gives AI assistants exact Hong Kong IPO cost maths, so they can stop guessing. It covers:

  • the entry fee (amount payable), including the 1% brokerage, SFC, AFRC and trading-fee levies, each rounded to the cent;
  • margin-financing interest, the break-even sell price, scenario P&L and expected value;
  • selling costs, with stamp duty rounded up to a whole HK$;
  • cited rule summaries (Mechanism A/B allocation, Pool A/B, FINI T+2);
  • open-licensed (Wikidata, CC0) lookups of HK-listed companies and listing dates.

中文简介:港股打新费用计算 MCP 服务器。让 Claude、Cursor 等 AI 助手精确计算入场费(1% 佣金 + 证监会/会财局征费 + 交易费,逐项四舍五入至分)、孖展利息、回本价、情景盈亏与期望值、卖出费用(印花税向上取整至元),并查询机制 A/B、甲乙组、FINI 等规则(附出处)。公司与上市日期查询只使用 Wikidata(CC0)开放数据,不抓取港交所/披露易。免费开源(MIT)。网页版计算器:https://hk-ipo-calc.pages.dev/

Ask things like:

"I'm applying for 20 lots of an IPO at HK$8.88, 500 shares a lot, with 10× margin at 3.5% for 7 days and a HK$100 handling fee. 18,000 out of 120,000 applicants at my size got one lot. What's my entry fee, break-even price and expected value?"

The numbers come from a tested fee engine, not from the model. That engine is the same one used by the web calculator and the HK IPO Ledger Chrome extension, and the two implementations are checked to give identical results on 8,000 test values.

Tools

Tool What it does
hk_ipo_amount_payable Amount payable for N shares: application money + 1% brokerage + 0.0027% SFC levy + 0.00015% AFRC levy + 0.00565% trading fee
hk_ipo_plan Full plan: entry fee, total payable, own cash vs margin loan, interest, fixed cost, break-even price, scenario table, expected value (from allotment counts or a rate)
hk_sell_costs Selling costs: 0.1% stamp duty rounded up to HK$1, trading fee, levies, broker commission / platform fee
hk_ipo_rules Cited rule summaries: fees, allocation (Mechanism A/B from 4 Aug 2025, 18C), pools, timeline (FINI) or all
hk_company_lookup Look up an HK-listed company by code or name (Wikidata, CC0)
hk_listings Listings by date range (Wikidata, CC0, cached 24 h)

Install

You need Python ≥ 3.10. The easiest way to run it is with uv, which needs no install step:

uvx hk-ipo-fee-mcp          # runs the stdio server
# or
pipx install hk-ipo-fee-mcp && hk-ipo-fee-mcp

Claude Desktop

Edit claude_desktop_config.json. On macOS it is at ~/Library/Application Support/Claude/; on Windows at %APPDATA%\Claude\.

{
  "mcpServers": {
    "hk-ipo-fee": { "command": "uvx", "args": ["hk-ipo-fee-mcp"] }
  }
}

Claude Code

claude mcp add hk-ipo-fee -- uvx hk-ipo-fee-mcp

Cursor

Add this to ~/.cursor/mcp.json, or to .cursor/mcp.json in a project:

{
  "mcpServers": {
    "hk-ipo-fee": { "command": "uvx", "args": ["hk-ipo-fee-mcp"] }
  }
}

VS Code (GitHub Copilot agent mode)

Add this to .vscode/mcp.json:

{
  "servers": {
    "hk-ipo-fee": { "type": "stdio", "command": "uvx", "args": ["hk-ipo-fee-mcp"] }
  }
}

Windsurf / Cline / other clients

Any client that speaks MCP over stdio works. Set the command to uvx and the args to ["hk-ipo-fee-mcp"]. If you installed with pipx, set the command to hk-ipo-fee-mcp with no args.

Environment variables (optional)

Variable Default Purpose
HKIPO_CONTACT project URL + maintainer email Contact string in the Wikidata User-Agent (Wikimedia UA policy). Set your own if you query a lot
HK_IPO_FEE_MCP_CACHE ~/.cache/hk-ipo-fee-mcp Cache directory for listing data

Example

hk_ipo_plan(offer_price=8.88, board_lot=500, lots_applied=20, margin_multiple=10, annual_rate=0.035, interest_days=7, handling_fee=100, allotted_lots=1, valid_applications=120000, successful_applicants=18000) returns:

Entry fee (1 lot) HK$4,484.78
Total amount payable (20 lots) HK$89,695.55
Margin interest HK$54.19
Fixed cost (paid either way) HK$154.19
Break-even sell price HK$9.289 (+4.61%), assuming zero sell commission

(These are illustrative inputs, not a real IPO.)

Data & compliance

  • Fees and rules follow published SFC, AFRC, HKEX and IRD (GovHK) rates; every rule summary cites its source.
  • No HKEX/HKEXnews scraping. HKEX's terms prohibit automated access, so IPO terms (offer price, board lot, allotment results) must come from you or the prospectus. The server never invents them.
  • Listing lookups use Wikidata (CC0). The data is community-maintained, so verify it before relying on it.
  • Results are arithmetic, not investment advice. This project is not affiliated with Hong Kong Exchanges and Clearing Limited.

Development

pip download --no-deps --no-binary :all: hk-ipo-fee-mcp && tar xzf hk_ipo_fee_mcp-*.tar.gz && cd hk_ipo_fee_mcp-*/
python -m venv .venv && . .venv/bin/activate && pip install -e . pytest
python -m pytest -q                 # fee anchors + MCP stdio end-to-end

More from the author

  • 🧮 HK IPO Calculator — a free bilingual web calculator using the same fee engine, plus guides on Mechanism A/B, Pool A/B, margin and fees.
  • 📒 HK IPO Ledger (Chrome extension) — an IPO ledger across multiple brokers, with allotment and P&L stats, kept on your device. Free for up to 30 records. Pro is a one-time payment with no subscription.

Support

Questions, bug reports and feature requests: email ztz1024666@gmail.com (see also the contact page). Docs and the web calculator: https://hk-ipo-calc.pages.dev/.

License

MIT © 2026 Tiezheng Zhang. Listing data from Wikidata is CC0.

Metadata

Release files for hk-ipo-fee-mcp 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Loss of provenance

These files do not have provenance metadata, despite files in a prior release including this data.

We recommend further investigation before installing these files. View details.

Source distribution (sdist)

Source distribution for hk-ipo-fee-mcp 0.1.1
File Size Uploaded Provenance Actions
hk_ipo_fee_mcp-0.1.1.tar.gz 22.9 kB Without provenance Details for hk_ipo_fee_mcp-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hk-ipo-fee-mcp 0.1.1
File Interpreter ABI Platform Actions
hk_ipo_fee_mcp-0.1.1-py3-none-any.whl Python 3 none any Details for hk_ipo_fee_mcp-0.1.1-py3-none-any.whl

Total release size: 45.5 kB

Release files / hk_ipo_fee_mcp-0.1.1.tar.gz

Loss of provenance

This file belongs to a release without provenance metadata, despite a prior release including this data.

We recommend further investigation before installing this file. View details.

Download URL hk_ipo_fee_mcp-0.1.1.tar.gz
Size 22.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a1bea3cd0d00f5d4d3a753e94eeb7f75690750ce3c0e360a677df83c08523e83
BLAKE2b-256 checksum
How to use checksums
c55d2929f2b07b8b1f13f5a08e7edc22a90bdfd88a91949cd210cd715cecf26e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / hk_ipo_fee_mcp-0.1.1-py3-none-any.whl

Loss of provenance

This file belongs to a release without provenance metadata, despite a prior release including this data.

We recommend further investigation before installing this file. View details.

Download URL hk_ipo_fee_mcp-0.1.1-py3-none-any.whl
Size 22.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9195702e994a56a7527ad042cee08002e750cd64765726a284fccfcb23e1dee0
BLAKE2b-256 checksum
How to use checksums
38b48a13cf2fea88811d998eaec442b7ed2cd9d2f3a1c3f99f7906c7542e6a8d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Security for hk-ipo-fee-mcp 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Loss of provenance

A previous release of these files had provenance metadata, but this release does not.

While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.

Release comparison

  • Removed 0.1.0 2 files With provenance
  • Added 0.1.1 2 files Without provenance

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Loss of provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page