MCP Hub
Back to servers

Jesse MCP Server

An MCP server that exposes the Jesse algorithmic trading framework's capabilities to LLM agents for backtesting, optimization, and risk analysis. It provides 32 specialized tools for managing trading strategies and performing comprehensive market simulations via the Jesse REST API.

Forks
1
Updated
Feb 18, 2026

Jesse MCP Server

PyPI version Python 3.10+ License: MIT

An MCP (Model Context Protocol) server that exposes Jesse's algorithmic trading framework capabilities to LLM agents.

Status: Feature Complete ✅

All planned features implemented and tested. 32 tools available (17 core + 15 agent).

Installation

PyPI

pip install jesse-mcp

uvx (recommended for running directly)

uvx jesse-mcp

Arch Linux (AUR)

yay -S jesse-mcp
# or
paru -S jesse-mcp

From Source

git clone https://github.com/bkuri/jesse-mcp.git
cd jesse-mcp
pip install -e .

Usage

# stdio transport (default, for MCP clients)
jesse-mcp

# HTTP transport (for remote access)
jesse-mcp --transport http --port 8100

# Show help
jesse-mcp --help

Environment Variables

VariableDescriptionDefault
JESSE_URLJesse REST API URLhttp://localhost:9000
JESSE_PASSWORDJesse UI password(required)
JESSE_API_TOKENPre-generated API token(alternative to password)

Features

  • Backtesting - Single and batch backtest execution via Jesse REST API
  • Optimization - Hyperparameter tuning with walk-forward validation
  • Monte Carlo Analysis - Statistical robustness testing
  • Pairs Trading - Cointegration testing and strategy generation
  • Strategy Management - CRUD operations for trading strategies
  • Risk Analysis - VaR, stress testing, comprehensive risk reports
  • Agent Tools - 15 specialized tools for autonomous trading workflows

Architecture

LLM Agent ←→ MCP Protocol ←→ jesse-mcp ←→ Jesse REST API (localhost:9000)
                                    ↓
                            Mock Fallbacks (when Jesse unavailable)

Available Tools (32 Total)

Core Tools (17)

Phase 1: Backtesting

ToolDescription
backtestRun single backtest with specified parameters
strategy_listList available strategies
strategy_readRead strategy source code
strategy_validateValidate strategy code

Phase 2: Data & Analysis

ToolDescription
candles_importDownload candle data from exchanges
backtest_batchRun concurrent multi-asset backtests
analyze_resultsExtract insights from backtest results
walk_forwardWalk-forward analysis for overfitting detection

Phase 3: Optimization

ToolDescription
optimizeOptimize hyperparameters using Optuna

Phase 4: Risk Analysis

ToolDescription
monte_carloMonte Carlo simulations for risk analysis
var_calculationValue at Risk (historical, parametric, Monte Carlo)
stress_testTest under extreme market scenarios
risk_reportComprehensive risk assessment

Phase 5: Pairs Trading

ToolDescription
correlation_matrixCross-asset correlation analysis
pairs_backtestBacktest pairs trading strategies
factor_analysisDecompose returns into systematic factors
regime_detectorIdentify market regimes and transitions

Agent Tools (15)

Specialized tools for autonomous trading workflows:

ToolDescription
strategy_suggest_improvementsAI-powered strategy enhancement suggestions
strategy_compare_strategiesCompare multiple strategies side-by-side
strategy_optimize_pair_selectionOptimize pairs trading selection
strategy_analyze_optimization_impactAnalyze impact of optimization changes
risk_analyze_portfolioPortfolio-level risk analysis
risk_stress_testAdvanced stress testing
risk_assess_leverageLeverage risk assessment
risk_recommend_hedgesHedging recommendations
risk_analyze_drawdown_recoveryDrawdown recovery analysis
backtest_comprehensiveFull backtest with all metrics
backtest_compare_timeframesCompare performance across timeframes
backtest_optimize_parametersQuick parameter optimization
backtest_monte_carloBacktest with Monte Carlo analysis
backtest_analyze_regimesRegime-aware backtest analysis
backtest_validate_significanceStatistical significance validation

Testing

# Install dev dependencies
pip install jesse-mcp[dev]

# Run all tests
pytest -v

# Run with coverage
pytest --cov=jesse_mcp

Status: 49 tests passing

Local Development

Prerequisites

  • Python 3.10+
  • Jesse 1.13.x running on localhost:9000
  • PostgreSQL on localhost:5432
  • Redis on localhost:6379

Start Jesse Stack (Podman)

# Start infrastructure
podman run -d --name jesse-postgres --network host \
  -e POSTGRES_USER=jesse_user -e POSTGRES_PASSWORD=password -e POSTGRES_DB=jesse_db \
  docker.io/library/postgres:14-alpine

podman run -d --name jesse-redis --network host \
  docker.io/library/redis:6-alpine redis-server --save "" --appendonly no

# Start Jesse
podman run -d --name jesse --network host \
  -v /path/to/jesse-bot:/home:z \
  docker.io/salehmir/jesse:latest bash -c "cd /home && jesse run"

Start Dev MCP Server

./scripts/start-dev-server.sh   # Start on port 8100
./scripts/stop-dev-server.sh    # Stop server

Add to OpenCode

Add to ~/.config/opencode/opencode.json:

{
  "mcp": {
    "jesse-mcp-dev": {
      "type": "remote",
      "url": "http://localhost:8100/mcp",
      "enabled": true
    }
  }
}

Documentation

API Reference

Jesse REST Client

The jesse_rest_client.py module provides direct access to Jesse's REST API:

from jesse_mcp.core.jesse_rest_client import get_jesse_rest_client

client = get_jesse_rest_client()

# Run backtest
result = client.backtest(
    strategy="OctopusStrategy",
    symbol="BTC-USDT", 
    timeframe="1h",
    start_date="2024-01-01",
    end_date="2024-01-31"
)

Mock Implementations

When Jesse is unavailable, all tools gracefully fall back to mock implementations that return realistic synthetic data. This enables development and testing without a full Jesse installation.

Key Dependencies

PackageVersionPurpose
fastmcp>=0.3.0MCP server framework
numpy>=1.24.0Numerical computations
pandas>=2.0.0Data manipulation
scipy>=1.10.0Statistical functions
scikit-learn>=1.3.0ML utilities
optuna>=3.0.0Hyperparameter optimization

Project Structure

jesse_mcp/
├── server.py            # FastMCP server with 17 core tools
├── optimizer.py         # Phase 3: Optimization tools
├── risk_analyzer.py     # Phase 4: Risk analysis tools
├── pairs_analyzer.py    # Phase 5: Pairs trading tools
├── agent_tools.py       # 15 agent-specific tools
├── core/
│   ├── integrations.py  # Jesse framework integration
│   ├── jesse_rest_client.py  # REST API client
│   └── mock.py          # Mock implementations
├── agents/
│   ├── base.py          # Base agent class
│   ├── backtester.py    # Backtesting specialist
│   └── risk_manager.py  # Risk management specialist
└── scripts/
    ├── start-dev-server.sh
    └── stop-dev-server.sh

License

MIT License - see LICENSE file for details.

Publishing

This package uses GitHub Actions with PyPI trusted publishing. To release a new version:

  1. Update version in pyproject.toml and jesse_mcp/__init__.py
  2. Create a git tag: git tag v1.x.x
  3. Push tag: git push origin v1.x.x
  4. Create GitHub release - automatically publishes to PyPI

Reviews

No reviews yet

Sign in to write a review