QuestDB Web Console MCP Server

v0.5.0
io.github.questdb/mcp-server-questdb Checked 58 minutes ago Published 2 months ago

Connects coding agents to a running QuestDB Web Console: notebook cells, SQL queries, and charts.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

get_pairing_credentials

Get the credentials the user needs to pair their browser with this MCP bridge — calling this tool does NOT itself pair anything. It returns a deep_link, ws_url, token, AND a pre-rendered `userMessage` with the exact text to show the user. REQUIRED FLOW — do all three in the defined: (1) call this tool, (2) write a message to the user containing the `userMessage` text (or your own equivalent showing deep_link + ws_url + token), (3) call `wait_for_pairing`. DO NOT skip step (2). Calling `wait_for_pairing` without first showing the credentials guarantees a timeout — the user has no credenti…

ParameterTypeDescription
auto_open_browserbooleanWhether to automatically open the pairing deep link in the user's browser. Defaults to true. Pass false to suppress the auto-open (e.g. headless / CI / background contexts, or when you don't want to s…

wait_for_pairing

Poll for completion of pairing started by `get_pairing_credentials`. PREREQUISITE: you have already written a message to the user containing the deep_link + ws_url + token from `get_pairing_credentials`'s last response. If you have NOT yet shown those credentials, do that first — calling this tool without showing credentials only burns 50 s of polling while the user sees nothing actionable. Blocks for `timeout_ms` (default 50 s, max 50 s — sized to fit under typical MCP client tool-call timeouts). Returns `{paired:true, consoleOrigin, permissions:{grantSchemaAccess,read,write}}` on success…

ParameterTypeDescription
timeout_msintegerOverride the default 50,000 ms poll length. Useful for tests.

get_tables

Get a list of all tables, materialized views, views and live views in the QuestDB database

get_table_schema

Get the full schema definition (DDL) for a specific table, materialized view, view or live view

ParameterTypeDescription
table_name *stringThe name of the table, materialized view, view or live view to get schema for

get_table_details

Get the runtime details/statistics of a specific table, materialized view, view or live view

ParameterTypeDescription
table_name *stringThe name of the table, materialized view, view or live view to get details for

validate_query

Validate the syntax correctness of a SQL query using QuestDB's SQL syntax validator. All generated SQL queries should be validated using this tool before responding to the user.

ParameterTypeDescription
query *stringThe SQL query to validate

get_questdb_toc

Get a table of contents listing all available QuestDB functions, operators, and SQL keywords. Use this first to see what documentation is available before requesting specific items.

get_questdb_documentation

Get documentation for specific QuestDB functions, operators, or SQL keywords. This is much more efficient than loading all documentation.

ParameterTypeDescription
category *stringThe category of documentation to retrieve
items *arrayList of specific docs items in the category. IMPORTANT: Category of these items must match the category parameter. Name of these items should exactly match the entry in the table of contents you get w…

create_notebook

Create a new QuestDB notebook tab in the editor. You never see query data; this only scaffolds the tab and binds the current chat if it isn't already bound to a notebook. The tab is ALWAYS created in the background — you never switch the user's active tab. The user sees a notification and opens it themselves; only call activate_notebook if they explicitly ask to be taken there.

ParameterTypeDescription
label *string | nullLabel shown on the new notebook tab (max 100 characters). Pass null to use the default.

activate_notebook

Switch the user's editor to the given notebook tab so it becomes visible and focused. ONLY call this after the user has explicitly agreed to be taken to the notebook (e.g. they accepted your offer to open it). Never call it to auto-switch while the user is working elsewhere.

ParameterTypeDescription
buffer_id *numberNotebook buffer id to activate (from a create_notebook result or the <notebook_context>/<workspace> prefix).
cell_to_focus *string | nullOptional cell id to focus and scroll into view after switching — useful to land the user on the specific cell you want them to see. Pass null to just open the tab without scrolling to a particular c…

duplicate_notebook

Duplicate a notebook tab. Copies every cell (SQL, mode, chart config), layout, and run history into a NEW notebook labelled "<label> (copy)" placed right after the original; cell ids are regenerated. Matching saved result snapshots are copied best-effort in the background and hydrate when the copy is opened. `last_run_status` is preserved as history and does not guarantee that a saved result snapshot exists. The copy is ALWAYS made in the background — you never switch the user's active tab. The user sees a notification and opens it themselves; only call activate_notebook if they explicitly a…

