# trading212-mcp-server

Connects Trading 212 to an AI agent for portfolio data, dividends, orders, pies, and analytics through natural-language requests.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 10
- Author: KyuRish
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/KyuRish/trading212-mcp-server
- Updated: 2026-08-20
- HTML: https://affpapa.org/en/nevibecode/mcp/trading212-mcp-server

## What it does

This server connects a Trading 212 brokerage account to an MCP client. The agent can inspect cash, positions, account details, pending and historical orders, dividends, transactions, pies, tradable instruments, and exchanges. It can also place or cancel orders through the available Trading 212 API tools.

Four analytics tools combine several API calls into portfolio summaries, position performance, dividend income, and recent activity views. Responses use typed Pydantic models, while rate-limit headers are handled with automatic waits and retries after 429 responses, up to 3 times. The server needs both `TRADING212_API_KEY` and `TRADING212_API_SECRET` before it can access the account.

Install it with `uvx` or `pip`. Set `ENVIRONMENT=demo` to use paper trading with virtual money, or `live` for the live environment. Supported clients include Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, and Gemini CLI.

## Requirements
- Needs: Python and uv (commands run via uvx)
- Environment variables: `TRADING212_API_KEY`, `TRADING212_API_SECRET`, `ENVIRONMENT` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add --env TRADING212_API_KEY=<TRADING212_API_KEY> --env TRADING212_API_SECRET=<TRADING212_API_SECRET> --env ENVIRONMENT=<ENVIRONMENT> --transport stdio trading212-mcp-server -- uvx trading212-mcp-server
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from trading212-mcp-server <command>

### Codex

**Platform CLI**
```bash
codex mcp add trading212-mcp-server --env TRADING212_API_KEY=<TRADING212_API_KEY> --env TRADING212_API_SECRET=<TRADING212_API_SECRET> --env ENVIRONMENT=<ENVIRONMENT> -- uvx trading212-mcp-server
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from trading212-mcp-server <command>

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "trading212-mcp-server": {
            "command": "uvx",
            "args": [
                "trading212-mcp-server"
            ],
            "env": {
                "TRADING212_API_KEY": "<TRADING212_API_KEY>",
                "TRADING212_API_SECRET": "<TRADING212_API_SECRET>",
                "ENVIRONMENT": "<ENVIRONMENT>"
            }
        }
    }
}
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from trading212-mcp-server <command>

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "trading212-mcp-server": {
            "type": "stdio",
            "command": "uvx",
            "args": [
                "trading212-mcp-server"
            ],
            "env": {
                "TRADING212_API_KEY": "<TRADING212_API_KEY>",
                "TRADING212_API_SECRET": "<TRADING212_API_SECRET>",
                "ENVIRONMENT": "<ENVIRONMENT>"
            }
        }
    }
}
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from trading212-mcp-server <command>

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e TRADING212_API_KEY=<TRADING212_API_KEY> -e TRADING212_API_SECRET=<TRADING212_API_SECRET> -e ENVIRONMENT=<ENVIRONMENT> trading212-mcp-server uvx trading212-mcp-server
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from trading212-mcp-server <command>

## When to use it
- inspect portfolio value and P&L
- look up a position by ticker
- place or cancel a trading order
- break down dividend income by ticker and month
- create and update investment pies

## Example prompts
- Show my portfolio summary with P&L and asset allocation.
- Find my AAPL position and report its current value.
- Use `ENVIRONMENT=demo` and create a pie with these target weights.

## Similar
- [kanchi-dividend-review-monitor](https://affpapa.org/en/nevibecode/skills/kanchi-dividend-review-monitor.md) — skill · 3200 installs
- [pp-yahoo-finance](https://affpapa.org/en/nevibecode/skills/pp-yahoo-finance.md) — skill · 648 installs
- [kanchi-dividend-us-tax-accounting](https://affpapa.org/en/nevibecode/skills/kanchi-dividend-us-tax-accounting.md) — skill · 3300 installs
- [okx-cex-portfolio](https://affpapa.org/en/nevibecode/skills/okx-cex-portfolio.md) — skill · 10100 installs
- [longbridge-portfolio](https://affpapa.org/en/nevibecode/skills/longbridge-portfolio.md) — skill · 3900 installs
- [trader-portfolio](https://affpapa.org/en/nevibecode/skills/trader-portfolio.md) — skill · 741 installs

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
