trading212-mcp-server — Claude Code MCP server: setup
Connects Trading 212 to an AI agent for portfolio data, dividends, orders, pies, and analytics through natural-language requests.
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-serverWhat trading212-mcp-server 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.
What it helps with
- 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 for the agent
- Show my portfolio summary with P&L and asset allocation.
- Find my AAPL position and report its current value.
- Use
ENVIRONMENT=demoand create a pie with these target weights.
How to install trading212-mcp-server
Platform CLI
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-serverReplace <…> 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>
Platform CLI
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-serverReplace <…> 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>
Config file
{
"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>
Config file
{
"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>
Platform CLI
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-serverReplace <…> 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>
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about trading212-mcp-server
How do I install trading212-mcp-server in Claude Code?
Run `claude mcp add trading212-mcp-server -e TRADING212_API_KEY=<TRADING212_API_KEY> -e TRADING212_API_SECRET=<TRADING212_API_SECRET> -- uvx trading212-mcp-server`.
What does trading212-mcp-server do?
It gives an MCP client access to Trading 212 portfolio data, orders, pies, dividends, market data, transaction history, and combined analytics.
What credentials does trading212-mcp-server require?
You need both the API Key and Secret from Settings > API (Beta) in the Trading 212 app. Set ENVIRONMENT=demo when you want to test with virtual money.