MCP Server
Key Concepts
Introduction
The QuantConnect Model Context Protocol (MCP) server is a bridge that connects a Large Language Model (LLM) to the QuantConnect API. With this setup, you can prompt the LLM and have it interact with our API on your behalf. This server equips the LLM with tools to create projects, run backtests, deploy live algorithms, and more. Our MCP integration can supercharge your existing workflow on QuantConnect and can even unlock quant trading to non-programmers. Simply prompt the LLM in layperson language and let it do the heavy lifting for you.
Example Conversation
The following example conversation with Claude Desktop demonstrates how the server equips an LLM with the ability to create trading strategies, backtest them, and deploy them to live trading:
Getting Started
To start using the QC MCP Server, see the Getting Started guide for one of the supported MCP clients.
Tools
The following table describes the tools the server provides:
| Tool | Cloud | Local |
|---|---|---|
| Account | ||
read_accountRead the organization account status. | ![]() | |
| Projects | ||
create_projectCreate a new project in your default organization. | ![]() | ![]() |
read_projectList details of a project or recent projects. | ![]() | ![]() |
list_projectsList the details of all projects. | ![]() | ![]() |
update_projectUpdate a project's name or description. | ![]() | ![]() |
delete_projectDelete a project. | ![]() | ![]() |
| Project Collaboration | ||
create_project_collaboratorAdd a collaborator to a project. | ![]() | ![]() |
read_project_collaboratorsList all collaborators on a project. | ![]() | ![]() |
update_project_collaboratorUpdate collaborator information for a project. | ![]() | ![]() |
delete_project_collaboratorRemove a collaborator from a project. | ![]() | ![]() |
lock_project_with_collaboratorsLock a project so you can edit it. | ![]() | |
| Project Nodes | ||
read_project_nodesRead the available and selected nodes of a project. | ![]() | ![]() |
update_project_nodesUpdate the active state of the given nodes to true. | ![]() | |
| Compile | ||
create_compileAsynchronously create a compile job request for a project. | ![]() | ![]() |
read_compileRead a compile packet job result. | ![]() | |
| Files | ||
create_fileAdd a file to a given project. | ![]() | ![]() |
read_fileRead a file from a project or all files if no name is provided. | ![]() | ![]() |
update_fileUpdate the name or content of a file. | ![]() | |
update_file_nameUpdate the name of a file. | ![]() | |
update_file_contentsUpdate the contents of a file. | ![]() | |
patch_fileApply a unified diff patch to a file. | ![]() | |
delete_fileDelete a file in a project. | ![]() | ![]() |
| Backtests | ||
create_backtestCreate a new backtest request and get the backtest ID. | ![]() | ![]() |
read_backtestRead the results of a backtest. | ![]() | ![]() |
list_backtestsList all backtests for the project. | ![]() | ![]() |
read_backtest_chartRead a chart from a backtest. | ![]() | |
read_backtest_ordersRead the orders of a backtest. | ![]() | |
read_backtest_insightsRead the insights of a backtest. | ![]() | |
update_backtestUpdate the name or note of a backtest. | ![]() | ![]() |
delete_backtestDelete a backtest from a project. | ![]() | ![]() |
| Optimization | ||
estimate_optimization_timeEstimate execution time of an optimization. | ![]() | |
create_optimizationCreate an optimization with parameters. | ![]() | ![]() |
read_optimizationRead an optimization. | ![]() | ![]() |
list_optimizationsList all optimizations for a project. | ![]() | ![]() |
update_optimizationUpdate the name of an optimization. | ![]() | |
abort_optimizationAbort an optimization. | ![]() | ![]() |
delete_optimizationDelete an optimization. | ![]() | ![]() |
| Live Trading | ||
authorize_connectionAuthorize an external live connection. | ![]() | |
create_live_algorithmCreate a live algorithm. | ![]() | ![]() |
read_live_algorithmRead details of a live algorithm. | ![]() | ![]() |
list_live_algorithmsList all active and past live deployments. | ![]() | |
read_live_chartRead a chart from a live algorithm. | ![]() | |
read_live_logsGet logs of a live algorithm. | ![]() | ![]() |
read_live_portfolioRead the live portfolio state. | ![]() | ![]() |
read_live_ordersRead orders from a live algorithm. | ![]() | ![]() |
read_live_insightsRead insights from a live algorithm. | ![]() | |
stop_live_algorithmStop a live algorithm. | ![]() | ![]() |
liquidate_live_algorithmLiquidate and stop a live algorithm. | ![]() | ![]() |
| Live Commands | ||
create_live_commandSend a command to a live algorithm. | ![]() | |
broadcast_live_commandBroadcast a live command to all live algorithms. | ![]() | |
| Object Store | ||
upload_objectUpload files to the Object Store. | ![]() | |
read_object_propertiesRead Object Store properties for an organization/key. | ![]() | |
read_object_store_file_job_idCreate a job to download files and return job ID. | ![]() | |
read_object_store_file_download_urlGet download URL for Object Store files. | ![]() | |
list_object_store_filesList Object Store files under a directory. | ![]() | |
delete_objectDelete an Object Store file. | ![]() | |
| Lean Versions | ||
read_lean_versionsReturn a list of LEAN versions. | ![]() | |
| MCP Server Versions | ||
read_mcp_server_versionReturn the current MCP Server version. | ![]() | |
read_latest_mcp_server_versionReturn the latest released MCP Server version. | ![]() | |
| AI | ||
check_initialization_errorsRun a short backtest to detect initialization errors. | ![]() | |
complete_codeShow code completion for specific text. | ![]() | |
enhance_error_messageShow enhanced error context and suggestions. | ![]() | |
update_code_to_pep8Update Python code to follow PEP8 style. | ![]() | |
check_syntaxCheck syntax of code. | ![]() | |
search_quantconnectSearch for QuantConnect content. | ![]() | |
Prompt Ideas
The following prompts are some ideas on how you can leverage the LLM’s knowledge to improve your workflow:
- Are there any new strategies out there being discussed online?
- How do you think we can improve the Sharpe ratio of this strategy?
- Review my live algorithms. Are there any you think we should stop trading?
- Add Option hedging to my strategy.
Workflow
The MCP integration supports multiple workflows, ranging from exclusively using the LLM for everything all the way to just prompting the LLM to supplement your activity on our other platforms. The following sections contain several examples of common workflows.
LLM-Focused Workflow
A cloud LLM-focused workflow might look like this:
- Open a project in Cloud Platform.
- In the IDE, open the Ask Mia panel.
- Issue prompts to investigate new trading ideas, create projects, run backtests, analyze backtest performance, and manage live algorithms.
- When you're finished, close the project.
A local LLM-focused workflow might look like this:
- Open Docker Desktop and your MCP client application.
- Issue prompts to investigate new trading ideas, create projects, run backtests, analyze backtest performance, and manage live algorithms.
- When you're finished, shut down the client and Docker Desktop.
The advantage of an LLM-focused workflow is it doesn't require you to be an expert in programming or financial markets. It leverages the knowledge of the pre-trained LLM to fill your knowledge gaps. The downside to this workflow is LLMs aren't perfect, so you may need to intervene if it starts hallucinating or if it struggles to implement sophisticated trading logic.
Multi-Platform Workflow
A multi-platform workflow might look like this:
- Open Cloud Platform, Docker Desktop, and your local MCP client application.
- Create a new project in the Algorithm Lab and run a backtest.
- Prompt the client application to add a trailing stop order to the project.
- Deploy an optimization in the Algorithm Lab.
- Prompt the client application to interpret the optimization results and offer suggestions for improvement.
- When you’re finished, close the Cloud Platform, client application, and Docker Desktop.
The advantage of this workflow is you can continue using the Cloud Platform, Local Platform, and CLI as you usually would while leveraging the power of LLMs to perform tedious tasks and brainstorm solutions.
Quotas
There are no quotas on the QuantConnect API, but the client you use may have quotas. For more information about the quotas, see the Quotas section for one of the supported MCP clients.
Troubleshooting
The following sections explain some issues you may encounter and how to resolve them.
No Local Tools Available
When you open your MCP client, it can take up to 30 seconds for the MCP server to start up and for the client to connect to it. Before you start entering prompts, check Docker Desktop to ensure the container is running and check the client to ensure it’s connected.
If the client can’t discover the tools after 30 seconds, follow these steps:
- Shut down the client application.
- If the server doesn’t automatically shut down in Docker Desktop, click the trash icon to shut it down.
- Restart the client application.

Connection Error Code -32000
The docker run ... command in the configuration file also accepts a --name option, which sets the name of the Docker container when the MCP Server starts running.
If your computer tries to start up two MCP Server containers with the same name, this error occurs.
To avoid the error, remove the --name option and its value from the configuration file.
For an example of a working configuration file, see the Getting Started guide for one of the supported MCP clients.
Service Outages
The MCP server relies on the QuantConnect API and the client application. To check the status of the QuantConnect API, see our Status page. To check the status of your client and the LLM, see their status page.
Examples
The following examples demonstrate the MCP server.
Example 1: Hello World
To test the server and client are working and connected, enter the following prompt into the client application:
> Create a QuantConnect project.
The client should call the create_project tool.
Example 2: Search QuantConnect, Create Projects, and Fix Errors
The following video shows this conversation with Claude Desktop in real-time:
Example 3: Brainstorm Ideas, Add Project Descriptions, and Add Collaborators
The following video shows this conversation with Claude Desktop in real-time:
