XTBApiServer

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Integrations

  • Enables configuration of the XTB API credentials through a .env file, supporting both demo and live trading account setups.

  • Supports installation via Git repository cloning.

  • Provides the runtime environment for the XTB API server, requiring version 16 or higher for proper operation.

XTBApiサーバー

これは@sharplygroup/xtb-api-jsライブラリを使用してXTB APIを公開するMCPサーバーです。これにより、モデルコンテキストプロトコルを介してXTB取引アカウントとやり取りできるようになります。

前提条件

  • Node.js (バージョン 16 以上)
  • npm
  • XTB取引口座

インストール

  1. このリポジトリをクローンします: git clone [repository_url]
  2. プロジェクトディレクトリに移動します: cd xtb-mcp-server
  3. 依存関係をインストール: npm install

構成

  1. プロジェクト ディレクトリに.envファイルを作成し、XTB API 資格情報を追加します。
DEMO_ACCOUNT=true USER_ID=your_user_id PASSWORD=your_password

注: your_user_idyour_passwordを実際の XTB API 認証情報に置き換えてください。ライブアカウントを使用している場合は、 DEMO_ACCOUNT falseに設定してください。

サーバーの実行

  1. TypeScriptコードをビルドします: npm run build
  2. サーバーを実行します: node build/index.js

MCPクライアントとの接続

MCP Inspector などの任意の MCP クライアントを使用してこのサーバーに接続できます。

  1. MCP インスペクターをグローバルにインストールします: npm install -g @modelcontextprotocol/inspector
  2. サーバーで MCP インスペクターを実行します: npx @modelcontextprotocol/inspector node build/index.js
  3. MCP Inspector UI で、トランスポート タイプとして「stdio」を選択し、「接続」をクリックします。

利用可能なツール

この MCP サーバーでは次のツールが公開されます。

アカウント操作

  • getCurrentUserData : アカウント通貨とアカウントレバレッジに関する情報を返します。
  • getMarginLevel : さまざまなアカウントインジケーターを返します。

計算操作

  • getCommissionDef : 手数料と為替レートの計算を返します。
    • パラメータ: symbol (文字列)、 volume (数値)
  • getMarginTrade : 指定された銘柄と数量の予想マージンを返します。
    • パラメータ: symbol (文字列)、 volume (数値)
  • getProfitCalculation : 指定された取引データの推定利益を計算します。
    • パラメータ: closePrice (数値)、 cmd (数値)、 openPrice (数値)、 symbol (文字列)、 volume (数値)

市場データ運用

  • getCalendar : 市場イベントを含むカレンダーを返します。
  • getChartLastRequest : 開始日から現在の時刻までのチャート情報を返します。
    • パラメータ: info (任意)
  • getChartRangeRequest : 指定された開始日と終了日の間のデータを含むチャート情報を返します。
    • パラメータ: info (任意)
  • getTickPrices : 指定されたシンボルの現在の相場の配列を返します。指定されたタイムスタンプから変更された相場のみが返されます。
    • パラメータ: level (数値)、 symbols (文字列[])、 timestamp (数値)
  • getTradingHours : 相場と取引時間を返します。
    • パラメータ: symbols (文字列[])

ニュースオペレーション

  • getNews : 指定された期間内に送信された取引サーバーからのニュースを返します。
    • パラメータ: end (数値)、 start (数値)

サーバー操作

  • getServerTime : 取引サーバーの現在の時刻を返します。
  • getVersion : 現在の API バージョンを返します。
  • ping : この関数を定期的に呼び出すだけで、システム内のすべてのコンポーネントの内部状態を更新できます。

シンボル操作

  • getAllSymbols : ユーザーが使用できるすべてのシンボルの配列を返します。
  • getSymbol : ユーザーが使用できるシンボルに関する情報を返します。
    • パラメータ: symbol (文字列)

貿易業務

  • getTrades : ユーザーの取引の配列を返します。
    • パラメータ: openedOnly (ブール値)
  • getTradeRecords : orders引数にリストされている取引の配列を返します。
    • パラメータ: orders数(number[])
  • getTradesHistory : 指定された期間内に終了したユーザーの取引の配列を返します。
    • パラメータ: end (数値)、 start (数値)
  • getTradeStatus : 現在のトランザクションステータスを返します。
    • パラメータ: order (数値)

取引業務

  • tradeTransaction : 取引トランザクションを開始します。
    • パラメータ: tradeTransInfo (任意)
  • tradeTransactionStatus : 現在のトランザクションのステータスを返します。
    • パラメータ: order (数値)

コマンド実行

  • executeCommand : サーバー上でコマンドを実行します。
    • パラメータ: command (文字列)

プロンプト

次のプロンプトが利用可能です:

  • getAccountDataPrompt : 現在のアカウントデータを取得します。
  • getSymbolInfoPrompt : 特定のシンボルに関する情報を取得します。
    • パラメータ: symbol (文字列)

免責事項

このMCPサーバーはサンプルとして提供されており、自己責任でご利用ください。ライブ取引口座でこのサーバーをご利用になる前に、XTB APIとそれに伴う潜在的なリスクについて十分にご理解ください。

-
security - not tested
F
license - not found
-
quality - not tested

XTB 取引 API を公開する MCP サーバー。ユーザーはモデル コンテキスト プロトコルを通じて XTB 取引アカウントと対話し、アカウント管理、市場データの取得、取引の実行などの操作を実行できます。

  1. Prerequisites
    1. Installation
      1. Configuration
        1. Running the Server
          1. Connecting with an MCP Client
            1. Available Tools
              1. Account Operations
              2. Calculation Operations
              3. Market Data Operations
              4. News Operations
              5. Server Operations
              6. Symbol Operations
              7. Trade Operations
              8. Trading Operations
              9. Command Execution
            2. Prompts
              1. Disclaimer
                ID: 4pw9haj5up