Supports storing authentication credentials and configuration options in .env files for secure and flexible deployment.
Referenced for repository hosting, issue reporting, and feature requests through GitHub's issues and discussions systems.
Mentioned as part of the contribution workflow, allowing developers to enforce code quality standards through pre-commit hooks.
Integrated for comprehensive test suite execution, including coverage reporting and parallel test running.
Built on Python 3.12+, with full type annotations and mypy verification for maximum reliability.
Provides deep integration with QuantConnect's algorithmic trading platform, offering tools for financial research, statistical analysis, portfolio optimization, project management, and backtesting capabilities. Includes features for ETF constituent analysis, correlation studies, PCA analysis, and authentication with the QuantConnect API.
Integrated for code linting as part of the development workflow and quality standards.
◆ QuantConnect MCP Server
Production-ready Model Context Protocol server for QuantConnect's algorithmic trading platform
Integrate QuantConnect's research environment, statistical analysis, and portfolio optimization into your AI workflows. Locally hosted, secure & capable of dramatically improving productivity
◉ Quick Start • ◉ Documentation • ◉ Architecture • ◉ Contributing
◈ Is this crazy?
- Full Project Lifecycle:
Create
,read
,update
,compile
, and manage QuantConnect projects and files programmatically. - End-to-End Backtesting:
Compile
projects,create backtests
,read detailed results
, and analyzecharts
,orders
, andinsights
. - Interactive Research: Full
QuantBook
integration for dynamic financial analysis, including historical andalternative data
retrieval. - Advanced Analytics: Perform
Principal Component Analysis (PCA)
,Engle-Granger cointegration tests
,mean-reversion analysis
, andcorrelation studies
. - Portfolio Optimization: Utilize sophisticated
sparse optimization
with Huber Downward Risk minimization, calculate performance, and benchmark strategies. - Universe Selection: Dynamically
screen assets
by multiple criteria, analyzeETF constituents
, and select assets based on correlation. - Enterprise-Grade Security: Secure,
SHA-256 authenticated
API integration with QuantConnect. - High-Performance Core: Built with an
async-first
design for concurrent data processing and responsiveness. - AI-Native Interface: Designed for seamless interaction via
natural language
in advanced AI clients.
◉ Table of Contents
- ◈ Quick Start
- ◈ Authentication
- ◈ Natural Language Examples
- ◈ Comprehensive API Reference
- ◈ Architecture
- ◈ Advanced Configuration
- ◈ Testing
- ◈ Contributing
- ◈ License
◈ Quick Start
Get up and running in under 2 minutes:
Prerequisites: You must have QuantConnect credentials (User ID and API Token) before running the server. The server will not function without proper authentication. See Authentication section for details on obtaining these credentials.
Install with uvx (Recommended)
One-Click Claude Desktop Install (Recommended)
- Download: Grab the latest
quantconnect-mcp.dxt
from the “Releases” page - Install: Double-click the file – Claude Desktop opens and prompts you to Install
- Configure: In Claude Desktop → Settings → Extensions → QuantConnect MCP, paste your user ID and API token
- Use it: Start a new Claude chat and call any QuantConnect tool
Why DXT?
Desktop Extensions (
.dxt
) bundle the server, dependencies, and manifest so users go from download → working MCP in one click – no terminal, no JSON editing, no version conflicts.
2. Set Up QuantConnect Credentials (Required)
The server requires these environment variables to function properly:
3. Launch the Server
4. Interact with Natural Language
Instead of calling tools programmatically, you use natural language with a connected AI client (like Claude, a GPT, or any other MCP-compatible interface).
"Initialize a research environment, add GOOGL, AMZN, and MSFT, then run a PCA analysis on them for 2023."
◈ Authentication
Getting Your Credentials
Credential | Where to Find | Required |
---|---|---|
User ID | Email received when signing up | ◉ Yes |
API Token | QuantConnect Settings | ◉ Yes |
Organization ID | Organization URL: /organization/{ID} | ◦ Optional |
Configuration Methods
Method 1: Environment Variables (Recommended)
◈ Natural Language Examples
This MCP server is designed to be used with natural language. Below are examples of how you can instruct an AI assistant to perform complex financial analysis tasks.
Factor‑Driven Portfolio Construction Pipeline
“Build a global equity long/short portfolio for 2025:
- Pull the constituents of QQQ, SPY, and EEM as of 2024‑12‑31 (survivor‑bias free).
- For each symbol, calculate Fama‑French 5‑factor and quality‑minus‑junk loadings using daily data 2022‑01‑01 → 2024‑12‑31.
- Rank stocks into terciles on value (B/M) and momentum (12‑1); go long top tercile, short bottom, beta‑neutral to the S&P 500.
- Within each book, apply Hierarchical Risk Parity (HRP) for position sizing, capped at 5 % gross exposure per leg.
- Target annualised ex‑ante volatility ≤ 10 %; solve with CVaR minimisation under a 95 % confidence level.
- Benchmark against MSCI World; report annualised return, vol, Sharpe, Sortino, max DD, hit‑rate, turnover for the period 2023‑01‑01 → 2024‑12‑31.
- Export the optimal weights and full tear‑sheet as
csv
.- Schedule a monthly rebalance job and push signals to the live trading endpoint.”
Robust Statistical‑Arbitrage Workflow
“Test and refine a pairs‑trading idea: • Universe: US Staples sector, market cap > $5 B, price > $10. • Data: 15‑minute bars, 2023‑01‑02 → 2025‑06‑30. • Step 1 – For all pairs, calculate rolling 60‑day distance correlation; keep pairs with dCor ≥ 0.80. • Step 2 – Run Johansen cointegration (lag = 2) on the survivors; retain pairs with trace‑stat < 5 % critical value. • Step 3 – For each cointegrated pair: – Estimate **half‑life of mean‑reversion**; discard if > 7 days. – Compute Hurst exponent; require H < 0.4. • Step 4 – Simulate a Bayesian Kalman‑filter spread to allow time‑varying hedge ratios. • Entry: z‑score crosses ±2 (two‑bar confirmation); Exit: z = 0 or t_max = 3 × half‑life. • Risk: cap pair notional at 3 % NAV, portfolio gross leverage ≤ 3 ×, stop‑loss at z = 4. • Output: trade log, PnL attribution, bootstrapped p‑value of alpha, and Likelihood‑Ratio test for regime shifts.”
Automated Project, Backtest & Hyper‑Parameter Sweep
“Spin up an experiment suite in QuantConnect:
- Create project ‘DynamicPairs_Kalman’ (Python).
- Add files: •
alpha.py
– signal generation (placeholder) •risk.py
– custom position sizing •config.yaml
– parameter grid:yaml entry_z: [1.5, 2.0, 2.5] lookback: [30, 60, 90] hedge: ['OLS', 'Kalman']
- Trigger a parameter‑sweep backtest labelled ‘GridSearch‑v1’ using in‑sample 2022‑23.
- When jobs finish, rank runs by Information Ratio and max DD < 10 %; persist top‑3 configs.
- Automatically launch out‑of‑sample backtests 2024‑YTD for the winners.
- Produce an executive summary: tables + charts (equity curve, rolling Sharpe, exposure histogram).
- Package the best model as a Docker image, push to registry, and deploy to the live‑trading cluster with a kill‑switch if 1‑day loss > 3 σ.”
Statistical Analysis Workflow
"Are Coca-Cola (KO) and Pepsi (PEP) cointegrated? Run the test for the period from 2023 to 2024. If they are, analyze their mean-reversion properties with a 20-day lookback."
Project and Backtest Management
"I need to manage my QuantConnect projects. First, create a new Python project named 'My_Awesome_Strategy'. Then, create a file inside it called 'main.py' and add this code:
...your algorithm code here...
. After that, compile it and run a backtest named 'Initial Run'. When it's done, show me the performance results."
◈ Comprehensive API Reference
◆ Authentication Tools
Tool | Description | Key Parameters |
---|---|---|
configure_quantconnect_auth | Set up API credentials | user_id , api_token , organization_id |
validate_quantconnect_auth | Test credential validity | - |
get_auth_status | Check authentication status | - |
test_quantconnect_api | Test API connectivity | endpoint , method |
clear_quantconnect_auth | Clear stored credentials | - |
◆ Project Management Tools
Tool | Description | Key Parameters |
---|---|---|
create_project | Create new QuantConnect project | name , language , organization_id |
read_project | Get project details or list all | project_id (optional) |
update_project | Update project name/description | project_id , name , description |
compile_project | Compile a project for backtesting | project_id |
◆ File Management Tools
Tool | Description | Key Parameters |
---|---|---|
create_file | Create file in project | project_id , name , content |
read_file | Read file(s) from project | project_id , name (optional) |
update_file_content | Update file content | project_id , name , content |
update_file_name | Rename file in project | project_id , old_file_name , new_name |
◆ QuantBook Research Tools
Tool | Description | Key Parameters |
---|---|---|
initialize_quantbook | Create new research instance | instance_name , organization_id , token |
list_quantbook_instances | View all active instances | - |
get_quantbook_info | Get instance details | instance_name |
remove_quantbook_instance | Clean up instance | instance_name |
◆ Data Retrieval Tools
Tool | Description | Key Parameters |
---|---|---|
add_equity | Add single equity security | ticker , resolution , instance_name |
add_multiple_equities | Add multiple securities | tickers , resolution , instance_name |
get_history | Get historical price data | symbols , start_date , end_date , resolution |
add_alternative_data | Subscribe to alt data | data_type , symbol , instance_name |
get_alternative_data_history | Get alt data history | data_type , symbols , start_date , end_date |
◆ Statistical Analysis Tools
Tool | Description | Key Parameters |
---|---|---|
perform_pca_analysis | Principal Component Analysis | symbols , start_date , end_date , n_components |
test_cointegration | Engle-Granger cointegration test | symbol1 , symbol2 , start_date , end_date |
analyze_mean_reversion | Mean reversion analysis | symbols , start_date , end_date , lookback_period |
calculate_correlation_matrix | Asset correlation analysis | symbols , start_date , end_date |
◆ Portfolio Optimization Tools
Tool | Description | Key Parameters |
---|---|---|
sparse_optimization | Advanced sparse optimization | portfolio_symbols , benchmark_symbol , optimization params |
calculate_portfolio_performance | Performance metrics | symbols , weights , start_date , end_date |
optimize_equal_weight_portfolio | Equal-weight optimization | symbols , start_date , end_date , rebalance_frequency |
◆ Universe Selection Tools
Tool | Description | Key Parameters |
---|---|---|
get_etf_constituents | Get ETF holdings | etf_ticker , date , instance_name |
add_etf_universe_securities | Add all ETF constituents | etf_ticker , date , resolution |
select_uncorrelated_assets | Find uncorrelated assets | symbols , num_assets , method |
screen_assets_by_criteria | Multi-criteria screening | symbols , min_return , max_volatility , etc. |
◆ Backtest Management Tools
Tool | Description | Key Parameters |
---|---|---|
create_backtest | Create new backtest from compile | project_id , compile_id , backtest_name |
read_backtest | Get backtest results | project_id , backtest_id , chart |
read_backtest_chart | Get chart data | project_id , backtest_id , name |
read_backtest_orders | Get order history | project_id , backtest_id , start , end |
read_backtest_insights | Get insights data | project_id , backtest_id , start , end |
◈ Architecture
Core Design Principles
- ◎ Modular Architecture: Each tool category is cleanly separated for maintainability
- ▪ Security First: SHA-256 authenticated API with secure credential management
- ⚡ Async Performance: Non-blocking operations for maximum throughput
- ◆ Type Safety: Full type annotations with mypy verification
- ⚙ Extensible: Plugin-based architecture for easy feature additions
◈ Advanced Configuration
Environment Variables
Variable | Description | Default | Example |
---|---|---|---|
MCP_TRANSPORT | Transport method | stdio | streamable-http |
MCP_HOST | Server host | 127.0.0.1 | 0.0.0.0 |
MCP_PORT | Server port | 8000 | 3000 |
MCP_PATH | HTTP endpoint path | /mcp | /api/v1/mcp |
LOG_LEVEL | Logging verbosity | INFO | DEBUG |
System Resources
You can monitor server performance and status using natural language queries for system resources:
"Show me the server's system info."
"What's the current server status and are there any active QuantBook instances?"
"Give me a summary of all available tools."
"Get the latest performance metrics for the server."
"What are the top 10 most resource-intensive processes running on the server?"
◈ Testing
Run the Test Suite
◈ Contributing
We welcome contributions! This project follows the highest Python development standards:
Development Setup
Code Quality Standards
- ◉ Type Hints: All functions must have complete type annotations
- ◉ Documentation: Comprehensive docstrings for all public functions
- ◉ Testing: Minimum 90% test coverage required
- ◉ Formatting: Black code formatting enforced
- ◉ Linting: Ruff linting with zero warnings
- ◉ Type Checking: mypy verification required
Development Workflow
Pull Request Guidelines
- ◆ Clear Description: Explain what and why, not just how
- ◆ Test Coverage: Include tests for all new functionality
- ◆ Documentation: Update README and docstrings as needed
- ◆ Code Review: Address all review feedback
- ◆ CI Passing: All automated checks must pass
◈ License
This project is licensed under the MIT License - see the LICENSE file for details.
Built with precision for the algorithmic trading community
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Tools
LLM Driven Trading Platform Orchestration - Strategy Design, Research & Implementation
Related MCP Servers
- AsecurityAlicenseAqualityEnables seamless integration with any LLM client supporting MCP for creating and optimizing technical content and product positioning using Open Strategy Partners' methodologies.Last updated -6203PythonCC BY-SA 4.0
- -securityAlicense-qualityProvides a semantic memory layer that integrates LLMs with OpenSearch, enabling storage and retrieval of memories within the OpenSearch engine.Last updated -4PythonApache 2.0
- AsecurityFlicenseAqualityEnables interaction with lightning addresses and common lightning tools via your LLM, providing Lightning Network functionality through natural language.Last updated -341TypeScript
- -securityFlicense-qualityA server application that enables large language models to execute stock trading operations through QMT trading system, providing functionality for account queries, position management, and order placement.Last updated -23Python