taxrail-mcp
TaxRail MCP provides free crypto-tax previews and paid plan unlock for US/Brazil tax optimization.
Check crypto disposal tax impact with lot-level data and get baseline vs optimized tax, savings, pricing, and planId.
Compare selling appreciated crypto vs Aave v3 borrowing for liquidity, including after-tax cost and LTV.
Classify business expenses as deductible for US or Brazil tax regimes.
Unlock full execution calldata and accounting dossier for a planId via x402 payment or configured bypass.
Supports US/Brazil individual and corporate regimes, custody locations, affiliate/referrer wallets, and pricing tiers.
This server has a remotely hosted endpoint. Open its connector listing for connection details, authentication requirements, and setup instructions:
TaxRail
The Autonomous $0-Upfront Tax-Optimization Rail for Humans & AI Agents — US & Brazil
TaxRail is a non-custodial, deterministic pre-execution tax & treasury optimization layer built for traders, corporate treasuries, and autonomous AI agents. Before executing a swap, TLH rotation (ETH → wstETH), or liquidity borrow (Aave v3), TaxRail simulates the tax impact across US (IRS 1099-DA, Form 8949) and Brazilian (Lei 14.754, DeCripto, R$ 35k, Lucro Real) regimes, builds ready-to-sign 1-click execution payloads (0x v2, Jupiter, Aave v3 atomic batch), and collects exactly 10% of verified tax savings directly from the operation's proceeds ($0 upfront) — with x402 Base USDC (eip155:8453) available as a dossier-only fallback via Coinbase CDP and PayAI.
Why TaxRail
Zero Blind Tax Drag: Naive FIFO disposals and unoptimized liquidations routinely leak 15%–37% in avoidable capital gains and indirect taxes. TaxRail sits directly in the pre-trade path.
Deterministic Engine, Zero LLM Math: All lot selection (FIFO vs. HIFO/SpecID), Tax-Loss Harvesting (TLH), Brazil Lei 14.754 / R$ 35k exemptions, and Lucro Real / Simples shields run in deterministic TypeScript—reproducible, auditable, and sub-5ms.
Non-Custodial by Design: TaxRail never holds user funds or private keys. It outputs unsigned swap intents and Aave v3 calldata for the agent or user wallet to sign.
Agent & Human 1-Click Monetization ($0 Upfront): Free discovery tools + exact 10% verified-savings fee paid directly from the swap output (
0x v2/Jupiterup to 1000 bps) orAave v3borrowed USDC, with 20% automatic affiliate revenue share (referrerWallet) and x402 fallback.
Related MCP server: ProfitSpot MCP
Architecture
flowchart LR
Agent["AI Agent / Wallet / n8n"] -->|"1. Free Pre-Trade Check (MCP / REST)"| Edge["Cloudflare Edge Worker (Hono)"]
Edge --> Engine["@taxrail/tax-engine (US & BR Deterministic Rules)"]
Engine -->|"Redacted Preview + taxSavedUsd + planId"| Agent
Agent -->|"2. x402 Base USDC Settlement (eip155:8453)"| Unlock["POST /api/v1/unlock-plan"]
Unlock --> Exec["@taxrail/execution (0x v2 / CoW / Jupiter / Aave v3)"]
Exec -->|"Calldata + Accounting Dossier"| Agent
Unlock -->|"20% Affiliate Share"| Dev["referrerWallet"]Monorepo Layout
Package / Path | Role |
| Canonical TypeScript types ( |
| Deterministic US & Brazil tax calculation, lot selection, TLH & Borrow-vs-Sell engine |
| Non-custodial payload builders ( |
| Local stdio MCP server ( |
| Coinbase AgentKit |
| Zero-dependency Python SDK ( |
| Cloudflare Workers + Hono API, remote |
| Base USDC ledger -> BRL PTAX converter & Simples Nacional (Fator R / PGDAS-D) exporter |
$0-Upfront 1-Click Pricing Model (10% Paid From Operation)
TaxRail aligns incentives with verifiable savings: if you save $0 in taxes, the plan costs $0. If you save taxes, you pay $0 out of pocket upfront — TaxRail collects exactly 10% of taxSavedUsd directly inside the operation.
Step | Tools / Endpoints | Upfront Cost | What You Get |
Step 1: Free Discovery |
| $0 | Baseline vs. optimized tax ( |
Step 2A: 1-Click Execution (Swaps & Aave v3) |
| $0 upfront(10% of | Live |
Step 2B: Dossier-Only x402 Fallback |
| 10% of | Direct dossier unlock for non-onchain corporate expenses ( |
Native On-Chain Fee Mechanics & 20% Affiliate Share
Swaps (
0x v2EVM /JupiterSolana): TaxRail embedsembeddedSwapFeeBps/embeddedSwapFeePpm(up to1000 bps/10%of trade) directly in the0x v2orJupiterquote so 100% of the 10% savings fee is collected from the swap's output token (USDC,wstETH,cbETH, etc.) in 1 transaction.Aave v3 Borrow-vs-Sell:
buildAaveBorrowPayloadadds the 10% savings fee on top ofliquidityNeededUsd(totalBorrowAmountUsd = netLiquidityUsd + feePaidFromBorrowUsd) and buildsatomicBatchCalls(approve→supply→borrow→USDC.transfer), so the user keeps 100% of their requested liquidity and pays $0 out of pocket.20% On-Chain Affiliate Share (
affiliateShareUsd): PassreferrerWallet(or?ref=0xWalletontaxrail.online) to automatically receive 20% of TaxRail's 10% fee natively inside the0x v2multi-recipient split orAave v3USDC transfer.
Supported Jurisdictions & Regimes
United States (
US):INDIVIDUAL,LLC_PASS_THROUGH,C_CORPShort-term vs. long-term capital gains, 3.8% NIIT toggle, HIFO/SpecID lot selection, Tax-Loss Harvesting, Aave v3 Borrow-vs-Sell interest tax-shield modeling, and
IRS_FORM_8949/QUICKBOOKS_EXPENSEexports.
Brazil (
BR):PF_LEI_14754,PF_DOMESTIC,PJ_LUCRO_REAL,PJ_SIMPLES_EXPORTLei 14.754 (15% offshore/crypto flat rate & loss carryforward), PF domestic R$ 35k/month sales exemption check, PJ Lucro Real IRPJ/CSLL + PIS/COFINS + IBS/CBS readiness credits, IOF/FX spread analysis, and
BR_LEI_14754/BR_LUCRO_REAL_OMIE_SPEDdossiers.
Quickstart
1. Local MCP Server (stdio)
npx -y taxrail-mcpAdd to Claude Desktop, Cursor, or any MCP-compatible agent runtime:
{
"mcpServers": {
"taxrail": {
"command": "npx",
"args": ["-y", "taxrail-mcp"]
}
}
}2. Remote MCP & REST API (Cloudflare Edge Worker)
Remote MCP:
POST https://api.taxrail.online/mcpPortable Agent Skill (
SKILL.md):https://api.taxrail.online/SKILL.md(committed inskills/taxrail-crypto-tax/SKILL.mdfor OpenClaw/ClawHub, Claude Code, Codex, Cursor)REST Endpoints:
GET /api/v1/x402/pre-trade-check?walletAddress=0x...&sellAsset=ETH&sellAmount=1($0.01 USDC pre-swap HIFO savings, 366-day ST→LT cliff warning & Aave v3 borrow-vs-sell check via x402)GET /api/v1/x402/br-35k-status?monthlySalesBrl=20000&plannedSaleUsd=2500&custodyLocation=DOMESTIC($0.005 USDC Brazil R$35k monthly domestic exemption vs Lei 14.754 flat 15% check via x402)GET /api/v1/x402/tlh-scan?walletAddress=0x...&chain=base&asset=ALL($0.01 USDC 1-parameter multi-asset wallet TLH & tax-risk scanner covering up to 25 volatile tokens via x402, with per-tokenplanIds)POST /api/v1/x402/optimize($0.10 USDC 1-step full optimization + calldata + dossier via x402)POST /api/v1/check-tax-impact(Free preview -> 1-clickprepare-executionorunlock-plan)POST /api/v1/borrow-vs-sell(Free preview -> 1-clickprepare-executionorunlock-plan)POST /api/v1/classify-expense(Free preview ->unlock-plan)POST /api/v1/prepare-execution($0 upfront — returns0x v2/Jupiter/Aave v3batch with 10% fee from operation)POST /api/v1/claim-dossier(Verifies on-chain receipt bytxHashand unlocks SpecID lots + Form 8949 / DeCripto CSV)POST /api/v1/unlock-plan(Dynamic x402USDCfallback oneip155:8453, 10% of verified tax savings)POST /api/v1/feedback&GET /api/v1/reputation(Free agent feedback loop & BaseScan-verified public reputation)
3. Coinbase AgentKit & SDK (npm install taxrail-agent-tools)
import { TaxRailActionProvider } from "taxrail-agent-tools";
const taxRail = new TaxRailActionProvider({
baseUrl: "https://api.taxrail.online",
referrerWallet: "0xYourDeveloperWalletOnBase", // earns 20% affiliate share
});
const actions = taxRail.getActions();4. LangChain Tools
import { DynamicStructuredTool } from "@langchain/core/tools";
import { createTaxRailLangChainTools } from "taxrail-agent-tools";
const tools = createTaxRailLangChainTools({
baseUrl: "https://api.taxrail.online",
referrerWallet: "0xYourDeveloperWalletOnBase",
}).map((spec) => new DynamicStructuredTool(spec));5. n8n Community Node
Import the declarative node definition from packages/agent-plugins/src/n8n-node.json to run checkTaxImpact, compareBorrowVsSell, classifyDeductibleExpense, and unlockPlan inside automated n8n workflows.
Local Development
Requirements: Node.js 22+ and pnpm 10+.
# Install workspace dependencies
pnpm install
# Typecheck all packages
pnpm typecheck
# Run test suite
pnpm test
# Start the Cloudflare Edge Worker locally
pnpm dev:worker
# Dry-run Cloudflare Workers deployment
pnpm deploy:dry-run
# Export a demo Brazilian CNPJ Service Export revenue report (PTAX + Fator R)
node --experimental-strip-types scripts/export-revenue-ledger.ts --demo --ptax 5.80Documentation (Português)
Disclaimer
TaxRail is a deterministic tax-calculation and non-custodial transaction-routing software layer. It does not provide legal, accounting, or investment advice, nor does it act as a custodian or digital-asset broker. Always have generated dossiers reviewed by a licensed CPA (US) or accountant (Brazil).
Available Tools
9 toolscheck_br_35k_statusBrazil R$35k Exemption & Lei 14.754 Check ($0.005 x402)CInspect
Calculates remaining R$35k monthly domestic exemption vs Lei 14.754 15% flat tax and max safe USD sale size ($0.005 USDC x402 on Base).
Inputs: usdBrlRate, plannedSaleUsd, custodyLocation, monthlySalesBrl, +1 more.
check_tax_impactCheck Crypto Disposal Tax Impact (FREE)CInspect
FREE tax optimization preview for US & Brazil crypto disposals. Returns baseline vs optimized tax, verified savings, dynamic x402 pricing, and planId.
Inputs: lots (required), regime (required), targetAsset (required), jurisdiction (required), +10 more.
claim_dossierClaim Tax Dossier After On-Chain ExecutionCInspect
Verifies the settled swap or Aave borrow txHash on-chain and unlocks SpecID selectedLots + Form 8949 / Brazil DeCripto CSV.
Inputs: planId (required), txHash (required), chain, feeTxHash, +1 more.
classify_deductible_expenseClassify Deductible Business Expense (FREE)CInspect
FREE preview classifying business expenses (AI/cloud/SaaS/contractors) for US C-Corp/LLC or Brazil Lucro Real.
Inputs: regime (required), amountUsd (required), vendorName (required), description (required), +8 more.
compare_borrow_vs_sellCompare DeFi Borrow vs Sell (FREE)CInspect
FREE preview comparing selling appreciated crypto vs borrowing USDC on Aave v3. Returns after-tax cost comparison, LTV, and planId.
Inputs: regime (required), holdingDays (required), jurisdiction (required), collateralAsset (required), +11 more.
prepare_executionPrepare $0-Upfront 1-Click Execution (Pay 10% From Operation)BInspect
FREE pre-execution step: returns ready-to-sign 0x v2 / Jupiter swap calldata or Aave v3 atomic borrow batch with TaxRail's exact 10% verified-savings fee embedded inside the operation ($0 upfront). Broadcast the tx and call claim_dossier to unlock SpecID lots & CSV.
Inputs: planId (required), buyAsset, takerAddress, borrowerAddress.
pre_trade_checkPre-Trade Swap/Sell Tax Guardrail ($0.01 x402)BInspect
Checks HIFO vs FIFO savings, 366-day US ST->LT cliffs, and Aave v3 borrow-vs-sell before swapping ($0.01 USDC x402 on Base).
Inputs: sellAsset (required), sellAmount (required), walletAddress (required), chain, +3 more.
scan_wallet_tlhScan Wallet for Year-End TLH & Tax Savings ($0.01 x402)CInspect
Scans up to 25 volatile tokens in an EVM wallet (Base/Ethereum/Arbitrum) for year-end TLH and HIFO tax savings ($0.01 USDC x402 on Base).
Inputs: walletAddress (required), asset, chain, jurisdiction, +2 more.
unlock_tax_planUnlock Full Tax Optimization Plan (x402)BInspect
Unlocks full execution calldata and accounting dossier for a planId. Uses TAXRAIL_REMOTE_URL with X-PAYMENT / TAXRAIL_DEV_BYPASS if configured, or returns x402 payment instructions.
Inputs: planId (required), paymentSignature.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Several tools overlap as tax-analysis previews: check_tax_impact, pre_trade_check, and compare_borrow_vs_sell all return savings/planId-style outputs, differing mainly by scenario. prepare_execution and unlock_tax_plan both surface execution calldata, while claim_dossier and unlock_tax_plan both unlock dossier/CSV outputs; descriptions help but boundaries are not crisp.
Most tool names follow a readable action_object pattern such as claim_dossier, prepare_execution, and check_tax_impact. pre_trade_check is an outlier pattern, and scan_wallet_tlh mixes an acronym into the object, but the set is still mostly predictable.
Nine tools fit a multi-step crypto tax workflow spanning analysis, pre-trade checks, execution preparation, payment/unlock, and post-trade dossier claiming. The count is well-scoped with no obvious filler tools.
The surface covers tax previews, TLH scanning, Brazil-specific exemption logic, deductible expense classification, borrow-vs-sell comparison, execution calldata preparation, plan unlocking, and post-trade CSV/Form 8949 dossier claiming. Minor gaps remain around broader jurisdiction/lifecycle management, but core workflows are covered.
Maintenance
Related MCP Connectors
23-in-1 MCP server: EVM tx simulator, funding rate arb, macro radar, swap calldata & security.
Real-time crypto & tokenized equity intelligence MCP over x402 USDC on Base mainnet.
7-factor stock scoring MCP server. US/HK/CN, 74 stocks. Free + Premium (USDC/Base). x402 ready.
Official Aave MCP for V3 and V4 markets, positions, governance, and transaction preparation.
Related MCP Servers
- AlicenseBqualityBmaintenanceMulti-DEX perpetual futures trading MCP server (Pacifica, Hyperliquid, Lighter). 18 tools for market data, trade execution with dry-run safety, funding rate arbitrage, and portfolio analytics.31582 npm44MIT
- AlicenseAqualityDmaintenanceCross-chain DeFi intelligence MCP server for AI agents. 7 tools for yield discovery, pool analysis, profit simulation, risk scoring, whale tracking, impermanent loss calculation, and DeFi overview across 86 chains and 6,500+ liquidity pools.71AGPL 3.0
- AlicenseAqualityDmaintenanceMCP server providing Solana/crypto/macro tools (wallet scan, password breach, Jito tip, GitHub health, FRED series, Drift exposure, premium chapters) with x402 payment gating (USDC on Base) for 7 of 8 tools.15MIT
- AlicenseAqualityDmaintenanceMCP server for Base L2 DeFi — wallets, swaps, liquidity, price feeds, flash loans8MIT