MCP server for Trading 212 - 32 tools for portfolio management, trading, pies, dividends, and analytics. Works with Claude, ChatGPT, Cursor, and any MCP client.
Project description
Trading 212 MCP Server
Connect your AI assistant to your Trading 212 brokerage account. Ask questions about your portfolio, place trades, manage pies, and analyze dividends - all through natural language.
Works with Claude Desktop, Claude Code, ChatGPT, Gemini, Cursor, Windsurf, and any client that supports the Model Context Protocol (MCP).
Why this server?
- 32 tools covering the full Trading 212 API, plus 4 analytics tools that combine multiple API calls into actionable insights
- Smart rate limiting - reads T212's rate limit headers, auto-waits, and retries on 429 (up to 3 times). No rate limit errors leak to your AI
- Zero config - install from PyPI, add your API key, done. No Docker, no database, no Redis
- Typed responses - every tool returns structured Pydantic models, not raw JSON
- Paper trading - set
ENVIRONMENT=demoto test with virtual money first
What can it do?
| Category | Tools | Examples |
|---|---|---|
| Analytics | Portfolio summary, performance, dividends, activity | "Show me my portfolio P&L" |
| Trading | Market, limit, stop, stop-limit orders | "Buy 5 shares of AAPL" |
| Portfolio | Positions, cash balance, account info | "What's my cash balance?" |
| Pies | Create, update, duplicate, delete pies | "Show my pie allocations" |
| Market Data | Instrument search, exchange schedules | "Search for Tesla" |
| History | Past orders, dividends, transactions, CSV exports | "Show my dividend history" |
Analytics tools
These combine multiple API calls into single high-level responses:
fetch_portfolio_summary- Complete snapshot: total value, P&L, cash, top holdings, allocationfetch_portfolio_performance- Per-position returns with dividends, best/worst performersfetch_dividend_summary- Income analysis grouped by ticker and monthfetch_recent_activity- Combined timeline of trades and transactions
Quick start
Install
uvx trading212-mcp-server
Or via pip:
pip install trading212-mcp-server
Get your API credentials
From the Trading 212 app: Settings > API (Beta). You need both the API Key and Secret - the server uses Basic Auth.
Connect to 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"
}
}
}
}
Connect to 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, ChatGPT, etc.)
Same command and env vars - configure per your client's MCP docs. Set ENVIRONMENT to demo for paper trading.
From source
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
claude_desktop_config.json for source installs
{
"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 32 tools
Analytics (composite)
| Tool | Description |
|---|---|
fetch_portfolio_summary |
Complete portfolio snapshot with P&L and allocations |
fetch_portfolio_performance |
Per-position returns, dividends, best/worst performers |
fetch_dividend_summary |
Dividend income by ticker and month |
fetch_recent_activity |
Combined timeline of trades and transactions |
Account
| Tool | Description |
|---|---|
fetch_account_info |
Account metadata (currency, ID) |
fetch_account_cash |
Cash balance, invested value, P&L |
fetch_all_open_positions |
All portfolio positions with live prices |
search_specific_position_by_ticker |
Single position lookup by ticker |
Trading
| Tool | Description |
|---|---|
place_market_order |
Buy/sell at current market price |
place_limit_order |
Buy/sell at specified price or better |
place_stop_order |
Trigger order at stop price |
place_stop_limit_order |
Stop trigger with limit execution |
fetch_all_orders |
List all pending orders |
fetch_order |
Get specific order by ID |
cancel_order |
Cancel a pending order |
Pies
| Tool | Description |
|---|---|
fetch_pies |
List all investment pies |
fetch_a_pie |
Pie details with instrument allocations |
create_pie |
Create a new pie with target weights |
update_pie |
Update pie settings and allocations |
duplicate_pie |
Clone an existing pie |
delete_pie |
Remove a pie |
Market Data
| Tool | Description |
|---|---|
search_instrument |
Search tradeable instruments by ticker or name |
search_exchange |
Search available exchanges |
History
| Tool | Description |
|---|---|
fetch_historical_order_data |
Past orders with pagination |
fetch_paid_out_dividends |
Dividend payment history |
fetch_transaction_list |
Deposits and withdrawals |
fetch_exports_list |
List CSV export reports |
request_csv_export |
Request a new CSV export |
Compatibility
Tested with these MCP clients:
| Client | Status |
|---|---|
| Claude Desktop | Supported |
| Claude Code | Supported |
| Cursor | Supported |
| Windsurf | Supported |
| Any MCP-compatible client | Supported |
Author
Built by Rishabh Dogra.
Support
If this server saves you time, a coffee would mean a lot.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file trading212_mcp_server-0.2.1.tar.gz.
File metadata
- Download URL: trading212_mcp_server-0.2.1.tar.gz
- Upload date:
- Size: 39.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
145eb0da8d7ac25e19c9c6d711efac1bcffd7fb076b114e81a6cabb6d150de87
|
|
| MD5 |
9012fd0953b79a08032ae72ef8c2b83b
|
|
| BLAKE2b-256 |
6c3af08d5f12e33262d348edcc66fb42eb3df5f6231d2f7a36c67a002f86e2d2
|
Provenance
The following attestation bundles were made for trading212_mcp_server-0.2.1.tar.gz:
Publisher:
publish.yml on KyuRish/trading212-mcp-server
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
trading212_mcp_server-0.2.1.tar.gz -
Subject digest:
145eb0da8d7ac25e19c9c6d711efac1bcffd7fb076b114e81a6cabb6d150de87 - Sigstore transparency entry: 1274630164
- Sigstore integration time:
-
Permalink:
KyuRish/trading212-mcp-server@ad42ac946ab98f1e8d6bd4a7f8371c879a1270f1 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/KyuRish
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ad42ac946ab98f1e8d6bd4a7f8371c879a1270f1 -
Trigger Event:
release
-
Statement type:
File details
Details for the file trading212_mcp_server-0.2.1-py3-none-any.whl.
File metadata
- Download URL: trading212_mcp_server-0.2.1-py3-none-any.whl
- Upload date:
- Size: 25.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
780e835e72ad021e5b3babde0d37d1a75ba00466e050c51f550c394028463153
|
|
| MD5 |
4e0b1317396b8277688498e38e869f26
|
|
| BLAKE2b-256 |
aaacce2f3c465e1c430e5baa8b38df88128d17ad4e7874105cd6c703da2770a3
|
Provenance
The following attestation bundles were made for trading212_mcp_server-0.2.1-py3-none-any.whl:
Publisher:
publish.yml on KyuRish/trading212-mcp-server
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
trading212_mcp_server-0.2.1-py3-none-any.whl -
Subject digest:
780e835e72ad021e5b3babde0d37d1a75ba00466e050c51f550c394028463153 - Sigstore transparency entry: 1274630201
- Sigstore integration time:
-
Permalink:
KyuRish/trading212-mcp-server@ad42ac946ab98f1e8d6bd4a7f8371c879a1270f1 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/KyuRish
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ad42ac946ab98f1e8d6bd4a7f8371c879a1270f1 -
Trigger Event:
release
-
Statement type: