Trading 212 MCP Server
Exposes Trading 212 trading account, instruments, orders, history, and pies as MCP tools. Allows placing and canceling real orders (defaults to demo/paper environment).
README
Trading 212 MCP Server
An MCP (Model Context Protocol) server for the Trading 212 Public API, packaged as a Docker container with an SSE transport for hosting on Obot (or any MCP host that speaks SSE).
It exposes the account, instruments, orders, history and pies endpoints as MCP tools.
⚠️ This server can place and cancel real orders. It targets the demo / paper environment by default. Only set
TRADING212_LIVE=trueonce you understand the risk.
Environments
Trading 212 runs two fully separate environments, each with its own credentials:
TRADING212_LIVE |
Base URL | Money |
|---|---|---|
unset / false (default) |
https://demo.trading212.com/api/v0 |
Paper |
true |
https://live.trading212.com/api/v0 |
Real |
Authentication
The Public API uses HTTP Basic auth — Base64("API_KEY:API_SECRET").
Generate the key and secret in the Trading 212 app under Settings > API; the secret
is shown only once.
Configuration
Provide config one of two ways (env vars are the simplest):
Environment variables
| Variable | Required | Description |
|---|---|---|
TRADING212_API_KEY |
yes | API key from the Trading 212 app |
TRADING212_API_SECRET |
yes | API secret (shown once at generation) |
TRADING212_LIVE |
no | true for the live/real-money environment; default uses demo/paper |
SERVER_HOST |
no | Bind host (default 0.0.0.0) |
SERVER_PORT |
no | Bind port (default 8000) |
Config file (Docker volume)
Mount a JSON file at /config/config.json (takes priority over env vars):
{
"api_key": "your-api-key-here",
"api_secret": "your-api-secret-here",
"live": false
}
Running
docker-compose
cp .env.example .env # then edit values
docker compose up --build
docker
docker build -t trading212-mcp .
docker run -p 8000:8000 \
-e TRADING212_API_KEY=... \
-e TRADING212_API_SECRET=... \
-e TRADING212_LIVE=false \
trading212-mcp
The server then exposes:
GET /sse— MCP SSE connection endpoint (point your MCP host here)POST /messages/— MCP message endpoint (used internally by the SSE transport)GET /health— liveness check (reports the active environment)
Deploying to Obot
- Build & push the image (the included GitHub Actions workflow publishes
ghcr.io/nigelvanhattum/trading212-mcp:lateston push tomain). - The Obot catalog entry lives in the
obot-mcp-repositoryrepo astrading212.yaml. - In Obot, add the server and set
TRADING212_API_KEY,TRADING212_API_SECRET, and optionallyTRADING212_LIVE.
Tools
| Module | Tools |
|---|---|
| account | get_account_summary, get_positions |
| instruments | list_instruments, list_exchanges |
| orders | list_orders, get_order, cancel_order, place_market_order, place_limit_order, place_stop_order, place_stop_limit_order |
| history | get_historical_orders, get_dividends, get_transactions, list_exports, request_export |
Order convention: a positive quantity buys, a negative quantity sells (e.g. -10.5).
Orders execute only in the account's main currency.
Development
pip install -e ".[dev]"
pytest
The Docker build runs the test suite as a build stage — a failing test fails the image build.
API reference
- Key concepts: https://docs.trading212.com/api/section/general-information/key-concepts
- Environments: https://docs.trading212.com/api/section/general-information/api-environments
- Full API: https://docs.trading212.com/api
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.