Skip to main content
Glama
rohith1125

sentinel

by rohith1125

Sentinel Execution MCP

CI License: MIT

本番グレードのアルゴリズム取引コントロールプレーンをMCPサーバーとして公開 — Claudeが自然言語でウォッチリストの管理、マーケットレジームの分類、リスク検証、ペーパー注文の提出を行えるようにします。


概要

Sentinelは2つのパッケージからなるモノレポです:

パッケージ

言語

役割

packages/engine

Python 3.12 / FastAPI

すべての取引ロジック: リスクチェック、レジーム分類、注文ライフサイクル、監査ジャーナル、戦略ガバナンス

packages/mcp

TypeScript / Node 20

40以上のツールをHTTP経由でエンジンにルーティングする軽量MCPサーバー。取引ロジックは一切ここにはありません。

Claude(またはMCP互換のエージェント)はMCPサーバーと通信します。MCPサーバーはエンジンと通信します。エンジンがデータベースとキャッシュを所有します。


Related MCP server: Alpaca MCP Server

アーキテクチャ

  Claude Desktop (or any MCP agent)
           │
           │  MCP protocol (stdio or SSE)
           ▼
  ┌─────────────────────────┐
  │   MCP Server            │  TypeScript · Zod validation · tool routing
  │   (packages/mcp)        │
  └────────────┬────────────┘
               │  HTTP REST (localhost:8100)
               ▼
  ┌─────────────────────────┐
  │   Engine API            │  Python · FastAPI · all trading logic
  │   (packages/engine)     │
  └──────────┬──────────────┘
             │
     ┌───────┴────────┐
     ▼                ▼
 PostgreSQL          Redis
 (orders,           (kill switch,
  positions,         rate limits,
  strategies,        cache)
  audit log)

エンジンが利用できない場合、すべてのMCPツール呼び出しは即座にエラーを返します。フォールバックや部分実行はありません。


クイックスタート(Docker — 推奨)

最速で起動する方法です。DockerNode.js 20+が必要です。

# 1. Clone and configure
git clone https://github.com/rohith1125/sentinel-execution-mcp.git
cd sentinel-execution-mcp
cp .env.example .env          # defaults work out of the box — no edits needed

# 2. Start Postgres + Redis + engine (runs migrations automatically)
docker compose -f docker/docker-compose.yml up -d db redis engine

# Wait ~10 seconds, then verify the engine is healthy:
curl http://localhost:8100/health
# {"status": "ok", "provider": "mock", ...}

# 3. Build the MCP server (one-time)
cd packages/mcp
npm install
npm run build

次に、SentinelをClaude Desktopに追加し(下記のClaude Desktopに接続を参照)、Claudeを再起動します。これで完了です — 40のツールがすべて有効になります。


手動セットアップ(Dockerなし)

PostgresとRedisがすでにローカルで稼働している場合に使用します。

前提条件:

依存関係

最小バージョン

備考

Python

3.12

エンジンのランタイム — python3 --versionで確認

Node.js

20

MCPサーバーのランタイム

PostgreSQL

15+

プライマリデータストア

Redis

7+

キルスイッチとキャッシュ

1. クローンと設定

git clone https://github.com/rohith1125/sentinel-execution-mcp.git
cd sentinel-execution-mcp
cp .env.example .env
# Default values work for local paper-trading development — no edits required

2. エンジンのセットアップ

cd packages/engine
python3.12 -m venv .venv
source .venv/bin/activate        # Windows: .venv\Scripts\activate
pip install -e ".[dev]"

3. データベースマイグレーションの実行

# From packages/engine with the venv active
alembic upgrade head

4. エンジンの起動

uvicorn sentinel.api:app --reload --port 8100

起動を確認します:

curl http://localhost:8100/health
# {"status": "ok", "env": "paper"}

5. MCPサーバーのビルドと起動

2つ目のターミナルを開きます:

cd packages/mcp
npm install
npm run build
npm run dev     # stdio transport — for direct Claude Desktop integration

Claude Desktopに接続

以下をClaude Desktopの設定ファイルに追加します。

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

ターミナルで以下を実行して正しいパスを取得します:

echo "$(pwd)/packages/mcp/dist/index.js"

次に、それを設定に貼り付けます:

{
  "mcpServers": {
    "sentinel": {
      "command": "node",
      "args": ["/absolute/path/to/sentinel-execution-mcp/packages/mcp/dist/index.js"],
      "env": {
        "ENGINE_BASE_URL": "http://localhost:8100",
        "APP_ENV": "paper"
      }
    }
  }
}

保存後、Claude Desktopを再起動します。チャット入力欄にハンマーアイコン(🔨)が表示されるはずです — クリックしてSentinelの40のツールが読み込まれていることを確認します。


