quant-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@quant-mcpBacktest a 20/50 SMA cross on AAPL and show the equity curve"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
quant-mcp — an MCP server for market analysis
Built by Ismaël LADJOHOUNLOU · Model Context Protocol · TypeScript · read-only by design
A Model Context Protocol server that gives an AI agent typed access to market data, indicators, backtesting and position sizing. It runs over stdio, works with Claude Desktop, Claude Code and the MCP inspector, and it is built around the three things that separate a useful MCP server from a demo:
It fits in a context window. No tool returns five thousand rows. Long series are truncated to the most recent values and the response states the total, so a call never pushes the user's original question out of the conversation.
Its errors are recoverable by the model. An unknown symbol comes back as
isError: truewith the list of valid symbols, not as a protocol exception. The model fixes its own call and continues.Its results carry their caveats. A backtest answer ships the execution model that produced it — next-bar fills, costs both sides, stop-before-target — so the model cannot quote a return figure without the assumptions that make it meaningful.
The data is generated deterministically from a seed, not downloaded. Every number in this
README is reproducible with npm test, and nothing here predicts a real market.
Try it
npm install
npm test # 24 tests, including a real MCP client driving a real handshake
npm run inspect # the official inspector, no model requiredWire it into a client with three lines of JSON: see docs/USAGE.md for Claude Desktop, Claude Code, and how to point it at your own CSV history.
Related MCP server: Alpha Vantage MCP Server
The tools
Tool | What it does | Guarantee it makes |
| The instruments available and where they come from | Says whether data is generated or operator-supplied |
| Recent candles for a symbol and timeframe | Bounded response, states how much was left out |
| SMA, EMA, RSI, ATR, Bollinger | Values aligned with candles, |
| MA cross, RSI reversion or breakout, with metrics, trades and equity curve | Next-bar execution, costs both sides, stop wins a bar that touches both; assumptions returned with the result |
| Risk and stop distance to contracts | Refuses a zero stop; flags notional above 20x equity |
Plus two resources (quant://symbols, quant://methodology) and two prompts
(analyse_symbol, review_backtest). The review prompt is the interesting one: it makes the
model re-run with doubled costs and check whether the equity curve rests on a few outliers
before it endorses a strategy.
Why the backtest can be trusted
The engine enforces the four rules that decide whether a backtest means anything, instead of leaving them to the caller's discipline:
A signal from bar i fills at the open of bar i + 1. Filling at the close that produced the signal is look-ahead, and it is the single most common reason a strategy looks profitable on a chart and is not in production. A test walks every trade and asserts the fill sits on the next bar's open.
Costs are charged on entry and exit. A test runs the same strategy at zero cost and at 20 bps and asserts the expensive one ends poorer, with the same trade count — which is how you know the costs are applied to the money and not to the signals.
A bar touching both stop and target is a stop. Without tick data the order inside the bar is unknowable, and assuming the favourable one is how a win rate gets inflated.
Size comes from risk. Position size is the risked fraction of equity divided by the stop distance, which is a multiple of ATR.
Read them in src/engine/backtest.ts, or ask the server for
quant://methodology.
Security
An MCP server runs with the user's privileges, and the thing choosing which tool to call is
a model reading text that may have come from anywhere. The mitigation with the best ratio of
effectiveness to effort is to not ship a dangerous tool: this server is read-only. No
filesystem writes, no network calls, no child processes, no trading API, no eval. A
prompt injection that reaches it cannot make it destroy anything, because there is nothing
destructive to call.
The full threat model, and the line to hold if you extend it, is in docs/SECURITY.md.
Tests
npm test24 tests in two layers.
Protocol — a real Client from the SDK, connected over an in-memory transport, doing a
real handshake: capabilities, tool listing with schemas, every tool called, truncation
asserted, schema violations caught before the handler runs, resources read, prompts rendered.
Testing the handler functions directly would pass while the server was unusable by any actual
client. CI goes one step further and pipes raw JSON-RPC into the built binary over stdio.
Engine — SMA and EMA against hand computations, RSI bounded and 100 on an unbroken advance, ATR reflecting a gap rather than just the bar range, determinism of the generated series, no look-ahead in fills, costs strictly reducing equity, and metrics agreeing with the equity curve they are derived from.
Author
Ismaël LADJOHOUNLOU — data engineer, algorithmic trading and automation developer.
Portfolio: https://ismael-portfolio-liard.vercel.app/en
Upwork: https://www.upwork.com/freelancers/~01498331f7c7800fc0
Related: Sluice (streaming pipeline with backpressure and exactly-once) · QuantSwap (DEX with a reorg-safe indexer) · Cascade (Instagram to WhatsApp automation)
Available for MCP server, agent tooling and integration work.
Licence
MIT © 2026 Ismaël LADJOHOUNLOU. See LICENSE.
Available Tools
5 toolsbacktestBacktest a strategyA
Runs a strategy over the history and returns metrics, the trade list and the equity curve. Signals fill at the next bar's open, costs are charged both sides, and a bar touching both stop and target counts as a stop. The assumptions come back with the result.
| Name | Required | Description | Default |
|---|---|---|---|
| bars | No | How many of the most recent bars to use. | |
| symbol | Yes | Instrument symbol, for example XAUUSD. Case-insensitive. | |
| strategy | Yes | Strategy definition. | |
| timeframe | No | Bar size. Defaults to 1d. | |
| riskPercent | No | Equity risked per trade. Defaults to 1. | |
| slippageBps | No | ||
| commissionBps | No | ||
| stopAtrMultiple | No | ||
| targetRMultiple | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full disclosure burden. It discloses key execution assumptions: fills at next bar's open, costs charged both sides, a bar touching both stop and target counts as a stop, and assumptions returned with results. This goes beyond a generic 'runs a backtest.' It does not mention potential rate limits or data source details, but the essential behavioral traits are covered.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Three sentences, each carrying distinct value: purpose/outputs, execution assumptions, and result contents. The most important information is front-loaded and there is no filler. This is an appropriate size for the tool's complexity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a tool with 9 parameters and a nested strategy object, the description plus schema cover the essentials: inputs are defined by the schema, and behavioral assumptions are clearly stated. Since there is no output schema, the mention of metrics, trade list, equity curve, and assumptions is valuable. Minor gaps remain around strategy variants, default values, and error behavior, but these are either in the schema or not critical for invocation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 56%, leaving slippageBps, commissionBps, stopAtrMultiple, and targetRMultiple undocumented. The description partially compensates by explaining cost behavior ('costs are charged both sides') and stop/target ambiguity, which gives those parameters context. However, it does not map each parameter to its effect or indicate which are optional, so the gap is not fully closed.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a specific verb and resource: 'Runs a strategy over the history' and enumerates concrete outputs (metrics, trade list, equity curve). This clearly distinguishes it from siblings like list_symbols or get_ohlc, though it does not explicitly name an alternative. The purpose is unambiguous.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for backtesting a strategy but provides no explicit when-to-use guidance or exclusions. It does not mention alternative tools or conditions where backtest would be inappropriate. With sibling tools serving clearly different purposes, the omission is minor but still leaves selection to inference.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_ohlcGet OHLC candlesA
Returns recent candles for a symbol. Long ranges are truncated to the most recent rows; the response states the total available.
| Name | Required | Description | Default |
|---|---|---|---|
| bars | No | How many of the most recent bars to use. | |
| symbol | Yes | Instrument symbol, for example XAUUSD. Case-insensitive. | |
| timeframe | No | Bar size. Defaults to 1d. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full transparency burden. It discloses a non-obvious behavioral trait: long ranges are truncated to the most recent rows, and the response states total available. It does not cover error cases or row ordering, but the key edge-case behavior is surfaced.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sentences with no filler. The core purpose is front-loaded, followed by a concise behavioral caveat. Every word earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple retrieval tool with no annotations or output schema, the description covers the main purpose, truncation behavior, and response-related note. It omits minor details like ordering and timestamp format, but standard OHLC data and the schema's parameter descriptions make this sufficient.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the baseline is 3. The description adds contextual behavior about truncation that relates to the bars parameter but does not detail each parameter beyond the schema. The schema already documents symbol, bars, and timeframe adequately.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb and resource ('Returns recent candles for a symbol') and is clearly distinguished from siblings like list_symbols, backtest, indicator, and position_size by its unique data-retrieval role. An agent can determine what this tool does without needing to open the schema.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The purpose statement implies when to use the tool (whenever recent OHLC candles are needed), but it provides no explicit exclusions or recommendations among alternatives. There is no mention of when not to use this tool or which sibling might be more appropriate.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
indicatorCompute a technical indicatorA
Computes SMA, EMA, RSI, ATR or Bollinger bands. Values are aligned with the candles and null before the indicator has enough history, so a caller cannot silently shift the series.
| Name | Required | Description | Default |
|---|---|---|---|
| bars | No | How many of the most recent bars to use. | |
| name | Yes | ||
| period | No | Lookback. Defaults per indicator. | |
| symbol | Yes | Instrument symbol, for example XAUUSD. Case-insensitive. | |
| timeframe | No | Bar size. Defaults to 1d. | |
| deviations | No | Bollinger only. Defaults to 2. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden of behavioral disclosure. It reveals a non-obvious behavioral trait: values are aligned with candles and null before enough history, preventing silent series shifts. However, it does not mention other behaviors like read-only nature, output structure, or error handling, so it is not fully comprehensive.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The entire description is a single sentence that front-loads the primary action and then adds a critical behavioral detail. There is no filler, repetition of schema information, or unnecessary context.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool is moderately complex with six parameters and no output schema, yet the description does not specify the return shape (e.g., one array per series for Bollinger) or default periods. While the alignment/null behavior adds useful return context, the lack of explicit output structure and usage guidance leaves noteworthy gaps.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 83%, so the schema documents most parameter semantics (e.g., range for bars, period, enum for timeframe). The tool description adds no parameter-specific meaning beyond the schema, so the baseline of 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description names a specific verb ('Computes') and a resource ('technical indicator') while explicitly enumerating the exact indicators supported: SMA, EMA, RSI, ATR, and Bollinger bands. This clearly distinguishes the tool from siblings like list_symbols or backtest, which perform unrelated operations.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description states what the tool computes but provides no guidance on when to use it versus alternatives such as get_ohlc or backtest. There are no explicit conditions, exclusions, or references to sibling tools, so the agent must infer usage context entirely.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_symbolsList available symbolsA
Lists the instruments this server can analyse, and where their data comes from.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the behavioral burden. 'Lists the instruments' clearly indicates a read-only operation with no side effects, and adding the data-provenance context is useful. It does not disclose output format or potential limitations, but these are less critical for a simple listing tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is one short sentence that immediately states the core function and then adds one useful contextual detail. Every word earns its place; there is no filler.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a parameterless listing tool with no output schema, the description is reasonably complete: it tells the agent what will be listed and mentions the provenance. It could mention the exact shape of the returned data, but this is a minor gap for such a simple tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool has zero parameters awaited with 100% schema coverage, so there is nothing for the description to add. Baseline 4 is appropriate given no parameter semantics are needed.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a specific verb ('Lists'), a resource ('instruments this server can analyse'), and an additional scope ('where their data comes from'). This clearly distinguishes list_symbols from its siblings, which perform analysis, price retrieval, indicators, and position sizing.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies that this tool is used to discover available symbols before calling analysis tools, but it does not explicitly state when to use this tool versus alternatives. It provides no exclusions or conditions, though the listing purpose is inherently distinct from the sibling tools.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
position_sizeSize a position from riskA
Turns account equity, risk tolerance and a stop distance into a position size. Refuses inputs that would risk more than the account or imply a zero stop.
| Name | Required | Description | Default |
|---|---|---|---|
| stop | Yes | ||
| entry | Yes | ||
| equity | Yes | ||
| riskPercent | Yes | ||
| contractSize | No | Units per contract. Defaults to 1. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It discloses that the tool refuses inputs that risk more than the account or imply a zero stop, which is useful behavioral context. However, it does not mention whether the tool is read-only, what the output format is, or how it handles errors beyond refusal. For a calculation tool with no annotations, this is a moderate gap.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two sentences with no fluff. The primary purpose is stated first, followed by a key behavioral constraint. Every word earns its place, and the structure is optimal for quick comprehension.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a tool with 5 parameters, no output schema, and no annotations, the description is incomplete. It does not explain what the tool returns (e.g., position size in shares or lots), nor does it mention contractSize or the role of entry price. The refusal behavior is disclosed, but other essential usage details are missing. The description is not sufficient for an agent to fully understand the tool's behavior and output.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is only 20% (only contractSize has a description). The tool description maps the main inputs (equity, risk tolerance, stop distance) to the calculation purpose, providing some semantic context. However, it omits entry and contractSize, and does not explain the relationship between parameters or the output units. It adds some value but does not fully compensate for the low schema coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a specific verb and resource: it turns account equity, risk tolerance, and a stop distance into a position size. This clearly distinguishes it from sibling tools like list_symbols, backtest, get_ohlc, and indicator, which are about data retrieval or backtesting. The purpose is unambiguous and not a tautology.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies when to use the tool (when you need to compute a position size from risk parameters), but it does not explicitly mention alternatives or when not to use it. No exclusions are stated, and the context is clear enough that an agent could infer usage, but the guidance is not explicit.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
5 tool updates
v1.0.0- First observed
backtest - First observed
get_ohlc - First observed
indicator - First observed
list_symbols - First observed
position_size
TDQS
Scored across 5 tools
Each tool covers a distinct aspect of the quant workflow: symbol discovery, OHLC data, indicator calculation, backtesting, and position sizing. There is no meaningful overlap or ambiguity between them.
Naming is readable but not uniform: list_symbols and get_ohlc follow a verb_noun pattern, while backtest, indicator, and position_size are single verbs or noun phrases. The inconsistency is noticeable but not confusing.
Five tools is well-scoped for a quantitative analysis server. Each tool serves a necessary step in the analysis workflow without redundancy or bloat.
The set covers the core workflow: discover symbols, retrieve data, compute indicators, run backtests, and size positions. Minor gaps exist around strategy persistence or more granular risk controls, but they do not create dead ends for the stated purpose.
Maintenance
Related MCP Connectors
- CPZAIOAuthcom.cpz-lab.mcp
Build, backtest, and deploy quantitative trading strategies from your AI agent.
Unified financial infrastructure connecting AI agents directly to trade live/demo brokerage accounts, Web3 non-custodial wallets, real-time market data across equities, ETFs, crypto, forex, options, DeFi swaps, and prediction markets, institutional research feeds, and algorithmic strategy backtesters.
Market intelligence for AI agents. Real-time data, cross-market analysis, and regime detection.
Cross-asset market data and LLM inference for AI agents. Pay-per-call in USDC via x402.
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables AI agents to discover and analyze prediction markets, execute trades, and manage positions on Polymarket via the Model Context Protocol.751 npm20MIT
- AlicenseNot gradedqualityBmaintenanceEnables LLMs and agentic workflows to access real-time and historical stock market data through the Model Context Protocol.207MIT
- AlicenseNot gradedqualityAmaintenanceEnables AI agents to scan markets, build option strategies, track positions, and execute trades on TastyTrade via the Model Context Protocol.3MIT
- AlicenseAqualityCmaintenanceReal-time stock & crypto market data for LLMs, over the Model Context Protocol.4MIT