MCP Hub
Back to servers

trading212-mcp-server

MCP server for Trading 212 API - portfolio, orders, pies, dividends, and analytics

Registryglama
Forks
1
Updated
Mar 5, 2026

Quick Install

uvx trading212-mcp-server

Trading 212 MCP Server

PyPI License: MIT

mcp-name: io.github.KyuRish/trading212-mcp-server

MCP server for the Trading 212 API. Works with any LLM client that supports MCP - Claude, ChatGPT, Gemini, Cursor, Windsurf, and more.

What can it do?

28 tools covering the full Trading 212 API, plus 4 analytics tools that combine multiple API calls into actionable insights:

CategoryTools
AnalyticsPortfolio summary, performance report, dividend analysis, recent activity
TradingMarket, limit, stop, and stop-limit orders
PortfolioPositions, pies, cash balance
Market DataInstrument search, exchange schedules
HistoryPast orders, dividends, transactions, CSV exports

Analytics tools

These combine multiple API calls into single high-level responses:

  • fetch_portfolio_summary - Complete snapshot: total value, P&L, cash, top holdings, allocation
  • fetch_portfolio_performance - Per-position returns with dividends, best/worst performers
  • fetch_dividend_summary - Income analysis grouped by ticker and month
  • fetch_recent_activity - Combined timeline of trades and transactions

Rate limiting

Built-in rate limiter reads T212's x-ratelimit-remaining and x-ratelimit-reset headers. It auto-waits when a limit is exhausted and retries on 429 (up to 3 times). Composite tools that chain multiple API calls handle this transparently - no 429 errors leak to the caller.

Installation

Quick start (recommended)

uvx trading212-mcp-server

pip

pip install trading212-mcp-server

From source

git clone https://github.com/KyuRish/trading212-mcp-server.git
cd trading212-mcp-server
uv sync

Authentication

Get your API Key and Secret from the Trading 212 app: Settings > API (Beta).

Both are required - the server uses Basic Auth (base64 key:secret).

Connect to your LLM

Claude Desktop

Add to claude_desktop_config.json (Windows: %APPDATA%\Claude\, Mac: ~/Library/Application Support/Claude/):

{
  "mcpServers": {
    "trading212": {
      "command": "uvx",
      "args": ["trading212-mcp-server"],
      "env": {
        "TRADING212_API_KEY": "<your-api-key>",
        "TRADING212_API_SECRET": "<your-api-secret>",
        "ENVIRONMENT": "live"
      }
    }
  }
}

Claude Code

claude mcp add trading212 -- uvx trading212-mcp-server

Then set the environment variables in your shell or .env file.

Other clients (Cursor, Windsurf, etc.)

Same command and env vars - configure per your client's MCP docs.

Set ENVIRONMENT to demo for paper trading.

From source

If running from a cloned repo instead of PyPI:

{
  "mcpServers": {
    "trading212": {
      "command": "uv",
      "args": ["run", "--directory", "<path-to-repo>", "-m", "trading212_mcp_server.server"],
      "env": {
        "TRADING212_API_KEY": "<your-api-key>",
        "TRADING212_API_SECRET": "<your-api-secret>",
        "ENVIRONMENT": "live"
      }
    }
  }
}

All tools

Analytics (composite)

ToolDescription
fetch_portfolio_summaryComplete portfolio snapshot with P&L and allocations
fetch_portfolio_performancePer-position returns, dividends, best/worst performers
fetch_dividend_summaryDividend income by ticker and month
fetch_recent_activityCombined timeline of trades and transactions

Account

ToolDescription
fetch_account_infoAccount metadata (currency, ID)
fetch_account_cashCash balance, invested value, P&L
fetch_all_open_positionsAll portfolio positions
search_specific_position_by_tickerSingle position by ticker

Trading

ToolDescription
place_market_orderBuy/sell at current price
place_limit_orderBuy/sell at specified price or better
place_stop_orderTrigger order at stop price
place_stop_limit_orderStop trigger with limit execution
fetch_all_ordersList pending orders
fetch_orderGet specific order by ID
cancel_orderCancel a pending order

Pies

ToolDescription
fetch_piesList all pies
fetch_a_piePie details by ID
create_pieCreate a new pie
update_pieUpdate pie settings
duplicate_pieClone a pie
delete_pieRemove a pie

Market Data

ToolDescription
search_instrumentSearch by ticker or name
search_exchangeSearch exchanges

History

ToolDescription
fetch_historical_order_dataPast orders with pagination
fetch_paid_out_dividendsDividend history
fetch_transaction_listDeposits/withdrawals
fetch_exports_listList CSV exports
request_csv_exportRequest new CSV export

Development

git clone https://github.com/KyuRish/trading212-mcp-server.git
cd trading212-mcp-server
cp .env.example .env  # fill in your API keys
uv sync
uv run -m trading212_mcp_server.server

Author

Built by Rishabh Dogra.

Support

This took quite some time to build in hopes it would make your life easier. If it did, a coffee would mean a lot.

Buy Me a Coffee

License

MIT

Reviews

No reviews yet

Sign in to write a review