MCPツールリファレンス

Sentinelは9つのカテゴリにわたる40以上のツールを公開しています。MCPサーバー名はsentinelです。

カテゴリ

ツール

説明

ウォッチリスト

watchlist.add

取引ウォッチリストにシンボルを追加します。オプションでグループに割り当て可能

watchlist.remove

シンボルを削除します。以後、戦略スキャンには表示されません

watchlist.list

アクティブなシンボルを一覧表示します。オプションでグループでフィルタリング可能

watchlist.get

単一シンボルの詳細を取得します

watchlist.groups

名前付きウォッチリストグループをすべて一覧表示します

watchlist.update

シンボルのメモまたはグループ割り当てを更新します

マーケットデータ

market.snapshot

1つ以上のシンボルの最新のクォートと取引データ

market.bars

設定可能なタイムフレームのOHLCVバー履歴

market.quote

シンボルのリアルタイムのビッド/アスクスプレッド

market.health

マーケットデータプロバイダーの接続状態を確認

レジーム

regime.evaluate

ATR、ADX、RSI、ボリンジャーバンド幅、ハースト指数、VWAP、価格効率を使用して現在のマーケットレジームを分類します

regime.history

シンボルの過去のレジームスナップショットを取得します

戦略

strategy.scan

1つ以上の戦略にわたってウォッチリストをシグナルスキャンします

strategy.signal

特定の戦略に対して単一のシンボルを評価します

strategy.list

登録済みのすべての戦略とその現在の状態を一覧表示します

リスク / キルスイッチ

risk.validate_trade

提出前に提案された取引に対して13以上のリスクチェックをすべて実行します

risk.kill_switch_status

すべてのキルスイッチの現在の状態を取得します

risk.kill_switch_enable

グローバル、戦略別、またはシンボル別にキルスイッチを有効にします

risk.kill_switch_disable

キルスイッチを無効にします(明示的な理由が必要)

risk.exposure

現在のグロスおよびネットエクスポージャーのサマリー

risk.drawdown

設定された制限に対する現在の日次ドローダウン

ポートフォリオ

portfolio.status

完全なアカウント概要: 評価額、現金、純資産、損益、買付余力

portfolio.positions

未実現損益を含むすべてのオープンポジション

portfolio.history

実現損益を含むクローズ済みポジション履歴

執行

execution.paper_order

ペーパートレーディング注文を提出します(成行、指値、逆指値、逆指値付き指値)

execution.cancel_order

IDで保留中または一部約定済みの注文をキャンセルします

execution.get_order

特定の注文の現在の状態を取得します

execution.list_orders

ステータス、シンボル、または日付範囲でフィルタリングした注文を一覧表示します

execution.reconcile

エンジン状態とブローカー間の手動リコンサイルをトリガーします

ガバナンス

governance.create_strategy

draft状態で新しい戦略を登録します

governance.promote_strategy

戦略を昇格させます: Draft → Research → Backtest → Paper → Live

governance.suspend_strategy

ライブまたはペーパー戦略を即座に停止します

governance.list_strategies

現在のライフサイクル状態とともにすべての戦略を一覧表示します

governance.evaluate_promotion

戦略が昇格の基準を満たしているかどうかを確認します

監査

audit.explain_trade

監査イベントIDによる取引判断の完全な人間可読な説明

audit.recent_events

直近の監査イベント。シンボルまたは戦略でフィルタリング可能

audit.trade_history

結果を含む完了した取引履歴

audit.decision_log

時間ウィンドウの生の意思決定ログエントリ

audit.stats

集計統計: 勝率、平均損益、シャープレシオの近似値

audit.export

日付範囲の監査レコードをCSVとしてエクスポート

パラメータスキーマを含む完全なツールドキュメント: docs/mcp-tools.md


環境変数

エンジン (packages/engine/.env)

変数

デフォルト

説明

APP_ENV

paper

developmentpaper、または live

DATABASE_URL

postgresql+asyncpg://sentinel:sentinel@localhost:5432/sentinel

PostgreSQL 接続文字列

REDIS_URL

redis://localhost:6379/0

Redis 接続文字列

MARKET_DATA_PROVIDER

mock

mock(認証情報不要)または alpaca

ALPACA_API_KEY

(empty)

MARKET_DATA_PROVIDER=alpaca の場合に必要です

ALPACA_API_SECRET

(empty)

MARKET_DATA_PROVIDER=alpaca の場合に必要です

ALPACA_BASE_URL

https://paper-api.alpaca.markets

ライブ取引には https://api.alpaca.markets を使用します

MAX_POSITION_PCT

0.05

口座純資産に対する最大ポジションサイズの割合(5%)

MAX_DAILY_DRAWDOWN_PCT

