Skip to main content
Glama
mcp-market-server

mcp-market-server

by AADHITYA369

mcp-market-server

MCP(Model Context Protocol)サーバーは、ライブの暗号市場データとペーパートレーディングエンジンを標準化されたツール呼び出しとして公開します。これにより、あらゆるエージェント(Claude Code、カスタムのマルチエージェントシステム)がBybitに照会し、シミュレーション取引を実行できます。

Tower Research CapitalのAI/MLインターン応募向けに構築:MCP統合、エージェントのツール呼び出し、リスク管理、本番運用スタイルのPythonを実証しています。

アーキテクチャ

┌─────────────┐     MCP stdio      ┌──────────────────┐    REST     ┌─────────┐
│ Claude Code │ ◄───────────────► │  FastMCP Server  │ ─────────►  │  Bybit  │
│   / Agent   │                    │  (tools.py)      │  public API │   v5    │
└─────────────┘                    └────────┬─────────┘             └─────────┘
                                            │
                                   ┌────────▼─────────┐
                                   │  Paper Engine    │
                                   │  SQLite + Risk   │
                                   └──────────────────┘

Related MCP server: KirpyV3 MCP Server

公開ツール

ツール

説明

get_klines

任意のシンボル/時間枠のOHLCVローソク足

get_orderbook

L2オーダーブックのスナップショット

get_ticker

最新価格 / 24時間統計

place_paper_order

成行/指値注文をペーパーエンジンへ送信(リスクガード付き)

cancel_order

未約定のペーパー注文をキャンセル

get_positions

保有ポジション + 未実現損益

get_orders

未約定/約定済みの注文履歴

close_position

ポジションを成行で決済

get_account

現金残高、純資産、実現/未実現損益

リスクガード(ペーパーエンジン)

  • 注文ごとの最大想定元本(risk.max_order_notional_usd)

  • 最大オープンポジション数(risk.max_open_positions)

  • 日次損失停止 — 日次ドローダウンが上限を超えるとトレーディングが無効化されます

  • すべての注文と決定は監査ログテーブルに記録されます

セットアップ

cd mcp-market-server
python -m venv .venv && .venv\Scripts\activate     # Windows
pip install -e ".[dev]"
cp .env.example .env                                # optional overrides
pytest                                              # run tests

Claude Code に登録する

{
  "mcpServers": {
    "market": {
      "command": "python",
      "args": ["-m", "mcp_market_server.server"],
      "cwd": "/absolute/path/to/mcp-market-server"
    }
  }
}

またはCLIで:

claude mcp add market -- python -m mcp_market_server.server

デモプロンプト(登録後)

Fetch the last 100 hourly candles for BTCUSDT and summarize the trend.

Place a paper long of 0.01 BTCUSDT with a 2% stop loss and take profit at 3%.

Show my account, then flatten everything if unrealized PnL is worse than -$50.

設計ノート

  • 公開エンドポイントのみ — APIキー不要、実際のお金は使用しません。ペーパーエンジンは成行注文をライブのティッカー価格で約定し、指値注文は価格が到達したときに約定します。

  • SQLite を使用して注文/ポジション/取引/監査を記録 — 依存関係ゼロの永続化で、クオンツデスクがすべての意思決定を記録する方法を忠実に再現します。

  • リスク層はツールとエンジンの間に配置 — 実際のトレーディングデスクと同じパターンです。戦略が提案し、リスク管理が最終判断を下します。

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables MCP-compatible AI clients to access live crypto market data and AI-driven quantitative analysis, with structured outputs and full observability.
    -
  • A
    license
    B
    quality
    D
    maintenance
    Enables AI agents to trade crypto with paper money, access market data, view leaderboards, and manage trading bots via an MCP-compatible interface.
    16
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    Provides live financial data for any LLM agent, including stock quotes, crypto prices, SEC filings, XBRL financials, FX rates, and macro indicators, through ten MCP tools.
    11
    109 npm
    1
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables AI agents to retrieve real-time cryptocurrency quotes, portfolio state, risk scores (0-100), and timestamped market context through MCP tools, replacing hallucinated prices with verifiable market data.
    MIT