Trading212 MCP Server
MCP server providing data connectivity to the Trading212 trading platform, enabling account management, order handling, portfolio tracking, and market data access via MCP tools and resources.
README
Trading212 MCP Server
Overview
The Trading212 MCP server is a Model Context Protocol server implementation that provides seamless data connectivity to the Trading212 trading platform enabling advanced interaction capabilities.
Star History
<a href="https://www.star-history.com/?repos=RohanAnandPandit%2Ftrading212-mcp-server&type=date&legend=top-left"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=RohanAnandPandit/trading212-mcp-server&type=date&theme=dark&legend=top-left" /> <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=RohanAnandPandit/trading212-mcp-server&type=date&legend=top-left" /> <img alt="Star History Chart" src="https://api.star-history.com/chart?repos=RohanAnandPandit/trading212-mcp-server&type=date&legend=top-left" /> </picture> </a>
Core Features
Trading212 API Integration
- Comprehensive account management:
- Account metadata retrieval
- Cash balance monitoring
- Portfolio management with positions tracking
- Advanced order handling:
- Market orders
- Limit orders
- Stop-limit orders
- Order history and management
- Portfolio management:
- Pies (portfolio buckets) management
- Position tracking and search
- Historical order data with pagination
Market Data Access
- Tradeable instruments information
- Exchange data with working schedules
- Historical trading data access
- Real-time market connectivity
Financial Analysis Tools
- Professional financial analysis capabilities
- Currency-aware data processing
- Comprehensive trading data analysis
- Risk management tools
MCP Protocol Support
- Full MCP protocol implementation
- Resource-based API endpoints
- Tool-based functionality
- Prompt-based analysis capabilities
Technical Requirements
- Python >= 3.11 (as specified in .python-version)
- Pydantic >= 2.11.4
- Hishel
Tools
Instruments Metadata
search_exchange: Fetch exchanges, optionally filtered by name or IDsearch_instrument: Fetch instruments, optionally filtered by ticker or name
Pies
fetch_pies: Fetch all piesduplicate_pie: Duplicate a piecreate_pie: Create a new pieupdate_pie: Update a specific pie by IDdelete_pie: Delete a pie
The Trading 212 Pies API is still operational, but the latest public
api.json marks it as deprecated upstream.
Equity Orders
fetch_all_orders: Fetch all equity ordersplace_limit_order: Place a limit orderplace_market_order: Place a market orderplace_stop_order: Place a stop orderplace_stop_limit_order: Place a stop-limit ordercancel_order: Cancel an existing order by IDfetch_order: Fetch a specific order by ID
Account Data
fetch_account_summary: Fetch account summaryfetch_account_cash: Fetch account cash balancefetch_account_info: Deprecated alias forfetch_account_summary
Personal Portfolio
fetch_positions: Fetch open positions, optionally filtered by tickerfetch_position_by_ticker: Fetch a single open position by tickerfetch_all_open_positions: Fetch all open positionsfetch_open_position_by_ticker: Deprecated alias forfetch_position_by_tickersearch_specific_position_by_ticker: Deprecated alias forfetch_position_by_ticker
Historical items
fetch_historical_order_data: Fetch historical order data with paginationfetch_paid_out_dividends: Fetch historical dividend data with paginationfetch_exports_list: Lists detailed information about all csv account exportsrequest_csv_export: Request a CSV export of the account's orders, dividends and transactions historyfetch_transaction_list: Fetch superficial information about movements to and from your account
Resources
Account Resources
trading212://account/summarytrading212://account/cashtrading212://positionstrading212://positions/{ticker}trading212://account/infodeprecated alias fortrading212://account/summarytrading212://account/portfoliodeprecated alias fortrading212://positionstrading212://account/positionscompatibility alias fortrading212://positionstrading212://account/portfolio/{ticker}deprecated alias fortrading212://positions/{ticker}trading212://account/positions/{ticker}compatibility alias fortrading212://positions/{ticker}
Order Resources
trading212://orderstrading212://orders/{order_id}
Portfolio Resources
trading212://piestrading212://pies/{pie_id}
Market Resources
trading212://instrumentstrading212://exchanges
Reports Resources
trading212://history/exports
Prompts
Data Analysis
analyse_trading212_data: Analyse trading212 data with currency context
The prompt includes:
- Professional financial expertise
- Currency-aware analysis
- Cautious financial advice
- Dynamic currency information from account data
Installation
Clone repository
git clone https://github.com/RohanAnandPandit/trading212-mcp-server.git
Environment Configuration
Copy .env.example to .env and configure:
cp .env.example .env
# Edit .env with your configuration
Using Claude Desktop
Installing via Docker
- Clone the repository and build a local image to be utilized by your Claude desktop client
cd trading212-mcp-server
docker build -t mcp/trading212-mcp-server .
- Change your
claude_desktop_config.jsonto match the following, replacingREPLACE_API_KEYwith your actual key: TRADING212_API_SECRETis optional. If supplied, the server will use the newer Basic auth flow from the current publicapi.json; if omitted, it will continue using the legacy API-key-only header that Trading 212 still exposes for compatibility.
claude_desktop_config.jsonpath
- On MacOS:
~/Library/Application\ Support/Claude/claude_desktop_config.json- On Windows:
%APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"trading212": {
"command": "docker",
"args": [
"run",
"-i",
"-e",
"TRADING212_API_KEY",
"mcp/trading212-mcp-server"
],
"env": {
"TRADING212_API_KEY": "REPLACE_API_KEY",
"TRADING212_API_SECRET": "OPTIONAL_API_SECRET"
}
}
}
}
Using uv
{
"mcpServers": {
"trading212": {
"command": "uv",
"args": [
"run",
"--directory",
"<insert path to repo>",
"src/server.py"
],
"env": {
"TRADING212_API_KEY": "<insert api key>",
"TRADING212_API_SECRET": "<optional api secret>"
}
}
}
}
Generating API credentials
- You can generate the API key from your account settings
- Visit the Trading212 help centre for more information
- If you are using the API key for the "Practice" account in Trading212 then set the
ENVIRONMENTtodemoin.env - Set
ENVIRONMENTtoliveif you are using the API key for real money docs/api.jsonis the canonical checked-in copy of the latest public Trading 212 API schema used for this project
Install packages
uv install
or
pip install -r requirements.txt
Running
After connecting Claude client with the MCP tool via json file and installing the packages, Claude should see the server's mcp tools:
You can run the server yourself via: In trading212-mcp-server repo:
uv run src/server.py
Using MCP Inspector
The mcp[cli] dependency in this project includes the mcp dev command,
which starts your server and launches the MCP Inspector via
@modelcontextprotocol/inspector.
Prerequisites:
- Node.js and
npxinstalled locally - Project dependencies installed with
uvorpip TRADING212_API_KEYconfigured in.env- Optional:
TRADING212_API_SECRETif you want to test the newer Basic auth flow
From the repository root, run:
uv run mcp dev src/server.py
If you are using the repo's virtual environment directly, this works too:
./.venv/bin/mcp dev src/server.py
The inspector command will:
- start the Trading 212 MCP server using this repo's Python environment
- open or print the MCP Inspector session details
- let you call tools and inspect resources interactively before wiring the server into a desktop client
If the inspector fails to start, the most common cause is that npx is not
available on your PATH. Installing Node.js usually resolves that.
Using Python
{
"mcpServers": {
"trading212": {
"command": "<insert path to python>",
"args": [
"<insert path to repo>/src/server.py"
]
}
}
}
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
For support, please:
- Open an issue in the GitHub repository
Documentation
For the Trading212 API documentation, view the Public API docs.
Legal Notice
This is an unofficial implementation of the Trading212 MCP protocol. Always consult official Trading212 documentation and terms of service before using this software.
Credits
- Project maintained by Rohan Pandit
Contributing
- Please read our CONTRIBUTING.md for more information on how to contribute to this project.
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
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
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.