Skip to main content

MCP server for Claude Desktop: natural-language market research and strategy backtesting with the AlgoChains library.

Project description

AlgoChains Library MCP

Ask market-research and trading-strategy questions in plain English, and let Claude pull data with AlgoChains, backtest strategies, and return interactive charts inline — built for Claude Desktop via the Model Context Protocol.

No coding required: describe the strategy, get a full backtest dashboard back in the chat.

Install (easiest — one click)

  1. Get your API key at https://algochains.ai.
  2. Download the extension: algochains-library-mcp.mcpb.
  3. Double-click the downloaded file (or in Claude Desktop: Settings → Extensions → Install extension… and pick it). Claude Desktop shows an install dialog — paste your API key into the AlgoChains API Key field and confirm.
  4. Fully quit Claude Desktop (Cmd+Q on macOS / quit from the system tray on Windows — closing the window is not enough) and reopen it.

The first launch downloads the Python environment (a few hundred MB) — it can take several minutes and Claude Desktop may report the server disconnected once; it recovers on the next launch. The AlgoChains tools then appear under the tools icon in the chat box.

Example asks

Research:

"Pick a heavily traded crypto coin and show me when it actually trades — busiest hours of the day in 30-minute bins over the last 3 months. Shade the London, China, and Brazil market opens so I can see what each one does to volume compared to NYSE."

Build & backtest:

"Backtest an opening range breakout on SPY for me, the range is the first 10 minutes of the New York session, give it a loose 2.5% trailing stop, and get me out by noon ET no matter what. Run it over the past 2 months."

Forecast:

"Where could Intel be trading 10 days from now? Give me the SDE forecast."

Forecast, anchored in the past (the dashboard overlays what the price actually did):

"Forecast INTC 10 days out as of June 15, 2026 using SDE describing geometric Brownian motion — then show me how the price actually played out against it."

What it does

