Trading212 MCP Server

by lukeplausin

372 downloads
Not rated
GitHub

About

A Model Context Protocol (MCP) connector tool for interfacing agentic AI with the Trading212 broker

Details

Author
lukeplausin
Downloads
372
Categories
Other

- Caches API results in‑memory (default 5‑minute TTL) or optionally via Redis.
- Resources to view portfolio, account info, cash, and instrument data.
- Tools to place orders (practice mode only), update investment pies, and search instruments.
- Supports STDIO and SSE transport modes.
- Can run locally or as a remote HTTP service.

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Trading212 MCP Server
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Install via uv or Docker and configure it in claude_desktop_config.json by specifying the Trading212 API key and environment (demo or live). For remote hosting, the server can run in SSE mode behind a reverse proxy. Example configuration uses uv run with --api-key and --environment flags, or the Docker image can be built and run.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "trading212 mcp server": {
            "mcp-server-trading212": {
                "command": "uv",
                "args": [
                    "--directory",
                    "path/to/project",
                    "run",
                    "--api-key",
                    "<KEEP_THIS_SECRET>",
                    "--environment",
                    "demo",
                    "mcp-server-trading212",
                    "--host",
                    "127.0.0.1",
                    "--port",
                    "6677",
                    "--sse"
                ]
            }
        }
    }
}

McpServers

{
    "mcp-server-trading212": {
        "command": "uv",
        "args": [
            "--directory",
            "path/to/project",
            "run",
            "--api-key",
            "<KEEP_THIS_SECRET>",
            "--environment",
            "demo",
            "mcp-server-trading212",
            "--host",
            "127.0.0.1",
            "--port",
            "6677",
            "--sse"
        ]
    }
}

Trading212 MCP Server

<div style="color: #856404; background-color: #fff3cd; border-left: 4px solid #ffeeba; padding: 10px;">
⚠️ Warning: Putting an AI in charge of your stock broker is inherently risky. Do not use this connector unless you have considered the risks and put appropriate controls in place to manage those risks.

By using this connector you agree to the terms of the MIT license, which includes indemnity from any financial losses resulting from it's use.

You should test the connector using "demo" mode before deploying to your live account.

Use at your own risk
</div>

Overview

The purpose of this MCP tool is to allow you to connect agentic AI to your Trading212 brokerage account. This will allow you to perform actions such as the following:

- Allow an AI to analyse and critique your portfolio
- Get the AI to suggest some stocks and order them on your behalf (due to a restriction in the Trading212 API, orders can only be created in practice mode currently)
- Allow the AI to manage/update a Trading212 investment pie on your behalf
- Allow the AI to create a Trading212 investment pie on your behalf (coming soon)

Due to aggressive API rate limits imposed by the Trading212 API, this tool will attempt to cache API results in-memory (the default TTL is 5 minutes).

If you deploy a local Redis server on port 6379 the tool will use it instead of the in-memory cache.

Security tips

- If you are hosting the tool server remotely and connecting over the internet, make sure you deploy a reverse proxy with HTTPS, and ideally with Mutual TLS verification.
- You should avoid saving your Trading212 API key in plaintext. Try using an automated secret manager like keyring or 1password
- Always test the connector on the demo account before connecting to your real account

Components

Resources

The server exposes some dynamic resources: - trading212://equity/portfolio: My Portfolio - All assets within your trading portfolio - trading212://equity/account/info - My Account Info - Information about your trading account - trading212://equity/account/cash - My Cash - Information about cash available in my trading account - trading212://equity/metadata/instruments/all - Traded instrument information - Information about all instruments (warning: returns a lot of data and will probably overflow the context window) - trading212://equity/metadata/instruments/list - Returns the list of traded instrument tickers - trading212://equity/metadata/instruments/{ticker} - Returns detailed information about a specific ticker

Prompts

There are currently no prompts

Tools

The server offers these tools:

Order management

- place_order
- Place an active order via Trading212. Will dynamically select the correct order type based on inputs.
- Input:
- ticker (string): The ticker of the stock to order
- quantity (float): The amount to buy or sell
- stopPrice (float): The stop price (if appropriate)
- limitPrice (float): The limit price (if appropriate)
- validDuration (string): The duration of the order (DAY / GTC)
- Returns: Data object from the Trading212 API

- cancel_order (coming soon)
- Cancel an order via Trading212
- Input:
- ticker (string): The ticker of the order
- Returns: Data object from the Trading212 API

- create_pie (coming soon)
- Create a "pie" in Trading212
- Input:
- dividendCashAction (str): What to do with dividends
- endDate (str): When the pie goal ends
- goal (int): Saving goal for the pie
- icon (str): What icon to use for the pie
- instrumentShares (dict[str, float]): Mapping of ticker names to share allocations.
- name (str): A name for the pie
- Returns: Data object from the Trading212 API

- update_pie
- Update a "pie" in Trading212
- Input:
- dividendCashAction (str): What to do with dividends
- endDate (str): When the pie goal ends
- goal (int): Saving goal for the pie
- icon (str): What icon to use for the pie
- instrumentShares (dict[str, float]): Mapping of ticker names to share allocations.
- name (str): A name for the pie
- Returns: Data object from the Trading212 API

Account data

- get_account_info
- Get the account ID and currency
- Returns: Data about the account

- get_portfolio
- Get the list of equities currently held in the account
- Returns: Portfolio data

- get_account_cash
- Get the currently available cash in the account
- Returns: Data about balance

Market data

- get_all_instruments
- Get the list of all instruments in the account (warning: returns a lot of data)
- Returns: Full data about all equities

- get_instrument_list
- Get the list of tickers available in the account
- Returns: Full list of stock tickers available in this account

- get_instrument
- Get full information about a single traded instrument, by ticker
- Input:
- ticker (string): The ticker of interest
- Returns: Full information about the traded instrument

- search_instruments
- Search all instruments by name, using a partial fuzzy search term
- Input:
- search_term (string): The term to search by (usually a company name)
- threshold (int): Minimum fuzzy search score to appear in results 0-100, default: 70
- limit (int): Maximum number of results to return, default: 15
- Returns: Full information about matching instruments

Usage with Claude Desktop

uv

```bash

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.