Skip to main content
Glama
rohith1125

sentinel

by rohith1125

Sentinel Execution MCP

CI License: MIT

프로덕션 등급 알고리즘 트레이딩 컨트롤 플레인을 MCP 서버로 노출합니다 — Claude가 자연어로 워치리스트를 관리하고, 시장 레짐을 분류하며, 리스크를 검증하고, 페이퍼 주문을 제출할 수 있게 합니다.


개요

Sentinel은 두 개의 패키지로 구성된 모노레포입니다:

패키지

언어

역할

packages/engine

Python 3.12 / FastAPI

모든 트레이딩 로직: 리스크 검사, 레짐 분류, 주문 수명주기, 감사 저널, 전략 거버넌스

packages/mcp

TypeScript / Node 20

HTTP를 통해 40개 이상의 도구를 엔진에 라우팅하는 경량 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 서버 빌드 및 시작

두 번째 터미널을 엽니다:

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

하나 이상의 심볼에 대한 최신 시세 및 거래 데이터를 제공합니다.

market.bars

시간 간격을 설정할 수 있는 OHLCV 봉 히스토리

market.quote

심볼에 대한 실시간 매수/매도 호가 스프레드

market.health

시장 데이터 공급자 연결 상태를 확인합니다.

레짐

regime.evaluate

ATR, ADX, RSI, Bollinger Width, Hurst Exponent, VWAP 및 Price Efficiency를 사용하여 현재 시장 레짐을 분류합니다.

regime.history

심볼에 대한 과거 레짐 스냅샷을 조회합니다.

전략

strategy.scan

하나 이상의 전략에 걸쳐 워치리스트에서 신호를 스캔합니다.

strategy.signal

특정 전략을 기준으로 단일 심볼을 평가합니다.

strategy.list

등록된 모든 전략과 현재 상태를 나열합니다.

리스크 / 킬 스위치

risk.validate_trade

제출 전 제안 거래에 대해 13개 이상의 리스크 검사를 모두 실행합니다.

risk.kill_switch_status

모든 킬 스위치의 현재 상태를 가져옵니다.

risk.kill_switch_enable

킬 스위치를 전역, 전략별 또는 심볼별로 활성화합니다.

risk.kill_switch_disable

킬 스위치를 비활성화합니다(명시적 사유 필요).

risk.exposure

현재 총(gross) 및 순(net) 노출 요약을 제공합니다.

risk.drawdown

설정된 한도 대비 현재 일별 드로다운을 확인합니다.

포트폴리오

portfolio.status

전체 계좌 개요: 가치, 현금, 순자산, 손익(P&L), 매수 여력.

portfolio.positions

미실현 손익(P&L)이 포함된 모든 보유 종목.

portfolio.history

실현 손익(P&L)이 포함된 청산 종목 이력.

실행

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

집계 통계: 승률, 평균 손익(P&L), Sharpe proxy.

audit.export

특정 날짜 범위의 감사 기록을 CSV로 내보냅니다.

매개변수 스키마와 함께 완전한 도구 문서: docs/mcp-tools.md


환경 변수

엔진 (packages/engine/.env)

변수

기본값

설명

APP_ENV

paper

development, paper 또는 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

(비어 있음)

MARKET_DATA_PROVIDER=alpaca인 경우 필수

ALPACA_API_SECRET

(비어 있음)

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

일일 손실 한도 (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

(비어 있음)

python -m sentinel.auth.cli generate --name master --scopes admin으로 생성

SENTINEL_API_KEYS_JSON

(비어 있음)

추가 클라이언트 키 레코드의 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