Trading 212 Controlled MCP
This server provides read-only access to Trading 212 account data plus a controlled, two-step process for live market orders and pending-order cancellations.
Retrieve account summary and cash information.
List open positions, optionally filtered by exact ticker.
Build a calculated portfolio view from open positions.
List pending orders, historical orders, transactions, and dividends.
Use cursor pagination and optional filters (limit, cursor, time, ticker) for historical data.
Preview a real market buy/sell order, then execute it only after direct user confirmation with a single-use, five-minute confirmation token.
Preview cancellation of a pending order by ID, then execute it after direct user confirmation.
Does not support transfers, withdrawals, Pie management, exports, or limit/stop/stop-limit orders.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Trading 212 Controlled MCP What's my current portfolio value?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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_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
In this folder, copy
.env.exampleto.env.Set
TRADING212_API_KEYandTRADING212_API_SECRETlocally. Do not paste them into chat, source code, or any committed file.Keep
TRADING212_ENVIRONMENT=demofor an initial verification. Useliveonly to read the live Invest/Stocks ISA account supported by Trading 212's public API.Install dependencies with
npm install, then runnpm testandnpm start.Add or install this folder as a local Codex plugin/MCP server. Its
.mcp.jsonstartssrc/server.jsover standard input/output. Configure credentials in the MCP host environment if it does not load the local.envfile.
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
.mcpbbundle 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 withnpm run build:claude.Claude Desktop (manual): alternatively, adapt
claude-desktop-config.example.jsonwith this repository's absolute path.Codex: install the local plugin or configure
mcp.json. The portableplugin.jsonandmcp.jsonare at the repository root;.codex-plugin/plugin.jsonremains 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
Authentication is HTTP Basic authentication using API key as username and API secret as password. The server creates this header in memory and never logs it.
Trading 212 documents cursor pagination for historical orders, dividends, and transactions. Use the returned
nextPagePathto obtain the next cursor; the MCP tools accept a cursor, not a custom URL.Historical list calls accept at most 50 items. Some endpoints have rate limits, so avoid bulk repeated calls.
This project uses the official current documentation: https://docs.trading212.com/api/accounts/getaccountsummary, https://docs.trading212.com/api/positions, https://docs.trading212.com/api/historical-events/transactions, and https://docs.trading212.com/api/section/authentication/building-the-authorization-header.
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 toolsexecute_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
Scored across 11 tools
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.
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.
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.
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
Related MCP Connectors
Connect brokerage accounts to AI assistants: holdings, orders, asset lookup, and approved trading.
Ask your AI about your own accounts, debts, budgets and goals. OAuth sign-in, read-only by default.
Read-only access to your own bank, card and brokerage accounts for Claude, ChatGPT and other AI agents: balances, transactions, spending, subscriptions, cashflow and investment holdings. It can never move money.
Unified financial infrastructure connecting AI agents directly to trade live/demo brokerage accounts, Web3 non-custodial wallets, real-time market data across equities, ETFs, crypto, forex, options, DeFi swaps, and prediction markets, institutional research feeds, and algorithmic strategy backtesters.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables 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.232MIT
- FlicenseNot gradedqualityDmaintenanceProvides 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.-
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to manage Trading212 brokerage accounts, including portfolio analysis, order placement (demo mode), and investment pie management.5MIT
- AlicenseNot gradedqualityCmaintenanceProvides read-only access to Trading 212 accounts, enabling AI assistants to retrieve portfolio positions, account summaries, instrument data, and transaction history.32 npm5MIT