ParameterTypeDescription
buffer_id *numberSource notebook buffer id (from <notebook_context> prefix).

delete_notebook

Archive (soft-delete) a notebook tab — the same as the user closing it with the X. It moves to history and the user can restore it; it is not permanently destroyed and query data is untouched. If this notebook is bound to the current chat, the binding goes stale (start a new one with create_notebook).

ParameterTypeDescription
buffer_id *numberNotebook buffer id (from <notebook_context> prefix).

list_cells

List the cells in a notebook. Returns id, type, short preview (≤120 chars), position, mode, and last-run status. Mode is the presented result kind: `run` for a table result, `draw` for a chart, and null for editor-only/markdown cells. Three fields are LIVE-ONLY — present only while the notebook is open in the console, so absence never means "not refreshing" or "not blocked": `refreshing: true` while a refresh is in flight (the visible rows are still the previous round's), `last_refresh_error` when the last round left a failure, and `auto_refresh_blocked: "contains_write"` on cells auto-ref…

ParameterTypeDescription
buffer_id *numberNotebook buffer id (from <notebook_context> prefix).

get_cell

Get full details of a cell (value, kind via `type`, editor_height/result_height, view, chart config, last-run status + trimmed error). Height values are fixed CSS pixels or "auto". `view` reports what a SQL/draw cell presents: "editor" while there is nothing to show, else the stored result or editor_result arrangement. Markdown has no pane-view state: it reports `view` and `result_height` as null. Other LIVE-ONLY fields are `refreshing: true`, `last_refresh_error`, and `auto_refresh_blocked: "contains_write"`; absence never means "not refreshing" or "not blocked". `last_run_status` is unrelate…

ParameterTypeDescription
buffer_id *number
cell_id *string
get_full_content *boolean | nullTrue returns the verbatim full value with no cap (errors above 1 MB). Required before rewriting any cell whose read came back truncated. Null/omitted applies the 4 KB cap.

get_notebook_state

Full structural snapshot of a notebook (layout, cells with previews, semantic pane dimensions, kind via `type`, last-run statuses). Cell `grid` contains x/y/w only; height is derived from editor_height, result_height, and view. `view` reports what a SQL/draw cell presents: "editor" while there is nothing to show, else the stored result or editor_result arrangement. Markdown has no pane-view state: it reports `view` and `result_height` as null. Other LIVE-ONLY fields are `refreshing: true`, `last_refresh_error`, and `auto_refresh_blocked: "contains_write"`; absence never means "not refreshing"…

ParameterTypeDescription
buffer_id *number

add_cell

Append a cell to the notebook. Returns the new cell id and, if run=true, a per-query status array with the same semantics as run_cell (reads run in parallel; an invalid statement is skipped with its error). Writes are never auto-run: a cell containing DDL/DML comes back `{ ran: false, skipped: true }`. You never see query rows or column data. Set type:"markdown" to add a prose cell instead of a SQL cell — its `sql` field then carries the markdown source, it is rendered (never executed), and `run` is ignored.

ParameterTypeDescription
after_cell_id *string | nullInsert after this cell id; pass null to append to the end.
buffer_id *number
run *boolean | nullIf true, run the cell immediately after inserting. Response then includes `ran` (true iff every statement succeeded), `queryCount`, and `results: string[]` — one entry per `;`-separated statement, e…
sql *stringSQL for the cell. May contain multiple statements separated by `;`. In draw mode, multi-statement cells overlay series on a single chart: the first query's timestamp column is the x-axis anchor, subse…
type *string | nullCell kind. "markdown" creates a rendered prose cell that is never executed (`run` is ignored). null/omitted = "sql".

update_cell

Replace a cell's value. Overwrites preemptively — cells are auto-saved. Results carry over by content: a statement whose text is unchanged keeps its result and its refresh state, an edited or added one starts empty, and a rewrite that leaves no statement unchanged clears the cell's results. Use to fix a broken SQL cell. When editing part of a long cell, base the new value on a non-truncated read (get_cell with get_full_content: true) — never on a preview or a `truncated: true` read.

ParameterTypeDescription
buffer_id *number
cell_id *string
value *string

delete_cell

Delete a cell from the notebook.

ParameterTypeDescription
buffer_id *number
cell_id *string

move_cell_up

Swap a cell with the one above it.

ParameterTypeDescription
buffer_id *number
cell_id *string

move_cell_down

Swap a cell with the one below it.

ParameterTypeDescription
buffer_id *number
cell_id *string

duplicate_cell

Duplicate a cell immediately after the original.

ParameterTypeDescription
buffer_id *number
cell_id *string

run_cell

Execute a SQL cell. A cell whose statements are all reads runs them in PARALLEL: one failure skips nothing, and a statement the server rejects at validation is skipped with its validation error as that statement's result. A cell containing any DDL/DML runs sequentially instead, and a failure stops the remaining statements. Returns `{ success, queryCount, results: string[] }`, where each `results` entry is `"success"`, `"cancelled"`, or `"ERROR: <message>"`, in source order. You do NOT see columns, rows, or values — call run_query if you need data. `success` is true only when every statement…

ParameterTypeDescription
buffer_id *number
cell_id *string

set_layout_mode

Switch a notebook between list and grid layouts.

ParameterTypeDescription
buffer_id *number
mode *string

set_cell_layout

Position a single cell in grid mode. x/y/w are integers in the react-grid-layout grid; width is limited to 12 columns. Cell height is derived from its semantic pane dimensions. The response includes the applied grid position plus the cell's presented `view` and `mode`; editor-only and markdown cells report mode null, and markdown also reports view null. Use set_cell_dimensions to resize a cell or change its `view`.

ParameterTypeDescription
buffer_id *number
cell_id *string
w *integer
x *integer
y *integer

set_cell_dimensions

Resize a cell using semantic pane dimensions in CSS pixels and choose its pane view. Every input field is required by strict tool calling: pass null to preserve the current setting. Pass "auto" for a height to restore automatic sizing, or a number to pin it. For SQL/draw cells, view accepts editor, result, or editor_result. view "editor" is DESTRUCTIVE: it discards the cell's result and snapshot and clears its presented mode — the same gesture as toggling off the table or chart in the UI; the response then carries mode:null and result_discarded:true. The stored result/editor_result arrangeme…

ParameterTypeDescription
buffer_id *number
cell_id *string
editor_height *Editor pane height in CSS pixels; for markdown, rendered content height. Null preserves, "auto" restores content-driven sizing. SQL editors are at least 72px, markdown at least 56px, and every pane at…
result_height *Result/chart pane height in CSS pixels. Null preserves, "auto" restores result-driven sizing. Maximum 2400px.
view *The cell's pane view. Null preserves. result and editor_result store the arrangement. editor DISCARDS the cell's result and snapshot, clears its presented mode, and hides the result pane (the toggle-o…

set_cell_mode

Switch a SQL cell between run (table output) and draw (chart output). Draw cells auto-execute — do not call run_cell afterwards. MULTI-SERIES TIP: a draw-mode cell can hold multiple SELECT statements separated by `;`. The first query's timestamp column is the chart's x-axis (the 'anchor'); every additional query contributes its numeric columns as extra series merged on the time axis. Use this to overlay metrics that come from different tables or different aggregations on a single chart.

ParameterTypeDescription
buffer_id *number
cell_id *string
mode *string

set_cell_chart_config

Configure the chart for a draw-mode cell. The cell's `;`-separated SELECTs AUTO-COMBINE into one chart sharing the first query's x-axis; `queries` holds one config per statement (index-aligned). Queries combine when their x-axis kind matches: all-temporal merge by time, all-categorical merge by category name. Each query keeps its own `type` (line/area/stepLine/stepArea/bar/stackedBar/scatter/pie/candlestick); set `axis:"right"` (+ optional `right_axis`) for a series on a different unit/scale; `enabled:false` opts a query out (the first query is always included — it defines the x-axis). For a…

ParameterTypeDescription
buffer_id *number
cell_id *string
queries *array | nullOne config per `;`-split query, index-aligned. Send the FULL array — one entry per statement, never a partial subset: a non-null array REPLACES all per-query configs, so any omitted statement loses…
right_axis *object | nullShared right y-axis; meaningful when some query has axis='right'. Null preserves.
x_column *string | nullShared x-axis column (the first query's). Null preserves.

set_cell_highlight_config

Set or clear the highlight rules of a run-mode cell's result grids (trend coloring): flash cells that moved up or down since the previous refresh, color threshold breaches, band values into steps, or shade a range. One config per cell, applied to every statement's grid by column name; a grid without the column is not affected. Replaces the whole config (PUT). `highlight_config: null` clears it. Typical watchlist: identity_columns ["symbol"], rules [{kind:"previous",column:"price",op:"gt",color:"green"},{kind:"previous",column:"price",op:"lt",color:"red"}]. Pair with set_cell_autorefresh so the…

ParameterTypeDescription
buffer_id *number
cell_id *string
highlight_config *object | nullHighlight rules for the cell's result grids. Rules evaluate top-down per cell; the first match colors the background. previous rules also show an up/down glyph.

set_cell_autorefresh

Set auto-refresh polling for a cell, as a per-cell override of the notebook default (set_notebook_autorefresh). Applies to both chart (draw-mode) and grid (run-mode) cells. A cell containing DDL/DML never polls: the value is stored, but the engine blocks its ticks and read tools report `auto_refresh_blocked: "contains_write"`. Markdown cells are rejected. Nothing polls without a per-cell value or a notebook default. `value`: true = adaptive poll (interval auto-tuned to response time), false = no polling, a fixed interval string (digits plus ms, s or m, from 50ms to 60m, e.g. "250ms", "5s", "15…

ParameterTypeDescription
buffer_id *number
cell_id *string
value *

set_notebook_autorefresh

Set the notebook-level auto-refresh default for every cell showing a chart or a grid. Cells with no per-cell value inherit it; set_cell_autorefresh sets a per-cell override that wins over it. Cells containing DDL/DML are skipped — auto-refresh never executes a write. Until this is set, nothing polls. `value`: true = adaptive poll (interval auto-tuned to response time), false = no polling, or a fixed interval string (digits plus ms, s or m, from 50ms to 60m, e.g. "250ms", "5s", "15m"). `reset_cell_overrides: true` additionally deletes every per-cell override in the same atomic call, so ALL ce…

ParameterTypeDescription
buffer_id *number
reset_cell_overrides *boolean | null
value *

set_cell_name

Set or clear a cell's name (its display label in the cell header). Applies to any cell; for a chart cell it is also the chart title. Pass null to clear.

ParameterTypeDescription
buffer_id *number
cell_id *string
name *string | nullCell name (max 100 characters). Pass null to clear.

apply_notebook_state

Bulk-apply the entire desired state of a notebook in one atomic call. Use this for bulk edits spanning multiple cells or creating a notebook from scratch. Use update_cell or set_cell_* for small operations. Use INSTEAD OF chained add_cell + update_cell + set_cell_mode + set_cell_chart_config only when composing a multi-cell layout from scratch, changing many cells at once, or restructuring an existing notebook. The cells array is the COMPLETE desired list: cells in the current notebook whose id is missing from your request are DELETED. For new cells, omit `id` and one will be generated. Each c…

set_cell_maximized

Spotlight one cell (or null to restore normal layout). Hides other cells in the notebook view.

ParameterTypeDescription
buffer_id *number
cell_id *string | nullCell id to spotlight, or null to clear.

run_query

Execute an arbitrary SQL statement against the user's QuestDB instance and return the result rows so you can inspect data, validate work, or compose follow-up queries. UNLIKE `run_cell`, this tool DOES return data values. Default limit is 100 rows; pass `limit` (max 10000) to request more. The response payload is capped at ~1 MB — rows beyond that are dropped from the tail. The response includes `truncated`, `total_count`, and `returned_count` so you know exactly what was clipped. DDL/DML (CREATE / INSERT / UPDATE / DROP / etc.) is allowed and executes against the live database — be delibe…

ParameterTypeDescription
limit *integer | nullMaximum rows to return (default 100, max 10000). Pass null for default.
sql *stringThe SQL statement to execute.

get_workspace_state

If notebook tools fail with BRIDGE_NOT_PAIRED, call get_pairing_credentials to begin pairing (the response includes a one-click URL to show the user; authentication runs in the browser, the bridge never sees credentials). Once paired, call get_workspace_state at the start of every notebook turn; the digest of edits since your last fetch is in get_recent_user_actions. Return the current workspace + notebook context as text. Use this at the start of every notebook turn so you know which notebook is active, what cells exist, layout mode, chart configs, and last-run statuses. SQL/draw cells repor…

ParameterTypeDescription
include_user_eventsboolean

get_recent_user_actions

If notebook tools fail with BRIDGE_NOT_PAIRED, call get_pairing_credentials to begin pairing (the response includes a one-click URL to show the user; authentication runs in the browser, the bridge never sees credentials). Once paired, call get_workspace_state at the start of every notebook turn; the digest of edits since your last fetch is in get_recent_user_actions. Return the digest of user edits to the notebook since your last fetch (or session start). Use this to detect that the user changed something the agent might want to react to. Coalesced — multiple typing events on the same cell…