io.github.KyuRish/trading212-mcp-server

平台与服务

by kyurish

面向 Trading 212 API 的 MCP server,支持查看投资组合、下单、管理 pies、股息与分析数据。

什么是 io.github.KyuRish/trading212-mcp-server

面向 Trading 212 API 的 MCP server,支持查看投资组合、下单、管理 pies、股息与分析数据。

README

Trading 212 MCP Server

PyPI Downloads License: MIT Glama Python MCP Tools

<!-- mcp-name: io.github.KyuRish/trading212-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=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.git
cd trading212-mcp-server
cp .env.example .env  # fill in your API keys
uv sync
uv run -m trading212_mcp_server.server
<details> <summary><code>claude_desktop_config.json</code> for source installs</summary>
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"
      }
    }
  }
}
</details>

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

常见问题

io.github.KyuRish/trading212-mcp-server 是什么?

面向 Trading 212 API 的 MCP server,支持查看投资组合、下单、管理 pies、股息与分析数据。

相关 Skills

Slack动图

by anthropics

Universal
热门

面向Slack的动图制作Skill,内置emoji/消息GIF的尺寸、帧率和色彩约束、校验与优化流程,适合把创意或上传图片快速做成可直接发送的Slack动画。

帮你快速做出适配 Slack 的动图,内置约束规则和校验工具,少踩上传与播放坑,做表情包和演示都更省心。

平台与服务
未扫描165.3k

MCP构建

by anthropics

Universal
热门

聚焦高质量 MCP Server 开发,覆盖协议研究、工具设计、错误处理与传输选型,适合用 FastMCP 或 MCP SDK 对接外部 API、封装服务能力。

想让 LLM 稳定调用外部 API,就用 MCP构建:从 Python 到 Node 都有成熟指引,帮你更快做出高质量 MCP 服务器。

平台与服务
未扫描165.3k

接口测试套件

by alirezarezvani

Universal
热门

扫描 Next.js、Express、FastAPI、Django REST 的 API 路由,自动生成覆盖鉴权、参数校验、错误码、分页、上传与限流场景的 Vitest 或 Pytest 测试套件。

帮你把API与集成测试自动化跑顺,减少回归漏测;能力全面,尤其适合复杂接口场景的QA团队。

平台与服务
未扫描23.5k

相关 MCP Server

Slack 消息

编辑精选

by Anthropic

热门

Slack 是让 AI 助手直接读写你的 Slack 频道和消息的 MCP 服务器。

这个服务器解决了团队协作中需要 AI 实时获取 Slack 信息的痛点,特别适合开发团队让 Claude 帮忙汇总频道讨论或发送通知。不过,它目前只是参考实现,文档有限,不建议在生产环境直接使用——更适合开发者学习 MCP 如何集成第三方服务。

平台与服务
89.1k

by netdata

热门

io.github.netdata/mcp-server 是让 AI 助手实时监控服务器指标和日志的 MCP 服务器。

这个工具解决了运维人员需要手动检查系统状态的痛点,最适合 DevOps 团队让 Claude 自动分析性能数据。不过,它依赖 NetData 的现有部署,如果你没用过这个监控平台,得先花时间配置。

平台与服务
79.9k

by d4vinci

热门

Scrapling MCP Server 是专为现代网页设计的智能爬虫工具,支持绕过 Cloudflare 等反爬机制。

这个工具解决了爬取动态网页和反爬网站时的头疼问题,特别适合需要批量采集电商价格或新闻数据的开发者。不过,它依赖外部浏览器引擎,资源消耗较大,不适合轻量级任务。

平台与服务
71.9k

评论