trading212
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 via the public beta API.
claude mcp add --transport stdio rohananandpandit-trading212-mcp-server uv run --directory <insert path to repo> src/server.py \ --env TRADING212_API_KEY="<insert api key>"
How to use
This MCP server provides a programmable interface to interact with Trading212 data and actions via the MCP protocol. It exposes tools for managing accounts, portfolios, orders, market data, and historical records, all organized into resource-based endpoints and instrumented for prompt-driven analysis. Use the provided MCP tools to fetch account metadata, monitor cash balances, view and modify pies (portfolio buckets), place and manage equity orders (market, limit, stop, and stop-limit), retrieve historical data, and access market/instrument information. The server also supports data analysis prompts with currency-aware context to help interpret financial information within Trading212 accounts.
To use the server with Claude or another MCP client, you connect the MCP tooling configuration (mcpServers) and provide the necessary environment (such as your API key). The Tools section lists the available endpoints like search_exchange, search_instrument, and all order/portfolio related operations. Ensure you supply your API key and environment (live or demo) as required by Trading212 when generating the API key, and keep credentials secure. Once connected, you can task the agent with actions such as fetching your open positions, placing orders, or analyzing trading data with the Data Analysis prompt to get currency-aware insights.
How to install
Prerequisites:
- Python 3.11 or newer
- Access to the uv tool (required to run MCP servers)
- A Trading212 API key (for live or demo environment)
Install steps:
-
Clone the repository git clone https://github.com/RohanAnandPandit/trading212-mcp-server.git cd trading212-mcp-server
-
Configure environment
- Copy example env if available and edit
cp .env.example .env
Set TRADING212_API_KEY and any other required variables
- Copy example env if available and edit
cp .env.example .env
-
Install Python dependencies (if any) pip install -r requirements.txt
-
Install and set up uv (if not already installed)
This command installs the uv tool locally for running MCP servers
uv install
-
Build or prepare any required containers or local runtime as needed (optional) docker build -t mcp/trading212-mcp-server . # if using Claude via Docker
-
Run the MCP server using uv
From the repository root, using the configuration example:
uv run --directory <insert path to repo> src/server.py
-
Connect via your MCP client
- Use the trading212 mcp_config entry shown in this document to configure the client.
- Provide your TRADING212_API_KEY in the environment or config as required by the client.
Additional notes
Tips and common issues:
- Ensure you have a valid Trading212 API key and set ENVIRONMENT=live or demo in your .env as appropriate.
- If you switch between live and demo, update TRADING212_API_KEY and ENVIRONMENT accordingly in your environment configuration.
- The uv command shown in the example runs the Python server directly from the repository. Ensure you point --directory to the repository root and that src/server.py exists.
- For Claude Desktop integration, you may need to adjust the docker run options to expose your API key securely. Do not hard-code credentials in shared config files.
- If you encounter import or dependency issues, verify your Python version (3.11+), and install dependencies with pip install -r requirements.txt.
- The Tools listed under the README are the MCP endpoints available to the MCP client. Familiarize yourself with fetch_account_cash, fetch_open_positions, place_market_order, and fetch_historical_order_data for common workflows.
Related MCP Servers
web-eval-agent
An MCP server that autonomously evaluates web applications.
mcp-neo4j
Neo4j Labs Model Context Protocol servers
Gitingest
mcp server for gitingest
zotero
Model Context Protocol (MCP) server for the Zotero API, in Python
fhir
FHIR MCP Server – helping you expose any FHIR Server or API as a MCP Server.
unitree-go2
The Unitree Go2 MCP Server is a server built on the MCP that enables users to control the Unitree Go2 robot using natural language commands interpreted by a LLM.