Trading 212 MCP Server
Trading 212 MCP サーバー
MCP を介した Claude 用の安全な Trading 212 Public API アクセス
使用技術:
プロジェクト概要
このプロジェクトは、Trading 212 Public API の機能を MCP ツールとして公開し、Claude Desktop がアカウント、市場、注文、履歴、およびパイ(Pie)データを安全に照会できるようにします。カスタム UI を構築することなく、自然言語でポートフォリオのワークフローにアクセスしたいユーザーを対象としています。主な価値は、構造化されたエラー、厳格な環境処理、およびツールファーストの MCP 統合を備えた、モジュール式の機能ベースの TypeScript アーキテクチャにあります。
Related MCP server: Trading 212 MCP Server
主な機能
Claude 対応 MCP ツール - MCP を通じて Claude Desktop から直接 Trading 212 の操作を実行できます。
Public API 互換認証 - API キー + API シークレットを使用した Trading 212 の基本認証をサポートします。
パイ(Pie)の完全サポート - 一覧表示、ID による取得、作成、更新、複製、削除の各操作が含まれます。
注文ワークフロー - 未決済注文、注文詳細、指値注文、成行注文、逆指値注文、逆指値指値注文の配置/キャンセルに対応しています。
履歴 + エクスポート操作 - カーソルベースの履歴注文、配当、取引、および CSV エクスポートのリクエスト/一覧取得エンドポイント。
型定義されたエラーモデル - 認証、バリデーション、レート制限、未検出、および API エラーの一貫した処理。
クイックスタートデモ
ローカルで実行し、MCP Inspector を使用してツールを検査します:
npx @modelcontextprotocol/inspectorstdio モードの場合、Inspector コマンドを次のように設定します:
bun run src/server.ts技術スタック
言語: TypeScript (strict モード)
ランタイム: Bun 1.x (Node.js 18+ 互換)
MCP:
@modelcontextprotocol/sdkバリデーション/スキーマ:
zod設定:
dotenvテスト: Bun テストランナー (
bun test src)
インストールとセットアップ
前提条件
Bun 1.0+
Node.js 18+
Trading 212 Public API 認証情報 (
TRADING212_API_KEY,TRADING212_API_SECRET)Claude Desktop (MCP 統合用)
セットアップ
リポジトリのクローン
git clone https://github.com/razeevascx/212mcp.gitプロジェクトディレクトリへ移動
cd 212mcp依存関係のインストール
bun install環境設定
cp .env.example .env.envに認証情報を設定TRADING212_API_KEY=your_api_key_here TRADING212_API_SECRET=your_api_secret_here ENVIRONMENT=live TRANSPORT=stdio LOG_LEVEL=info DEBUG=falseプロジェクトのビルド
bun run buildサーバーの起動
bun run start
検証
ターミナル出力に
Trading 212 MCP Server runningと表示されるはずです。Claude Desktop で MCP ツールを開き、Trading 212 ツールがリストされていることを確認してください。
Claude Desktop の設定
以下の MCP サーバー設定を使用してください:
{
"mcpServers": {
"trading212": {
"command": "/absolute/path/to/212mcp/start.sh"
}
}
}start.sh を作成し、実行権限を付与します:
#!/bin/bash
set -euo pipefail
set -a
source /absolute/path/to/212mcp/.env
set +a
exec bun run /absolute/path/to/212mcp/src/server.tsMCP ツール
アカウント
fetch_account_cashfetch_account_metadata
インストゥルメント
search_exchangesearch_instrument
ポートフォリオ / ポジション
fetch_open_positions(オプションのtickerフィルターあり)
注文
fetch_all_ordersfetch_orderplace_limit_orderplace_market_orderplace_stop_orderplace_stop_limit_ordercancel_order
履歴
fetch_historical_order_datafetch_paid_out_dividendsfetch_transaction_listfetch_exports_listrequest_export_csv
パイ(Pie)
fetch_piesfetch_piecreate_pieupdate_pieduplicate_piedelete_pie
サーバーユーティリティ
get_server_health
API 使用上の注意
認証: Trading 212 Public API は基本認証 (
API_KEY:API_SECRET) を使用し、BaseClientによって処理されます。環境ルーティング:
ENVIRONMENT=demo|liveは Trading 212 のデモ/ライブベース URL にマッピングされます。ページネーション: 履歴エンドポイントは
limit+cursorを使用し、nextPagePathを返します。レート制限: API にはレート制限があり、
429はRATE_LIMIT_EXCEEDEDとして表面化されます。
開発
スクリプト
bun run build— TypeScript のコンパイルbun run start— MCP サーバーの起動bun run dev— ウォッチモードbun test src—src内のテスト実行
トラブルシューティング
認証情報が不足している場合:
TRADING212_API_KEYとTRADING212_API_SECRETを設定してください。認証エラー: API 認証情報を再生成し、サーバーを再起動してください。
Claude が接続できない場合: Bun のインストール、コマンドパス、および Claude MCP 設定を確認してください。
起動時に、サーバーは認証設定を検証し、認証情報が不完全な場合は即座に停止します。
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
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.
Connect brokerage accounts to AI assistants: holdings, orders, asset lookup, and approved trading.
Build and backtest investing strategies from your AI assistant. Remote MCP with OAuth sign-in.
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
- AlicenseAqualityDmaintenanceEnables 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.232MIT
- AlicenseNot gradedqualityBmaintenanceExposes 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
- AlicenseNot gradedqualityDmaintenanceEnables 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
- FlicenseNot gradedqualityCmaintenanceExposes Trading212 account data (summary, portfolio, cash, order history, dividends) as MCP tools, intended for direct connection to Claude.ai.-