Skip to main content
Glama
joshua-repo

t212-mcp

by joshua-repo

t212-mcp

Trading212 アカウント(サマリー、ポートフォリオ、現金、注文履歴、配当)をツールとして公開する MCP サーバーで、claude.ai にカスタムリモートコネクタとして直接接続することを想定しています。

claude.ai はパブリックインターネット経由でこのサーバーに到達し、T212 アカウントは live であるため、サーバーはツール呼び出しを提供する前に OAuth ログイン(設定した単一のパスワード)を要求します — auth.py を参照してください。

0. VPS にコードを取得し、前提条件をインストールする

git clone <this-repo-url> t212-mcp && cd t212-mcp

VPS には gitrsyncuvシステム全体にインストールされている必要があります(アプリは後で専用のシステムユーザーとしてホームディレクトリなしで実行されるため、自分の $HOME の下だけでは不十分です):

curl -LsSf https://astral.sh/uv/install.sh | sh
sudo cp "$HOME/.local/bin/uv" /usr/local/bin/uv

Related MCP server: Trading212 MCP Server

1. 設定

python3 setup_wizard.py

対話形式で設定を進めます:T212 API キー/シークレット、ドメイン(独自ドメインがない場合は無料の <ip>.sslip.io を提供)、ログインパスワード — その後、chmod 600.env を書き込みます。再実行すると .env を最初から再生成します(上書き前に確認を求められます)。

手動で編集したい場合は? cp .env.example .env を実行して、以下を記入してください:

  • T212_API_KEY / T212_API_SECRET — Trading212 → 設定 → API(キー/シークレットのペア、Basic 認証)から取得。

  • T212_ENVlive または demo

  • MCP_PUBLIC_URL — このサーバーが到達可能になる HTTPS URL(例:https://mcp.example.com、末尾スラッシュなし)。DNS とリバースプロキシ設定と一致する必要があります。

  • MCP_DOMAIN — 上記と同じホスト(スキームなし。Caddy が TLS 証明書を要求するために使用)。

  • MCP_AUTH_PASSWORD — あなただけが知っているパスワード。Claude を接続するときにブラウザで一度入力します。

2. DNS を VPS に向ける

MCP_DOMAIN のドメインに対して、VPS の IP を指す A/AAAA レコードを作成します。ポート 80 と 443 はインターネットから到達可能である必要があります。

以下の TLS リバースプロキシをインストールする前に、このマシンで 80/443 に既に何かがバインドされているか(他のサイトを提供する既存の nginx/Caddy)を確認してください:

sudo ss -tlnp | grep -E ':80|:443'

3. 実行する

sudo useradd --system --no-create-home --shell /usr/sbin/nologin t212mcp
sudo mkdir -p /opt/t212-mcp
sudo rsync -a --exclude .venv --exclude __pycache__ --exclude .git ./ /opt/t212-mcp/
sudo chown -R t212mcp:t212mcp /opt/t212-mcp
cd /opt/t212-mcp
# t212mcp has no home dir, so point uv's cache somewhere it can write:
sudo -u t212mcp env HOME=/opt/t212-mcp UV_CACHE_DIR=/opt/t212-mcp/.cache/uv \
    uv sync --frozen --no-dev

sudo cp deploy/t212-mcp.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now t212-mcp

次に、上記の ss -tlnp の結果に応じて、ポート 8000 の前に TLS を配置します:

  • 80/443 で何も実行されていない — Caddy(単一の静的バイナリ、アイドル時 RAM 約 10〜20MB)をインストールし、deploy/Caddyfile を指すように設定します:

    sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
    curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
    curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
    sudo apt update && sudo apt install -y caddy
    set -a; source .env; set +a
    sudo bash -c "sed 's/{\$MCP_DOMAIN}/'\"$MCP_DOMAIN\"'/' deploy/Caddyfile > /etc/caddy/Caddyfile"
    sudo systemctl reload caddy
  • 他のサイト用に nginx が既に実行されているdeploy/nginx.conf.example/etc/nginx/sites-available/t212-mcp にコピーし、その中の mcp.example.com を実際の $MCP_DOMAIN に置き換え、sites-enabled にシンボリックリンクを作成し、nginx -t && systemctl reload nginx を実行してから、sudo certbot --nginx -d $MCP_DOMAIN を実行します(既存のサーバーブロックには影響しません)。

起動を確認します:

curl https://$MCP_DOMAIN/.well-known/oauth-authorization-server

4. Claude に接続する

claude.ai で:設定 → コネクタ → カスタムコネクタを追加 を選択し、URL として https://<MCP_DOMAIN>/mcp を貼り付けます。Claude はこのサーバーのログインページへのブラウザタブを開きます — MCP_AUTH_PASSWORD を入力 — するとリダイレクトで戻り、接続されます。

ローカル開発

uv run python server.py は、同じ streamable-HTTP + OAuth サーバーをローカルの HOST:PORT(デフォルト 0.0.0.0:8000)で実行します — OAuth プロバイダーが無条件に組み込まれているため、ローカル実行でも MCP_PUBLIC_URLMCP_AUTH_PASSWORD の環境変数が必要です。ローカルのみのテスト(TLS なし、Claude コネクタなし、ツールコードと OAuth フローを curl で試すだけ)には、MCP_PUBLIC_URLhttp://127.0.0.1:8000 に向けてください。

Maintenance

ActivityMaintained
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

  • Brazilian Open Finance MCP — 30+ banks (Itaú, Nubank, etc.) to Claude/Cursor. Read-only.

  • Real SEC, 13F, insider, congress & macro data your AI agent can cite. Hosted MCP, 24 tools.

  • MCP server exposing the Backtest360 engine API as tools for AI agents.

  • SmartMoney77 MCP v0.6.0 — 14 public tools that turn financial questions into exact numbers and citable links. New: historical_investment_return and compare_investments, which compute "what if I had invested" results from real yearly price data. Also compound interest, FIRE number, credit-card payoff, emergency fund, inflation, latte factor, investment fees, cost of waiting, plus discovery/deep-link/share-pack tools for a catalog of calculators in 6 languages (he/en/ar/es/pt/in). Public, no login. Endpoint: https://smartmoney77.com/mcp

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Provides secure access to Trading 212 Public API through MCP, enabling Claude Desktop users to manage portfolios, execute trades, and analyze market data using natural language commands.
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI agents to manage Trading212 brokerage accounts, including portfolio analysis, order placement (demo mode), and investment pie management.
    5
    MIT
  • F
    license
    A
    quality
    D
    maintenance
    An MCP server that wraps the Trading 212 Public API, enabling AI agents to interact with your Trading 212 brokerage account through natural language.
    16
  • 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

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/joshua-repo/t212-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server