Using QuestDB with AI coding agents
AI coding agents like Claude Code and OpenAI Codex can help you build applications that use QuestDB.
There are four options, depending on what you want the AI to do, and they combine well:
| You want to | Use | Requires |
|---|---|---|
| Build notebooks and live dashboards in the Web Console from your agent, and query and ingest data through it | The official QuestDB MCP server | Node.js and a coding agent |
| Query and ingest data directly, no console involved | The REST API: QuestDB speaks HTTP out of the box | Nothing to install |
| Teach the agent QuestDB's time-series SQL and patterns | The QuestDB skill | Claude Code or Codex |
| AI help inside the console, without a coding agent | The built-in AI Assistant | Your own OpenAI or Anthropic key, or a local model |
The MCP server and the skill work best together: the skill supplies the time-series SQL knowledge, and the MCP server turns it into live dashboards in your console. Separately, the TSBS Benchmark skill automates end-to-end performance benchmarking.
QuestDB MCP server
The official QuestDB
MCP server (@questdb/mcp-bridge) connects coding
agents to a running
Web Console. Every action
executes in the browser through your already-authenticated console session, and
a four-level permission model controls what the agent can see and do, from no
data access up to DDL/DML execution.
Once connected, the agent can:
- Build dashboards: create and edit SQL and markdown cells, draw nine chart types, arrange cells into live grid dashboards, and set chart auto-refresh.
- Explore schema and data: list tables and materialized views, fetch DDL and runtime statistics, and run ad-hoc queries with result rows returned to the agent.
- Look up documentation: built-in reference for QuestDB functions, operators, and SQL keywords.
- Two-way handoff: hand analysis back and forth with your agent; it snapshots the workspace and tracks your edits, so you can both work on the same notebook without conflicts.
Learn more about the QuestDB MCP server →
REST API: no setup required
QuestDB speaks HTTP natively, so agents can query it with no MCP server and nothing to install. Try the public QuestDB demo with Claude Code:
You: "Use QuestDB's REST API at https://demo.questdb.io/ to list all tables"
Claude Code: [Queries /exec endpoint and lists available tables including trades]
You: "Query the trades table and show me the last 10 trades. Data is time-ordered natively, no ORDER BY needed"
Claude Code: [Sends SQL via HTTP: SELECT * FROM trades LIMIT -10]
You: "What's the total volume traded per symbol, sampled by 1 hour? Use SAMPLE BY"
Claude Code: [Writes and executes SAMPLE BY 1h query grouped by symbol]
You: "Plot the price of BTC-USDT over the last 30 days"
Claude Code: [Queries data and generates a chart using matplotlib]
Connect to your own QuestDB
- Install Claude Code: https://claude.ai/code
- Start QuestDB (default port 9000)
- Ask Claude Code to connect and explore
You: "Connect to my QuestDB at localhost:9000 and show me what tables I have"
Claude Code: I'll query the QuestDB REST API to list your tables.
[Executes curl command and shows results]
QuestDB agent skill
The QuestDB agent skill is an experimental skill for Claude Code and Codex. It embeds QuestDB-specific knowledge directly into the agent's context, covering SQL syntax, common mistakes, ingestion patterns, Grafana templates, and financial indicator recipes, so the agent can build complete data pipelines without searching the docs for every step. For topics not covered by the skill, the agent falls back to the online documentation automatically.
Installation
- npx (recommended)
- Manual copy
npx skills add questdb/skills
This installs the skill globally for Claude Code. To install it for a specific
project only, run the command from the project directory with the --local
flag.
Copy the questdb/ folder from the
repository into
your skills directory:
Claude Code:
~/.claude/skills/questdb/: available in all projects<project>/.claude/skills/questdb/: available in a specific project
Codex:
~/.codex/skills/questdb/: available in all projects<project>/.codex/skills/questdb/: available in a specific project
The folder must contain SKILL.md and the references/ directory.
What's included
- SQL reference: QuestDB-specific syntax including
SAMPLE BY,LATEST ON,ASOF JOIN, window functions, and materialized views - Common mistakes: 50+ patterns to avoid when coming from PostgreSQL (e.g.,
time_bucket()does not exist, useSAMPLE BYinstead) - Ingestion patterns: Python templates for ILP ingestion, including array support for order book data
- Grafana integration: Dashboard deployment via API, datasource configuration, and ready-to-use panel queries
- Financial indicators: 20+ indicator recipes ready for Grafana panels
- Enterprise authentication: REST and ILP token configuration, ACL setup
Example prompt
With QuestDB and Grafana running locally:
Build a real-time crypto market data pipeline using cryptofeed (OKX exchange)
ingesting trades and L2 order book data into QuestDB.
Symbols: BTC-USDT, ETH-USDT, SOL-USDT.
Then create a Grafana dashboard with OHLC candlesticks, VWAP,
Bollinger Bands, and RSI panels, with a symbol dropdown.
The agent will create the database schema, write the ingestion script, wait for data, and deploy a Grafana dashboard, all in a single pass.
Built-in indicators
The following indicators are embedded in the skill and can be generated without online lookups:
Aggressor imbalance, ATR, Bid-ask spread, Bollinger Bands, Bollinger BandWidth, Compound interest, Cumulative product, Donchian Channels, Keltner Channels, Liquidity comparison, MACD, Maximum drawdown, OBV, OHLC bars, Rate of Change, Realized volatility, Rolling std dev, RSI, Stochastic Oscillator, TICK & TRIN, Volume profile, Volume spikes, VWAP.
TSBS Benchmark skill
The TSBS Benchmark skill is a skill for Claude Code and Codex that runs end-to-end Time Series Benchmark Suite (TSBS) benchmarks against QuestDB. It installs prerequisites, spins up QuestDB in Docker, builds TSBS, generates data, loads it, runs all query benchmarks, and cleans up, all from a single prompt.
Installation
Copy claude/SKILL.md from the
repository
into your skills directory:
Claude Code:
~/.claude/skills/tsbs-benchmark/SKILL.md: available in all projects<project>/.claude/skills/tsbs-benchmark/SKILL.md: available in a specific project
Codex:
~/.codex/skills/tsbs-benchmark/SKILL.md: available in all projects<project>/.codex/skills/tsbs-benchmark/SKILL.md: available in a specific project
What it handles
The skill orchestrates eight sequential steps:
- Prerequisites: validates and installs Docker, Go 1.22.5, and build tools (make, gcc, gzip)
- QuestDB deployment: launches the latest QuestDB container with ports 9000, 9009, 8812, and 9003
- TSBS compilation: clones and builds four QuestDB-specific binaries from the TSBS repository
- Data generation: creates ~12 GB of uncompressed benchmark data (34.5M rows, 345.6M metrics)
- Data loading: ingests via ILP with worker threads matching CPU cores (capped at 32)
- Query generation: produces 1,000 queries for each of the 16 query types
- Benchmark execution: runs all queries in single-worker mode so QuestDB's internal parallelization is measured accurately
- Cleanup: removes the Docker container and temporary files
Benchmark parameters
| Parameter | Value |
|---|---|
| Use case | cpu-only |
| Scale | 4,000 hosts |
| Time window | 1 day (2016-01-01 to 2016-01-02) |
| Log interval | 10 seconds |
| Rows generated | 34.5M |
| Metrics generated | 345.6M |
| Query types | 16 (cpu-max variants, single/double-groupby, high-cpu, lastpoint, groupby-orderby-limit) |
| Queries per type | 1,000 |
Example prompt
Run the full TSBS benchmark against QuestDB with the default cpu-only dataset.
The agent will handle everything from installing prerequisites through reporting the final query-by-query results.
Tips
- Provide context: Tell the agent about your use case, data volume, and requirements
- Ask follow-up questions: Agents remember context within a session
- Request explanations: Ask "why?" to understand recommendations
- Iterate on code: Ask the agent to modify or improve generated code
Next steps
- REST API reference: API documentation
- SQL overview: QuestDB SQL syntax
- Client libraries: Official client libraries
- Sample datasets: Example data to try