Kind Name What it does
resource algochains://agents-guide The library's AGENTS.md — API, symbols, resolutions, examples (plus the server's determinism rules).
tool research_query Historical OHLCV for one symbol or a list — a quick look (wraps algochains.research_query).
tool forecast SDE (GBM) Monte Carlo price forecast in one call — quantile fan, return distribution vs Student-t fit, terminal prices; PNG inline + interactive artifact.
tool run_python Run Python in a temp dir; any matplotlib figure is returned inline (themed).
tool build_report Run analysis cells in a temp dir; charts inline + report as markdown text.
tool build_algorithm Write a bt.Strategy and backtest it in the background; keeps the CSVs in a per-name temp dir (no plotting).
tool make_backtest_dashboard Render the run (waits if it's still running): fast matplotlib PNG inline + a React+Recharts interactive artifact.
tool send_signal Propagate a live trade signal (requires SIGNAL_SECRET; off by default).

Claude reads the resource to ground itself in the library, then uses the tools to answer.

Backtesting is two steps, mirroring research → build_report:

  1. build_algorithm(name, ...) launches the backtest in the background (Backtrader is slow — long or multi-symbol runs take minutes) and returns quickly with state:"done" or "running".
  2. make_backtest_dashboard(name) waits for the run if needed, then renders a matplotlib PNG inline plus artifact_jsx — a React+Recharts component Claude drops into an artifact for an interactive dashboard (candlestick equity, drawdown, rolling Sharpe, per-trade P&L, round trips).

Forecasting is one call: forecast(symbol, days, ...) runs the whole standardized pipeline inside the library — history → moment estimation (μ, σ, skew, kurtosis, Student-t fit) → GBM Monte Carlo — and returns the forecast dashboard (quantile fan, return distribution, terminal prices) inline plus the interactive artifact. Forecasts are reproducible: the same seed gives identical paths, and every answer quotes the methodology line (SDE: GBM · MC paths · seed). Ask for a forecast as of a past date and the dashboard overlays what the price actually did over the forecast window — instant hindcast validation.

What's written to disk (and why)

Almost nothing, and nothing hidden. Research code and backtests run in throwaway temp folders that clean themselves up — a backtest's raw CSVs stick around for ~12 hours in case you want to inspect them, then they're deleted automatically.

The one thing that's kept: every completed backtest leaves you a receipt. Three small files land in ~/Downloads/AlgoChains/comparisons/<run-name>/ (or ~/Desktop/… if you have no Downloads folder):

  • strategy.py — the exact code that ran. Not a description of your strategy, the literal script that produced the numbers you're looking at.
  • round_trips.csv — every trade it made: entries, exits, P&L.
  • dashboard.png — the dashboard image itself, so the picture of the results survives along with the numbers. (not including the trades at the bottom for now, soon to come)

Here's why that matters. A chat scrolls away, but a trading result you might act on shouldn't. When Claude tells you a strategy returned +12%, these files are your proof of what returned +12% — so next week you can reread the logic, diff two variants of a strategy to see exactly what changed, or hand the script to someone else to reproduce your result. Without them, "the backtest I ran last Tuesday" would be a memory; with them it's a folder. And because the dashboard is saved too, you can simply ask Claude "show me the dashboard for <run-name> again" in any later chat — even after the run's working data has long been cleaned up.

Nothing else is saved, the files are a few KB per run, re-running a name simply overwrites its folder, and deleting any of it is always safe. The folder won't bloat either: only the 20 most recent runs are kept — older ones are pruned automatically, except any folder you've added your own files to, which is left alone. (Power users can move the location with ALGOCHAINS_LIBRARY_MCP_COMPARISONS_DIR or change the cap with ALGOCHAINS_LIBRARY_MCP_COMPARISONS_KEEP; 0 keeps everything.)

run_python, build_report, and build_algorithm execute model-written Python locally on your machine — that's how Desktop (no code execution of its own) does the analysis. Only connect this server in an environment you trust.

Notes

  • Symbol formats: Forex EUR-USD, Stocks AAPL, Crypto BTC-USD.
  • Multiple symbols: research_query and build_algorithm accept a list of symbols as well as a single string. Multi-symbol backtests use the ('symbols', []) param and self.datas[i] (see the agents-guide "Multi-asset" section); the equity curve is the true combined portfolio value.
  • Resolutions: 1m, 5m, 15m, 30m, 1h, 4h, 1d. Databases: Forex, Stocks, Crypto.
  • Charts use a shared matplotlib/mplfinance theme; the interactive dashboard is React+Recharts (Plotly and other CDN-loaded libraries fail in Desktop's artifact sandbox — Recharts is bundled).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

algochains_library_mcp-0.1.4.tar.gz (42.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

algochains_library_mcp-0.1.4-py3-none-any.whl (44.9 kB view details)

Uploaded Python 3

File details

Details for the file algochains_library_mcp-0.1.4.tar.gz.

File metadata

  • Download URL: algochains_library_mcp-0.1.4.tar.gz
  • Upload date:
  • Size: 42.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for algochains_library_mcp-0.1.4.tar.gz
Algorithm Hash digest
SHA256 7f26c3519186b35f25a0c7f5a7f1687c9771579b6a992b76c61d00ad5d3fd78d
MD5 ad74e2aee4b8690b7066809919ba56f0
BLAKE2b-256 76f1807f431f46ecacf2b460fdbf605e9e4c63f1eb995484d6956c2253e1e6a6

See more details on using hashes here.

File details

Details for the file algochains_library_mcp-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: algochains_library_mcp-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 44.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for algochains_library_mcp-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 16cde88f8f6402220194a2fe84baf4a6013fb5a9740ea01c5da265781b34aac2
MD5 69558b4ed00f55960a5f4514ff9fdca4
BLAKE2b-256 4f1e5ae1f178b7e6d19d28308008e393edc894a4867d68dbbeca10ba23eca397

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page