candlestick-chart-mcp

candlestick-chart-mcp

Renders OHLCV data as candlestick chart PNGs and returns inline images. It is a pure renderer with no network access, allowing models to view charts generated from provided data.

Category
访问服务器

README

candlestick-chart-mcp

An MCP server that renders OHLCV data as a candlestick chart PNG and returns it as inline image content, so the model can actually look at the chart it asked for.

It is a pure renderer: no network access, no API keys, no market-data provider. You pass the bars in; it draws them.

Install

npm install
npm run build

Verify it end to end (spawns the server over stdio and calls the tool for real):

npm run check

Render sample charts to out/ to eyeball the output:

npm run smoke

Register with a client

Claude Code:

claude mcp add candlestick-chart -- node /absolute/path/to/candlestick-chart-mcp/dist/index.js

Or in a config file (.mcp.json, claude_desktop_config.json, …):

{
  "mcpServers": {
    "candlestick-chart": {
      "command": "node",
      "args": ["/absolute/path/to/candlestick-chart-mcp/dist/index.js"]
    }
  }
}

The tool

render_candlestick_chart

Returns two content blocks: a short text summary (bar count, date range, OHLC, percent change, plus any notes about inputs that were adjusted) and the PNG.

Bars. candles accepts either form per bar, and mixing them is fine:

{ "time": "2026-01-05", "open": 100, "high": 103.2, "low": 99.4, "close": 102.8, "volume": 1200000 }
[1767571200, 100, 103.2, 99.4, 102.8, 1200000]

The tuple form is [time, open, high, low, close, volume?] and costs far fewer tokens — prefer it for anything longer than a handful of bars. time takes epoch seconds, epoch milliseconds, or any string Date.parse understands. Bars are sorted by time; a high/low that contradicts the body is clamped rather than rejected.

Everything else is optional:

Option Default Notes
title, subtitle — Subtitle defaults to date range · bar count · change
chartType candlestick or heikin-ashi, ohlc-bars
width, height, scale 1400, 800, 1 scale is the device-pixel ratio
theme dark or light
colorScheme diverging or classic, mono — see below
bodyStyle per scheme filled or hollow-up
showVolume true Needs a volume column; drawn in its own panel
showGrid, showLegend, showLastPrice true
yScale linear log for multi-year or high-growth ranges
timeZone UTC Any IANA zone; applies to every label
sma, ema [] Arrays of periods, e.g. [20, 50]
bollinger — { "period": 20, "stdDev": 2 }
vwap false Session-anchored; needs volume on every bar
priceLines [] { price, label?, color?, style? } — support, resistance, stops
markers [] { index? or time?, side: buy/sell/neutral, label? }

Example call:

{
  "candles": [[1767571200, 100, 103.2, 99.4, 102.8, 1200000], "…"],
  "title": "BTCUSD · 1D",
  "sma": [20, 50],
  "bollinger": { "period": 20, "stdDev": 2 },
  "priceLines": [{ "price": 61941.5, "label": "resistance" }],
  "markers": [{ "time": "2026-02-14", "side": "buy", "label": "entry" }],
  "yScale": "log",
  "timeZone": "Europe/Riga"
}

Inputs that cannot be honoured do not fail the call — an SMA period longer than the series, a missing volume column, a log scale with non-positive prices, an unknown time zone are each dropped or downgraded and reported in the text block.

Colour

Up/down is a polarity encoding, so the default diverging scheme uses the blue ↔ red diverging pair. That pair clears the all-pairs colourblind gate in both themes (CVD ΔE 21.6 light / 19.2 dark against a ≥ 8 target). The traditional green/red pair fails it at ΔE 4.1 for deuteranopia, so classic ships with hollow up-bodies: shape carries the direction and hue only reinforces it. mono drops hue entirely — ink, hollow versus filled — for print and forced-colours contexts.

With the up/down pair already on screen there is no room left for a palette of overlay hues: every candidate measured below the normal-vision floor against one of the poles. So all overlays share one validated accent per scheme, and their identity comes from dash pattern + legend + a direct label at the end of each line. Four overlays are distinguishable; a fifth reuses a dash pattern and the response says so.

Volume bars inherit the bar's direction at half strength so the panel stays recessive, and it is a separate panel — never a second y-axis on the price plot.

Layout notes

  • Bars sit on an ordinal x-axis (one slot per bar), so weekends and market holidays leave no gaps. Time labels appear where the label actually changes; intraday charts substitute the date wherever the day rolls over.
  • Below ~3.5 px per bar, bodies are dropped and each bar becomes a single high-low hairline — a 1200-bar chart stays readable.
  • Bodies cap at 26 px wide so a seven-bar chart still looks like candles.
  • The PNG is capped near 4.5 MB; a request that would exceed it is re-rendered at scale: 1 and, failing that, returns an error asking for smaller dimensions.

Layout of the source

File Role
src/index.ts MCP server, tool registration, marker/time-zone resolution
src/schema.ts Zod input schema — the tool's contract
src/render.ts All drawing: layout, axes, candles, overlays, annotations
src/theme.ts Palettes and the validation results behind them
src/indicators.ts SMA, EMA, Bollinger, VWAP, Heikin-Ashi
src/candles.ts Input normalisation
src/format.ts Tick stepping, number and date formatting

Adding an indicator panel (RSI, MACD) means adding a panel band to the layout block in renderChart and a series function in indicators.ts.

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选