Exposes the Jesse algorithmic trading framework's capabilities to LLM agents
Jesse MCP Server
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
| Variable |
Description |
Default |
JESSE_URL |
Jesse REST API URL |
http://server2:9100 |
JESSE_PASSWORD |
Jesse UI password |
(required) |
JESSE_API_TOKEN |
Pre-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
| Tool |
Description |
backtest |
Run single backtest with specified parameters |
strategy_list |
List available strategies |
strategy_read |
Read strategy source code |
strategy_validate |
Validate strategy code |
Phase 2: Data & Analysis
| Tool |
Description |
candles_import |
Download candle data from exchanges |
backtest_batch |
Run concurrent multi-asset backtests |
analyze_results |
Extract insights from backtest results |
walk_forward |
Walk-forward analysis for overfitting detection |
Phase 3: Optimization
| Tool |
Description |
optimize |
Optimize hyperparameters using Optuna |
Phase 4: Risk Analysis
| Tool |
Description |
monte_carlo |
Monte Carlo simulations for risk analysis |
var_calculation |
Value at Risk (historical, parametric, Monte Carlo) |
stress_test |
Test under extreme market scenarios |
risk_report |
Comprehensive risk assessment |
Phase 5: Pairs Trading
| Tool |
Description |
correlation_matrix |
Cross-asset correlation analysis |
pairs_backtest |
Backtest pairs trading strategies |
factor_analysis |
Decompose returns into systematic factors |
regime_detector |
Identify market regimes and transitions |
Agent Tools (15)
Specialized tools for autonomous trading workflows:
| Tool |
Description |
strategy_suggest_improvements |
AI-powered strategy enhancement suggestions |
strategy_compare_strategies |
Compare multiple strategies side-by-side |
strategy_optimize_pair_selection |
Optimize pairs trading selection |
strategy_analyze_optimization_impact |
Analyze impact of optimization changes |
risk_analyze_portfolio |
Portfolio-level risk analysis |
risk_stress_test |
Advanced stress testing |
risk_assess_leverage |
Leverage risk assessment |
risk_recommend_hedges |
Hedging recommendations |
risk_analyze_drawdown_recovery |
Drawdown recovery analysis |
backtest_comprehensive |
Full backtest with all metrics |
backtest_compare_timeframes |
Compare performance across timeframes |
backtest_optimize_parameters |
Quick parameter optimization |
backtest_monte_carlo |
Backtest with Monte Carlo analysis |
backtest_analyze_regimes |
Regime-aware backtest analysis |
backtest_validate_significance |
Statistical 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)
Environment Variables
JESSE_URLJesse REST API URL
JESSE_PASSWORDrequiredJesse UI password
JESSE_API_TOKENPre-generated API token
Configuration
{"mcpServers": {"jesse": {"command": "uvx", "args": ["jesse-mcp"], "env": {"JESSE_PASSWORD": "your_password_here"}}}}Try it
→List all available trading strategies currently in my Jesse framework.
→Run a backtest for the 'MovingAverageCross' strategy from 2023-01-01 to 2023-12-31.
→Perform a Monte Carlo simulation on the latest backtest results to assess risk.
→Optimize the hyperparameters for my current strategy to improve the Sharpe ratio.
→Generate a comprehensive risk report for the recent backtest session.