AI Trader
Backtrader-powered backtesting framework for algorithmic trading, featuring 20+ strategies, multi-market support, CLI tools, and an integrated MCP server for professional traders.
What is AI Trader?
AI Trader is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to backtrader-powered backtesting framework for algorithmic trading, featuring 20+ strategies, multi-market support, cli tools, and an integrated mcp server for professional traders.
Backtrader-powered backtesting framework for algorithmic trading, featuring 20+ strategies, multi-market support, CLI tools, and an integrated MCP server for professional traders.
This server falls under the Finance & Fintech category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- Backtrader-powered backtesting framework for algorithmic tra
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx ai-traderConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use AI Trader
AI Trader is a Backtrader-powered backtesting framework for algorithmic trading that ships with an integrated MCP server, letting Claude and other AI assistants interact with a professional-grade backtesting engine through natural language. It supports 20+ built-in strategies (from simple SMA crossovers to adaptive models), multi-market data (US stocks, Taiwan stocks, cryptocurrencies, and forex), and provides CLI tools for fetching market data, running backtests, and managing a local SQLite data cache. Quant developers and traders can use it to prototype, test, and iterate on trading strategies conversationally without writing boilerplate code.
Prerequisites
- Python 3.9 or later with pip or uv
- The ai-trader package installed (pip install ai-trader)
- Market data files in CSV format or SQLite cache (created via ai-trader fetch)
- An MCP-compatible client such as Claude Desktop
Install the ai-trader package
Install ai-trader from PyPI using pip. This installs the Backtrader engine, CLI tools, and the MCP server module.
pip install ai-traderFetch market data
Download historical price data for your target assets. The --storage sqlite flag caches data locally for reuse across backtests.
ai-trader fetch AAPL --market us_stock --start-date 2020-01-01 --storage sqlite
ai-trader fetch BTC-USD --market crypto --start-date 2021-01-01 --storage sqliteVerify available strategies
List the 20+ built-in strategies to confirm the installation is working and see what strategy names to use in prompts or YAML configs.
ai-trader strategy listRun a quick backtest from the CLI
Test a strategy against fetched data directly from the command line before connecting via MCP.
ai-trader quick --data AAPL --strategy CrossSMAStrategy --start-date 2020-01-01 --end-date 2023-12-31Add the MCP server to your client config
Register the ai-trader MCP server in your claude_desktop_config.json so Claude can run backtests, list strategies, and manage data via natural language.
{
"mcpServers": {
"ai-trader": {
"command": "npx",
"args": ["ai-trader"]
}
}
}Start a backtesting session with Claude
With the MCP server running, ask Claude to list strategies or run a backtest. The server translates natural language into Backtrader runs and returns performance metrics.
AI Trader Examples
Client configuration
claude_desktop_config.json entry for the AI Trader MCP server. The server is invoked via npx and uses locally installed Python tooling.
{
"mcpServers": {
"ai-trader": {
"command": "npx",
"args": ["ai-trader"]
}
}
}Prompts to try
Example prompts that drive the Backtrader backtesting engine through the AI Trader MCP server.
- "List all available trading strategies."
- "Run a backtest of CrossSMAStrategy on AAPL from 2020 to 2023 with $100,000 starting capital."
- "Fetch Tesla stock data for 2022 and run a MACD-based strategy backtest."
- "Compare the Sharpe ratio of CrossSMAStrategy vs MACDBBands on BTC-USD for 2021."
- "Download S&P 500 data and run the top 3 strategies. Which performed best?"Troubleshooting AI Trader
ModuleNotFoundError when starting the server
Ensure ai-trader is installed in the Python environment that the MCP client will use. If using a virtual environment, activate it first or provide the full path to the Python binary in the config.
No data found for a symbol during backtest
Run 'ai-trader fetch <SYMBOL> --market <market>' first to download and cache the data. Use 'ai-trader data list' to see what data is available locally.
Backtest completes but returns no trades
Check that the date range has sufficient data and that the strategy parameters (e.g. SMA windows) are appropriate for the period length. Short date ranges may not generate enough signals for the strategy to trade.
Frequently Asked Questions about AI Trader
What is AI Trader?
AI Trader is a Model Context Protocol (MCP) server that backtrader-powered backtesting framework for algorithmic trading, featuring 20+ strategies, multi-market support, cli tools, and an integrated mcp server for professional traders. It connects AI assistants to external tools and data sources through a standardized interface.
How do I install AI Trader?
Follow the installation instructions on the AI Trader GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with AI Trader?
AI Trader works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is AI Trader free to use?
Yes, AI Trader is open source and available under the GPL-3.0 license. You can use it freely in both personal and commercial projects.
AI Trader Alternatives — Similar Finance & Fintech Servers
Looking for alternatives to AI Trader? Here are other popular finance & fintech servers you can use with Claude, Cursor, and VS Code.
ValueCell
★ 10.7kValueCell is a community-driven, multi-agent platform for financial applications.
Vibe Trading
★ 8.1k'Vibe-Trading: Your Personal Trading Agent'
Quantdinger
★ 6.2kAI quantitative trading platform for crypto, stocks, and forex with backtesting, live trading, market data, and multi-agent research.vibe-trading ,trading-agents,ai-trader,ai-trading
TradingView
★ 2.8kReal-time crypto & stock screening, advanced technical indicators, Bollinger Bands intelligence, candlestick patterns + native Claude Desktop integration. Multi-exchange (Binance, KuCoin, Bybit+). Open-source AI trading infrastructure.
Financial Datasets
★ 2.1kProvides access to comprehensive financial data including income statements, balance sheets, cash flow statements, stock prices, company news, SEC filings, and cryptocurrency information with built-in financial ratio analysis.
Stripe
★ 1.6kThe Stripe Model Context Protocol server allows you to integrate with Stripe APIs through function calling. This protocol supports various tools to interact with different Stripe services.
Browse More Finance & Fintech MCP Servers
Explore all finance & fintech servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up AI Trader in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use AI Trader?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.