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
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。