Skip to main content
Glama
Trading 212 MCP Server

Trading 212 MCP Server

Trading 212 MCP-Server

Sicherer Zugriff auf die Trading 212 Public API für Claude via MCP

Erstellt mit:

Projektübersicht

Dieses Projekt stellt die Funktionen der Trading 212 Public API als MCP-Tools bereit, sodass Claude Desktop sicher Kontodaten, Marktdaten, Aufträge, Historien und Pie-Daten abfragen kann. Es richtet sich an Benutzer, die einen natürlichsprachlichen Zugriff auf ihre Portfolio-Workflows wünschen, ohne eine eigene Benutzeroberfläche entwickeln zu müssen. Der Hauptvorteil liegt in einer modularen, funktionsbasierten TypeScript-Architektur mit strukturierten Fehlermeldungen, strikter Umgebungskonfiguration und einer Tool-zentrierten MCP-Integration.

Related MCP server: Trading 212 MCP Server

Hauptfunktionen

  • Claude-fähige MCP-Tools – Nutzen Sie Trading 212-Operationen direkt aus Claude Desktop über MCP.

  • Public API-kompatible Authentifizierung – Unterstützt Trading 212 Basic Auth mit API-Key + API-Secret.

  • Vollständige Pie-Abdeckung – Beinhaltet Operationen zum Auflisten, Abrufen nach ID, Erstellen, Aktualisieren, Duplizieren und Löschen von Pies.

  • Auftrags-Workflows enthalten – Ausstehende Aufträge, Auftragsdetails, Platzieren/Stornieren von Limit-, Markt-, Stop- und Stop-Limit-Aufträgen.

  • Historie + Export-Operationen – Cursor-basierte historische Aufträge, Dividenden, Transaktionen sowie Endpunkte zum Anfordern/Auflisten von CSV-Exporten.

  • Typisiertes Fehlermodell – Konsistente Fehlerbehandlung für Authentifizierung, Validierung, Ratenbegrenzung, "Nicht gefunden"-Fehler und API-Fehler.

Quick Start Demo

Lokal ausführen und dann die Tools mit dem MCP Inspector untersuchen:

npx @modelcontextprotocol/inspector

Für den stdio-Modus konfigurieren Sie den Inspector-Befehl wie folgt:

bun run src/server.ts

Tech-Stack

  • Sprache: TypeScript (Strict Mode)

  • Laufzeitumgebung: Bun 1.x (kompatibel mit Node.js 18+)

  • MCP: @modelcontextprotocol/sdk

  • Validierung/Schema: zod

  • Konfiguration: dotenv

  • Tests: Bun Test-Runner (bun test src)

Installation & Einrichtung

Voraussetzungen

  • Bun 1.0+

  • Node.js 18+

  • Trading 212 Public API-Zugangsdaten (TRADING212_API_KEY, TRADING212_API_SECRET)

  • Claude Desktop (für die MCP-Integration)

Einrichtung

  1. Repository klonen

    git clone https://github.com/razeevascx/212mcp.git
  2. In das Projektverzeichnis navigieren

    cd 212mcp
  3. Abhängigkeiten installieren

    bun install
  4. Umgebung konfigurieren

    cp .env.example .env
  5. Zugangsdaten in .env festlegen

    TRADING212_API_KEY=your_api_key_here
    TRADING212_API_SECRET=your_api_secret_here
    ENVIRONMENT=live
    TRANSPORT=stdio
    LOG_LEVEL=info
    DEBUG=false
  6. Projekt bauen

    bun run build
  7. Server starten

    bun run start

Überprüfung

  • Sie sollten Trading 212 MCP Server running in der Terminalausgabe sehen.

  • Öffnen Sie in Claude Desktop die MCP-Tools und bestätigen Sie, dass die Trading 212-Tools aufgelistet sind.

Claude Desktop-Konfiguration

Verwenden Sie diese MCP-Server-Konfiguration:

{
  "mcpServers": {
    "trading212": {
      "command": "/absolute/path/to/212mcp/start.sh"
    }
  }
}

Erstellen Sie eine start.sh und machen Sie diese ausführbar:

#!/bin/bash
set -euo pipefail
set -a
source /absolute/path/to/212mcp/.env
set +a
exec bun run /absolute/path/to/212mcp/src/server.ts

MCP-Tools

Konten

  • fetch_account_cash

  • fetch_account_metadata

Instrumente

  • search_exchange

  • search_instrument

