SuperAPI AI Directory

acb-tax-mcp

Canadian adjusted cost base (ACB) and capital gains from trade history: average-cost tracking, per-disposition realized gains and superficial-loss detection.

Open website

About this tool

Purpose acb-tax-mcp is an MCP (Model Context Protocol) server for calculating Canadian adjusted cost base (ACB) and capital gains from transaction history. It is aimed at LLM agents, letting users ask an assistant questions in natural language, such as "What are my 2024 capital gains?" or "Did I trigger any superficial losses?", with the server processing transactions according to CRA rules instead of relying on a spreadsheet.

Main capabilities Implements the CRA average cost method: all shares of the same security are combined into a single ACB, and gains are calculated based on average cost, not FIFO. Implements the superficial loss rule: losses are denied and deferred into the ACB of substituted shares—substituted shares are shares bought within 30 days before or after the sale. Handles commissions and CAD exchange rate conversion for each transaction. Returns calculation results as structured JSON. Supports Claude Desktop, Claude Code, Cursor, or any MCP-compatible client.

Usage Requires Python 3.10+ and MCP Python SDK 2.x (mcp>=2,<3). SDK 1.x is feature-frozen upstream and no longer supported; 0.4.0 is the last version that can run on it. Try it without installing: open the Glama server page and use Try in Browser to call the tools in a sandbox containing several sample transactions. The command to run from source (without installing) is not provided with specifics in the official materials. Configure the client: in claude_desktop_config.json. Provide the tool with a list of transactions, or a .csv / .json file path. CSV uses the same column names as the header row. If a broker export has different headers (such as "Trade Date", "Activity Type", "Symbol", "Quantity", etc.), first run it through normalize_broker_csv. Example: examples/sample_trades.csv is a ready-made broker-style export containing alias headers, numbers with $ formatting, a DRIP row, a dividend row (skipped for cause), a USD transaction with FX, and a superficial loss scenario. You can ask the assistant to clean it up with normalize_broker_csv and run calculate_acb on the result.

When to use You can give the assistant the following instructions: "Calculate the ACB and capital gains for the transactions in ~/trades.csv." "What is my 2024 capital gains report?" "Did these sales trigger a superficial loss?" "What is the current book cost of XEQT?" "This is my RBC activity export—clean it up and calculate my ACB." "XEQT is priced at $35.20, VTI at $305.40 USD (1.37 CAD): what is my unrealized gain?"

Superficial loss example Buy 100 shares @ $10, sell 100 shares @ $8 (loss of $200), and 9 days later buy 100 shares again at $8: The $200 loss is denied and added to the ACB of the repurchased shares (the new per-share ACB becomes $10), so it will be recovered on a future sale.

Limitations The average cost method is calculated per identical property. Since CRA rules combine identical property at the taxpayer level, all transactions in the same security across all accounts should be provided together. The tool combines by the security key provided by the user. Superficial losses use the standard "least of three" test, in a single forward pass. Deeply chained or overlapping superficial losses may require case-by-case professional judgment. Not yet handled: return of capital, reinvested/notional distributions (ETF phantom distributions), stock splits, options, and other corporate actions. These affect ACB and are on the roadmap. Exchange rates must be provided per transaction (using the transaction-date exchange rate). The tool does not fetch exchange rates. Registered accounts (TFSA/RRSP) have no capital gains; this tool is for non-registered (taxable) accounts. Not tax advice.

License MIT. See LICENSE.