trading212-mcp-server

trading212-mcp-server

MCP server for the Trading 212 API. Provides 28 tools for portfolio management, trading, pies, dividends, market data, and analytics.

Category
访问服务器

README

Trading 212 MCP Server

PyPI License: MIT Glama Python MCP Tools

<!-- mcp-name: io.github.KyuRish/trading212-mcp-server -->

MCP server for the Trading 212 API. Works with any LLM client that supports MCP - Claude, ChatGPT, Gemini, Cursor, Windsurf, and more.

What can it do?

28 tools covering the full Trading 212 API, plus 4 analytics tools that combine multiple API calls into actionable insights:

Category Tools
Analytics Portfolio summary, performance report, dividend analysis, recent activity
Trading Market, limit, stop, and stop-limit orders
Portfolio Positions, pies, cash balance
Market Data Instrument search, exchange schedules
History Past orders, dividends, transactions, CSV exports

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

Rate limiting

Built-in rate limiter reads T212's x-ratelimit-remaining and x-ratelimit-reset headers. It auto-waits when a limit is exhausted and retries on 429 (up to 3 times). Composite tools that chain multiple API calls handle this transparently - no 429 errors leak to the caller.

Installation

Quick start (recommended)

uvx trading212-mcp-server

pip

pip install trading212-mcp-server

From source

git clone https://github.com/KyuRish/trading212-mcp-server.git
cd trading212-mcp-server
uv sync

Authentication

Get your API Key and Secret from the Trading 212 app: Settings > API (Beta).

Both are required - the server uses Basic Auth (base64 key:secret).

Connect to your LLM

Claude Desktop

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

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

Claude Code

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

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

Other clients (Cursor, Windsurf, etc.)

Same command and env vars - configure per your client's MCP docs.

Set ENVIRONMENT to demo for paper trading.

From source

If running from a cloned repo instead of PyPI:

{
  "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 tools

Analytics (composite)

Tool Description
fetch_portfolio_summary Complete portfolio snapshot with P&L and allocations
fetch_portfolio_performance Per-position returns, dividends, best/worst performers
fetch_dividend_summary Dividend income by ticker and month
fetch_recent_activity Combined timeline of trades and transactions

Account

Tool Description
fetch_account_info Account metadata (currency, ID)
fetch_account_cash Cash balance, invested value, P&L
fetch_all_open_positions All portfolio positions
search_specific_position_by_ticker Single position by ticker

Trading

Tool Description
place_market_order Buy/sell at current price
place_limit_order Buy/sell at specified price or better
place_stop_order Trigger order at stop price
place_stop_limit_order Stop trigger with limit execution
fetch_all_orders List pending orders
fetch_order Get specific order by ID
cancel_order Cancel a pending order

Pies

Tool Description
fetch_pies List all pies
fetch_a_pie Pie details by ID
create_pie Create a new pie
update_pie Update pie settings
duplicate_pie Clone a pie
delete_pie Remove a pie

Market Data

Tool Description
search_instrument Search by ticker or name
search_exchange Search exchanges

History

Tool Description
fetch_historical_order_data Past orders with pagination
fetch_paid_out_dividends Dividend history
fetch_transaction_list Deposits/withdrawals
fetch_exports_list List CSV exports
request_csv_export Request new CSV export

Development

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

Author

Built by Rishabh Dogra.

Support

This took quite some time to build in hopes it would make your life easier. If it did, a coffee would mean a lot.

Buy Me a Coffee

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选