
Trading 212的MCP服务器 - 组合分析,订单管理,馅饼,分红. 与克洛德, ChatGPT, Cursor, Windsurf 合作.
概览
把你的AI助手连接到你的212交易经纪账户 问关于你的投资组合, 放置交易, 管理馅饼, 分析红利 - 全部通过自然语言。 与 . 以及任何支持"模式背景协议"(MCP)的客户端合作. - 涵盖完整的Trading 212 API, 加上4个分析工具, 将多个API的呼声结合成可操作的洞察力 - - 读取 T212 的速率限制头, 自动等待, 并在429上重试(最多3次). 没有速率限制错误泄露到您的 AI - - 从 PyPI 安装, 添加您的 API 密钥, 完成 .
概述(AI 翻译)
把你的AI助手连接到你的212交易经纪账户 问关于你的投资组合, 放置交易, 管理馅饼, 分析红利 - 全部通过自然语言。
与克洛德桌面,克洛德代码,ChatGPT,双子座,光标,Windsurf以及任何支持"模型背景协议"(MCP)的客户端合作.
□ 为什么这个服务器?
- ** 32个工具** 涵盖完整的贸易212 API,外加4个分析工具,将API的多种呼声结合到可操作的见解中
- Smart rate control - 读取 T212 的限速头,自动等待,并在429上重试(最多3次). 没有速率限制错误泄露到你的AI
- 零配置 - 从 PyPI 安装, 添加您的 API 密钥, 完成 。 没有 Docker, 没有数据库, 没有 Redis
- ** Typed 响应** - 每个工具返回结构化的 Pydantic 模型,而不是原始的 JSON
- ** 纸张交易** - 设置
ENVIRONMENT=demo先用虚拟货币测试
□能作么生会.
类 工具 类 例 |------------.
- ** 分析** * 组合摘要、业绩、红利、活动 * * “给我看看我的组合P&L” * * ===============================================================================================================================================================================================================================================================
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
Trading 212 MCP Server
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=demoto test with virtual money first
What can it do?
| Category | Tools | Examples |
|---|---|---|
| Analytics | Portfolio summary, performance, dividends, activity | “Show me my portfolio P&L” |
| Trading | Market, limit, stop, stop-limit orders | “Buy 5 shares of AAPL” |
| Portfolio | Positions, cash balance, account info | “What’s my cash balance?” |
| Pies | Create, update, duplicate, delete pies | “Show my pie allocations” |
| Market Data | Instrument search, exchange schedules | “Search for Tesla” |
| History | Past 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, allocationfetch_portfolio_performance- Per-position returns with dividends, best/worst performersfetch_dividend_summary- Income analysis grouped by ticker and monthfetch_recent_activity- Combined timeline of trades and transactions
Quick start
Install
uvx trading212-mcp-server
Or via pip:
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.
安装
uvx trading212-mcp-server配置
{
"mcpServers": {
"trading212": {
"command": "uvx",
"args": ["trading212-mcp-server"],
"env": {
"TRADING212_API_KEY": "<your-api-key>",
"TRADING212_API_SECRET": "<your-api-secret>",
"ENVIRONMENT": "live"
}
}
}
}