{
  "markdown": "# TradingCalc MCP Server\n\n[![MCP Badge](https://lobehub.com/badge/mcp/skalinin909-tradingcalc-mcp)](https://lobehub.com/mcp/skalinin909-tradingcalc-mcp)\n\nAsk Claude or Cursor trade questions and get exact numbers back — not AI guesses.\n\n> \"What's my PnL if I buy 0.5 BTC at $80k and sell at $95k with 5x leverage?\"\n> \"Size my position: $10k account, 1% risk, long BTC at $83k, stop at $81k.\"\n> \"Is this carry trade worth it? 0.01% funding long, 0.05% short, $50k, 30 days.\"\n\n23 deterministic tools across trade planning, risk & margin, funding/carry, and market-structure (Market Profile) analysis. Formulas verified against 22 canonical test vectors — same inputs always produce the same outputs. Free, no signup.\n\nAccess via **MCP** (Claude Desktop / Cursor / VS Code) or a plain HTTP POST to the MCP endpoint. Free, no signup.\n\n## Endpoints\n\n| Surface | URL | Auth |\n|---|---|---|\n| MCP | `https://tradingcalc.io/api/mcp` | Bearer optional (free) |\n| For agents / setup | `https://tradingcalc.io/for-agents` | None |\n| Verification proof | `https://tradingcalc.io/verify` | None |\n\nMCP transport: **Streamable HTTP** (MCP spec 2024-11-05)\n\n## Quick Start\n\n### Claude Desktop\n\nAdd to `claude_desktop_config.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"tradingcalc\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"mcp-remote\", \"https://tradingcalc.io/api/mcp\"]\n    }\n  }\n}\n```\n\n### Cursor / VS Code\n\n```json\n{\n  \"tradingcalc\": {\n    \"url\": \"https://tradingcalc.io/api/mcp\"\n  }\n}\n```\n\n### Direct HTTP\n\n```bash\ncurl -X POST https://tradingcalc.io/api/mcp \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"jsonrpc\": \"2.0\",\n    \"id\": 1,\n    \"method\": \"tools/call\",\n    \"params\": {\n      \"name\": \"workflow.run_liquidation_safety\",\n      \"arguments\": {\n        \"side\": \"long\",\n        \"entryPrice\": 95000,\n        \"leverage\": 10\n      }\n    }\n  }'\n```\n\n## Example prompts\n\nAfter connecting, just ask naturally — the AI picks the right tool automatically:\n\n**Trade P&L**\n> \"I bought 0.5 BTC at $80,000 and want to sell at $95,000 with 5x leverage. What's my net profit after fees?\"\n\n**Position sizing**\n> \"I have a $10,000 account and want to risk 1% going long BTC at $83,000 with a stop at $81,000. How many coins should I buy?\"\n\n**Liquidation check**\n> \"Long ETH at $3,200 with 10x leverage — where do I get liquidated?\"\n\n**Full pre-trade check**\n> \"Analyze this setup: long BTC at $83,000, stop $81,000, target $90,000, $10k account, 1% risk, 5x leverage. Is it worth taking?\"\n\n**Funding cost**\n> \"I'm holding 0.5 BTC long on Bybit at $83,000 with 0.01% funding rate. How much will funding cost me over 3 days?\"\n\n**Carry trade**\n> \"Is this carry trade worth it? Long on Bybit at 0.01% funding, short on Binance at 0.05%, $50k notional, 30 days.\"\n\n**DCA average entry**\n> \"I bought BTC at $78k (0.2 BTC), $80k (0.3 BTC), and $82k (0.1 BTC). What's my average entry and breakeven?\"\n\n**Scale-out plan**\n> \"I'm long 1 BTC from $80k. I want to close 30% at $88k, 40% at $92k, 30% at $96k. What's my total P&L?\"\n\n---\n\n## Tools (23)\n\nTool naming follows the `workflow.run_*` / `primitive.*` / `system.*` namespace convention.\nOld flat names (`pnl`, `liquidation`, etc.) are accepted for backward compatibility. All tools are\nfree via MCP — no signup; 20 calls/day anonymously, 200/day with a free API key.\n\n### Trade Planning\n\n| Tool | Description |\n|---|---|\n| `workflow.run_pnl_planning` | Net PnL, fees and gross profit/loss for a futures trade |\n| `workflow.run_breakeven_planning` | Break-even price accounting for entry/exit fees |\n| `workflow.run_exit_target` | Exit price required to hit a target PnL or ROE |\n| `workflow.run_scenario_planning` | Multi-scenario P&L analysis across price targets |\n| `workflow.run_dca_entry` | DCA across N price levels → avg entry, breakeven, level contribution |\n| `workflow.run_scale_out` | Partial exits at multiple levels → P&L per exit, weighted avg, overall ROI |\n\n### Risk & Margin\n\n| Tool | Description |\n|---|---|\n| `workflow.run_liquidation_safety` | Liquidation price for long/short isolated margin |\n| `workflow.run_position_sizing` | Position size based on account size and max risk % |\n| `workflow.run_max_leverage` | Maximum safe leverage based on drawdown tolerance and volatility |\n| `workflow.run_risk_reward` | Full R:R analysis: sizing + liquidation + breakeven + P&L at stop and target |\n\n### Funding & Carry\n\n| Tool | Description |\n|---|---|\n| `workflow.run_funding_cost` | Cumulative funding cost over a holding period |\n| `workflow.run_funding_arbitrage` | Annualized yield from long/short basis trades across two exchanges |\n| `workflow.run_compound_funding` | Capital growth projection from reinvesting funding income |\n| `workflow.run_funding_breakeven` | Price move needed to cover funding cost + fees over holding period |\n| `workflow.run_carry_trade` | Delta-neutral carry setup: net yield, ROI, breakeven days, verdict |\n\n### Market Structure (Market Profile)\n\n| Tool | Description |\n|---|---|\n| `workflow.run_open_analysis` | Open location + type (OD/OTD/ORR/OAIR), VAH/VAL/VPOC/IB, scenario framing |\n| `workflow.run_session_structure` | Day-type classifier — trend / balance / neutral_trend / normal / normal_var |\n| `workflow.run_value_migration` | Value-area migration across sessions — directional conviction vs balance |\n| `workflow.run_breakout_acceptance` | Breakout acceptance vs rejection beyond the value area (optional delta) |\n\n### Primitives\n\n| Tool | Description |\n|---|---|\n| `primitive.average_entry` | Average entry price after DCA into a position |\n| `primitive.hedge_ratio` | Short perp size and funding cost to hedge a spot position |\n\n### Integrated Decision\n\n| Tool | Description |\n|---|---|\n| `workflow.run_pre_trade_check` | Full pre-trade decision: position size, liquidation, breakeven, funding cost, go/no-go signal. Accepts live exchange + symbol. |\n\n### System\n\n| Tool | Description |\n|---|---|\n| `system.verify` | Run 22 canonical test vectors against all calculators. Returns pass/fail report. |\n\nFormulas normalized across 7 exchanges: **Binance, Bybit, OKX, Hyperliquid, Aster, KuCoin, MEXC**.\n\n## Rate Limits\n\n| Access | Req/day | Price |\n|---|---|---|\n| Anonymous | 20 | Free |\n| Free API key | 200 | Free |\n\nThe Service is free. Need a higher-limit key → email [hi@tradingcalc.io](mailto:hi@tradingcalc.io).\n\nPass key as: `Authorization: Bearer <your-api-key>`\n\n## Self-Verification\n\nAgents can verify all 22 canonical test vectors before trusting results:\n\n```json\n{\n  \"jsonrpc\": \"2.0\", \"id\": 1,\n  \"method\": \"tools/call\",\n  \"params\": { \"name\": \"system.verify\", \"arguments\": {} }\n}\n```\n\nResponse: `{ \"status\": \"pass\", \"passed\": 22, \"failed\": 0, \"total\": 22 }`\n\nLive proof: [tradingcalc.io/verify](https://tradingcalc.io/verify)\n\n## Use Cases\n\n- **Trading bots** — check liquidation price before every trade\n- **AI agents** — deterministic risk calculations without hallucination risk\n- **Multi-agent systems** — drop-in risk management agent in analyst + risk + execution pipelines\n- **Dashboards** — embed calculations programmatically\n\n## Why deterministic?\n\nLLMs asked directly give plausible but potentially wrong numbers. TradingCalc MCP returns exact calculations — same inputs always produce the same outputs. No hallucination risk for financial data.\n\n## Risk Agent Wrapper\n\n`examples/risk-agent-wrapper.ts` — a drop-in TypeScript wrapper for risk-gated trade execution.\nIntegrates with any agent framework (ElizaOS, CrewAI, AutoGen, Hummingbot, Freqtrade).\n\n```typescript\nimport { RiskAgent, preTradeGate } from './examples/risk-agent-wrapper';\n\nconst agent = new RiskAgent({ apiKey: 'tc_your_key', minLiqDistancePct: 3.0 });\n\nconst result = await agent.evaluate({\n  symbol: 'BTCUSDT', exchange: 'bybit',\n  side: 'long', entry_price: 83000, stop_loss: 81000,\n  account_balance: 10000, risk_pct: 1, leverage: 5,\n  funding_rate: 0.0001, hold_hours: 24,\n});\n\nif (result.approved) {\n  // execute trade — result.recommended_size, result.liquidation_price\n} else {\n  console.log('Rejected:', result.rejection_reason);\n}\n\n// Binary gate for execution bots\nconst ok = await agent.isSafe({ symbol: 'ETHUSDT', side: 'short', ... });\n\n// Standalone function (minimal integration)\nconst { approved, size, liqPrice } = await preTradeGate({ ... }, 'tc_your_key');\n```\n\n## TypeScript SDK\n\nFor code-first integrations, use `tradingcalc-sdk` instead of raw JSON-RPC:\n\n```bash\nnpm install tradingcalc-sdk\n```\n\n```typescript\nimport { TradingCalcClient } from 'tradingcalc-sdk';\n\nconst tc = new TradingCalcClient({ apiKey: 'tc_your_key' });\n\n// Workflows — orchestrated decisions\nconst check = await tc.workflows.preTradeCheck({ side: 'long', entry_price: 83000, leverage: 5, funding_rate: 0.0001, account_balance: 5000 });\n\n// Primitives — single formula\nconst avg = await tc.primitives.averageEntry({ symbol: 'BTCUSDT', input: { fills: [{ price: 83000, quantity: 0.1 }] } });\n\n// System\nconst report = await tc.system.verify();\n```\n\n`tc.call()` is available for raw MCP access. Full docs: [npmjs.com/package/tradingcalc-sdk](https://www.npmjs.com/package/tradingcalc-sdk)\n\n## Links\n\n- For agents: [tradingcalc.io/for-agents](https://tradingcalc.io/for-agents)\n- For agents: [tradingcalc.io/for-agents](https://tradingcalc.io/for-agents)\n- Verification proof: [tradingcalc.io/verify](https://tradingcalc.io/verify)\n- Web calculators: [tradingcalc.io](https://tradingcalc.io)\n",
  "bytes": 9369,
  "sha": "9185ea57e5bfce3d372f127c86bbfddf00bbed05b2f6b474989f695719d44a2d",
  "repo_slug": "skalinin909/tradingcalc-mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_skalinin909_tradingcalc_5d169838/readme"
}