Trading212 Mcp Server

io.github.KyuRish由 GitHub 帳號 KyuRish 發布v0.1.1更新於 Oct 24, 2026

MCP server for Trading 212 API - portfolio, orders, pies, dividends, and analytics

已驗證STDIO僅桌面金融資料與分析

概覽

AI 產生的概覽

將 AI 助理連接到 Trading 212 券商帳戶,用來檢視投資組合、下單、管理派和分紅分析。

可以做什麼
  • 讀取帳戶資料:帳戶資訊、現金餘額、持倉清單與依代號查詢單一持倉
  • 下單與管理訂單:市價、限價、停損、停損限價單,列出並取消未成交訂單
  • 管理投資派:列出、檢視、建立、更新、複製和刪除派
  • 查詢市場資料:搜尋可交易標的與交易所
  • 檢視歷史:歷史訂單、已發放股利、資金流水與 CSV 匯出申請
  • 執行組合分析:組合總覽、各持倉報酬、股利彙總與近期活動
適用情境
適合以自然語言詢問 Trading 212 帳戶狀況、查看餘額與報酬、分析股利收入,或不必開啟應用程式就能下單與管理投資派。
執行需求
以本機 Python 套件執行(PyPI,透過 uvx 或 pip 啟動)。需要從 Settings > API (Beta) 取得的 Trading 212 API 金鑰與密鑰,分別以 TRADING212_API_KEY 和 TRADING212_API_SECRET 提供,並將 ENVIRONMENT 設為 live 或 demo。需要連線至 Trading 212 API 的網路存取。
安裝前請注意
此伺服器持有可下真實訂單、取消訂單與刪除投資派的券商 API 憑證;熟悉前建議將 ENVIRONMENT 設為 demo 使用虛擬資金。下單與修改派會實際作用於帳戶,助理的請求會傳送給 Trading 212。請勿將 API 金鑰與密鑰寫入共用的設定檔。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Trading212 Mcp Server,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

Trading 212 MCP Server

[PyPI] [Downloads] [License: MIT] [Glama] [Python] [MCP] [Tools]

Connect your AI assistant to your Trading 212 brokerage account. Ask questions about your portfolio, place trades, manage pies, and analyze dividends - all through natural language.

Works with Claude Desktop, Claude Code, ChatGPT, Gemini, Cursor, Windsurf, and any client that supports the Model Context Protocol (MCP).

Why this server?

  • 32 tools covering the full Trading 212 API, plus 4 analytics tools that combine multiple API calls into actionable insights
  • Smart rate limiting - reads T212's rate limit headers, auto-waits, and retries on 429 (up to 3 times). No rate limit errors leak to your AI
  • Zero config - install from PyPI, add your API key, done. No Docker, no database, no Redis
  • Typed responses - every tool returns structured Pydantic models, not raw JSON
  • Paper trading - set ENVIRONMENT=demo to test with virtual money first

What can it do?

CategoryToolsExamples
AnalyticsPortfolio summary, performance, dividends, activity"Show me my portfolio P&L"
TradingMarket, limit, stop, stop-limit orders"Buy 5 shares of AAPL"
PortfolioPositions, cash balance, account info"What's my cash balance?"
PiesCreate, update, duplicate, delete pies"Show my pie allocations"
Market DataInstrument search, exchange schedules"Search for Tesla"
HistoryPast orders, dividends, transactions, CSV exports"Show my dividend history"

Analytics tools

These combine multiple API calls into single high-level responses:

  • fetch_portfolio_summary - Complete snapshot: total value, P&L, cash, top holdings, allocation
  • fetch_portfolio_performance - Per-position returns with dividends, best/worst performers
  • fetch_dividend_summary - Income analysis grouped by ticker and month
  • fetch_recent_activity - Combined timeline of trades and transactions

Quick start

Install

bash
uvx trading212-mcp-server

Or via pip:

bash
pip install trading212-mcp-server

Get your API credentials

From the Trading 212 app: Settings > API (Beta). You need both the API Key and Secret - the server uses Basic Auth.

Connect to Claude Desktop

Add to claude_desktop_config.json (Windows: %APPDATA%\Claude\, Mac: ~/Library/Application Support/Claude/):

json
{  "mcpServers": {    "trading212": {      "command": "uvx",      "args": ["trading212-mcp-server"],      "env": {        "TRADING212_API_KEY": "<your-api-key>",        "TRADING212_API_SECRET": "<your-api-secret>",        "ENVIRONMENT": "live"      }    }  }}

Connect to Claude Code

bash
claude mcp add trading212 -- uvx trading212-mcp-server

Then set the environment variables in your shell or .env file.

Other clients (Cursor, Windsurf, ChatGPT, etc.)

Same command and env vars - configure per your client's MCP docs. Set ENVIRONMENT to demo for paper trading.

From source

bash
git clone https://github.com/KyuRish/trading212-mcp-server.gitcd trading212-mcp-servercp .env.example .env  # fill in your API keysuv syncuv run -m trading212_mcp_server.server
claude_desktop_config.json for source installs
json
{  "mcpServers": {    "trading212": {      "command": "uv",      "args": ["run", "--directory", "<path-to-repo>", "-m", "trading212_mcp_server.server"],      "env": {        "TRADING212_API_KEY": "<your-api-key>",        "TRADING212_API_SECRET": "<your-api-secret>",        "ENVIRONMENT": "live"      }    }  }}

All 32 tools

Analytics (composite)

ToolDescription
fetch_portfolio_summaryComplete portfolio snapshot with P&L and allocations
fetch_portfolio_performancePer-position returns, dividends, best/worst performers
fetch_dividend_summaryDividend income by ticker and month
fetch_recent_activityCombined timeline of trades and transactions

Account

ToolDescription
fetch_account_infoAccount metadata (currency, ID)
fetch_account_cashCash balance, invested value, P&L
fetch_all_open_positionsAll portfolio positions with live prices
search_specific_position_by_tickerSingle position lookup by ticker

Trading

ToolDescription
place_market_orderBuy/sell at current market price
place_limit_orderBuy/sell at specified price or better
place_stop_orderTrigger order at stop price
place_stop_limit_orderStop trigger with limit execution
fetch_all_ordersList all pending orders
fetch_orderGet specific order by ID
cancel_orderCancel a pending order

Pies

ToolDescription
fetch_piesList all investment pies
fetch_a_piePie details with instrument allocations
create_pieCreate a new pie with target weights
update_pieUpdate pie settings and allocations
duplicate_pieClone an existing pie
delete_pieRemove a pie

Market Data

ToolDescription
search_instrumentSearch tradeable instruments by ticker or name
search_exchangeSearch available exchanges

History

ToolDescription
fetch_historical_order_dataPast orders with pagination
fetch_paid_out_dividendsDividend payment history
fetch_transaction_listDeposits and withdrawals
fetch_exports_listList CSV export reports
request_csv_exportRequest a new CSV export

Compatibility

Tested with these MCP clients:

ClientStatus
Claude DesktopSupported
Claude CodeSupported
CursorSupported
WindsurfSupported
Any MCP-compatible clientSupported

Author

Built by Rishabh Dogra.

Support

If this server saves you time, a coffee would mean a lot.

[Buy Me a Coffee]

License

MIT

來源:README.md,提交 850da6b

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.1.1最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分