Repository avatar
Multimedia
v0.1.0
active

mcp

com.chartquery/mcp

Generate chart images, diagrams, barcodes, QR codes and thermal labels on demand. PNG, SVG or PDF o…

Documentation

ChartQuery MCP Server

Official Model Context Protocol server for the ChartQuery chart and QR code API.

Generate chart images, diagrams, barcodes, QR codes and thermal labels on demand. PNG, SVG or PDF output.

It lets Claude, Cursor, VS Code, Windsurf and any MCP client call the API as tools. Runs over stdio (local) or Streamable HTTP (self-hosted).

Requirements

  • Node.js 20 or newer
  • a ChartQuery API key — sign up, then copy it from the dashboard

Hosted server (recommended)

ChartQuery runs this server for you at https://mcp.chartquery.com/ (Streamable HTTP). Send your API key in the x-api-key header; nothing to install.

claude mcp add --transport http chartquery https://mcp.chartquery.com/ --header "x-api-key: YOUR_API_KEY"
{
  "mcpServers": {
    "chartquery": {
      "url": "https://mcp.chartquery.com/",
      "headers": {
        "x-api-key": "YOUR_API_KEY"
      }
    }
  }
}

The hosted server and this package expose the same API; run the package locally when you want stdio, your own network egress, or to self-host it.

Run it locally

Claude Code

claude mcp add chartquery --env CHARTQUERY_API_KEY=YOUR_API_KEY -- npx -y @chartquery/mcp

Claude Desktop, Cursor, Windsurf and other clients

Add the server to the client's MCP configuration (claude_desktop_config.json, .cursor/mcp.json…):

{
  "mcpServers": {
    "chartquery": {
      "command": "npx",
      "args": ["-y", "@chartquery/mcp"],
      "env": {
        "CHARTQUERY_API_KEY": "YOUR_API_KEY"
      }
    }
  }
}

VS Code

{
  "servers": {
    "chartquery": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@chartquery/mcp"],
      "env": {
        "CHARTQUERY_API_KEY": "${input:chartquery-api-key}"
      }
    }
  },
  "inputs": [
    {
      "type": "promptString",
      "id": "chartquery-api-key",
      "description": "ChartQuery API key",
      "password": true
    }
  ]
}

Claude Desktop extension

Download the .mcpb bundle from the releases page and open it; Claude Desktop asks for your API key.

Docker

docker build -t chartquery-mcp .
docker run -i --rm -e CHARTQUERY_API_KEY=YOUR_API_KEY chartquery-mcp

Tools

ToolDescription
barcodeGenerate a barcode image via GET. Output: SVG (default) or PNG. Supports 25+ formats: EAN-13, Code 128, ITF-14, GS1-128, postal codes and more.
chartRender a Chart.js image via GET. Pass the full chart object as URL-encoded JSON in query. Prefer format png for ChatGPT. POST sends the same object as a JSON body, not query.
chart_aiDescribe a chart in plain English via GET and get a rendered image back. Powered by AI.
chart_renderRender a previously saved chart by ID. Public, no API key required. Supports URL overrides for templates (?data1=, ?labels=, ?title=…).
chart_viewView a previously saved chart as an interactive HTML page. Public, no API key required. Iframe-embeddable.
diagramRender a diagram via GET. Use type (mermaid, d2, …), query (source code), and format=png for ChatGPT. POST uses diagram_type and diagram_source instead.
diagram_aiDescribe a diagram in plain English via GET and get a rendered image back. Powered by AI.
diagram_renderRender a previously saved diagram by ID. Public, no API key required. Supports ?format= and ?query= overrides.
diagram_viewView a previously saved diagram as an HTML page. Public, no API key required. Iframe-embeddable with inline SVG rendering.
labelPreview a thermal label via GET. Pass the same label object as a URL-encoded JSON string in query. Inside that JSON, text items use content and size (1-10), not text or fontSize. Prefer format=png fo…
label_compileCompile a label to printer commands (tsc, zpl, epl, …). POST width, language, and elements. Text uses content and size (1-10), not text or fontSize. No barcode element. Example: {"width":40,"height":…
label_convertConvert printer commands from one language to another. POST source, from, and to. from is the source language (tsc, zpl, epl, …). to is the target (tsc, zpl, escpos, …).
label_parseParse printer commands into structured elements. POST source and language (tsc, zpl, epl, …).
label_renderRender a previously saved label by ID. Public, no API key required. Supports ?format= override.
label_validateValidate printer commands. POST source (the raw commands) and language (tsc, zpl, epl, …).
label_viewView a previously saved label as an HTML page. Public, no API key required. Iframe-embeddable with inline SVG rendering.
qrcodeGenerate a styled QR code via GET. Output: SVG (default) or PNG. Supports dot styles, gradients, custom corners and all QR versions.
statsInfrastructure health for an engine or endpoint over the last hour. Not scoped to your account or tenant. Enabled per account: HTTP 403 means contact support to activate it.
usageReturn this account's Chartquery usage and credit balance. No body. Requires an API key.

Every tool that calls the API consumes credits. JSON results are returned as text; images are returned inline and other files (PDF…) as embedded resources, up to 4 MB.

Streamable HTTP

npx @chartquery/mcp --http --port 3000

The endpoint is POST /mcp (stateless, JSON responses). Each client sends its own key in the x-api-key header (or Authorization: Bearer <key>); the server never uses a key of its own. It binds to 127.0.0.1 by default and rejects browser origins unless you allow them — put it behind TLS before exposing it.

createHttpHandler() is exported for Fetch-compatible runtimes (Cloudflare Workers, Deno, Bun):

import { createHttpHandler } from "@chartquery/mcp";

export default { fetch: createHttpHandler({ allowedOrigins: [] }) };

Security

  • The API key is read from CHARTQUERY_API_KEY (stdio) or the request headers (HTTP) and removed from error messages.
  • Content fetched from websites is untrusted: the server instructions tell the model to treat it as data, not instructions.
  • See SECURITY.md to report a vulnerability.

Development

npm install
npm test
npm run build
npx @modelcontextprotocol/inspector node dist/stdio.js

Built on the SDK

The server uses the official Node.js SDK (@chartquery/sdk).

All ChartQuery SDKs

SDKPackageInstall
Node.js@chartquery/sdknpm install @chartquery/sdk
Pythonchartquerypip install chartquery
Gochartquery-gogo get github.com/chartquery/chartquery-go
.NETChartQuerydotnet add package ChartQuery
Rubychartquerygem install chartquery
PHPchartquery/sdkcomposer require chartquery/sdk
Javachartquery-javabuild from source, see its README
CLI@chartquery/clinpm install -g @chartquery/cli
MCP server@chartquery/mcpnpx -y @chartquery/mcp

License

MIT — see LICENSE.

NPM
@chartquery/mcp
Install Command
npm install @chartquery/mcp

Remote