sql-query-mcp
sql-query-mcp is a read-only MCP server that lets AI assistants safely explore and query PostgreSQL and MySQL databases in a controlled, audited way.
List connections (
list_connections): View all configured database connections by their connection ID.List schemas (
list_schemas): Enumerate visible schemas within a PostgreSQL connection.List databases (
list_databases): Enumerate visible databases within a MySQL connection.List tables (
list_tables): Retrieve all tables and views for a given PostgreSQL schema or MySQL database.Describe table (
describe_table): Inspect a table's columns, primary/foreign keys, and indexes.Run SELECT queries (
run_select): Execute read-onlySELECTor CTE (WITH ... SELECT) queries, with an optional row limit.Explain queries (
explain_query): RunEXPLAIN(and optionallyEXPLAIN ANALYZEfor PostgreSQL only) to inspect query execution plans.Sample table data (
get_table_sample): Fetch a small row preview from a table for schema discovery, with an optional row limit.
All queries are validated as read-only via sqlglot (no comments, no multi-statement inputs), database credentials are managed via environment variables, and all server calls are audit-logged for security and compliance.
Allows AI agents to interact with MySQL databases by discovering database structures, inspecting table columns and indexes, sampling records, and executing or analyzing read-only SQL queries.
Allows AI agents to interact with PostgreSQL databases by discovering schemas and table structures, sampling records, and executing or analyzing read-only SQL queries.
sql-query-mcp
A general-purpose MCP server that lets AI work with multiple databases within clear boundaries.
Current database support
Database | Status | Current availability |
PostgreSQL | Supported | Available today |
MySQL | Supported | Available today |
Hive | Supported | Available today |
SQLite | Candidate | Not supported yet |
SQL Server | Candidate | Not supported yet |
ClickHouse | Candidate | Not supported yet |
Related MCP server: DiceDB MCP
Product value
sql-query-mcp helps AI clients discover schema, sample data, and analyze
read-only queries through one controlled MCP interface.
It keeps connection handling, namespace rules, SQL validation, and audit logging on the server side, so you can expose useful database context to AI without exposing raw connection strings or flattening engine-specific concepts.
What AI can do with it
The current tool set focuses on database discovery, controlled query workflows, asynchronous read-only queries, batched query result exports, and one narrow local file import path. You can use it to help an AI assistant understand structure before it generates SQL, runs a bounded query, starts a long-running read-only query, exports PostgreSQL or MySQL results to a local file, or imports a prepared CSV/XLSX file into an existing table.
MySQL and Hive support explain_query. Hive uses EXPLAIN and
EXPLAIN ANALYZE for explain_query.
Tool | PostgreSQL | MySQL | Hive | Purpose |
| Yes | Yes | Yes | List configured connections |
| Yes | No | No | List visible PostgreSQL schemas |
| No | Yes | Yes | List visible MySQL or Hive databases |
| Yes | Yes | Yes | List tables and views |
| Yes | Yes | Yes | Inspect columns, keys, and indexes |
| Yes | Yes | Yes | Run short bounded read-only queries |
| Yes | Yes | Yes | Start long-running read-only queries |
| Yes | Yes | Yes | Fetch async query status and paginated results |
| Yes | Yes | Yes | Cancel running async queries |
| Yes | Yes | Yes | Inspect query plans |
| Yes | Yes | Yes | Fetch small table samples |
| Yes | Yes | No | Export query results to local CSV/XLSX files |
| Yes | Yes | Yes | Import local CSV/XLSX files |
These tools are useful for tasks such as listing namespaces, inspecting table
definitions, reviewing indexes, sampling records, running short read-only
queries with run_select, running long read-only queries with start_query,
get_query, and cancel_query, analyzing read-only queries with EXPLAIN, and
exporting PostgreSQL or MySQL query results to local CSV/XLSX files. You can
also import prepared local files. For full request and response details, see
docs/api-reference.md (Chinese).
How boundaries are constrained
The product boundary is intentionally narrow today. PostgreSQL, MySQL, and Hive are available today. Query tools remain read-only, PostgreSQL and MySQL query results can be exported to local files, and the only database write path is a controlled local CSV/XLSX import into existing tables.
The service keeps those boundaries explicit in a few ways.
Connections declare
engineexplicitly, so the server never guesses fromconnection_id.PostgreSQL uses
schema, while MySQL and Hive usedatabase, without collapsing both into one vague namespace field.Real DSNs stay in environment variables, while config files store only the environment variable names.
Query execution passes through
sqlglotvalidation before reaching the database. Userun_selectfor short bounded read-only queries, and usestart_query,get_query, andcancel_queryfor long-running read-only queries.The server accepts only
SELECTandWITH ... SELECT, rejects comments and multi-statement input, and records audit logs for each call.export_query_filewrites files on the MCP server machine. It is synchronous but reads database rows and writes CSV/XLSX files in batches. Large exports can still hit your MCP client's tool timeout. For XLSX output, UUID values are written as text and timezone-aware datetime values are written without the timezone. Hive export is not supported yet.import_table_filedoesn't accept raw SQL. It inserts only file columns whose headers exactly match existing table columns.Hive
import_table_fileis intended for small files only and rejects files with more than 1000 data rows. Hive imports write rows one by one, so they can be slow and can hit your MCP client's tool timeout. For bulk Hive loads, use Hive-nativeLOAD DATA, external tables, or your existing data ingestion pipeline.
For Hive, explain_query uses EXPLAIN and EXPLAIN ANALYZE.
Quick start
sql-query-mcp supports two official PyPI-based setup modes. Both are intended
for real usage, not just local testing.
Choose how you want your MCP client to start the server.
Use installed command mode if you want a simple local command after one install.
pipx install sql-query-mcpUse managed launch mode if you want the package source declared directly in your MCP client config.
pipx run --spec sql-query-mcp sql-query-mcpPin a version with pipx install 'sql-query-mcp==X.Y.Z' or
pipx run --spec 'sql-query-mcp==X.Y.Z' sql-query-mcp. Upgrade installed
command mode with pipx upgrade sql-query-mcp.
Create a config file.
The server configuration should live outside the repository so the same file works with either startup mode.
mkdir -p ~/.config/sql-query-mcpThen save the example JSON later in this section as
~/.config/sql-query-mcp/connections.json.
Register the server in your MCP client.
Codex:
docs/codex-setup.md(Chinese)OpenCode:
docs/opencode-setup.md(Chinese)
Installed command mode means your client runs sql-query-mcp directly.
Managed launch mode means your client starts the server through pipx run.
In both modes, put SQL_QUERY_MCP_CONFIG and your real database DSNs in the
MCP client's environment block instead of exporting them in your shell.
The console entry point is sql-query-mcp, which maps to
sql_query_mcp.app:main.
The PyPI install name is sql-query-mcp, and the Python package import path is
sql_query_mcp.
For pipx install and pipx run, set SQL_QUERY_MCP_CONFIG explicitly to
your config file path. The default config/connections.json path is mainly for
source checkouts and local development.
The example config looks like this.
{
"settings": {
"default_limit": 200,
"max_limit": 1000,
"audit_log_path": "logs/audit.jsonl"
},
"connections": [
{
"connection_id": "crm_prod_main_ro",
"engine": "postgres",
"label": "CRM PostgreSQL production / Main / read-only",
"env": "prod",
"tenant": "main",
"role": "ro",
"dsn_env": "PG_CONN_CRM_PROD_MAIN_RO",
"enabled": true,
"default_schema": "public"
},
{
"connection_id": "crm_mysql_prod_main_ro",
"engine": "mysql",
"label": "CRM MySQL production / Main / read-only",
"env": "prod",
"tenant": "main",
"role": "ro",
"dsn_env": "MYSQL_CONN_CRM_PROD_MAIN_RO",
"enabled": true,
"default_database": "crm"
},
{
"connection_id": "warehouse_hive_prod_main_ro",
"engine": "hive",
"label": "Warehouse Hive production / Main / read-only",
"env": "prod",
"tenant": "main",
"role": "ro",
"dsn_env": "HIVE_CONN_WAREHOUSE_PROD_MAIN_RO",
"enabled": true,
"default_database": "default"
}
]
}Set DSNs in the MCP client environment. For Hive, use a Hive DSN such as:
export HIVE_CONN_WAREHOUSE_PROD_MAIN_RO='hive://user:password@hive.example.com:10000/default?auth=CUSTOM'Documentation
If you want implementation details, setup guidance, or internal structure, use these docs as your starting points.
docs/project-overview.md: project goals, concepts, and code structure (Chinese)docs/api-reference.md: MCP tool reference (Chinese)docs/codex-setup.md: Codex setup steps (Chinese)docs/opencode-setup.md: OpenCode setup steps (Chinese)docs/release-process.md: PyPI and GitHub Release workflow (Chinese)docs/git-workflow.md: repository collaboration workflow (Chinese)
Development
If you want to modify or verify the project locally, use this shortest path. Editable install remains the development path, and the local environment still requires Python 3.10+.
python3.10 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
pip install -e .
PYTHONPATH=. python3 -m unittest discover -s testsThe main entry point is sql_query_mcp/app.py. Core modules include:
sql_query_mcp/config.py: config loading and validationsql_query_mcp/validator.py: read-only SQL validationsql_query_mcp/introspection.py: metadata inspectionsql_query_mcp/executor.py: query execution and limitssql_query_mcp/adapters/: PostgreSQL, MySQL, and Hive adapters
Contributing
If you want to contribute or review the repository workflow, start with these pages.
CONTRIBUTING.mddocs/roadmap.mddocs/git-workflow.md(Chinese)
Run PYTHONPATH=. python3 -m unittest discover -s tests before you submit
changes.
License
This project is released under the MIT License. See LICENSE.
Available Tools
13 toolscancel_queryB
Cancel a running asynchronous query.
| Name | Required | Description | Default |
|---|---|---|---|
| query_id | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Description lacks details on side effects, permissions, idempotency, or error handling. No annotations provided to compensate.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Single sentence, no redundant words, effectively communicates core action.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Adequate for a simple cancel operation, but missing information on edge cases like non-existent or already completed queries.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Parameter 'query_id' is self-explanatory but description does not clarify its origin or format, adding no value beyond the schema title.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description clearly states verb 'Cancel' and resource 'running asynchronous query', distinguishing it from sibling tools like start_query and get_query.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No explicit guidance on when to use or alternatives, but the context of sibling tools implies it is for cancelling queries started by start_query or run_select.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
describe_tableB
Describe columns, keys, and indexes for a table.
| Name | Required | Description | Default |
|---|---|---|---|
| schema | No | ||
| database | No | ||
| table_name | Yes | ||
| connection_id | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are present, so the description carries full burden. It implies a read-only metadata retrieval but does not explicitly state safety, permissions, or rate limits. While 'describe' suggests non-destructive, the lack of explicit transparency justifies a moderate score.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single 7-word sentence, which is concise but under-specified. It front-loads the purpose but omits necessary context for parameters and usage. It could be expanded without losing conciseness.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With 4 parameters (2 required), no output schema, and no annotations, the description is too brief to be complete. It does not explain return values, parameter roles, or usage context, leaving significant gaps for an agent to properly invoke the tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0% (no parameter descriptions). The description does not explain the meaning or usage of parameters like 'connection_id', 'table_name', 'schema', or 'database'. It fails to compensate for the schema gap, offering no parameter semantics.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: describing columns, keys, and indexes for a table. It uses a specific verb 'describe' and resource 'table', which distinctively sets it apart from siblings like 'list_tables' (list tables) and 'get_table_sample' (fetch data).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives. It does not mention prerequisites (e.g., connection_id, table_name) or scenarios where it is inappropriate. No comparison with siblings like 'list_tables' or 'get_table_sample'.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
explain_queryB
Run EXPLAIN on a read-only SELECT or CTE query.
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | ||
| analyze | No | ||
| connection_id | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It states the tool is read-only and runs EXPLAIN, which is generally non-destructive. However, it does not detail permissions, side effects, or output format. This is minimally adequate but lacks depth.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, concise sentence with no redundant information. It directly communicates the tool's function.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no output schema, no annotations, and three parameters with zero description coverage, the description is extremely incomplete. It fails to provide essential details for agent usage, such as parameter meanings, output structure, or behavioral nuances.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, and the tool description adds no parameter details. The three parameters (sql, analyze, connection_id) are not explained at all. Without additional context in the description, the agent cannot understand parameter semantics.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool runs EXPLAIN on read-only SELECT or CTE queries. This distinguishes it from siblings like run_select (which executes the query) and describe_table (which describes tables). The verb 'Run EXPLAIN' and resource 'SELECT or CTE query' are specific.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description specifies the queries are 'read-only SELECT or CTE', implying it should be used for analyzing query plans and not for DML queries. It clearly indicates the context but does not explicitly mention when not to use or list alternatives among siblings.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
export_query_fileB
Export a read-only query result to a local CSV or XLSX file.
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | ||
| limit | No | ||
| format | No | csv | |
| file_name | No | ||
| overwrite | No | ||
| export_all | No | ||
| output_path | Yes | ||
| connection_id | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries full burden. It only notes read-only, but fails to disclose side effects, file location, or behavior of parameters like overwrite and export_all. Important behaviors are omitted.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single concise sentence that front-loads the core action. It is appropriately sized but could include more detail without becoming verbose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given 8 parameters, no output schema, and no annotations, the description is inadequate. It does not cover required parameters, output format details, or behavior nuances, leaving significant gaps.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so description must explain parameters. It only mentions CSV and XLSX (format), but ignores all other 7 parameters including required ones like SQL and connection_id. No additional meaning is provided.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool exports a read-only query result to CSV or XLSX files. It uses a specific verb-resource pair and distinguishes from siblings like run_select and import_table_file.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies it's for read-only operations but does not explicitly state when to use this tool over alternatives or when not to use it. No alternatives are mentioned.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_queryB
Get asynchronous query status and paginated results when complete.
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| offset | No | ||
| query_id | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description bears full burden. It mentions async behavior and pagination but fails to disclose what happens if the query is still running, the format of status responses, or how to handle errors. Lacks details on polling behavior.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single concise sentence with no wasted words. It efficiently communicates the core functionality.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool is moderately complex (async, paginated, status check) and has no output schema. The description is too brief to cover necessary context like how to poll for status, interpret results, or handle partial results. Leaves significant gaps.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so description must compensate. It adds minimal meaning by mentioning 'paginated results' which hints at limit/offset, but does not explain query_id or the behavior of limit/offset defaults. Leaves parameter semantics largely unexplained.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool retrieves asynchronous query status and paginated results when complete, using specific verb and resource. It distinguishes from siblings like start_query and run_select by focusing on the retrieval of results.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies the tool should be used after a query is complete, but provides no explicit when-to-use or when-not-to-use guidance. It does not name alternatives like cancel_query or explain_query.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_table_sampleC
Fetch a small sample from a table for schema discovery.
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| schema | No | ||
| database | No | ||
| table_name | Yes | ||
| connection_id | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description must disclose behavioral traits. It mentions 'small sample' but does not specify the default limit, that it is read-only, or any authentication requirements. The lack of detail about the return behavior (e.g., row count, data format) leaves the agent uninformed.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is very concise (one sentence) and front-loads the purpose. However, it is too brief to convey necessary detail, sacrificing completeness for brevity. It earns its place but could be expanded without becoming verbose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the absence of annotations, output schema, and parameter descriptions, the description is severely incomplete. It does not explain what the return value looks like, how many rows are fetched, or any prerequisites (e.g., that the table must exist). The tool requires 5 parameters, but nothing is said about their roles or constraints.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0%, meaning no parameter descriptions are present in the input schema. The description does not add any meaning to parameters like connection_id, table_name, limit, schema, or database. It fails to explain what each parameter does, leaving the agent without context beyond the schema's basic types and defaults.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: 'Fetch a small sample from a table for schema discovery.' It specifies the verb 'fetch' and the resource 'table sample', and the phrase 'for schema discovery' distinguishes it from siblings like run_select (generic querying) and describe_table (schema structure only).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description does not provide any explicit guidance on when to use this tool versus alternatives like describe_table or run_select. The phrase 'for schema discovery' implies a specific use case, but no when-to-use or when-not-to-use instructions are given, leaving the agent without clear decision support.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
import_table_fileA
Import a local CSV or XLSX file into an existing table.
| Name | Required | Description | Default |
|---|---|---|---|
| schema | No | ||
| database | No | ||
| file_path | Yes | ||
| sheet_name | No | ||
| table_name | Yes | ||
| connection_id | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden for behavioral disclosure. It does not mention whether data is appended or overwritten, permission requirements, file size limits, or other side effects. This is insufficient for a mutation tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence that efficiently conveys the core purpose. It is front-loaded and contains no redundant information.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given 6 parameters (3 required), no output schema, and no parameter descriptions, the description is inadequate. It fails to cover file format specifics, behavior on conflict, or usage context for optional parameters.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description mentions high-level purpose but does not explain any parameters beyond the tool's summary. With 0% schema description coverage, this leaves 6 parameters undocumented, providing minimal added value.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool imports a local CSV or XLSX file into an existing table, specifying the action, resource, and target. It distinguishes from sibling tools like export_query_file and run_select.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies the tool is for importing local files into an existing table, which differentiates it from querying, exporting, or describing tables. However, it lacks explicit guidance on prerequisites or when not to use it.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_connectionsB
List configured SQL connections by connection_id.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Without annotations, the description carries the full burden. It indicates a read operation ('List') but does not disclose behavioral traits such as authentication needs, rate limits, or whether the list is exhaustive. The simplicity of the tool partially compensates for the lack of detail.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence with no superfluous words. It is appropriately sized for the tool's simplicity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the low complexity (no parameters, no output schema), the description is minimally complete. It states what the tool does but lacks details about the output format or what constitutes a 'configured SQL connection'. It is adequate but could be slightly enhanced.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has no parameters and 100% coverage, so the description adds no additional meaning. The baseline of 3 is appropriate as the schema is self-sufficient.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states 'List configured SQL connections by connection_id.' specifying the verb and resource. However, mentioning 'by connection_id' is slightly misleading as there are no input parameters; it might imply filtering. Still, it distinguishes itself from sibling list tools like list_databases and list_tables.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is provided on when to use this tool versus alternatives like list_databases or list_schemas. The description does not mention prerequisites or context for listing connections.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_databasesB
List visible databases for a MySQL or Hive connection.
| Name | Required | Description | Default |
|---|---|---|---|
| connection_id | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Without annotations, the description carries full burden for behavioral disclosure. It only says 'list visible databases,' but does not mention whether it is read-only, auth requirements, or any side effects. This is minimal and insufficient for an agent to assess safety.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single concise sentence (8 words) that is front-loaded with the action. However, it might be overly terse, missing details that could be included without harming conciseness.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no output schema and no annotations, the description should provide more context about inputs, outputs, and behavior. It lacks details on return format, prerequisites, or the concept of 'visible.' This is insufficient for complete understanding.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0%, so description must compensate. The description mentions 'for a MySQL or Hive connection,' adding context that connection_id refers to such a connection, but does not explain the parameter's meaning, format, or where to obtain it. This adds minimal value.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states that the tool lists visible databases for a MySQL or Hive connection, giving a specific verb and resource. It implicitly differentiates from sibling tools like list_schemas or list_tables, which operate at different levels.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies the tool should be used when you need to see databases for a specific connection, but it lacks explicit guidance on when not to use it or alternatives. No mention of prerequisites or comparison with siblings.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_schemasB
List visible schemas for a PostgreSQL connection.
| Name | Required | Description | Default |
|---|---|---|---|
| connection_id | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are present, so the description must fully disclose behavioral traits. It only says 'list visible schemas' and omits other traits like mutability, safety, or permissions. This is insufficient for an agent to understand implications.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is extremely concise at 6 words, which is efficient for a simple list tool. However, it lacks structure that could include parameter context or usage notes.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the simple nature of the tool and lack of output schema, the description provides minimal context about what the list contains or how filtering ('visible') works. It is adequate but not thorough for robust tool selection.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
With 0% schema description coverage, the description should clarify the single required parameter connection_id. It only vaguely refers to 'a PostgreSQL connection' without adding meaning beyond the schema's name and type.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool lists visible schemas for a PostgreSQL connection, which distinguishes it from siblings like list_tables and list_databases that list different objects.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives, nor any conditions or exclusions. The agent is left to infer usage context from the name alone.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_tablesC
List tables and views for a resolved schema or database.
| Name | Required | Description | Default |
|---|---|---|---|
| schema | No | ||
| database | No | ||
| connection_id | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations are absent, so the description must carry the full behavioral burden. It only states the basic action, lacking details on permissions, output format, or what 'resolved' means.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single concise sentence, but it could be slightly expanded to include key details without losing brevity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the number of sibling tools and no output schema, the description is incomplete. It omits essential context like relationships to list_databases and list_schemas, or what 'resolved' signifies.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, and the description adds no meaning beyond parameter names. There is no explanation of how schema and database interact or what 'resolved' implies.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states it lists tables and views for a schema or database, specifying the verb and resource. However, it does not differentiate from sibling tools like list_databases or list_schemas, missing nuance like 'resolved.'
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool versus alternatives, no prerequisites mentioned, and no context on handling optional parameters.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
run_selectA
Run a read-only SELECT or CTE query.
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | ||
| limit | No | ||
| connection_id | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It discloses the read-only nature, which is critical for safety, but lacks further behavioral traits such as timeouts, response structure, or rate limits. A more detailed description would be beneficial.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence of 7 words, extremely concise and front-loaded with the key purpose. However, it could be slightly more informative without sacrificing conciseness.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no output schema, the description should explain what the tool returns (e.g., rows, columns, success indication). It also lacks information about error handling or prerequisites (e.g., connection must be live). This leaves the agent with incomplete context for using the tool reliably.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, meaning no parameter descriptions exist in the schema. The description adds no additional meaning beyond the parameter names (sql, limit, connection_id). It does not explain the purpose of limit, the format of sql, or how connection_id is used.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool runs a read-only SELECT or CTE query. It specifies the verb 'run', the resource 'query', and the scope 'read-only', effectively distinguishing it from sibling tools like start_query (presumably for writes) and other non-query tools.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly indicates the tool is 'read-only', which guides the agent to use it only for queries that do not modify data. It implies when not to use (for DML operations), but does not name alternatives like start_query for writes or explain_query for analysis.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
start_queryB
Start an asynchronous read-only SELECT or CTE query.
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | ||
| limit | No | ||
| connection_id | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the burden. It discloses key behaviors: async (needs follow-up), read-only (no writes), and restricted to SELECT/CTE. However, it omits how to monitor or cancel queries, and does not mention authentication or rate limits.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Single sentence delivering essential information: verb, async, read-only, query type. No unnecessary words. Front-loaded with key differentiators.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Without output schema or parameter details, the description lacks completeness. It does not explain the full async flow (e.g., use get_query to retrieve results) or mention cancellation via cancel_query. For a tool initiating an async operation, this is insufficient.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, yet the description says nothing about parameters. It does not explain sql format, connection_id purpose, or limit behavior. The description adds no meaning beyond the schema field names.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description specifies 'Start an asynchronous read-only SELECT or CTE query.' This is a clear verb-resource pair with specific constraints (async, read-only, query type), distinguishing it from siblings like run_select (likely synchronous) and describe_table (describes schema).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives such as run_select or get_query. It does not explain the async nature implies subsequent polling or result retrieval. No exclusions or contexts are given.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
1 tool update
v0.4.0- Added
export_query_file
12 tool updates
v0.3.0- Added
cancel_query - Added
describe_table - Added
explain_query - Added
get_query - Added
get_table_sample - Added
import_table_file - Added
list_connections - Added
list_databases - Added
list_schemas - Added
list_tables - Added
run_select - Added
start_query
8 tool updates
v0.1.2- Removed
describe_table - Removed
explain_query - Removed
get_table_sample - Removed
list_connections - Removed
list_databases - Removed
list_schemas - Removed
list_tables - Removed
run_select
8 tool updates
v0.1.3- First observed
describe_table - First observed
explain_query - First observed
get_table_sample - First observed
list_connections - First observed
list_databases - First observed
list_schemas - First observed
list_tables - First observed
run_select
TDQS
Each tool has a clearly distinct purpose: cancel_query, describe_table, explain_query, etc. The only potentially overlapping pair (run_select and start_query) are distinguished by synchronous vs asynchronous execution, and descriptions make this explicit.
All tools follow a consistent verb_noun pattern in snake_case, e.g., list_connections, run_select, export_query_file. No mixing of styles or ambiguous verb usage.
With 13 tools, the set is well-scoped for a SQL query interface. It covers all necessary operations without being bloated or insufficient.
The tool surface covers schema discovery, synchronous and asynchronous queries, query explanation, export, and import. Minor gaps include lack of a tool to modify queries or view history, but core workflows are well supported.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Cloud-hosted MCP server for durable AI memory
An MCP server that integrates with Discord to provide AI-powered features.
MCP server for AI dialogue using various LLM models via AceDataCloud
MCP server for building and testing AI agents with multi-model experimentation and insights.
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceThe Multi DB MCP Server is a high-performance implementation of the Database Model Context Protocol designed to revolutionize how AI agents interact with databases. Currently supporting MySQL and PostgreSQL databases.420MIT
- AlicenseNot gradedqualityCmaintenanceAn MCP server that enables AI applications to interact with DiceDB databases.5MIT
- AlicenseNot gradedqualityCmaintenanceAn MCP server that enables AI assistants to create and manage persistent SQLite databases through natural language without requiring SQL knowledge. It allows users to propose schemas, store records, and perform complex queries across multiple databases for structured data tracking.MIT
- AlicenseNot gradedqualityDmaintenanceZero-config MCP server that empowers AI agents to safely query SQL and NoSQL databases like PostgreSQL, MySQL, SQLite, MongoDB, and Redis.241MIT
Appeared in Searches
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/andyWang1688/sql-query-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server