Trading 212 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:
Category | Tools |
Analytics | Portfolio summary, performance report, dividend analysis, recent activity |
Trading | Market, limit, stop, and stop-limit orders |
Portfolio | Positions, pies, cash balance |
Market Data | Instrument search, exchange schedules |
History | Past 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, 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
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-serverpip
pip install trading212-mcp-serverFrom source
git clone https://github.com/KyuRish/trading212-mcp-server.git
cd trading212-mcp-server
uv syncAuthentication
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-serverThen 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)
Tool | Description |
| Complete portfolio snapshot with P&L and allocations |
| Per-position returns, dividends, best/worst performers |
| Dividend income by ticker and month |
| Combined timeline of trades and transactions |
Account
Tool | Description |
| Account metadata (currency, ID) |
| Cash balance, invested value, P&L |
| All portfolio positions |
| Single position by ticker |
Trading
Tool | Description |
| Buy/sell at current price |
| Buy/sell at specified price or better |
| Trigger order at stop price |
| Stop trigger with limit execution |
| List pending orders |
| Get specific order by ID |
| Cancel a pending order |
Pies
Tool | Description |
| List all pies |
| Pie details by ID |
| Create a new pie |
| Update pie settings |
| Clone a pie |
| Remove a pie |
Market Data
Tool | Description |
| Search by ticker or name |
| Search exchanges |
History
Tool | Description |
| Past orders with pagination |
| Dividend history |
| Deposits/withdrawals |
| List CSV exports |
| Request 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.serverAuthor
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.
License
MIT