# QueryIO [Health: Active]

**Category:** 🗄️ Databases  
**Repository:** https://github.com/aradhyas8/queryio-mcp  
**GitHub Stars:** 0  
**npm Downloads (last month):** 108  
**Views:** 2  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/queryio

## Description
PostgreSQL MCP server for AI coding agents. Inspect a row and its foreign-key relationships with inspect_row, then investigate with bounded, read-oriented SQL.

## Tools
Capabilities this server exposes over MCP:

- **query** — Run one read-only SQL statement (SELECT, WITH, VALUES, TABLE, SHOW) against PostgreSQL. Runs in a read-only transaction that is always rolled back, with server-side timeouts. Results are bounded: has_more means more rows existed (truncated_by says whether the row cap or byte budget stopped retrieval), and long values are cut with a …[+size] marker. Columns with sensitive-looking names (password, token, api_key, ...) come back as [redacted], counted in columns_redacted and values_redacted.
- **list_tables** — List tables outside system schemas: schema-qualified name, estimated_rows (planner estimate, null if never analyzed; no scans), and column count. Optional filter: case-insensitive substring matched against table and column names.
- **describe_tables** — Describe several tables in one call: columns (name, type, nullable), primary key, outgoing and incoming foreign keys (constraint, from_table/from_columns, to_table/to_columns, paired by position), and indexes. Each column carries planner statistics (no scans): stats_available, and when true null_frac, n_distinct (negative = minus the distinct fraction of rows, -1 = unique) and, for enum-like non-sensitive columns, common_values with frequencies. Columns matching a redaction pattern get stats_available: false, redacted: true. Unknown tables get a per-table error; the rest still succeed.
- **inspect_row** — Fetch one row by its full primary key plus its depth-1 declared foreign-key neighborhood in one call. Each relation is one FK constraint: direction outgoing (rows the root references) or incoming (rows referencing the root), the related table, constraint, source_columns (referencing) paired by position with target_columns (referenced), status (ok, timeout, error), and compact rows (columns once, rows as arrays). Each relation returns up to N rows (default 5) ordered by the related table's primary key (order_by; ctid without one), never by recency; has_more means more rows existed, with no count. Relations not attempted due to the relation cap or total deadline are listed in relations_not_attempted with reason (max_relations, deadline). Values are truncated and redacted as in query, totalled in values_truncated and values_redacted. Tables without a declared primary key need query instead.

## Claude Desktop Quick Installation
No generated config for this server: it installs through its own setup steps.

The project's own setup steps (from https://github.com/aradhyas8/queryio-mcp), copied verbatim. Follow them in order; they are not an mcpServers config.

1. Add to your MCP client:

```sh
npx -y queryio setup
```

2. Add to your MCP client:

```sh
npx -y queryio setup --claude
```

3. Add to your MCP client:

```sh
npx -y queryio setup --codex
```

4. Add to your MCP client:

```sh
npx -y queryio setup --cursor
```

## Documentation

## What QueryIO MCP server does

QueryIO MCP server gives AI coding agents a read-only view of PostgreSQL application data. It is designed for debugging concrete records such as users, invoices, projects, and their related entities. The main workflow starts with a primary-key lookup, then uses the returned relationship samples and targeted SQL to test a diagnosis.

The server supports four MCP tools: `inspect_row`, `query`, `list_tables`, and `describe_tables`. Together, they cover record inspection, bounded SQL checks, table discovery, and schema-oriented investigation.

## How it works

`inspect_row` accepts a fully qualified table and a complete primary-key value. It returns the selected row and samples from each declared foreign-key relationship in both directions: rows referenced by the root and rows that reference it. Each relationship is limited, ordered by the related table's primary key when available, and marked when results were truncated or could not be attempted because of relation or deadline limits.

`query` accepts one read-only SQL statement. Supported statement forms include `SELECT`, `WITH`, `VALUES`, `TABLE`, and `SHOW`. The statement runs inside a read-only transaction that is rolled back, with server-side statement and lock timeouts. Results are bounded by row and byte limits, and long values are shortened with a size marker.

Schema exploration avoids data scans where planner metadata is sufficient. `list_tables` reports non-system tables, estimated row counts, and column counts, with an optional case-insensitive name filter. `describe_tables` reports columns, nullability, primary and foreign keys, indexes, and available planner statistics for multiple tables in one request.

## Setup and configuration

QueryIO requires Node.js 20 or newer and a PostgreSQL role that can read the target data. Set the `QUERYIO_DATABASE_URL` environment variable to the database connection string, then check connectivity with:

```bash
npx -y queryio check
```

Run the setup wizard from the application repository to configure the coding agent connection:

```bash
npx -y queryio setup
```

The wizard can detect Claude Code, Codex, and Cursor, shows proposed changes before writing them, and does not store the database connection string in a configuration file. Individual client selection is available with `--claude`, `--codex`, or `--cursor`. Start the agent from a terminal where `QUERYIO_DATABASE_URL` is set. A dedicated read-only PostgreSQL role is recommended.

## Tools and capabilities

- `inspect_row`: Fetches one primary-key row and bounded samples for its immediate declared foreign-key neighborhood. It returns compact relationship results, paired source and target columns, statuses, and truncation indicators.
- `query`: Runs one bounded, read-only SQL statement for joins, aggregates, and targeted checks. Sensitive-looking columns are redacted, and result metadata reports truncation and redaction counts.
- `list_tables`: Finds non-system tables by table or column name and returns planner-estimated row counts without scanning tables.
- `describe_tables`: Examines several tables together, including columns, keys, indexes, and selected planner statistics. Sensitive columns do not expose their statistics.

## Limitations and notes

`inspect_row` requires a declared primary key and follows only declared foreign keys one level deep. Tables without primary keys must be investigated with `query`. Related rows are ordered by key, not by recency, and the tool returns samples rather than complete relationship contents or counts.

Sensitive-looking names such as `password`, `token`, and `api_key` are redacted on a best-effort basis. Values can also be shortened to stay within response limits. Every call is read-only and rolled back, but QueryIO is not a complete security sandbox; database permissions and a dedicated read-only role remain important.

_Full upstream README: https://allmcps.com/mcp/queryio/readme_