Portfolio / Positionen

  • fetch_open_positions (optionaler ticker-Filter)

Aufträge

  • fetch_all_orders

  • fetch_order

  • place_limit_order

  • place_market_order

  • place_stop_order

  • place_stop_limit_order

  • cancel_order

Historie

  • fetch_historical_order_data

  • fetch_paid_out_dividends

  • fetch_transaction_list

  • fetch_exports_list

  • request_export_csv

Pies

  • fetch_pies

  • fetch_pie

  • create_pie

  • update_pie

  • duplicate_pie

  • delete_pie

Server-Dienstprogramm

  • get_server_health

Hinweise zur API-Nutzung

  • Authentifizierung: Die Trading 212 Public API verwendet Basic Auth (API_KEY:API_SECRET), was von BaseClient gehandhabt wird.

  • Umgebungs-Routing: ENVIRONMENT=demo|live wird auf die Basis-URLs von Trading 212 (Demo/Live) gemappt.

  • Paginierung: Historien-Endpunkte verwenden limit + cursor und geben nextPagePath zurück.

  • Ratenbegrenzungen: Die API ist ratenbegrenzt; 429 wird als RATE_LIMIT_EXCEEDED ausgegeben.

Entwicklung

Skripte

  • bun run build — TypeScript kompilieren

  • bun run start — MCP-Server starten

  • bun run dev — Watch-Modus

  • bun test src — Tests in src ausführen

Fehlerbehebung

  • Zugangsdaten fehlen: Setzen Sie TRADING212_API_KEY und TRADING212_API_SECRET.

  • Authentifizierungsfehler: Generieren Sie die API-Zugangsdaten neu und starten Sie den Server neu.

  • Claude kann keine Verbindung herstellen: Überprüfen Sie die Bun-Installation, den Befehlspfad und die Claude MCP-Konfiguration.

Beim Start validiert der Server die Authentifizierungskonfiguration und bricht sofort ab, wenn die Zugangsdaten unvollständig sind.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    • Connect Claude, ChatGPT, Codex, Claude Code or another MCP client to your real multi-broker investment portfolio. Fortunest tracks stocks, ETFs and crypto across brokers and exchanges; its MCP server lets your agent read holdings, returns, allocation, risk, trades and tax lots, calculated by Fortunest rather than guessed by the model. Reads run on their own; every change waits for your approval in the Fortunest app, and no tool places an order or moves money. Sign-in is OAuth 2.1 and needs Fortunest Pro (14-day trial, no card). A free demo that needs no account is listed as Fortunest demo.

      https://app.fortunest.ai/mcp
    • Connect brokerage accounts to AI assistants: holdings, orders, asset lookup, and approved trading.

      https://mcp.tradeit.app/mcp
    • Build and backtest investing strategies from your AI assistant. Remote MCP with OAuth sign-in.

      https://tactfolio.com/mcp
    • OpenFinance gives any AI agent easy trading across every major market through one hosted MCP server. Trade crypto spot and perpetuals on Hyperliquid with market, limit and TWAP orders, leverage and margin control. Trade stocks, indices, commodities, forex and pre-IPO names as Hyperliquid HIP-3 perps. Trade Polymarket prediction markets with odds, order books, positions, PnL and trader leaderboards. Swap and bridge across 40+ EVM chains and Solana with Relay and Jupiter, find memecoins across 200+ chains, launch tokens on Robinhood Chain and Solana, and buy crypto with card, bank or UPI. Write actions are designed to ask for your confirmation first. Connect with OAuth (sign in to OpenFinance and approve) or an API key. Works with Claude, ChatGPT, Cursor, VS Code, Codex and any MCP client. No install. Home: https://openfinance.tech/agents · Docs: https://docs.openfinance.tech · GitHub: https://github.com/openfinance-tech/mcp

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables AI assistants to interact with Trading 212 investment accounts for portfolio tracking, account management, and real-time order execution. It supports managing investment pies, analyzing historical data, and monitoring market performance across multiple instrument types.
      23
      2
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Exposes Trading 212 trading account, instruments, orders, history, and pies as MCP tools. Allows placing and canceling real orders (defaults to demo/paper environment).
      Apache 2.0
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to read a Trading 212 portfolio (balances, positions, orders, history) and place trades via the public API, supporting both demo and live environments.
      MIT
    • F
      license
      Not graded
      quality
      C
      maintenance
      Exposes Trading212 account data (summary, portfolio, cash, order history, dividends) as MCP tools, intended for direct connection to Claude.ai.
      -