Skip to main content
Glama
Trading 212 Controlled MCP

Trading 212 Controlled MCP

Trading 212 Controlled MCP

An open-source MCP server for Trading 212 account access. It supports Codex and Claude Desktop locally today, with a portable Agent Plugins manifest for future broader distribution. It exposes portfolio tools plus a controlled, two-step process for live Market orders and pending-order cancellations.

It cannot transfer money, withdraw money, manage Pies, generate exports, or create limit, stop, or stop-limit orders.

This project is not affiliated with or endorsed by Trading 212, Anthropic, or OpenAI. It is software tooling, not investment advice.

Included tools

Tool

Trading 212 source

get_account_summary, get_cash

GET /api/v0/equity/account/summary

get_positions, get_portfolio

GET /api/v0/equity/positions

get_pending_orders

GET /api/v0/equity/orders

get_historical_orders

GET /api/v0/equity/history/orders

get_transactions

GET /api/v0/equity/history/transactions

get_dividends

GET /api/v0/equity/history/dividends

preview_market_order → execute_confirmed_action

POST /api/v0/equity/orders/market after a five-minute, single-use confirmation

preview_order_cancellation → execute_confirmed_action

DELETE /api/v0/equity/orders/{id} after a five-minute, single-use confirmation

get_portfolio is a calculated view over positions because the current Trading 212 documentation exposes open positions rather than the older portfolio endpoint.

Related MCP server: Trading 212 MCP Server

Secure setup

  1. In this folder, copy .env.example to .env.

  2. Set TRADING212_API_KEY and TRADING212_API_SECRET locally. Do not paste them into chat, source code, or any committed file.

  3. Keep TRADING212_ENVIRONMENT=demo for an initial verification. Use live only to read the live Invest/Stocks ISA account supported by Trading 212's public API.

  4. Install dependencies with npm install, then run npm test and npm start.

  5. Add or install this folder as a local Codex plugin/MCP server. Its .mcp.json starts src/server.js over standard input/output. Configure credentials in the MCP host environment if it does not load the local .env file.

For extra protection, restrict the API key to the machine/server IP in Trading 212 if your account settings offer that control. Revoke and recreate the key if it is ever disclosed.

Use with Claude and Codex

After cloning the repository, run npm install, copy .env.example to .env, and add your own Trading 212 credentials locally. Never commit .env.

  • Claude Desktop (one click): download the .mcpb bundle from a GitHub Actions artifact or release, then open it with Claude Desktop and select Install. Claude will prompt for your Trading 212 API key and secret and stores them in the operating system's secure credential store. Build it locally with npm run build:claude.

  • Claude Desktop (manual): alternatively, adapt claude-desktop-config.example.json with this repository's absolute path.

  • Codex: install the local plugin or configure mcp.json. The portable plugin.json and mcp.json are at the repository root; .codex-plugin/plugin.json remains as a Codex compatibility manifest.

Public ChatGPT and Claude connector

GitHub distribution supports local installation, but it is not a public connector by itself. A public ChatGPT or Claude connector needs a hosted Streamable HTTP MCP service that securely stores each user's own credentials and authorizes each request. See the public-hosting plan before attempting deployment.

Public-distribution documents: privacy policy, terms of use, financial-risk disclaimer, and support.

API and data notes

Security model

  • No credentials are stored in the skill, plugin manifest, source, tests, or example environment file.

  • The client blocks every path outside the read-only allowlist before making a network request and always uses GET.

  • Errors truncate upstream response text and never include authorization headers.

  • The process communicates over MCP stdio; do not expose it as a public HTTP service without an authenticated proxy and secret manager.

  • A market order must be previewed before it can be submitted. Its confirmation token expires after five minutes, is consumed before submission, and is never retried because Trading 212 states that Market order requests are not idempotent.

  • For live accounts, Trading 212 currently documents Market orders as the supported API execution type. The tool supports positive quantities for buys and negative quantities for sells.

Available Tools

11 tools
execute_confirmed_actionA

Execute exactly one previously previewed market order or pending-order cancellation. Call only after the user directly confirms the exact preview. The confirmation token is single-use and expires after five minutes; executions are never retried automatically.

Inputs: confirmation (required), confirmationToken (required).

get_account_summaryB

Retrieve the current account summary. Read-only.

Inputs: no named parameters.

get_cashA

Retrieve account summary for cash information only. Read-only; no transfers or withdrawals.

Inputs: no named parameters.

get_dividendsA

List paid dividends with cursor pagination and optional ticker filter. Read-only.

Inputs: limit, cursor, ticker.

get_historical_ordersA

List completed/cancelled historical orders with cursor pagination. Read-only.

Inputs: limit, cursor.

get_pending_ordersA

List currently pending orders. Read-only.

Inputs: no named parameters.

get_portfolioA

Build a current portfolio view with market values and allocation from open positions. Read-only.

Inputs: no named parameters.

get_positionsA

List open positions, optionally for one exact Trading 212 ticker. Read-only.

Inputs: ticker.

get_transactionsA

List account cash movements with cursor pagination, optionally from an ISO-8601 time. Read-only.

Inputs: time, limit, cursor.

preview_market_orderA

Create a five-minute preview for a real buy or sell Market order. It does not place an order. Present every detail and wait for the user to directly confirm before calling execute_confirmed_action.

Inputs: ticker (required), quantity (required), extendedHours.

preview_order_cancellationA

Check a pending order and create a five-minute cancellation preview. It does not cancel anything. Present the order details and wait for direct user confirmation before calling execute_confirmed_action.

Inputs: orderId (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 11 tools

    Disambiguation3/5

    Most tools are clearly distinct, but there is overlap between get_cash and get_account_summary, and between get_positions and get_portfolio since both concern position/account data. The descriptions help clarify intent, but an agent could still select the wrong getter without deeper inspection.

    Naming Consistency5/5

    All tools follow a consistent get_/preview_/execute_ prefix pattern with clear object/action naming. There is no mixing of casing, verb styles, or vague generic names.

    Tool Count5/5

    11 tools is well within the ideal range for a trading account server. Each tool serves a distinct read or controlled-action role, and there is no obvious bloat or unnecessary duplication.

    Completeness4/5

    The read surface is thorough, covering cash, positions, portfolio, orders, transactions, dividends, and account summary. The action surface supports market order previews, cancellation previews, and confirmed execution; missing limit/stop order types and order modification are minor given the apparent controlled scope.

    Maintenance

    ActivityStale
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables AI assistants to interact with Trading 212 investment accounts for portfolio tracking, account management, and real-time order execution. It supports managing investment pies, analyzing historical data, and monitoring market performance across multiple instrument types.
      23
      2
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Provides secure access to Trading 212 Public API through MCP, enabling Claude Desktop users to manage portfolios, execute trades, and analyze market data using natural language commands.
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to manage Trading212 brokerage accounts, including portfolio analysis, order placement (demo mode), and investment pie management.
      5
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Provides read-only access to Trading 212 accounts, enabling AI assistants to retrieve portfolio positions, account summaries, instrument data, and transaction history.
      32 npm
      5
      MIT