0.02

1日の損失に対するハードリミット(2%)。違反すると取引が停止します

MAX_GROSS_EXPOSURE_PCT

0.80

全ポジションにわたる最大グロスエクスポージャー(80%)

MAX_CONCURRENT_POSITIONS

10

同時にオープンできる最大ポジション数

MAX_TRADE_RISK_PCT

0.01

個別取引あたりの最大リスク(1%)

PAPER_FILL_LATENCY_MS

50

ペーパートレーディングモードにおけるシミュレーションされた約定遅延

SLIPPAGE_BPS

5

シミュレーションされたスリッページ(ベーシスポイント)

SENTINEL_AUTH_ENABLED

true

ローカル開発時のみ false に設定します

SENTINEL_MASTER_KEY

(empty)

python -m sentinel.auth.cli generate --name master --scopes admin で生成します

SENTINEL_API_KEYS_JSON

(empty)

追加のクライアントキーレコードのJSON配列

MCP サーバー (packages/mcp/.env)

変数

デフォルト

説明

ENGINE_BASE_URL

http://localhost:8100

実行中のエンジンサービスのベースURL

完全な注釈付きリファレンスについては、リポジトリのルートにある .env.example を参照してください。


ワークフロー例(ペーパートレーディング)

# 1. Add symbols
watchlist.add(symbols=["NVDA", "MSFT", "AAPL"], group="tech")

# 2. Classify regime
regime.evaluate(symbol="NVDA", timeframe="1Day")

# 3. Scan for signals
strategy.scan(group="tech", strategy="momentum_v1")

# 4. Validate before submitting
risk.validate_trade(symbol="NVDA", side="buy", qty=10, order_type="market")

# 5. Submit paper order
execution.paper_order(symbol="NVDA", side="buy", qty=10, order_type="market")

# 6. Review portfolio
portfolio.status()

# 7. Inspect the audit trail
audit.recent_events(symbol="NVDA", limit=1)
audit.explain_trade(audit_event_id="evt-...")

テストの実行

エンジン(Python)

cd packages/engine
source .venv/bin/activate
pytest tests/ -v

MCP サーバー(TypeScript)

cd packages/mcp
pnpm test

フルCI(lint + 型チェック + テスト)

# From repo root
make check

リポジトリ構成

sentinel-execution-mcp/
├── packages/
│   ├── engine/          # Python FastAPI trading engine
│   │   ├── sentinel/    # Application source
│   │   ├── tests/       # Pytest test suite
│   │   └── alembic/     # Database migrations
│   └── mcp/             # TypeScript MCP server
│       └── src/
│           └── tools/   # One file per tool category
├── docker/              # Dockerfiles and docker-compose
├── docs/                # Architecture, tool reference, risk model
├── scripts/             # Setup and reset helpers
└── .env.example         # Annotated environment variable reference

安全に関する免責事項

このソフトウェアは、すべてのコンポーネントを完全に理解している場合を除き、ペーパートレーディングおよび研究専用です。実際のAlpaca認証情報を設定して APP_ENV=live にすると、実際の資金で実際の注文が発行されます。ハードコードされたリスク制限は控えめなデフォルト値です。使用前に、ご自身のリスク許容度に合っていることを確認してください。著者は金銭的損失に対する責任を負いません。


ライセンス

MIT。 LICENSE を参照してください。

F
license - not found
Not graded
quality - not tested
Not graded
maintenance - not tested

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

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

Related MCP Servers

  • A
    license
    B
    quality
    D
    maintenance
    Enables AI assistants like Claude to interact with Paper's trading platform API using natural language, allowing users to manage accounts, portfolios, trades, and access market data through conversational requests.
    23
    15
    23
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables natural language trading operations through Alpaca's Trading API, supporting stocks, options, crypto, portfolio management, and real-time market data access through AI assistants like Claude.
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables Claude to autonomously trade, analyze, and manage positions on Polymarket prediction markets with 45 comprehensive tools covering market discovery, analysis, trading execution, portfolio management, and real-time monitoring with enterprise-grade safety features.
    MIT
  • A
    license
    B
    quality
    A
    maintenance
    Provides 32 trading analysis tools for AI-powered market analysis, including real-time data, technical indicators, options Greeks, scanners, and Interactive Brokers portfolio management, all accessible via natural language in Claude Desktop.
    35
    328
    MIT

View all related MCP servers

Related MCP Connectors

  • Trade Robinhood through natural language in Claude Code.

  • Global stock research, ML forecasts, valuation signals, screeners & portfolio tracking in Claude

  • Build, backtest, and deploy quantitative trading strategies from your AI agent.

View all MCP Connectors

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/rohith1125/sentinel-execution-mcp'

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