Get the FREE Ultimate OpenClaw Setup Guide →

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.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
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:

  1. Clone the repository git clone https://github.com/RohanAnandPandit/trading212-mcp-server.git cd trading212-mcp-server

  2. Configure environment

    • Copy example env if available and edit cp .env.example .env

      Set TRADING212_API_KEY and any other required variables

  3. Install Python dependencies (if any) pip install -r requirements.txt

  4. Install and set up uv (if not already installed)

    This command installs the uv tool locally for running MCP servers

    uv install

  5. Build or prepare any required containers or local runtime as needed (optional) docker build -t mcp/trading212-mcp-server . # if using Claude via Docker

  6. Run the MCP server using uv

    From the repository root, using the configuration example:

    uv run --directory <insert path to repo> src/server.py

  7. 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

Sponsor this space

Reach thousands of developers