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 分